From ac42eb62f83363f30692f0c1b797349c505e33df Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 17 Jan 2023 18:40:10 +0100 Subject: [PATCH] Revert "windowMenu: Do actions requiring grab once ungrabbed" This reverts commit 2b3ab3ececd2b70023547552b1acf84cbc4fecb1. Since the window menu no longer uses a MetaDisplay grab, but directly a ClutterGrab, this is ineffective. But also, grabs are stackable, so it's fine to push the window operation grab first and then dismiss the window menu grab, even when MetaDisplay grabs get ported to using ClutterGrab underneath. We now can just grab right away, so do that. Part-of: --- js/ui/windowMenu.js | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/js/ui/windowMenu.js b/js/ui/windowMenu.js index 081645f04..c5a632803 100644 --- a/js/ui/windowMenu.js +++ b/js/ui/windowMenu.js @@ -1,7 +1,7 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -* /* exported WindowMenuManager */ -const { GLib, Meta, St } = imports.gi; +const {Meta, St} = imports.gi; const BoxPointer = imports.ui.boxpointer; const Main = imports.ui.main; @@ -57,13 +57,13 @@ var WindowMenu = class extends PopupMenu.PopupMenu { item.setSensitive(false); item = this.addAction(_("Move"), event => { - this._grabAction(window, Meta.GrabOp.KEYBOARD_MOVING, event.get_time()); + window.begin_grab_op(Meta.GrabOp.KEYBOARD_MOVING, true, event.get_time()); }); if (!window.allows_move()) item.setSensitive(false); item = this.addAction(_("Resize"), event => { - this._grabAction(window, Meta.GrabOp.KEYBOARD_RESIZING_UNKNOWN, event.get_time()); + window.begin_grab_op(Meta.GrabOp.KEYBOARD_RESIZING_UNKNOWN, true, event.get_time()); }); if (!window.allows_resize()) item.setSensitive(false); @@ -184,26 +184,6 @@ var WindowMenu = class extends PopupMenu.PopupMenu { if (!window.can_close()) item.setSensitive(false); } - - _grabAction(window, grabOp, time) { - if (global.display.get_grab_op() == Meta.GrabOp.NONE) { - window.begin_grab_op(grabOp, true, time); - return; - } - - let waitId = 0; - let id = global.display.connect('grab-op-end', display => { - display.disconnect(id); - GLib.source_remove(waitId); - - window.begin_grab_op(grabOp, true, time); - }); - - waitId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 100, () => { - global.display.disconnect(id); - return GLib.SOURCE_REMOVE; - }); - } }; var WindowMenuManager = class {