Skip to content

Commit 49352c1

Browse files
authored
Merge branch 'main' into lenemter/fix-pip-dnd
2 parents 6c66e68 + 9038f7b commit 49352c1

File tree

2 files changed

+11
-38
lines changed

2 files changed

+11
-38
lines changed

data/gala.metainfo.xml.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
</ul>
3939
</description>
4040
<issues>
41+
<issue url="https://github.com/elementary/gala/issues/397">Prevent PIP overlapping wingpanel?</issue>
4142
<issue url="https://github.com/elementary/gala/issues/857">Toggling the active window's maximization state during multitasking view messes up the window preview size</issue>
4243
<issue url="https://github.com/elementary/gala/issues/1967">Some apps ignore HiDPI mode</issue>
4344
<issue url="https://github.com/elementary/gala/issues/2088">Invisible window clones</issue>

plugins/pip/PopupWindow.vala

Lines changed: 10 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)