diff mbox

gtk: Fix accelerator filtering

Message ID 5127BBC1.5070607@siemens.com
State New
Headers show

Commit Message

Jan Kiszka Feb. 22, 2013, 6:41 p.m. UTC
This is in fact very simply: When the input in grabbed, everything
should be exclusively passed to the guest - except it has our magic
CTRL-ALT modifier set. Then let GTK filter out those accels that are in
use.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 ui/gtk.c |   16 ++--------------
 1 files changed, 2 insertions(+), 14 deletions(-)
diff mbox

Patch

diff --git a/ui/gtk.c b/ui/gtk.c
index 8eedd0d..f693478 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -311,22 +311,10 @@  static void gd_mouse_mode_change(Notifier *notify, void *data)
 static gboolean gd_window_key_event(GtkWidget *widget, GdkEventKey *key, void *opaque)
 {
     GtkDisplayState *s = opaque;
-    GtkAccelGroupEntry *entries;
-    guint n_entries = 0;
-    gboolean propagate_accel = TRUE;
     gboolean handled = FALSE;
 
-    entries = gtk_accel_group_query(s->accel_group, key->keyval,
-                                    key->state, &n_entries);
-    if (n_entries) {
-        const char *quark = g_quark_to_string(entries[0].accel_path_quark);
-
-        if (gd_is_grab_active(s) && strstart(quark, "<QEMU>/File/", NULL)) {
-            propagate_accel = FALSE;
-        }
-    }
-
-    if (!handled && propagate_accel) {
+    if (!gd_is_grab_active(s) ||
+        key->state == (GDK_CONTROL_MASK | GDK_MOD1_MASK)) {
         handled = gtk_window_activate_key(GTK_WINDOW(widget), key);
     }