Revert "windowMenu: Do actions requiring grab once ungrabbed"

This reverts commit 2b3ab3ecec.

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: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2526>
This commit is contained in:
Carlos Garnacho 2023-01-17 18:40:10 +01:00 committed by Marge Bot
parent 426efb75ee
commit ac42eb62f8

View File

@ -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 {