Skip to content

Commit

Permalink
docking: Generalize unredirect toggling to support GNOME 48 and earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
vanvugt committed Jan 15, 2025
1 parent 52dfc08 commit 4e283f2
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions docking.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 4e283f2

Please sign in to comment.