@@ -88,20 +88,15 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
8888
8989 update_size ();
9090
91- #if HAS_MUTTER45
92- Mtk . Rectangle monitor_rect;
93- #else
94- Meta . Rectangle monitor_rect;
95- #endif
96- get_current_monitor_rect (out monitor_rect);
91+ var workarea_rect = display. get_workspace_manager (). get_active_workspace (). get_work_area_all_monitors ();
9792
9893 float x_position, y_position;
9994 if (Clutter . get_default_text_direction () == Clutter . TextDirection . RTL ) {
100- x_position = SCREEN_MARGIN + monitor_rect . x;
95+ x_position = SCREEN_MARGIN + workarea_rect . x;
10196 } else {
102- x_position = monitor_rect . width + monitor_rect . x - SCREEN_MARGIN - width;
97+ x_position = workarea_rect . x + workarea_rect . width - SCREEN_MARGIN - width;
10398 }
104- y_position = monitor_rect . height + monitor_rect . y - SCREEN_MARGIN - height;
99+ y_position = workarea_rect . y + workarea_rect . height - SCREEN_MARGIN - height;
105100
106101 set_position (x_position, y_position);
107102
@@ -431,22 +426,12 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
431426 private void place_window_in_screen () {
432427 off_screen = false ;
433428
434- #if HAS_MUTTER45
435- Mtk . Rectangle monitor_rect;
436- #else
437- Meta . Rectangle monitor_rect;
438- #endif
439- get_current_monitor_rect (out monitor_rect);
429+ var workarea_rect = display. get_workspace_manager (). get_active_workspace (). get_work_area_all_monitors ();
440430
441- int monitor_x = monitor_rect. x;
442- int monitor_y = monitor_rect. y;
443- int monitor_width = monitor_rect. width;
444- int monitor_height = monitor_rect. height;
445-
446- var screen_limit_start_x = SCREEN_MARGIN + monitor_x;
447- var screen_limit_end_x = monitor_width + monitor_x - SCREEN_MARGIN - width;
448- var screen_limit_start_y = SCREEN_MARGIN + monitor_y;
449- var screen_limit_end_y = monitor_height + monitor_y - SCREEN_MARGIN - height;
431+ var screen_limit_start_x = workarea_rect. x + SCREEN_MARGIN ;
432+ var screen_limit_end_x = workarea_rect. x + workarea_rect. width - SCREEN_MARGIN - width;
433+ var screen_limit_start_y = workarea_rect. y + SCREEN_MARGIN ;
434+ var screen_limit_end_y = workarea_rect. y + workarea_rect. height - SCREEN_MARGIN - height;
450435
451436 var duration = AnimationsSettings . get_animation_duration (300 );
452437
@@ -467,12 +452,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
467452 set_easing_mode (Clutter . AnimationMode . EASE_OUT_BACK );
468453 set_easing_duration (duration);
469454
470- #if HAS_MUTTER45
471- Mtk . Rectangle monitor_rect;
472- #else
473- Meta . Rectangle monitor_rect;
474- #endif
475- get_current_monitor_rect (out monitor_rect);
455+ var monitor_rect = display. get_monitor_geometry (display. get_current_monitor ());
476456
477457 int monitor_x = monitor_rect. x;
478458 int monitor_y = monitor_rect. y;
@@ -546,14 +526,6 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
546526 return false ;
547527 }
548528
549- #if HAS_MUTTER45
550- private void get_current_monitor_rect (out Mtk . Rectangle rect) {
551- #else
552- private void get_current_monitor_rect (out Meta . Rectangle rect) {
553- #endif
554- rect = display. get_monitor_geometry (display. get_current_monitor ());
555- }
556-
557529 private void get_target_window_size (out float width, out float height) {
558530 if (clone_container. has_clip) {
559531 clone_container. get_clip (null , null , out width, out height);
0 commit comments