viewSelector: Rework Ctrl+Alt+Tab support

Now that there's only a ACTIVITIES and a SEARCH page, the old method of handling
keyboard tabbing (extra parameters to ViewSelector._addPage()) limits what we can
do.

Manually set up the Ctrl+Alt+Tab support for each element.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1593>
This commit is contained in:
Georges Basile Stavracas Neto 2021-01-27 12:55:20 -03:00 committed by Marge Bot
parent de15eb3bbc
commit 456b446394

View File

@ -7,7 +7,6 @@ const Signals = imports.signals;
const AppDisplay = imports.ui.appDisplay;
const Main = imports.ui.main;
const OverviewControls = imports.ui.overviewControls;
const Params = imports.misc.params;
const Search = imports.ui.search;
const ShellEntry = imports.ui.shellEntry;
const WorkspacesView = imports.ui.workspacesView;
@ -257,10 +256,35 @@ var ViewSelector = GObject.registerClass({
this._activitiesPage =
this._addPage(activitiesContainer, _('Activities'), 'view-app-grid-symbolic');
Main.ctrlAltTabManager.addGroup(
this.appDisplay,
_('Applications'),
'edit-find-symbolic', {
proxy: this,
focusCallback: () => {
this._showPage(this._activitiesPage);
this._showAppsButton.checked = true;
this.appDisplay.navigate_focus(
null, St.DirectionType.TAB_FORWARD, false);
},
});
Main.ctrlAltTabManager.addGroup(
this._workspacesDisplay,
_('Windows'),
'focus-windows-symbolic', {
proxy: this,
focusCallback: () => {
this._showPage(this._activitiesPage);
this._showAppsButton.checked = false;
this._workspacesDisplay.navigate_focus(
null, St.DirectionType.TAB_FORWARD, false);
},
});
this._searchResults = new Search.SearchResultsView();
this._searchPage = this._addPage(this._searchResults,
_("Search"), 'edit-find-symbolic',
{ a11yFocus: this._entry });
this._searchPage = this._addPage(this._searchResults);
Main.ctrlAltTabManager.addGroup(this._entry, _('Search'), 'edit-find-symbolic');
// Since the entry isn't inside the results container we install this
// dummy widget as the last results container child so that we can
@ -364,19 +388,8 @@ var ViewSelector = GObject.registerClass({
super.vfunc_hide();
}
_addPage(actor, name, a11yIcon, params) {
params = Params.parse(params, { a11yFocus: null });
_addPage(actor) {
let page = new St.Bin({ child: actor });
if (params.a11yFocus) {
Main.ctrlAltTabManager.addGroup(params.a11yFocus, name, a11yIcon);
} else {
Main.ctrlAltTabManager.addGroup(actor, name, a11yIcon, {
proxy: this,
focusCallback: () => this._a11yFocusPage(page),
});
}
page.hide();
this.add_actor(page);
return page;
@ -433,11 +446,6 @@ var ViewSelector = GObject.registerClass({
this._animateIn();
}
_a11yFocusPage(page) {
this._showAppsButton.checked = page == this._activitiesPage;
page.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
}
_onShowAppsButtonToggled() {
this._showPage(this._activitiesPage);
}