[gnome-shell/wip/carlosg/osk-cldr: 32/34] viewSelector: Send first printable keystroke to the search entry



commit fffbbf3e286930ba5a359341404475e95d58c601
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Dec 22 12:30:11 2017 +0100

    viewSelector: Send first printable keystroke to the search entry
    
    StIMText used to handle key events for IM consumption in the capture phase,
    this made the search box work automagically with nothing explicitly focusing
    it. Since it's no longer the case, it has to be done somewhere.

 js/ui/viewSelector.js |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index 7131f77..d9a13a3 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -606,6 +606,15 @@ var ViewSelector = new Lang.Class({
                 // - cancel the search
                 this.reset();
             }
+        } else if (!this._text.has_key_focus() &&
+                   (event.type() == Clutter.EventType.KEY_PRESS ||
+                    event.type() == Clutter.EventType.KEY_RELEASE)) {
+            let unichar = event.get_key_unicode();
+
+            if (GLib.unichar_isprint(unichar)) {
+                this._text.grab_key_focus();
+                return this._text.event(event, false);
+            }
         }
 
         return Clutter.EVENT_PROPAGATE;


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