lookingGlass: Use Clutter.grab() for actor picking

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2045>
This commit is contained in:
Carlos Garnacho 2021-11-18 00:13:45 +01:00
parent 81179bbf84
commit 0e4cd3bc79

View File

@ -558,12 +558,7 @@ var Inspector = GObject.registerClass({
eventHandler.connect('scroll-event', this._onScrollEvent.bind(this));
eventHandler.connect('motion-event', this._onMotionEvent.bind(this));
let seat = Clutter.get_default_backend().get_default_seat();
this._pointerDevice = seat.get_pointer();
this._keyboardDevice = seat.get_keyboard();
this._pointerDevice.grab(eventHandler);
this._keyboardDevice.grab(eventHandler);
this._grab = global.stage.grab(eventHandler);
// this._target is the actor currently shown by the inspector.
// this._pointerTarget is the actor directly under the pointer.
@ -596,8 +591,10 @@ var Inspector = GObject.registerClass({
}
_close() {
this._pointerDevice.ungrab();
this._keyboardDevice.ungrab();
if (this._grab) {
this._grab.dismiss();
this._grab = null;
}
this._eventHandler.destroy();
this._eventHandler = null;
this.emit('closed');