mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-15 00:34:05 +09:00
Another tweak to fix slim chance of stuck grabs
This commit is contained in:
13
taskbar.js
13
taskbar.js
@@ -1232,8 +1232,9 @@ const taskbarAppIcon = new Lang.Class({
|
||||
|
||||
// grabHelper.grab() is usually called when the menu is opened. However, there seems to be a bug in the
|
||||
// underlying gnome-shell that causes all window contents to freeze if the grab and ungrab occur
|
||||
// in quick succession (for example, clicking the icon as the preview window is opening)
|
||||
// So, instead wait a few ms and verify that the window is still open before grabbing
|
||||
// in quick succession in timeouts from the Mainloop (for example, clicking the icon as the preview window is opening)
|
||||
// So, instead wait until the mouse is leaving the icon (and might be moving toward the open window) to trigger the grab
|
||||
// in windowPreview.js
|
||||
let windowPreviewMenuData = this.menuManagerWindowPreview._menus[this.menuManagerWindowPreview._findMenu(this.windowPreview)];
|
||||
this.windowPreview.disconnect(windowPreviewMenuData.openStateChangeId);
|
||||
windowPreviewMenuData.openStateChangeId = this.windowPreview.connect('open-state-changed', Lang.bind(this.menuManagerWindowPreview, function(menu, open) {
|
||||
@@ -1241,12 +1242,8 @@ const taskbarAppIcon = new Lang.Class({
|
||||
if (this.activeMenu)
|
||||
this.activeMenu.close(BoxPointer.PopupAnimation.FADE);
|
||||
|
||||
// hack to make sure the preview menu wasn't immediately closed before grabbing focus
|
||||
Mainloop.timeout_add(200, Lang.bind(this, function() {
|
||||
if(menu.isOpen) {
|
||||
this._grabHelper.grab({ actor: menu.actor, focus: menu.sourceActor, onUngrab: Lang.bind(this, this._closeMenu, menu) });
|
||||
}
|
||||
}));
|
||||
// don't grab here, we are grabbing in onLeave in windowPreview.js
|
||||
//this._grabHelper.grab({ actor: menu.actor, focus: menu.sourceActor, onUngrab: Lang.bind(this, this._closeMenu, menu) });
|
||||
} else {
|
||||
this._grabHelper.ungrab({ actor: menu.actor });
|
||||
}
|
||||
|
||||
@@ -128,6 +128,14 @@ const thumbnailPreviewMenu = new Lang.Class({
|
||||
this.cancelOpen();
|
||||
this.cancelClose();
|
||||
|
||||
// grabHelper.grab() is usually called when the menu is opened. However, there seems to be a bug in the
|
||||
// underlying gnome-shell that causes all window contents to freeze if the grab and ungrab occur
|
||||
// in quick succession in timeouts from the Mainloop (for example, clicking the icon as the preview window is opening)
|
||||
// So, instead wait until the mouse is leaving the icon (and might be moving toward the open window) to trigger the grab
|
||||
if(this.isOpen)
|
||||
this._source.menuManagerWindowPreview._grabHelper.grab({ actor: this.actor, focus: this.sourceActor,
|
||||
onUngrab: Lang.bind(this, this.requestCloseMenu) });
|
||||
|
||||
this._hoverCloseTimeoutId = Mainloop.timeout_add(this._dtpSettings.get_int('leave-timeout'), Lang.bind(this, this.hoverClose));
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user