From 377e2ed8a5f694ee937f39e12e7239645b2bf209 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 4 Mar 2013 11:23:46 -0500
Subject: [PATCH] keybindings: filter overlay key even when not-modal

mutter currently only filters the overlay key through the shell
when there is a grab operation and that grab operation belongs to the
shell (because the shell is pushModal'd). This means the shell can't
filter out overlay key press events events at startup (since the shell
isn't normally modal).

This commit changes the code to always run the shell filtering code,
even when the shell is not modal.

https://bugzilla.gnome.org/show_bug.cgi?id=694837
---
 src/core/keybindings.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index b3bb1cecc..bfc16a73d 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -1707,23 +1707,21 @@ process_overlay_key (MetaDisplay *display,
         }
       else if (event->evtype == XI_KeyRelease)
         {
+          MetaKeyBinding *binding;
+
           display->overlay_key_only_pressed = FALSE;
           /* We want to unfreeze events, but keep the grab so that if the user
            * starts typing into the overlay we get all the keys */
           XIAllowEvents (display->xdisplay, event->deviceid,
                          XIAsyncDevice, event->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;
-            }
+          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);
         }