From 05de06f5c27f1071351071f0f114e33a31c4dc58 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 21 Oct 2022 20:21:13 +0200 Subject: [PATCH] panel,windowMenu: Update to meta_window_begin_grab_op() API change Add device/sequence parameters. Part-of: --- js/ui/panel.js | 2 ++ js/ui/windowMenu.js | 32 +++++++++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/js/ui/panel.js b/js/ui/panel.js index 27bcfebb7..0dd62561f 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -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; } diff --git a/js/ui/windowMenu.js b/js/ui/windowMenu.js index 394de589f..83699d0cd 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 {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);