Skip to content

Commit 75f279e

Browse files
authored
PiP: Use constraints (#1608)
1 parent 9cb7c0e commit 75f279e

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

plugins/pip/PopupWindow.vala

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,17 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
118118
close_button = Gala.Utils.create_close_button ();
119119
close_button.opacity = 0;
120120
close_button.reactive = true;
121+
// TODO: Check if close button should be on the right
122+
close_button.add_constraint (new Clutter.AlignConstraint (this, Clutter.AlignAxis.X_AXIS, 0.0f));
123+
close_button.add_constraint (new Clutter.AlignConstraint (this, Clutter.AlignAxis.Y_AXIS, 0.0f));
121124
close_button.add_action (close_action);
122125

123126
resize_button = Utils.create_resize_button ();
124-
resize_button.set_pivot_point (0.5f, 0.5f);
125-
resize_button.set_position (width - button_size, height - button_size);
126127
resize_button.opacity = 0;
127-
resize_button.button_press_event.connect (on_resize_button_press);
128128
resize_button.reactive = true;
129+
resize_button.add_constraint (new Clutter.AlignConstraint (this, Clutter.AlignAxis.X_AXIS, 1.0f));
130+
resize_button.add_constraint (new Clutter.AlignConstraint (this, Clutter.AlignAxis.Y_AXIS, 1.0f));
131+
resize_button.button_press_event.connect (on_resize_button_press);
129132

130133
add_child (container);
131134
add_child (close_button);
@@ -257,7 +260,6 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
257260

258261
update_container_scale ();
259262
update_size ();
260-
reposition_resize_button ();
261263

262264
break;
263265
case Clutter.EventType.BUTTON_RELEASE:
@@ -295,7 +297,6 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
295297
private void on_allocation_changed () {
296298
update_clone_clip ();
297299
update_size ();
298-
reposition_resize_button ();
299300
}
300301

301302
private void on_close_click_clicked () {
@@ -510,10 +511,6 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
510511
return false;
511512
}
512513

513-
private void reposition_resize_button () {
514-
resize_button.set_position (width - button_size, height - button_size);
515-
}
516-
517514
private void get_current_monitor_rect (out Meta.Rectangle rect) {
518515
var display = wm.get_display ();
519516
rect = display.get_monitor_geometry (display.get_current_monitor ());

0 commit comments

Comments
 (0)