Use preview opened state instead of hover for intellihide

This commit is contained in:
Charles Gagnon
2019-05-26 08:41:45 -04:00
parent c74fa64a66
commit 9c262facdc
3 changed files with 14 additions and 8 deletions

View File

@@ -187,9 +187,9 @@ var Intellihide = Utils.defineClass({
() => this._onHoverChanged()
],
[
this._dtpPanel.taskbar.previewMenu.menu,
'notify::hover',
() => this._onHoverChanged()
this._dtpPanel.taskbar.previewMenu,
'open-state-changed',
() => this._queueUpdatePanelPosition()
],
[
Main.overview,
@@ -203,7 +203,7 @@ var Intellihide = Utils.defineClass({
},
_onHoverChanged: function() {
this._hoveredOut = !this._panelBox.hover && !this._dtpPanel.taskbar.previewMenu.menu.hover;
this._hoveredOut = !this._panelBox.hover;
this._queueUpdatePanelPosition();
},
@@ -295,7 +295,7 @@ var Intellihide = Utils.defineClass({
},
_checkIfShouldBeVisible: function(fromRevealMechanism) {
if (Main.overview.visibleTarget || this._dtpPanel.taskbar.previewMenu.menu.get_hover() || this._panelBox.get_hover()) {
if (Main.overview.visibleTarget || this._dtpPanel.taskbar.previewMenu.opened || this._panelBox.get_hover()) {
return true;
}

View File

@@ -94,7 +94,7 @@ var defineClass = function (classDef) {
.forEach(k => C.prototype[k] = classDef[k]);
if (isGObject) {
C = GObject.registerClass(C);
C = GObject.registerClass({ Signals: classDef.Signals || {} }, C);
}
return C;

View File

@@ -54,6 +54,7 @@ var animationTime = 0;
var PreviewMenu = Utils.defineClass({
Name: 'DashToPanel-PreviewMenu',
Extends: St.Widget,
Signals: { 'open-state-changed': {} },
_init: function(dtpSettings, panelWrapper) {
this.callParent('_init', { layout_manager: new Clutter.BinLayout() });
@@ -163,7 +164,7 @@ var PreviewMenu = Utils.defineClass({
this._animateOpenOrClose(true);
this.menu.reactive = true;
this.opened = true;
this._setOpenedState(true);
}
},
@@ -237,6 +238,11 @@ var PreviewMenu = Utils.defineClass({
this._endPeek(true);
},
_setOpenedState: function(opened) {
this.opened = opened;
this.emit('open-state-changed');
},
_removeFocus: function() {
if (this._focusedPreview) {
this._focusedPreview.setFocus(false);
@@ -349,7 +355,7 @@ var PreviewMenu = Utils.defineClass({
_resetHiddenState: function() {
this.menu.hide();
this.opened = false;
this._setOpenedState(false);
this.menu.opacity = 0;
this.menu[this._translationProp] = this._translationOffset;
this._box.get_children().forEach(c => c.destroy());