[gnome-shell/wip/carlosg/osk-events-in-grab: 10/11] grabHelper: Special case event funneling towards the OSK




commit c29e0cf6e60a1296b43fc33d94f2acc649046cf9
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Mar 9 23:11:03 2022 +0100

    grabHelper: Special case event funneling towards the OSK
    
    In the case of bringing up the OSK while there is a grab (like, every
    GNOME Shell entry), we used to special case event capturing so events
    directed to the OSK would be let through.
    
    When Clutter.Grab came around, events would be propagated only within
    the actor hierarchy that holds the grab, which rendered this special
    case just as useless as the OSK while a grab was hold. Since it wouldn't
    be part of the grab hierarchy, clicking on the OSK would do nothing.
    
    In order to let the OSK handle events, double down on the special case
    and let it forward the event directly to the actor under the device,
    instead of trying to let it through somehow. Since the actor under the
    device are usually OSK buttons in this case, we don't need further
    propagation to make it work, which makes the OSK functional again while
    the shell holds a grab.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2237>

 js/ui/grabHelper.js |  2 +-
 js/ui/keyboard.js   | 12 +++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/grabHelper.js b/js/ui/grabHelper.js
index af4641014a..c4028fc38b 100644
--- a/js/ui/grabHelper.js
+++ b/js/ui/grabHelper.js
@@ -272,7 +272,7 @@ var GrabHelper = class GrabHelper {
             this.currentGrab.actor.contains(targetActor))
             return Clutter.EVENT_PROPAGATE;
 
-        if (Main.keyboard.shouldTakeEvent(event))
+        if (Main.keyboard.maybeHandleEvent(event))
             return Clutter.EVENT_PROPAGATE;
 
         if (button || touchBegin) {
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 6512bf0d23..af195dccfd 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -1263,13 +1263,19 @@ var KeyboardManager = class KeyBoardManager {
             this._keyboard.resetSuggestions();
     }
 
-    shouldTakeEvent(event) {
+    maybeHandleEvent(event) {
         if (!this._keyboard)
             return false;
 
         const actor = global.stage.get_event_actor(event);
-        return Main.layoutManager.keyboardBox.contains(actor) ||
-               !!actor._extendedKeys || !!actor.extendedKey;
+
+        if (Main.layoutManager.keyboardBox.contains(actor) ||
+            !!actor._extendedKeys || !!actor.extendedKey) {
+            actor.event(event);
+            return true;
+        }
+
+        return false;
     }
 };
 


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