[gnome-shell] viewSelector: Rework Ctrl+Alt+Tab support



commit 456b446394d89707d6fa061b55b06293fc8b96f2
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Jan 27 12:55:20 2021 -0300

    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>

 js/ui/viewSelector.js | 50 +++++++++++++++++++++++++++++---------------------
 1 file changed, 29 insertions(+), 21 deletions(-)
---
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index b0d8f8b9c2..33b761f140 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -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);
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]