AppMenuButton: Check input mode only on application focus changes
Bailing out of _sync() early if the application lost keyboard focus to the shell can only be done on actual application focus changes. In particular, doing this check on a switch to an empty workspace while the keyboard focus is already on the shell prevents the AppMenuButton from being hidden as it should. https://bugzilla.gnome.org/show_bug.cgi?id=672011
This commit is contained in:
parent
22e1abbaff
commit
985f28bbea
@ -303,7 +303,7 @@ const AppMenuButton = new Lang.Class({
|
|||||||
|
|
||||||
let tracker = Shell.WindowTracker.get_default();
|
let tracker = Shell.WindowTracker.get_default();
|
||||||
let appSys = Shell.AppSystem.get_default();
|
let appSys = Shell.AppSystem.get_default();
|
||||||
tracker.connect('notify::focus-app', Lang.bind(this, this._sync));
|
tracker.connect('notify::focus-app', Lang.bind(this, this._focusAppChanged));
|
||||||
appSys.connect('app-state-changed', Lang.bind(this, this._onAppStateChanged));
|
appSys.connect('app-state-changed', Lang.bind(this, this._onAppStateChanged));
|
||||||
|
|
||||||
global.window_manager.connect('switch-workspace', Lang.bind(this, this._sync));
|
global.window_manager.connect('switch-workspace', Lang.bind(this, this._sync));
|
||||||
@ -479,16 +479,9 @@ const AppMenuButton = new Lang.Class({
|
|||||||
this._sync();
|
this._sync();
|
||||||
},
|
},
|
||||||
|
|
||||||
_sync: function() {
|
_focusAppChanged: function() {
|
||||||
let tracker = Shell.WindowTracker.get_default();
|
let tracker = Shell.WindowTracker.get_default();
|
||||||
let lastStartedApp = null;
|
|
||||||
let workspace = global.screen.get_active_workspace();
|
|
||||||
for (let i = 0; i < this._startingApps.length; i++)
|
|
||||||
if (this._startingApps[i].is_on_workspace(workspace))
|
|
||||||
lastStartedApp = this._startingApps[i];
|
|
||||||
|
|
||||||
let focusedApp = tracker.focus_app;
|
let focusedApp = tracker.focus_app;
|
||||||
|
|
||||||
if (!focusedApp) {
|
if (!focusedApp) {
|
||||||
// If the app has just lost focus to the panel, pretend
|
// If the app has just lost focus to the panel, pretend
|
||||||
// nothing happened; otherwise you can't keynav to the
|
// nothing happened; otherwise you can't keynav to the
|
||||||
@ -496,6 +489,17 @@ const AppMenuButton = new Lang.Class({
|
|||||||
if (global.stage_input_mode == Shell.StageInputMode.FOCUSED)
|
if (global.stage_input_mode == Shell.StageInputMode.FOCUSED)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this._sync();
|
||||||
|
},
|
||||||
|
|
||||||
|
_sync: function() {
|
||||||
|
let tracker = Shell.WindowTracker.get_default();
|
||||||
|
let focusedApp = tracker.focus_app;
|
||||||
|
let lastStartedApp = null;
|
||||||
|
let workspace = global.screen.get_active_workspace();
|
||||||
|
for (let i = 0; i < this._startingApps.length; i++)
|
||||||
|
if (this._startingApps[i].is_on_workspace(workspace))
|
||||||
|
lastStartedApp = this._startingApps[i];
|
||||||
|
|
||||||
let targetApp = focusedApp != null ? focusedApp : lastStartedApp;
|
let targetApp = focusedApp != null ? focusedApp : lastStartedApp;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user