viewSelector: Allow to start navigating results using arrow keys

We currently require users to tab away from the search entry before
search results can be navigated using arrow keys. For convenience,
support using arrow keys directly from the entry.

https://bugzilla.gnome.org/show_bug.cgi?id=663901
This commit is contained in:
Florian Müllner
2012-03-10 03:40:46 +01:00
parent 700f706428
commit 384c7e2c17
2 changed files with 28 additions and 4 deletions

View File

@ -292,6 +292,15 @@ const SearchTab = new Lang.Class({
return true;
}
} else if (this.active) {
let arrowNext, nextDirection;
if (entry.get_text_direction() == Clutter.TextDirection.RTL) {
arrowNext = Clutter.Left;
nextDirection = Gtk.DirectionType.LEFT;
} else {
arrowNext = Clutter.Right;
nextDirection = Gtk.DirectionType.RIGHT;
}
if (symbol == Clutter.Tab) {
this._searchResults.navigateFocus(Gtk.DirectionType.TAB_FORWARD);
return true;
@ -300,6 +309,12 @@ const SearchTab = new Lang.Class({
this._searchResults.navigateFocus(Gtk.DirectionType.TAB_BACKWARD);
this._focusTrap.can_focus = true;
return true;
} else if (symbol == Clutter.Down) {
this._searchResults.navigateFocus(Gtk.DirectionType.DOWN);
return true;
} else if (symbol == arrowNext && this._text.position == -1) {
this._searchResults.navigateFocus(nextDirection);
return true;
}
}
return false;