workspace: Don't move focus unconditionally

Since commit 1939e22c22, 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
This commit is contained in:
Florian Müllner 2017-10-10 00:04:56 +02:00 committed by Florian Müllner
parent 71515a8a11
commit 09d3cdb023

View File

@ -660,7 +660,6 @@ var WindowOverlay = new Lang.Class({
if (this._hidden)
return;
this._windowClone.actor.grab_key_focus();
this._animateVisible();
this.emit('show-close-button');
},
@ -1852,7 +1851,12 @@ var Workspace = new Lang.Class({
this.actor.add_actor(clone.actor);
overlay.connect('show-close-button', this._onShowOverlayClose.bind(this));
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);