[gnome-shell] viewSelector: Tie cursor visibility to :focus style



commit 5f0389c07ca48e233a7c929eaf6c3a06512d2a48
Author: Florian MÃllner <fmuellner gnome org>
Date:   Sat Mar 10 05:50:17 2012 +0100

    viewSelector: Tie cursor visibility to :focus style
    
    With the recent keynav changes, the keyboard focus can now move
    away from the search entry while a search is active. While we
    keep the focus entry style while a search is active, we set the
    cursor visibility depending on whether the entry has focus. This
    doesn't seem very logical, so always request to show the cursor
    when we appear focused.
    Note that at least for now we are just expressing intent, as clutter
    never draws the cursor for unfocused entries.

 js/ui/viewSelector.js |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index 925d430..795f9fc 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -201,14 +201,15 @@ const SearchTab = new Lang.Class({
 
     _onStageKeyFocusChanged: function() {
         let focus = global.stage.get_key_focus();
-        this._text.set_cursor_visible(focus == this._text);
+        let appearFocused = (this._entry.contains(focus) ||
+                             this._searchResults.actor.contains(focus));
 
-        if (focus != this._entry && focus != this._text) {
-            if (this._searchResults.actor.contains(focus))
-                this._entry.add_style_pseudo_class('focus');
-            else
-                this._entry.remove_style_pseudo_class('focus');
-        }
+        this._text.set_cursor_visible(appearFocused);
+
+        if (appearFocused)
+            this._entry.add_style_pseudo_class('focus');
+        else
+            this._entry.remove_style_pseudo_class('focus');
     },
 
     _onMapped: function() {



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