[gnome-shell/T27795: 92/138] viewSelector: Allow triggering the desktop search on key presses



commit 5c6550bf94443d7e729a7ec1144749d450433ce7
Author: Mario Sanchez Prada <mario endlessm com>
Date:   Wed Feb 14 10:42:44 2018 +0000

    viewSelector: Allow triggering the desktop search on key presses
    
    This implements the necessary hooks to start searching when typing
    from the APPS page (icon grid mode).

 js/ui/overview.js     |  1 +
 js/ui/viewSelector.js | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+)
---
diff --git a/js/ui/overview.js b/js/ui/overview.js
index f61caabd87..9c686f4108 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -488,6 +488,7 @@ var Overview = class {
 
     focusSearch() {
         this.show();
+        this.viewSelector.focusSearch();
     }
 
     _showOrSwitchPage(page) {
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index d507aadabd..881affea00 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -462,6 +462,7 @@ var ViewSelector = class {
                                                                    work_area: true }));
 
         this.appDisplay = this._viewsDisplay.appDisplay;
+        this._entry = this._viewsDisplay.entry;
 
         this._stageKeyPressId = 0;
         Main.overview.connect('showing', () => {
@@ -541,7 +542,14 @@ var ViewSelector = class {
         Main.overview.show();
     }
 
+    _clearSearch() {
+        this._entry.resetSearch();
+        this._viewsDisplay.actor.showPage(ViewsDisplayPage.APP_GRID, false);
+    }
+
     show(viewPage) {
+        this._clearSearch();
+
         // We're always starting up to the APPS page, so avoid making the workspacesDisplay
         // (used for the Windows picker) visible to prevent situations where that actor
         // would intercept clicks meant for the desktop's icons grid.
@@ -567,6 +575,11 @@ var ViewSelector = class {
         this._workspacesDisplay.hide();
     }
 
+    focusSearch() {
+        if (this._activePage == this._appsPage)
+            this._entry.grab_key_focus();
+    }
+
     _addPage(actor, name, a11yIcon, params) {
         params = Params.parse(params, { a11yFocus: null });
 
@@ -635,6 +648,13 @@ var ViewSelector = class {
         }
     }
 
+    _pageChanged() {
+        if (this._activePage != this._appsPage)
+            this._clearSearch();
+
+        this._pageChanged();
+    }
+
     _showPage(page) {
         if (!Main.overview.visible)
             return;
@@ -669,6 +689,12 @@ var ViewSelector = class {
             return Clutter.EVENT_STOP;
         }
 
+        if (this._entry.handleStageEvent(event))
+            return Clutter.EVENT_STOP;
+
+        if (this._entry.active)
+            return Clutter.EVENT_PROPAGATE;
+
         if (!global.stage.key_focus) {
             if (symbol == Clutter.Tab || symbol == Clutter.Down) {
                 this._activePage.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);


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