Skip to content

Commit

Permalink
remove DisplayWindow
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit committed Jan 8, 2024
1 parent 49e4d5d commit e08639a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 93 deletions.
1 change: 0 additions & 1 deletion po/POTFILES
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ src/Objects/Monitor.vala
src/Views/NightLightView.vala
src/Views/DisplaysView.vala
src/Views/FiltersView.vala
src/Widgets/DisplayWindow.vala
src/Widgets/DisplayWidget.vala
src/Widgets/DisplaysOverlay.vala
67 changes: 33 additions & 34 deletions src/Widgets/DisplayWidget.vala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public struct Display.Resolution {
bool is_current;
}

public class Display.DisplayWidget : Gtk.EventBox {
public class Display.DisplayWidget : Gtk.Fixed {
public signal void set_as_primary ();
public signal void move_display (double diff_x, double diff_y);
public signal void end_grab (int delta_x, int delta_y);
Expand All @@ -45,7 +45,6 @@ public class Display.DisplayWidget : Gtk.EventBox {
private double start_y = 0;
private bool holding = false;

public DisplayWindow display_window { get; private set; }
public Gtk.Button primary_image { get; private set; }
public Gtk.MenuButton toggle_settings { get; private set; }

Expand Down Expand Up @@ -514,38 +513,38 @@ public class Display.DisplayWidget : Gtk.EventBox {
});
}

public override bool button_press_event (Gdk.EventButton event) {
if (only_display) {
return false;
}

start_x = event.x_root;
start_y = event.y_root;
holding = true;
return false;
}

public override bool button_release_event (Gdk.EventButton event) {
holding = false;
if ((delta_x == 0 && delta_y == 0) || only_display) {
return false;
}

var old_delta_x = delta_x;
var old_delta_y = delta_y;
delta_x = 0;
delta_y = 0;
end_grab (old_delta_x, old_delta_y);
return false;
}

public override bool motion_notify_event (Gdk.EventMotion event) {
if (holding && !only_display) {
move_display (event.x_root - start_x, event.y_root - start_y);
}

return false;
}
// public override bool button_press_event (Gdk.EventButton event) {
// if (only_display) {
// return false;
// }

// start_x = event.x_root;
// start_y = event.y_root;
// holding = true;
// return false;
// }

// public override bool button_release_event (Gdk.EventButton event) {
// holding = false;
// if ((delta_x == 0 && delta_y == 0) || only_display) {
// return false;
// }

// var old_delta_x = delta_x;
// var old_delta_y = delta_y;
// delta_x = 0;
// delta_y = 0;
// end_grab (old_delta_x, old_delta_y);
// return false;
// }

// public override bool motion_notify_event (Gdk.EventMotion event) {
// if (holding && !only_display) {
// move_display (event.x_root - start_x, event.y_root - start_y);
// }

// return false;
// }

public void set_primary (bool is_primary) {
if (is_primary) {
Expand Down
57 changes: 0 additions & 57 deletions src/Widgets/DisplayWindow.vala

This file was deleted.

1 change: 0 additions & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ plug_files = files(
'Views/NightLightView.vala',
'Views/DisplaysView.vala',
'Views' / 'FiltersView.vala',
'Widgets/DisplayWindow.vala',
'Widgets/DisplayWidget.vala',
'Widgets/DisplaysOverlay.vala',
)
Expand Down

0 comments on commit e08639a

Please sign in to comment.