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 {