[gnome-shell/wip/carlosg/grabs-pt2: 6/14] boxPointer: Do not mute key events while showing




commit c0e8d2b0fa84ca7a967c8c901cc37405b2da8a89
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Nov 18 00:18:09 2021 +0100

    boxPointer: Do not mute key events while showing
    
    We want to mute things like pointers hovering the BoxPointer while
    it does open. However keyboard events should still be handled
    promptly.
    
    Since Clutter.grab() will involve different actors being grabbed
    and focused, this will have some more presence, e.g. when navigating
    panel menus. We want to be able to navigate outside a menu while it
    is still being shown.

 js/ui/boxpointer.js | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/boxpointer.js b/js/ui/boxpointer.js
index be9c57ce03..91f0ab0107 100644
--- a/js/ui/boxpointer.js
+++ b/js/ui/boxpointer.js
@@ -46,6 +46,7 @@ var BoxPointer = GObject.registerClass({
         this.add_actor(this._border);
         this.set_child_above_sibling(this.bin, this._border);
         this._sourceAlignment = 0.5;
+        this._muteKeys = true;
         this._muteInput = true;
 
         this.connect('notify::visible', () => {
@@ -58,8 +59,12 @@ var BoxPointer = GObject.registerClass({
         this.connect('destroy', this._onDestroy.bind(this));
     }
 
-    vfunc_captured_event() {
-        if (this._muteInput)
+    vfunc_captured_event(event) {
+        let mute = (event.type() === Clutter.EventType.KEY_PRESS ||
+                    event.type() === Clutter.EventType.KEY_RELEASE) ?
+            this._muteKeys : this._muteInput;
+
+        if (mute)
             return Clutter.EVENT_STOP;
 
         return Clutter.EVENT_PROPAGATE;
@@ -86,6 +91,7 @@ var BoxPointer = GObject.registerClass({
         else
             this.opacity = 255;
 
+        this._muteKeys = false;
         this.show();
 
         if (animate & PopupAnimation.SLIDE) {
@@ -148,6 +154,7 @@ var BoxPointer = GObject.registerClass({
         }
 
         this._muteInput = true;
+        this._muteKeys = true;
 
         this.remove_all_transitions();
         this.ease({
@@ -161,6 +168,7 @@ var BoxPointer = GObject.registerClass({
                 this.opacity = 0;
                 this.translation_x = 0;
                 this.translation_y = 0;
+                //this._muteKeys = true;
                 if (onComplete)
                     onComplete();
             },


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