From 9d2232303ffff67b0fe98e15c5ef5dccafff4550 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Thu, 25 Oct 2018 12:01:53 -0400 Subject: [PATCH] Sync panel reveal from hotkeys overlay and intellihide shortcut --- intellihide.js | 26 +++++++++++++++++--------- overview.js | 6 ++++-- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/intellihide.js b/intellihide.js index 3d622ee..1d6859d 100644 --- a/intellihide.js +++ b/intellihide.js @@ -41,6 +41,12 @@ const T1 = 'checkGrabTimeout'; const T2 = 'limitUpdateTimeout'; const T3 = 'postAnimateTimeout'; +var Hold = { + NONE: 0, + TEMPORARY: 1, + PERMANENT: 2 +}; + var Intellihide = new Lang.Class({ Name: 'DashToPanel.Intellihide', @@ -49,6 +55,7 @@ var Intellihide = new Lang.Class({ this._dtpSettings = dtpPanel._dtpSettings; this._panelBox = dtpPanel.panelBox; this._proximityManager = dtpPanel.panelManager.proximityManager; + this._holdStatus = Hold.NONE; this._signalsHandler = new Utils.GlobalSignalsHandler(); this._timeoutsHandler = new Utils.TimeoutsHandler(); @@ -66,7 +73,6 @@ var Intellihide = new Lang.Class({ this._animationDestination = -1; this._pendingUpdate = false; this._dragging = false; - this._currentlyHeld = false; this._hoveredOut = false; this._windowOverlap = false; this._panelAtTop = this._dtpSettings.get_string('panel-position') === 'TOP'; @@ -119,19 +125,21 @@ var Intellihide = new Lang.Class({ }, toggle: function() { - this._currentlyHeld ? this.release() : this.revealAndHold() + this[this._holdStatus & Hold.PERMANENT ? 'release' : 'revealAndHold'](Hold.PERMANENT); }, - revealAndHold: function() { - if (this._enabled) { + revealAndHold: function(holdStatus) { + if (this._enabled && !this._holdStatus) { this._revealPanel(); - this._currentlyHeld = true; } + + this._holdStatus |= holdStatus; }, - release: function() { - if (this._enabled) { - this._currentlyHeld = false; + release: function(holdStatus) { + this._holdStatus -= holdStatus; + + if (this._enabled && !this._holdStatus) { this._queueUpdatePanelPosition(); } }, @@ -271,7 +279,7 @@ var Intellihide = new Lang.Class({ //unless this is a mouse interaction or entering/leaving the overview, limit the number //of updates, but remember to update again when the limit timeout is reached this._pendingUpdate = true; - } else if (!this._currentlyHeld) { + } else if (!this._holdStatus) { this._checkIfShouldBeVisible(fromRevealMechanism) ? this._revealPanel() : this._hidePanel(); this._timeoutsHandler.add([T2, MIN_UPDATE_MS, () => this._endLimitUpdate()]); } diff --git a/overview.js b/overview.js index 6aac872..46e7937 100644 --- a/overview.js +++ b/overview.js @@ -21,7 +21,9 @@ */ const Me = imports.misc.extensionUtils.getCurrentExtension(); +const Intellihide = Me.imports.intellihide; const Utils = Me.imports.utils; + const Lang = imports.lang; const Main = imports.ui.main; const Shell = imports.gi.Shell; @@ -292,7 +294,7 @@ var dtpOverview = new Lang.Class({ if (hotkey_option === 'TEMPORARILY' || overlayFromShortcut) this.taskbar.toggleNumberOverlay(true); - this._panel.intellihide.revealAndHold(); + this._panel.intellihide.revealAndHold(Intellihide.Hold.TEMPORARY); let timeout = this._dtpSettings.get_int('overlay-timeout'); @@ -308,7 +310,7 @@ var dtpOverview = new Lang.Class({ this.taskbar.toggleNumberOverlay(false); } - this._panel.intellihide.release(); + this._panel.intellihide.release(Intellihide.Hold.TEMPORARY); })); } });