Skip to content

Commit 468779f

Browse files
committed
PopupWindow: pass display instead of wm
1 parent f4e30e8 commit 468779f

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

plugins/pip/Main.vala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public class Gala.Plugins.PIP.Plugin : Gala.Plugin {
9292
var rect = Graphene.Rect.alloc ();
9393
rect.init (point_x, point_y, width, height);
9494

95-
var popup_window = new PopupWindow (wm, active);
95+
var popup_window = new PopupWindow (wm.get_display (), active);
9696
popup_window.set_container_clip (rect);
9797
popup_window.show.connect (on_popup_window_show);
9898
popup_window.hide.connect (on_popup_window_hide);
@@ -114,7 +114,7 @@ public class Gala.Plugins.PIP.Plugin : Gala.Plugin {
114114
private void select_window_at (int x, int y) {
115115
var selected = get_window_actor_at (x, y);
116116
if (selected != null) {
117-
var popup_window = new PopupWindow (wm, selected);
117+
var popup_window = new PopupWindow (wm.get_display (), selected);
118118
popup_window.show.connect (on_popup_window_show);
119119
popup_window.hide.connect (on_popup_window_hide);
120120
add_window (popup_window);

plugins/pip/PopupWindow.vala

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
1616

1717
public signal void closed ();
1818

19-
public Gala.WindowManager wm { get; construct; }
19+
public Meta.Display display { get; construct; }
2020
public Meta.WindowActor window_actor { get; construct; }
2121

2222
private Clutter.Clone clone; // clone itself
@@ -52,12 +52,11 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
5252
|| window_type == Meta.WindowType.MODAL_DIALOG;
5353
}
5454

55-
public PopupWindow (Gala.WindowManager wm, Meta.WindowActor window_actor) {
56-
Object (wm: wm, window_actor: window_actor);
55+
public PopupWindow (Meta.Display display, Meta.WindowActor window_actor) {
56+
Object (display: display, window_actor: window_actor);
5757
}
5858

5959
construct {
60-
unowned var display = wm.get_display ();
6160
var scale = display.get_monitor_scale (display.get_current_monitor ());
6261

6362
button_size = Gala.Utils.scale_to_int (36, scale);
@@ -133,7 +132,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
133132
window.unmanaged.connect (on_close_click_clicked);
134133
window.notify["appears-focused"].connect (update_window_focus);
135134

136-
unowned var workspace_manager = wm.get_display ().get_workspace_manager ();
135+
unowned var workspace_manager = display.get_workspace_manager ();
137136
workspace_manager.active_workspace_changed.connect (update_window_focus);
138137
}
139138

@@ -215,15 +214,15 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
215214
}
216215

217216
private Clutter.Actor on_move_begin () {
218-
wm.get_display ().set_cursor (Meta.Cursor.DND_IN_DRAG);
217+
display.set_cursor (Meta.Cursor.DND_IN_DRAG);
219218

220219
return this;
221220
}
222221

223222
private void on_move_end () {
224223
reactive = true;
225224
update_screen_position ();
226-
wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
225+
display.set_cursor (Meta.Cursor.DEFAULT);
227226
}
228227

229228
#if HAS_MUTTER45
@@ -245,7 +244,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
245244
grab = resize_button.get_stage ().grab (resize_button);
246245
resize_button.event.connect (on_resize_event);
247246

248-
wm.get_display ().set_cursor (Meta.Cursor.SE_RESIZE);
247+
display.set_cursor (Meta.Cursor.SE_RESIZE);
249248

250249
return Clutter.EVENT_PROPAGATE;
251250
}
@@ -306,7 +305,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
306305

307306
update_screen_position ();
308307

309-
wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
308+
display.set_cursor (Meta.Cursor.DEFAULT);
310309
}
311310

312311
private void on_allocation_changed () {
@@ -329,14 +328,14 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
329328
}
330329

331330
private void update_window_focus () {
332-
unowned Meta.Window focus_window = wm.get_display ().get_focus_window ();
331+
unowned Meta.Window focus_window = display.get_focus_window ();
333332
if ((focus_window != null && !get_window_is_normal (focus_window))
334333
|| (previous_focus != null && !get_window_is_normal (previous_focus))) {
335334
previous_focus = focus_window;
336335
return;
337336
}
338337

339-
unowned var workspace_manager = wm.get_display ().get_workspace_manager ();
338+
unowned var workspace_manager = display.get_workspace_manager ();
340339
unowned var active_workspace = workspace_manager.get_active_workspace ();
341340
unowned var window = window_actor.get_meta_window ();
342341

@@ -520,7 +519,6 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
520519
}
521520

522521
private bool coord_is_in_other_monitor (float coord, Clutter.Orientation axis) {
523-
var display = wm.get_display ();
524522
int n_monitors = display.get_n_monitors ();
525523

526524
if (n_monitors == 1) {
@@ -553,7 +551,6 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
553551
#else
554552
private void get_current_monitor_rect (out Meta.Rectangle rect) {
555553
#endif
556-
var display = wm.get_display ();
557554
rect = display.get_monitor_geometry (display.get_current_monitor ());
558555
}
559556

0 commit comments

Comments
 (0)