[mutter] keybindings: Add MetaKeyBinding for overlay-key



commit aa43e715c08584e0bce645d88330a914863b5c1f
Author: Florian MÃllner <fmuellner gnome org>
Date:   Wed Aug 29 23:07:34 2012 +0200

    keybindings: Add MetaKeyBinding for overlay-key
    
    As the overlay key works differently from normal keybindings, it
    requires special treatment. However, by adding a rudimentary
    MetaKeyBinding for it, we will be able to confine the special
    handling to mutter and treat it like any other keybinding in
    the shell.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=688202

 src/core/keybindings.c |   21 +++++++++++++++++++++
 src/core/prefs.c       |   10 ++++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 97a04af..f750b2f 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -1499,6 +1499,18 @@ process_overlay_key (MetaDisplay *display,
           /* We want to unfreeze events, but keep the grab so that if the user
            * starts typing into the overlay we get all the keys */
           XAllowEvents (display->xdisplay, AsyncKeyboard, event->xkey.time);
+
+          if (display->grab_op == META_GRAB_OP_COMPOSITOR)
+            {
+              MetaKeyBinding *binding =
+                  display_get_keybinding (display,
+                                          display->overlay_key_combo.keysym,
+                                          display->overlay_key_combo.keycode,
+                                          display->grab_mask);
+              if (binding &&
+                  meta_compositor_filter_keybinding (display->compositor, screen, binding))
+                return TRUE;
+            }
           meta_display_overlay_key_activate (display);
         }
 
@@ -4221,6 +4233,8 @@ init_builtin_key_bindings (MetaDisplay *display)
 void
 meta_display_init_keys (MetaDisplay *display)
 {
+  MetaKeyHandler *handler;
+
   /* Keybindings */
   display->keymap = NULL;
   display->keysyms_per_keycode = 0;
@@ -4250,6 +4264,13 @@ meta_display_init_keys (MetaDisplay *display)
 
   key_handlers = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
                                         (GDestroyNotify) key_handler_free);
+
+  handler = g_new0 (MetaKeyHandler, 1);
+  handler->name = g_strdup ("overlay-key");
+  handler->flags = META_KEY_BINDING_BUILTIN;
+
+  g_hash_table_insert (key_handlers, g_strdup ("overlay-key"), handler);
+
   init_builtin_key_bindings (display);
 
   rebuild_key_binding_table (display);
diff --git a/src/core/prefs.c b/src/core/prefs.c
index f21bd43..fadf01f 100644
--- a/src/core/prefs.c
+++ b/src/core/prefs.c
@@ -1702,8 +1702,18 @@ meta_key_pref_free (MetaKeyPref *pref)
 static void
 init_bindings (void)
 {
+  MetaKeyPref *pref;
+
   key_bindings = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
                                         (GDestroyNotify)meta_key_pref_free);
+
+  pref = g_new0 (MetaKeyPref, 1);
+  pref->name = g_strdup ("overlay-key");
+  pref->action = META_KEYBINDING_ACTION_OVERLAY_KEY;
+  pref->bindings = g_slist_prepend (pref->bindings, &overlay_key_combo);
+  pref->builtin = 1;
+
+  g_hash_table_insert (key_bindings, g_strdup ("overlay-key"), pref);
 }
 
 static void



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