lookingGlass: Replace global grabs with input device grabs

Global grabs are being removed from Clutter in favour of input device
grabs.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/495
This commit is contained in:
Jonas Dreßler 2019-04-14 18:32:11 +02:00 committed by Florian Müllner
parent 61f86cbc54
commit 6c33aff6d1

View File

@ -491,8 +491,13 @@ var Inspector = GObject.registerClass({
eventHandler.connect('button-press-event', this._onButtonPressEvent.bind(this)); eventHandler.connect('button-press-event', this._onButtonPressEvent.bind(this));
eventHandler.connect('scroll-event', this._onScrollEvent.bind(this)); eventHandler.connect('scroll-event', this._onScrollEvent.bind(this));
eventHandler.connect('motion-event', this._onMotionEvent.bind(this)); eventHandler.connect('motion-event', this._onMotionEvent.bind(this));
Clutter.grab_pointer(eventHandler);
Clutter.grab_keyboard(eventHandler); let dm = Clutter.DeviceManager.get_default();
this._pointerDevice = dm.get_core_device(Clutter.InputDeviceType.POINTER_DEVICE);
this._keyboardDevice = dm.get_core_device(Clutter.InputDeviceType.KEYBOARD_DEVICE);
this._pointerDevice.grab(eventHandler);
this._keyboardDevice.grab(eventHandler);
// this._target is the actor currently shown by the inspector. // this._target is the actor currently shown by the inspector.
// this._pointerTarget is the actor directly under the pointer. // this._pointerTarget is the actor directly under the pointer.
@ -525,8 +530,8 @@ var Inspector = GObject.registerClass({
} }
_close() { _close() {
Clutter.ungrab_pointer(); this._pointerDevice.ungrab();
Clutter.ungrab_keyboard(); this._keyboardDevice.ungrab();
this._eventHandler.destroy(); this._eventHandler.destroy();
this._eventHandler = null; this._eventHandler = null;
this.emit('closed'); this.emit('closed');