[gnome-shell] viewSelector: Don't focus search entry on whitespace
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] viewSelector: Don't focus search entry on whitespace
- Date: Sat, 23 Feb 2013 08:42:53 +0000 (UTC)
commit fb0cf64536a35d0d018d2f2bd506a9f02af57b14
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Feb 22 20:56:24 2013 +0100
viewSelector: Don't focus search entry on whitespace
We recently started to trim leading and trailing whitespace from
the search string, and not to trigger a search when the resulting
string was empty. However we still allow whitespace to trigger
type-ahead-find, so that the key focus is moved briefly to the
search entry and back to the stage, resulting in a disruptive
flickering of the entry.
Fix this by excluding whitespace from triggering type-ahead-find.
https://bugzilla.gnome.org/show_bug.cgi?id=694475
js/ui/viewSelector.js | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index 386150f..011855f 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -279,8 +279,7 @@ const ViewSelector = new Lang.Class({
else
Main.overview.hide();
return true;
- } else if (Clutter.keysym_to_unicode(symbol) ||
- (symbol == Clutter.BackSpace && this._searchActive)) {
+ } else if (this._shouldTriggerSearch(symbol)) {
this.startSearch(event);
} else if (!this._searchActive) {
if (symbol == Clutter.Tab || symbol == Clutter.Down) {
@@ -345,6 +344,17 @@ const ViewSelector = new Lang.Class({
}
},
+ _shouldTriggerSearch: function(symbol) {
+ let unicode = Clutter.keysym_to_unicode(symbol);
+ if (unicode == 0)
+ return false;
+
+ if (getTermsForSearchString(String.fromCharCode(unicode)).length > 0)
+ return true;
+
+ return symbol == Clutter.BackSpace && this._searchActive;
+ },
+
startSearch: function(event) {
global.stage.set_key_focus(this._text);
this._text.event(event, true);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]