Skip to content

Commit

Permalink
intellihide: Fix unexpected unredirection disable with overview
Browse files Browse the repository at this point in the history
When overview shows, this._animateIn is called in
_onOverviewShowing(). And when overview hides, _updateDashVisibility()
might call this._animateIn() again, which makes the unredirection always
disabled and brings performance issue in some cases.

This commit replaces the counter for unredirection by a boolean value,
to make logic more clear, and disabling/enabling unredirection balanced.
  • Loading branch information
taoky committed Apr 15, 2024
1 parent 5d417c0 commit 73afb79
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions docking.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ const DockedDash = GObject.registerClass({
this._autohideIsEnabled = null;
this._intellihideIsEnabled = null;

// This variable counts how many times Meta.disable_unredirect_for_display() is called
// This variable marks if Meta.disable_unredirect_for_display() is called
// to help restore the original state when intelihide is disabled.
this._disableUnredirectCount = 0;
this._unredirectDisabled = false;

// Create intellihide object to monitor windows overlapping
this._intellihide = new Intellihide.Intellihide(this.monitorIndex);
Expand Down Expand Up @@ -669,9 +669,10 @@ const DockedDash = GObject.registerClass({
}

_restoreUnredirect() {
for (let i = 0; i < this._disableUnredirectCount; i++)
if (this._unredirectDisabled) {
Meta.enable_unredirect_for_display(global.display);
this._disableUnredirectCount = 0;
this._unredirectDisabled = false;
}
}

/**
Expand Down Expand Up @@ -827,9 +828,9 @@ const DockedDash = GObject.registerClass({
}

_animateIn(time, delay) {
if (this._intellihideIsEnabled) {
if (!this._unredirectDisabled && this._intellihideIsEnabled) {
Meta.disable_unredirect_for_display(global.display);
this._disableUnredirectCount++;
this._unredirectDisabled = true;
}
this._dockState = State.SHOWING;
this.dash.iconAnimator.start();
Expand Down Expand Up @@ -868,9 +869,9 @@ const DockedDash = GObject.registerClass({
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
onComplete: () => {
this._dockState = State.HIDDEN;
if (this._intellihideIsEnabled && this._disableUnredirectCount > 0) {
if (this._intellihideIsEnabled && this._unredirectDisabled) {
Meta.enable_unredirect_for_display(global.display);
this._disableUnredirectCount--;
this._unredirectDisabled = false;
}
// Remove queued barried removal if any
if (this._removeBarrierTimeoutId > 0)
Expand Down

0 comments on commit 73afb79

Please sign in to comment.