[gnome-shell/wip/carlosg/no-event-source: 4/8] searchController: Query stage for target actor instead of event.get_source()




commit 55db4742df4b2ff52f827dfc18ea6b79cf561b4f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Feb 25 13:10:30 2022 +0100

    searchController: 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/searchController.js | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/searchController.js b/js/ui/searchController.js
index 5d25897c79..6105e976b6 100644
--- a/js/ui/searchController.js
+++ b/js/ui/searchController.js
@@ -306,12 +306,13 @@ var SearchController = GObject.registerClass({
 
     _onCapturedEvent(actor, event) {
         if (event.type() === Clutter.EventType.BUTTON_PRESS) {
-            let source = event.get_source();
-            if (source !== this._text &&
+            const targetActor = global.stage.get_device_actor(
+                event.get_device(), event.get_event_sequence());
+            if (targetActor !== this._text &&
                 this._text.has_key_focus() &&
                 this._text.text === '' &&
                 !this._text.has_preedit() &&
-                !Main.layoutManager.keyboardBox.contains(source)) {
+                !Main.layoutManager.keyboardBox.contains(targetActor)) {
                 // the user clicked outside after activating the entry, but
                 // with no search term entered and no keyboard button pressed
                 // - cancel the search


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]