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:
parent
de15eb3bbc
commit
456b446394
@ -7,7 +7,6 @@ const Signals = imports.signals;
|
|||||||
const AppDisplay = imports.ui.appDisplay;
|
const AppDisplay = imports.ui.appDisplay;
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
const OverviewControls = imports.ui.overviewControls;
|
const OverviewControls = imports.ui.overviewControls;
|
||||||
const Params = imports.misc.params;
|
|
||||||
const Search = imports.ui.search;
|
const Search = imports.ui.search;
|
||||||
const ShellEntry = imports.ui.shellEntry;
|
const ShellEntry = imports.ui.shellEntry;
|
||||||
const WorkspacesView = imports.ui.workspacesView;
|
const WorkspacesView = imports.ui.workspacesView;
|
||||||
@ -257,10 +256,35 @@ var ViewSelector = GObject.registerClass({
|
|||||||
this._activitiesPage =
|
this._activitiesPage =
|
||||||
this._addPage(activitiesContainer, _('Activities'), 'view-app-grid-symbolic');
|
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._searchResults = new Search.SearchResultsView();
|
||||||
this._searchPage = this._addPage(this._searchResults,
|
this._searchPage = this._addPage(this._searchResults);
|
||||||
_("Search"), 'edit-find-symbolic',
|
Main.ctrlAltTabManager.addGroup(this._entry, _('Search'), 'edit-find-symbolic');
|
||||||
{ a11yFocus: this._entry });
|
|
||||||
|
|
||||||
// Since the entry isn't inside the results container we install this
|
// Since the entry isn't inside the results container we install this
|
||||||
// dummy widget as the last results container child so that we can
|
// dummy widget as the last results container child so that we can
|
||||||
@ -364,19 +388,8 @@ var ViewSelector = GObject.registerClass({
|
|||||||
super.vfunc_hide();
|
super.vfunc_hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
_addPage(actor, name, a11yIcon, params) {
|
_addPage(actor) {
|
||||||
params = Params.parse(params, { a11yFocus: null });
|
|
||||||
|
|
||||||
let page = new St.Bin({ child: 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();
|
page.hide();
|
||||||
this.add_actor(page);
|
this.add_actor(page);
|
||||||
return page;
|
return page;
|
||||||
@ -433,11 +446,6 @@ var ViewSelector = GObject.registerClass({
|
|||||||
this._animateIn();
|
this._animateIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
_a11yFocusPage(page) {
|
|
||||||
this._showAppsButton.checked = page == this._activitiesPage;
|
|
||||||
page.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
_onShowAppsButtonToggled() {
|
_onShowAppsButtonToggled() {
|
||||||
this._showPage(this._activitiesPage);
|
this._showPage(this._activitiesPage);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user