viewSelector: remove the search entry's event grab

The search entry was taking a sort of grab when it was in the
focused-but-empty state, and would eat up most events for other actors
(except, confusingly, for panel actors). The only bit of "modality" we
really need here is that the entry is supposed to go back to the
unfocused state if you click somewhere outside it when it was in the
focused-but-empty state. So do that.

https://bugzilla.gnome.org/show_bug.cgi?id=642502
This commit is contained in:
Dan Winship 2011-02-16 13:44:03 -05:00
parent 5b8d3ba1d6
commit 3755783d41

View File

@ -161,8 +161,6 @@ SearchTab.prototype = {
},
_reset: function () {
this._entry.sync_hover();
this._text.text = '';
// Return focus to the viewSelector
@ -262,18 +260,14 @@ SearchTab.prototype = {
_onCapturedEvent: function(actor, event) {
let source = event.get_source();
let panelEvent = source && Main.panel.actor.contains(source);
switch (event.type()) {
case Clutter.EventType.BUTTON_PRESS:
// the user clicked outside after activating the entry, but
// with no search term entered - cancel the search
if (source != this._text && this._text.text == '') {
if (source != this._text && this._text.text == '')
this._reset();
// allow only panel events to continue
return !panelEvent;
}
return false;
break;
case Clutter.EventType.KEY_PRESS:
// If some "special" actor grabbed the focus (run
// dialog, looking glass); we don't want to interfere
@ -305,13 +299,10 @@ SearchTab.prototype = {
this._text.event(event, false);
}
return false;
default:
// Suppress all other events outside the panel while the entry
// is activated and no search has been entered - any click
// outside the entry will cancel the search
return (this._text.text == '' && !panelEvent);
break;
}
return false;
},
_doSearch: function () {