From 0442e967962b18c91e2241e334b15cab0f8d7106 Mon Sep 17 00:00:00 2001 From: Leo Date: Wed, 11 Dec 2024 18:29:42 +0300 Subject: [PATCH 1/4] Fix crash when using tiling shortcuts (#2040) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Danielle Foré Co-authored-by: Ryan Kornheisl Co-authored-by: Leonhard <106322251+leolost2605@users.noreply.github.com> --- src/WindowManager.vala | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/WindowManager.vala b/src/WindowManager.vala index 37d69c639..0819e9922 100644 --- a/src/WindowManager.vala +++ b/src/WindowManager.vala @@ -97,7 +97,7 @@ namespace Gala { #else private Meta.Rectangle old_rect_size_change; #endif - private Clutter.Actor latest_window_snapshot; + private Clutter.Actor? latest_window_snapshot; private GLib.Settings behavior_settings; private GLib.Settings new_behavior_settings; @@ -1402,13 +1402,13 @@ namespace Gala { latest_window_snapshot.restore_easing_state (); ulong maximize_old_handler_id = 0UL; - maximize_old_handler_id = latest_window_snapshot.transitions_completed.connect (() => { - latest_window_snapshot.disconnect (maximize_old_handler_id); - latest_window_snapshot.destroy (); + maximize_old_handler_id = latest_window_snapshot.transitions_completed.connect ((snapshot) => { + snapshot.disconnect (maximize_old_handler_id); + snapshot.destroy (); actor.set_translation (0.0f, 0.0f, 0.0f); }); - latest_window_snapshot.restore_easing_state (); + latest_window_snapshot = null; actor.set_pivot_point (0.0f, 0.0f); actor.set_translation (old_rect_size_change.x - ex, old_rect_size_change.y - ey, 0.0f); @@ -1775,11 +1775,13 @@ namespace Gala { latest_window_snapshot.restore_easing_state (); ulong unmaximize_old_handler_id = 0UL; - unmaximize_old_handler_id = latest_window_snapshot.transitions_completed.connect (() => { - latest_window_snapshot.disconnect (unmaximize_old_handler_id); - latest_window_snapshot.destroy (); + unmaximize_old_handler_id = latest_window_snapshot.transitions_completed.connect ((snapshot) => { + snapshot.disconnect (unmaximize_old_handler_id); + snapshot.destroy (); }); + latest_window_snapshot = null; + actor.set_pivot_point (0.0f, 0.0f); actor.set_position (ex, ey); actor.set_translation (-ex + offset_x * (1.0f / scale_x - 1.0f) + old_rect_size_change.x, -ey + offset_y * (1.0f / scale_y - 1.0f) + old_rect_size_change.y, 0.0f); From 74f91ae8fb37473fe170fc92723cb2af0c86c242 Mon Sep 17 00:00:00 2001 From: Leonhard <106322251+leolost2605@users.noreply.github.com> Date: Thu, 12 Dec 2024 13:52:23 +0100 Subject: [PATCH 2/4] HideTracker: Use custom window rect for overlap calculation (#2162) --- src/ShellClients/HideTracker.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ShellClients/HideTracker.vala b/src/ShellClients/HideTracker.vala index ee6f9cd26..092b26c54 100644 --- a/src/ShellClients/HideTracker.vala +++ b/src/ShellClients/HideTracker.vala @@ -171,7 +171,7 @@ public class Gala.HideTracker : Object { continue; } - if (!panel.window.get_frame_rect ().overlap (window.get_frame_rect ())) { + if (!panel.get_custom_window_rect ().overlap (window.get_frame_rect ())) { continue; } From 32a5f354d7e76033757a49cb5955f7bfabfe3277 Mon Sep 17 00:00:00 2001 From: Leonhard <106322251+leolost2605@users.noreply.github.com> Date: Thu, 12 Dec 2024 16:26:17 +0100 Subject: [PATCH 3/4] Fix cancelling workspace switch gesture (#2148) Co-authored-by: Leo --- src/WindowManager.vala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/WindowManager.vala b/src/WindowManager.vala index 0819e9922..825b11cf3 100644 --- a/src/WindowManager.vala +++ b/src/WindowManager.vala @@ -2201,7 +2201,6 @@ namespace Gala { if (!animating_switch_workspace) { return; } - animating_switch_workspace = cancel_action; if (switch_workspace_window_created_id > 0) { disconnect (switch_workspace_window_created_id); @@ -2212,6 +2211,8 @@ namespace Gala { switch_workspace_completed (); } + animating_switch_workspace = cancel_action; + if (cancel_action) { var cancel_direction = (animation_direction == Meta.MotionDirection.LEFT) ? Meta.MotionDirection.RIGHT @@ -2293,8 +2294,7 @@ namespace Gala { } public override void kill_switch_workspace () { - // We don't care about animation direction, we don't want to cancel it, make it nudge so that it doesn't call switch_workspace_completed () - switch_workspace_animation_finished (LEFT, false, true); + end_switch_workspace (); } public override void locate_pointer () { From 779ff1886eae5daa7247a09215b299aaa9a25159 Mon Sep 17 00:00:00 2001 From: Leonhard <106322251+leolost2605@users.noreply.github.com> Date: Thu, 12 Dec 2024 16:32:33 +0100 Subject: [PATCH 4/4] Fix cancelling gesture in multitasking view (#2149) Co-authored-by: Leo --- src/Widgets/MonitorClone.vala | 2 +- src/Widgets/WindowClone.vala | 6 +++--- src/Widgets/WindowCloneContainer.vala | 6 +++--- src/Widgets/WorkspaceClone.vala | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Widgets/MonitorClone.vala b/src/Widgets/MonitorClone.vala index c54812773..5f6f66e7f 100644 --- a/src/Widgets/MonitorClone.vala +++ b/src/Widgets/MonitorClone.vala @@ -102,7 +102,7 @@ namespace Gala { */ public void close (bool with_gesture = false, bool is_cancel_animation = false) { window_container.restack_windows (); - window_container.close (with_gesture, is_cancel_animation); + window_container.close (with_gesture); } private void window_left (int window_monitor, Meta.Window window) { diff --git a/src/Widgets/WindowClone.vala b/src/Widgets/WindowClone.vala index db747dc10..05c678810 100644 --- a/src/Widgets/WindowClone.vala +++ b/src/Widgets/WindowClone.vala @@ -271,7 +271,7 @@ public class Gala.WindowClone : Clutter.Actor { * * @param animate Animate the transformation of the placement */ - public void transition_to_original_state (bool with_gesture = false, bool is_cancel_animation = false) { + public void transition_to_original_state (bool with_gesture = false) { var outer_rect = window.get_frame_rect (); unowned var display = window.get_display (); @@ -332,9 +332,9 @@ public class Gala.WindowClone : Clutter.Actor { * Animate the window to the given slot */ #if HAS_MUTTER45 - public void take_slot (Mtk.Rectangle rect, bool from_window_position, bool with_gesture = false, bool is_cancel_animation = false) { + public void take_slot (Mtk.Rectangle rect, bool from_window_position, bool with_gesture = false) { #else - public void take_slot (Meta.Rectangle rect, bool from_window_position, bool with_gesture = false, bool is_cancel_animation = false) { + public void take_slot (Meta.Rectangle rect, bool from_window_position, bool with_gesture = false) { #endif slot = rect; active = false; diff --git a/src/Widgets/WindowCloneContainer.vala b/src/Widgets/WindowCloneContainer.vala index d6ce80455..0e9bdea6a 100644 --- a/src/Widgets/WindowCloneContainer.vala +++ b/src/Widgets/WindowCloneContainer.vala @@ -206,7 +206,7 @@ namespace Gala { foreach (var tilable in window_positions) { unowned var clone = (WindowClone) tilable.id; - clone.take_slot (tilable.rect, opening, with_gesture, is_cancel_animation); + clone.take_slot (tilable.rect, opening && !is_cancel_animation, with_gesture); } } @@ -400,7 +400,7 @@ namespace Gala { * Calls the transition_to_original_state() function on each child * to make them take their original locations again. */ - public void close (bool with_gesture = false, bool is_cancel_animation = false) { + public void close (bool with_gesture = false) { if (!opened) { return; } @@ -408,7 +408,7 @@ namespace Gala { opened = false; foreach (var window in get_children ()) { - ((WindowClone) window).transition_to_original_state (with_gesture, is_cancel_animation); + ((WindowClone) window).transition_to_original_state (with_gesture); } } } diff --git a/src/Widgets/WorkspaceClone.vala b/src/Widgets/WorkspaceClone.vala index 0c4721ab3..e40562c30 100644 --- a/src/Widgets/WorkspaceClone.vala +++ b/src/Widgets/WorkspaceClone.vala @@ -369,8 +369,8 @@ namespace Gala { update_size (monitor); new GesturePropertyTransition (this, gesture_tracker, "x", initial_x, target_x).start (with_gesture); - new GesturePropertyTransition (background, gesture_tracker, "scale-x", 1.0d, (double) scale).start (with_gesture); - new GesturePropertyTransition (background, gesture_tracker, "scale-y", 1.0d, (double) scale).start (with_gesture); + new GesturePropertyTransition (background, gesture_tracker, "scale-x", null, (double) scale).start (with_gesture); + new GesturePropertyTransition (background, gesture_tracker, "scale-y", null, (double) scale).start (with_gesture); #if HAS_MUTTER45 Mtk.Rectangle area = { @@ -415,7 +415,7 @@ namespace Gala { new GesturePropertyTransition (background, gesture_tracker, "scale-x", null, 1.0d).start (with_gesture); new GesturePropertyTransition (background, gesture_tracker, "scale-y", null, 1.0d).start (with_gesture); - window_container.close (with_gesture, is_cancel_animation); + window_container.close (with_gesture); } } }