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.
This commit is contained in:
parent
c2f304f3bc
commit
5f0389c07c
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user