grabHelper: Query stage for target actor instead of event.get_source()

Events are going to stop containing the destinatary, so stop using this
API. Querying the stage is equivalent and ensured to be up-to-date.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2216>
This commit is contained in:
Carlos Garnacho 2022-02-25 13:07:49 +01:00 committed by Marge Bot
parent 4735193456
commit 4a8b8e6dd5

View File

@ -265,9 +265,11 @@ var GrabHelper = class GrabHelper {
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
} }
const targetActor = global.stage.get_event_actor(event);
if (type === Clutter.EventType.ENTER || if (type === Clutter.EventType.ENTER ||
type === Clutter.EventType.LEAVE || type === Clutter.EventType.LEAVE ||
this.currentGrab.actor.contains(event.get_source())) this.currentGrab.actor.contains(targetActor))
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
if (Main.keyboard.shouldTakeEvent(event)) if (Main.keyboard.shouldTakeEvent(event))
@ -279,7 +281,7 @@ var GrabHelper = class GrabHelper {
if (press || touchBegin) if (press || touchBegin)
this._ignoreUntilRelease = true; this._ignoreUntilRelease = true;
let i = this._actorInGrabStack(event.get_source()) + 1; let i = this._actorInGrabStack(targetActor) + 1;
this.ungrab({ actor: this._grabStack[i].actor, isUser: true }); this.ungrab({ actor: this._grabStack[i].actor, isUser: true });
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} }