searchDisplay, viewSelector: use St keynav in Applications and Search

https://bugzilla.gnome.org/show_bug.cgi?id=663901
This commit is contained in:
Rui Matos 2011-11-12 04:40:56 +00:00
parent 02aae631d8
commit c7a37660ce
4 changed files with 47 additions and 9 deletions

View File

@ -308,6 +308,7 @@ StScrollBar StButton#vhandle:hover
} }
.dash-search-button:selected, .dash-search-button:selected,
.dash-search-button:focus,
.notification-button:focus, .notification-button:focus,
.notification-icon-button:focus, .notification-icon-button:focus,
.hotplug-notification-item:focus, .hotplug-notification-item:focus,
@ -693,6 +694,7 @@ StScrollBar StButton#vhandle:hover
font-weight: bold; font-weight: bold;
} }
.dash-search-button:focus,
.dash-search-button:selected { .dash-search-button:selected {
padding-top: 3px; padding-top: 3px;
padding-bottom: 4px; padding-bottom: 4px;

View File

@ -29,6 +29,7 @@ const Contact = new Lang.Class({
this.actor = new St.Bin({ style_class: 'contact', this.actor = new St.Bin({ style_class: 'contact',
reactive: true, reactive: true,
can_focus: true,
track_hover: true }); track_hover: true });
let content = new St.BoxLayout( { style_class: 'contact-content', let content = new St.BoxLayout( { style_class: 'contact-content',

View File

@ -32,6 +32,7 @@ const SearchResult = new Lang.Class({
if (content == null) { if (content == null) {
content = new St.Bin({ style_class: 'search-result-content', content = new St.Bin({ style_class: 'search-result-content',
reactive: true, reactive: true,
can_focus: true,
track_hover: true }); track_hover: true });
let icon = new IconGrid.BaseIcon(this.metaInfo['name'], let icon = new IconGrid.BaseIcon(this.metaInfo['name'],
{ createIcon: this.metaInfo['createIcon'] }); { createIcon: this.metaInfo['createIcon'] });
@ -267,6 +268,7 @@ const SearchResults = new Lang.Class({
_createOpenSearchProviderButton: function(provider) { _createOpenSearchProviderButton: function(provider) {
let button = new St.Button({ style_class: 'dash-search-button', let button = new St.Button({ style_class: 'dash-search-button',
reactive: true, reactive: true,
can_focus: true,
x_fill: true, x_fill: true,
y_align: St.Align.MIDDLE }); y_align: St.Align.MIDDLE });
let bin = new St.Bin({ x_fill: false, let bin = new St.Bin({ x_fill: false,

View File

@ -151,6 +151,23 @@ const SearchTab = new Lang.Class({
global.stage.connect('notify::key-focus', Lang.bind(this, this._updateCursorVisibility)); global.stage.connect('notify::key-focus', Lang.bind(this, this._updateCursorVisibility));
this._capturedEventId = 0; this._capturedEventId = 0;
// Since the entry isn't inside the results container we install this
// dummy widget as the last results container child so that we can
// include the entry in the keynav tab path...
this._focusTrap = new St.Bin({ can_focus: true });
this._focusTrap.connect('key-focus-in', Lang.bind(this, function() {
this._entry.grab_key_focus();
}));
// ... but make it unfocusable using arrow keys keynav by making its
// bounding box always contain the possible focus source's bounding
// box since StWidget's keynav logic won't ever select it as a target
// in that case.
this._focusTrap.add_constraint(new Clutter.BindConstraint({ source: this._searchResults.actor,
coordinate: Clutter.BindCoordinate.ALL }));
this._searchResults.actor.add_actor(this._focusTrap);
global.focus_manager.add_group(this._searchResults.actor);
}, },
hide: function() { hide: function() {
@ -271,8 +288,17 @@ const SearchTab = new Lang.Class({
this._reset(); this._reset();
return true; return true;
} }
} else if (this.active) {
if (symbol == Clutter.Tab) {
this._searchResults.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
return true;
} else if (symbol == Clutter.ISO_Left_Tab) {
this._focusTrap.can_focus = false;
this._searchResults.actor.navigate_focus(null, Gtk.DirectionType.TAB_BACKWARD, false);
this._focusTrap.can_focus = true;
return true;
}
} }
return false; return false;
}, },
@ -517,18 +543,25 @@ const ViewSelector = new Lang.Class({
if (symbol == Clutter.Escape) { if (symbol == Clutter.Escape) {
Main.overview.hide(); Main.overview.hide();
return true; return true;
} else if (modifiers & Clutter.ModifierType.CONTROL_MASK) { } else if (Clutter.keysym_to_unicode(symbol) ||
(symbol == Clutter.BackSpace && this._searchTab.active)) {
this._searchTab.startSearch(event);
} else if (!this._searchTab.active) {
if (modifiers & Clutter.ModifierType.CONTROL_MASK) {
if (symbol == Clutter.Page_Up) { if (symbol == Clutter.Page_Up) {
if (!this._searchTab.active)
this._prevTab(); this._prevTab();
return true; return true;
} else if (symbol == Clutter.Page_Down) { } else if (symbol == Clutter.Page_Down) {
if (!this._searchTab.active)
this._nextTab(); this._nextTab();
return true; return true;
} }
} else if (Clutter.keysym_to_unicode(symbol)) { } else if (symbol == Clutter.Tab) {
this._searchTab.startSearch(event); this._activeTab.page.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
return true;
} else if (symbol == Clutter.ISO_Left_Tab) {
this._activeTab.page.navigate_focus(null, Gtk.DirectionType.TAB_BACKWARD, false);
return true;
}
} }
return false; return false;
}, },