[mutter] keybindings: Handle switch-to-workspace-{up, down, left, right} again



commit abd0ac2cc3aeafb8f055bd58943c81ba4a7f5e75
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Apr 17 16:54:37 2014 +0200

    keybindings: Handle switch-to-workspace-{up,down,left,right} again
    
    Commit 585fdd781cc5 not only removed the tabpopup, but set invalid
    handlers (a.k.a. NULL) for those shortcuts; add back handling of
    basic handling of those shortcuts by switching instantly without any
    popups.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=728423

 src/core/keybindings.c |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index cc9b09b..19376e4 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -2475,7 +2475,19 @@ handle_switch_to_workspace (MetaDisplay     *display,
   gint which = binding->handler->data;
   MetaWorkspace *workspace;
 
-  workspace = meta_screen_get_workspace_by_index (screen, which);
+  if (which < 0)
+    {
+      /* Negative workspace numbers are directions with respect to the
+       * current workspace.
+       */
+
+      workspace = meta_workspace_get_neighbor (screen->active_workspace,
+                                               which);
+    }
+  else
+    {
+      workspace = meta_screen_get_workspace_by_index (screen, which);
+    }
 
   if (workspace)
     {
@@ -3350,28 +3362,28 @@ init_builtin_key_bindings (MetaDisplay *display)
                           common_keybindings,
                           META_KEY_BINDING_NONE,
                           META_KEYBINDING_ACTION_WORKSPACE_LEFT,
-                          NULL, 0);
+                          handle_switch_to_workspace, META_MOTION_LEFT);
 
   add_builtin_keybinding (display,
                           "switch-to-workspace-right",
                           common_keybindings,
                           META_KEY_BINDING_NONE,
                           META_KEYBINDING_ACTION_WORKSPACE_RIGHT,
-                          NULL, 0);
+                          handle_switch_to_workspace, META_MOTION_RIGHT);
 
   add_builtin_keybinding (display,
                           "switch-to-workspace-up",
                           common_keybindings,
                           META_KEY_BINDING_NONE,
                           META_KEYBINDING_ACTION_WORKSPACE_UP,
-                          NULL, 0);
+                          handle_switch_to_workspace, META_MOTION_UP);
 
   add_builtin_keybinding (display,
                           "switch-to-workspace-down",
                           common_keybindings,
                           META_KEY_BINDING_NONE,
                           META_KEYBINDING_ACTION_WORKSPACE_DOWN,
-                          NULL, 0);
+                          handle_switch_to_workspace, META_MOTION_DOWN);
 
   add_builtin_keybinding (display,
                           "switch-to-workspace-last",


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