[gnome-shell] main: hide the overview on key release



commit 6e4c89b3101259275694eb3112d05ab005aec117
Author: StÃphane DÃmurget <stephane demurget free fr>
Date:   Sun Nov 4 18:30:44 2012 +0100

    main: hide the overview on key release
    
    Entering the overview with the overlay key is done on key release but
    exiting the overview on key press, which is inconsistent.
    
    This change makes the overview hidden also on key release.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=683024

 js/ui/main.js |   90 ++++++++++++++++++++++++++++++--------------------------
 1 files changed, 48 insertions(+), 42 deletions(-)
---
diff --git a/js/ui/main.js b/js/ui/main.js
index fcffbf7..638a857 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -473,7 +473,7 @@ function getWindowActorsForWorkspace(workspaceIndex) {
 function _globalKeyPressHandler(actor, event) {
     if (modalCount == 0)
         return false;
-    if (event.type() != Clutter.EventType.KEY_PRESS)
+    if (event.type() != Clutter.EventType.KEY_PRESS && event.type() != Clutter.EventType.KEY_RELEASE)
         return false;
 
     if (!sessionMode.allowKeybindingsWhenModal) {
@@ -489,51 +489,57 @@ function _globalKeyPressHandler(actor, event) {
     // This relies on the fact that Clutter.ModifierType is the same as Gdk.ModifierType
     let action = global.display.get_keybinding_action(keyCode, modifierState);
 
-    if (action == Meta.KeyBindingAction.SWITCH_PANELS) {
-        ctrlAltTabManager.popup(modifierState & Clutter.ModifierType.SHIFT_MASK,
-                                modifierState);
-        return true;
-    }
-
-    switch (action) {
-        // left/right would effectively act as synonyms for up/down if we enabled them;
-        // but that could be considered confusing; we also disable them in the main view.
-        //
-        // case Meta.KeyBindingAction.WORKSPACE_LEFT:
-        //  if (!sessionMode.hasWorkspaces)
-        //      return false;
-        //
-        //     wm.actionMoveWorkspaceLeft();
-        //     return true;
-        // case Meta.KeyBindingAction.WORKSPACE_RIGHT:
-        //  if (!sessionMode.hasWorkspaces)
-        //      return false;
-        //
-        //     wm.actionMoveWorkspaceRight();
-        //     return true;
-        case Meta.KeyBindingAction.WORKSPACE_UP:
-            if (!sessionMode.hasWorkspaces)
-                return false;
-
-            wm.actionMoveWorkspace(Meta.MotionDirection.UP);
-            return true;
-        case Meta.KeyBindingAction.WORKSPACE_DOWN:
-            if (!sessionMode.hasWorkspaces)
-                return false;
-
-            wm.actionMoveWorkspace(Meta.MotionDirection.DOWN);
+    if (event.type() == Clutter.EventType.KEY_PRESS) {
+        if (action == Meta.KeyBindingAction.SWITCH_PANELS) {
+            ctrlAltTabManager.popup(modifierState & Clutter.ModifierType.SHIFT_MASK,
+                                    modifierState);
             return true;
-        case Meta.KeyBindingAction.PANEL_RUN_DIALOG:
-        case Meta.KeyBindingAction.COMMAND_2:
-            if (!sessionMode.hasRunDialog)
-                return false;
+        }
 
-            openRunDialog();
-            return true;
-        case Meta.KeyBindingAction.PANEL_MAIN_MENU:
-        case Meta.KeyBindingAction.OVERLAY_KEY:
+        switch (action) {
+            // left/right would effectively act as synonyms for up/down if we enabled them;
+            // but that could be considered confusing; we also disable them in the main view.
+            //
+            // case Meta.KeyBindingAction.WORKSPACE_LEFT:
+            //  if (!sessionMode.hasWorkspaces)
+            //      return false;
+            //
+            //     wm.actionMoveWorkspaceLeft();
+            //     return true;
+            // case Meta.KeyBindingAction.WORKSPACE_RIGHT:
+            //  if (!sessionMode.hasWorkspaces)
+            //      return false;
+            //
+            //     wm.actionMoveWorkspaceRight();
+            //     return true;
+            case Meta.KeyBindingAction.WORKSPACE_UP:
+                if (!sessionMode.hasWorkspaces)
+                    return false;
+
+                wm.actionMoveWorkspace(Meta.MotionDirection.UP);
+                return true;
+            case Meta.KeyBindingAction.WORKSPACE_DOWN:
+                if (!sessionMode.hasWorkspaces)
+                    return false;
+
+                wm.actionMoveWorkspace(Meta.MotionDirection.DOWN);
+                return true;
+            case Meta.KeyBindingAction.PANEL_RUN_DIALOG:
+            case Meta.KeyBindingAction.COMMAND_2:
+                if (!sessionMode.hasRunDialog)
+                    return false;
+
+                openRunDialog();
+                return true;
+            case Meta.KeyBindingAction.PANEL_MAIN_MENU:
+                overview.hide();
+                return true;
+        }
+    } else if (event.type() == Clutter.EventType.KEY_RELEASE) {
+        if (action == Meta.KeyBindingAction.OVERLAY_KEY) {
             overview.hide();
             return true;
+        }
     }
 
     return false;



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