panel,windowMenu: Update to meta_window_begin_grab_op() API change

Add device/sequence parameters.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2526>
This commit is contained in:
Carlos Garnacho 2022-10-21 20:21:13 +02:00 committed by Marge Bot
parent 0e969cab91
commit 05de06f5c2
2 changed files with 31 additions and 3 deletions

View File

@ -548,6 +548,8 @@ class Panel extends St.Widget {
return dragWindow.begin_grab_op(
Meta.GrabOp.MOVING,
event.get_device(),
event.get_event_sequence(),
event.get_time()) ? Clutter.EVENT_STOP : Clutter.EVENT_PROPAGATE;
}

View File

@ -1,7 +1,7 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*
/* exported WindowMenuManager */
const {Meta, St} = imports.gi;
const {Clutter, Meta, St} = imports.gi;
const BoxPointer = imports.ui.boxpointer;
const Main = imports.ui.main;
@ -57,13 +57,39 @@ var WindowMenu = class extends PopupMenu.PopupMenu {
item.setSensitive(false);
item = this.addAction(_("Move"), event => {
window.begin_grab_op(Meta.GrabOp.KEYBOARD_MOVING, event.get_time());
const device = event.get_device();
const seat = device.get_seat();
const deviceType = device.get_device_type();
const pointer =
deviceType === Clutter.InputDeviceType.POINTER_DEVICE ||
deviceType === Clutter.InputDeviceType.TABLET_DEVICE ||
deviceType === Clutter.InputDeviceType.PEN_DEVICE ||
deviceType === Clutter.InputDeviceType.ERASER_DEVICE
? device : seat.get_pointer();
window.begin_grab_op(
Meta.GrabOp.KEYBOARD_MOVING,
pointer, null,
event.get_time());
});
if (!window.allows_move())
item.setSensitive(false);
item = this.addAction(_("Resize"), event => {
window.begin_grab_op(Meta.GrabOp.KEYBOARD_RESIZING_UNKNOWN, event.get_time());
const device = event.get_device();
const seat = device.get_seat();
const deviceType = device.get_device_type();
const pointer =
deviceType === Clutter.InputDeviceType.POINTER_DEVICE ||
deviceType === Clutter.InputDeviceType.TABLET_DEVICE ||
deviceType === Clutter.InputDeviceType.PEN_DEVICE ||
deviceType === Clutter.InputDeviceType.ERASER_DEVICE
? device : seat.get_pointer();
window.begin_grab_op(
Meta.GrabOp.KEYBOARD_RESIZING_UNKNOWN,
pointer, null,
event.get_time());
});
if (!window.allows_resize())
item.setSensitive(false);