From 4e283f2e71bdb31fa6c53310a80799d59085f2e9 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Wed, 15 Jan 2025 17:37:57 +0800 Subject: [PATCH] docking: Generalize unredirect toggling to support GNOME 48 and earlier Closes: https://github.com/micheleg/dash-to-dock/issues/2347 --- docking.js | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/docking.js b/docking.js index 8db8028c2..f79804dee 100644 --- a/docking.js +++ b/docking.js @@ -245,7 +245,7 @@ const DockedDash = GObject.registerClass({ this._autohideIsEnabled = null; this._intellihideIsEnabled = null; - // This variable marks if Meta.disable_unredirect_for_display() is called + // This variable marks if _disableUnredirect() is called // to help restore the original state when intelihide is disabled. this._unredirectDisabled = false; @@ -669,9 +669,22 @@ const DockedDash = GObject.registerClass({ ]); } + _disableUnredirect() { + if (!this._unredirectDisabled) { + if (Meta.disable_unredirect_for_display !== undefined) + Meta.disable_unredirect_for_display(global.display); + else if (global.compositor.disable_unredirect !== undefined) + global.compositor.disable_unredirect(); + this._unredirectDisabled = true; + } + } + _restoreUnredirect() { if (this._unredirectDisabled) { - Meta.enable_unredirect_for_display(global.display); + if (Meta.enable_unredirect_for_display !== undefined) + Meta.enable_unredirect_for_display(global.display); + else if (global.compositor.enable_unredirect !== undefined) + global.compositor.enable_unredirect(); this._unredirectDisabled = false; } } @@ -829,10 +842,8 @@ const DockedDash = GObject.registerClass({ } _animateIn(time, delay) { - if (!this._unredirectDisabled && this._intellihideIsEnabled) { - Meta.disable_unredirect_for_display(global.display); - this._unredirectDisabled = true; - } + if (this._intellihideIsEnabled) + this._disableUnredirect(); this._dockState = State.SHOWING; this.dash.iconAnimator.start(); this._delayedHide = false; @@ -870,10 +881,8 @@ const DockedDash = GObject.registerClass({ mode: Clutter.AnimationMode.EASE_OUT_QUAD, onComplete: () => { this._dockState = State.HIDDEN; - if (this._intellihideIsEnabled && this._unredirectDisabled) { - Meta.enable_unredirect_for_display(global.display); - this._unredirectDisabled = false; - } + if (this._intellihideIsEnabled) + this._restoreUnredirect(); // Remove queued barrier removal timeout if any if (this._removeBarrierTimeoutId > 0) GLib.source_remove(this._removeBarrierTimeoutId);