From 5f0389c07ca48e233a7c929eaf6c3a06512d2a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sat, 10 Mar 2012 05:50:17 +0100 Subject: [PATCH] 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 file changed, 8 insertions(+), 7 deletions(-) diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js index 925d430f3..795f9fc1c 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() {