Skip to content

Commit

Permalink
Merge branch 'main' into lenemter/fix-notifications-crash
Browse files Browse the repository at this point in the history
  • Loading branch information
lenemter authored Dec 21, 2024
2 parents 4e15658 + cbcf70b commit a0bfda8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 44 deletions.
2 changes: 2 additions & 0 deletions data/gala.metainfo.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@
</ul>
</description>
<issues>
<issue url="https://github.com/elementary/gala/issues/397">Prevent PIP overlapping wingpanel?</issue>
<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>
<issue url="https://github.com/elementary/gala/issues/1967">Some apps ignore HiDPI mode</issue>
<issue url="https://github.com/elementary/gala/issues/2088">Invisible window clones</issue>
<issue url="https://github.com/elementary/gala/issues/2113">gnome-session-x11-services-ready.target isn't started on Wayland session</issue>
<issue url="https://github.com/elementary/gala/issues/2131">Unthemed cursor style and glitchy menus on some applications</issue>
<issue url="https://github.com/elementary/gala/issues/2159">Crash when moving windows between workspaces and using gestures to switch</issue>
<issue url="https://github.com/elementary/gala/issues/2169">Text UI based Scaling: Tiny Titlebars in XWayland Apps</issue>
<issue url="https://github.com/elementary/gala/issues/2171">PiP dragging doesn't start until after mouse is released</issue>
</issues>
</release>

Expand Down
60 changes: 16 additions & 44 deletions plugins/pip/PopupWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {

clone = new Clutter.Clone (window_actor);

move_action = new DragDropAction (DragDropActionType.SOURCE, "pip");
move_action.drag_begin.connect (on_move_begin);
move_action.drag_canceled.connect (on_move_end);
move_action.actor_clicked.connect (activate);

clone_container = new Clutter.Actor () {
scale_x = 0.35f,
scale_y = 0.35f
Expand All @@ -84,24 +79,24 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
};
container.add_child (clone_container);
container.add_effect (new ShadowEffect ("window"));
container.add_action (move_action);

move_action = new DragDropAction (DragDropActionType.SOURCE, "pip");
move_action.drag_begin.connect (on_move_begin);
move_action.drag_canceled.connect (on_move_end);
move_action.actor_clicked.connect (activate);
add_action (move_action);

update_size ();

#if HAS_MUTTER45
Mtk.Rectangle monitor_rect;
#else
Meta.Rectangle monitor_rect;
#endif
get_current_monitor_rect (out monitor_rect);
var workarea_rect = display.get_workspace_manager ().get_active_workspace ().get_work_area_all_monitors ();

float x_position, y_position;
if (Clutter.get_default_text_direction () == Clutter.TextDirection.RTL) {
x_position = SCREEN_MARGIN + monitor_rect.x;
x_position = SCREEN_MARGIN + workarea_rect.x;
} else {
x_position = monitor_rect.width + monitor_rect.x - SCREEN_MARGIN - width;
x_position = workarea_rect.x + workarea_rect.width - SCREEN_MARGIN - width;
}
y_position = monitor_rect.height + monitor_rect.y - SCREEN_MARGIN - height;
y_position = workarea_rect.y + workarea_rect.height - SCREEN_MARGIN - height;

set_position (x_position, y_position);

Expand Down Expand Up @@ -431,22 +426,12 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
private void place_window_in_screen () {
off_screen = false;

#if HAS_MUTTER45
Mtk.Rectangle monitor_rect;
#else
Meta.Rectangle monitor_rect;
#endif
get_current_monitor_rect (out monitor_rect);
var workarea_rect = display.get_workspace_manager ().get_active_workspace ().get_work_area_all_monitors ();

int monitor_x = monitor_rect.x;
int monitor_y = monitor_rect.y;
int monitor_width = monitor_rect.width;
int monitor_height = monitor_rect.height;

var screen_limit_start_x = SCREEN_MARGIN + monitor_x;
var screen_limit_end_x = monitor_width + monitor_x - SCREEN_MARGIN - width;
var screen_limit_start_y = SCREEN_MARGIN + monitor_y;
var screen_limit_end_y = monitor_height + monitor_y - SCREEN_MARGIN - height;
var screen_limit_start_x = workarea_rect.x + SCREEN_MARGIN;
var screen_limit_end_x = workarea_rect.x + workarea_rect.width - SCREEN_MARGIN - width;
var screen_limit_start_y = workarea_rect.y + SCREEN_MARGIN;
var screen_limit_end_y = workarea_rect.y + workarea_rect.height - SCREEN_MARGIN - height;

var duration = AnimationsSettings.get_animation_duration (300);

Expand All @@ -467,12 +452,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
set_easing_mode (Clutter.AnimationMode.EASE_OUT_BACK);
set_easing_duration (duration);

#if HAS_MUTTER45
Mtk.Rectangle monitor_rect;
#else
Meta.Rectangle monitor_rect;
#endif
get_current_monitor_rect (out monitor_rect);
var monitor_rect = display.get_monitor_geometry (display.get_current_monitor ());

int monitor_x = monitor_rect.x;
int monitor_y = monitor_rect.y;
Expand Down Expand Up @@ -546,14 +526,6 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
return false;
}

#if HAS_MUTTER45
private void get_current_monitor_rect (out Mtk.Rectangle rect) {
#else
private void get_current_monitor_rect (out Meta.Rectangle rect) {
#endif
rect = display.get_monitor_geometry (display.get_current_monitor ());
}

private void get_target_window_size (out float width, out float height) {
if (clone_container.has_clip) {
clone_container.get_clip (null, null, out width, out height);
Expand Down

0 comments on commit a0bfda8

Please sign in to comment.