From 776a0074d5a7dcba8ad5ec16b97acc0023f8abb8 Mon Sep 17 00:00:00 2001 From: Leonhard Kargl Date: Tue, 10 Dec 2024 14:45:48 +0100 Subject: [PATCH] Fix flicker for non autohide panels --- src/ShellClients/PanelClone.vala | 10 ++----- src/Widgets/MultitaskingView.vala | 44 +++++++++++++------------------ 2 files changed, 20 insertions(+), 34 deletions(-) diff --git a/src/ShellClients/PanelClone.vala b/src/ShellClients/PanelClone.vala index 275c4fb2e..858441c02 100644 --- a/src/ShellClients/PanelClone.vala +++ b/src/ShellClients/PanelClone.vala @@ -156,14 +156,8 @@ public class Gala.PanelClone : Object { new GesturePropertyTransition (clone, gesture_tracker, "y", null, calculate_clone_y (false)).start (with_gesture, (cancel_action) => { if (!cancel_action) { - // We need the small timeout because in the case that we're showing in sync with the multitasking view - // we have to make sure that we hide the clone after the multitasking view was already hidden otherwise - // it flickers because the actual window actors are hidden by the multitasking view - Timeout.add_once (10, () => { - force_hide = false; - clone.visible = false; - panel_hidden = false; - }); + clone.visible = false; + panel_hidden = false; } }); } diff --git a/src/Widgets/MultitaskingView.vala b/src/Widgets/MultitaskingView.vala index 103fd78b0..37a98c42b 100644 --- a/src/Widgets/MultitaskingView.vala +++ b/src/Widgets/MultitaskingView.vala @@ -702,37 +702,29 @@ namespace Gala { ShellClientsManager.get_instance ().set_force_hide_panels (false, multitasking_gesture_tracker, with_gesture); } - GestureTracker.OnEnd on_animation_end = (percentage, cancel_action, calculated_duration) => { - Timeout.add (calculated_duration, () => { - if (!opening) { - foreach (var container in window_containers_monitors) { - container.visible = false; - } - - hide (); - - wm.background_group.show (); - wm.window_group.show (); - wm.top_window_group.show (); - - wm.pop_modal (modal_proxy); + // The callback needs to run at the same frame as the others (e.g. PanelClone) so we can't do a simple Timeout here + // The actual transition does nothing here, since the opacity just stays at 255 + new GesturePropertyTransition (this, multitasking_gesture_tracker, "opacity", null, 255u).start (with_gesture, (cancel_action) => { + if (!opening) { + foreach (var container in window_containers_monitors) { + container.visible = false; } - animating = false; + hide (); - if (cancel_action) { - toggle (false, true); - } + wm.background_group.show (); + wm.window_group.show (); + wm.top_window_group.show (); - return Source.REMOVE; - }); - }; + wm.pop_modal (modal_proxy); + } - if (!with_gesture) { - on_animation_end (1, false, is_cancel_animation ? 0 : ANIMATION_DURATION); - } else { - multitasking_gesture_tracker.connect_handlers (null, null, (owned) on_animation_end); - } + animating = false; + + if (cancel_action) { + toggle (false, true); + } + }); } private bool keybinding_filter (Meta.KeyBinding binding) {