Window Previews: enable/disable in windowPreviews.js

This commit is contained in:
franglais125
2017-07-25 17:11:50 -04:00
parent 8e96bc6a06
commit 15291fa8e3
2 changed files with 32 additions and 6 deletions

View File

@@ -228,10 +228,13 @@ const taskbarAppIcon = new Lang.Class({
}
]);
this.windowPreview.enableWindowPreview();
},
disableWindowPreview: function() {
this._signalsHandler.removeWithLabel('window-preview');
if (this.windowPreview)
this.windowPreview.disableWindowPreview();
},
shouldShowTooltip: function() {

View File

@@ -73,12 +73,6 @@ const thumbnailPreviewMenu = new Lang.Class({
Main.uiGroup.add_actor(this.actor);
this._enterSourceId = this._source.actor.connect('enter-event', Lang.bind(this, this._onEnter));
this._leaveSourceId = this._source.actor.connect('leave-event', Lang.bind(this, this._onLeave));
this._enterMenuId = this.actor.connect('enter-event', Lang.bind(this, this._onMenuEnter));
this._leaveMenuId = this.actor.connect('leave-event', Lang.bind(this, this._onMenuLeave));
// Change the initialized side where required.
this._arrowSide = side;
this._boxPointer._arrowSide = side;
@@ -100,6 +94,35 @@ const thumbnailPreviewMenu = new Lang.Class({
this._peekModeCurrentWorkspace = null;
},
enableWindowPreview: function() {
// Show window previews on mouse hover
this._enterSourceId = this._source.actor.connect('enter-event', Lang.bind(this, this._onEnter));
this._leaveSourceId = this._source.actor.connect('leave-event', Lang.bind(this, this._onLeave));
this._enterMenuId = this.actor.connect('enter-event', Lang.bind(this, this._onMenuEnter));
this._leaveMenuId = this.actor.connect('leave-event', Lang.bind(this, this._onMenuLeave));
},
disableWindowPreview: function() {
if (this._enterSourceId) {
this._source.actor.disconnect(this._enterSourceId);
this._enterSourceId = 0;
}
if (this._leaveSourceId) {
this._source.actor.disconnect(this._leaveSourceId);
this._leaveSourceId = 0;
}
if (this._enterMenuId) {
this.actor.disconnect(this._enterMenuId);
this._enterMenuId = 0;
}
if (this._leaveMenuId) {
this.actor.disconnect(this._leaveMenuId);
this._leaveMenuId = 0;
}
},
requestCloseMenu: function() {
// The "~0" argument makes the animation display.
this.close(~0);