Remove the cursor from the search entry when it doesn't have focus

We should not be showing the cursor in the search entry in the overview
if the user's input will be appearing elsewhere, such as in the run dialog,
in the Looking Glass console, or in the notification's response field.
This commit is contained in:
Marina Zhurakhinskaya 2010-06-28 17:02:18 -04:00
parent 71bbd4ed5c
commit 40c7d3763b

View File

@ -160,11 +160,21 @@ SearchEntry.prototype = {
})); }));
this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
global.stage.connect('notify::key-focus', Lang.bind(this, this._updateCursorVisibility));
this.pane = null; this.pane = null;
this._capturedEventId = 0; this._capturedEventId = 0;
}, },
_updateCursorVisibility: function() {
let focus = global.stage.get_key_focus();
if (focus == global.stage || focus == this.entry)
this.entry.set_cursor_visible(true);
else
this.entry.set_cursor_visible(false);
},
show: function() { show: function() {
if (this._capturedEventId == 0) if (this._capturedEventId == 0)
this._capturedEventId = global.stage.connect('captured-event', this._capturedEventId = global.stage.connect('captured-event',