[gnome-shell] AppMenuButton: Check input mode only on application focus changes



commit 985f28bbeae134b0aab17ea35ad0026c357aadd7
Author: Rui Matos <tiagomatos gmail com>
Date:   Tue Mar 13 19:20:37 2012 +0100

    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

 js/ui/panel.js |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/js/ui/panel.js b/js/ui/panel.js
index eb93547..ef240a5 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -303,7 +303,7 @@ const AppMenuButton = new Lang.Class({
 
         let tracker = Shell.WindowTracker.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));
 
         global.window_manager.connect('switch-workspace', Lang.bind(this, this._sync));
@@ -479,16 +479,9 @@ const AppMenuButton = new Lang.Class({
         this._sync();
     },
 
-    _sync: function() {
+    _focusAppChanged: function() {
         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;
-
         if (!focusedApp) {
             // If the app has just lost focus to the panel, pretend
             // 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)
                 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;
 



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