[gnome-shell/50-fix-overview-focus-stealing] workspace: Don't move focus unconditionally



commit dc291cdf5c9f3b9d1e8c7c4cde0d4c349a22fb76
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Oct 10 00:04:56 2017 +0200

    workspace: Don't move focus unconditionally
    
    Since commit 1939e22c22c, we move the keyboard focus with the hover
    highlight. However while this makes sense when interacting with
    the window picker, it interferes with keyboard navigation of other
    components like dash or top bar. Address this by only moving the
    focus when the previous focus was already inside the window picker
    or unset.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/issues/50

 js/ui/workspace.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index a64cf7dec..85cd2d36a 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -662,7 +662,6 @@ var WindowOverlay = new Lang.Class({
         if (this._hidden)
             return;
 
-        this._windowClone.actor.grab_key_focus();
         this._animateVisible();
         this.emit('show-close-button');
     },
@@ -1860,7 +1859,12 @@ var Workspace = new Lang.Class({
 
         this.actor.add_actor(clone.actor);
 
-        overlay.connect('show-close-button', Lang.bind(this, this._onShowOverlayClose));
+        overlay.connect('show-close-button', () => {
+            let focus = global.stage.key_focus;
+            if (focus == null || this.actor.contains(focus))
+                clone.actor.grab_key_focus();
+            this._onShowOverlayClose(overlay);
+        });
 
         if (this._windows.length == 0)
             clone.setStackAbove(null);


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