[gnome-shell/wip/carlosg/no-event-source: 2/8] keyboard: Query stage for target actor instead of event.get_source()
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/no-event-source: 2/8] keyboard: Query stage for target actor instead of event.get_source()
- Date: Fri, 25 Feb 2022 15:32:31 +0000 (UTC)
commit a79d004550d2ff5818da33987400936337647b69
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Feb 25 13:09:17 2022 +0100
keyboard: 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.
js/ui/keyboard.js | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 75df02de66..5a1c0c30b6 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -257,8 +257,11 @@ var LanguageSelectionPopup = class extends PopupMenu.PopupMenu {
}
_onCapturedEvent(actor, event) {
- if (event.get_source() == this.actor ||
- this.actor.contains(event.get_source()))
+ const targetActor = global.stage.get_device_actor(
+ event.get_device(), event.get_event_sequence());
+
+ if (targetActor == this.actor ||
+ this.actor.contains(targetActor))
return Clutter.EVENT_PROPAGATE;
if (event.type() == Clutter.EventType.BUTTON_RELEASE || event.type() == Clutter.EventType.TOUCH_END)
@@ -405,9 +408,11 @@ var Key = GObject.registerClass({
let type = event.type();
let press = type == Clutter.EventType.BUTTON_PRESS || type == Clutter.EventType.TOUCH_BEGIN;
let release = type == Clutter.EventType.BUTTON_RELEASE || type == Clutter.EventType.TOUCH_END;
+ const targetActor = global.stage.get_device_actor(
+ event.get_device(), event.get_event_sequence());
- if (event.get_source() == this._boxPointer.bin ||
- this._boxPointer.bin.contains(event.get_source()))
+ if (targetActor == this._boxPointer.bin ||
+ this._boxPointer.bin.contains(targetActor))
return Clutter.EVENT_PROPAGATE;
if (press)
@@ -1285,7 +1290,8 @@ var KeyboardManager = class KeyBoardManager {
if (!this._keyboard)
return false;
- let actor = event.get_source();
+ const actor = global.stage.get_device_actor(
+ event.get_device(), event.get_event_sequence());
return Main.layoutManager.keyboardBox.contains(actor) ||
!!actor._extendedKeys || !!actor.extendedKey;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]