From patchwork Fri Feb 22 18:41:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 222602 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 520AE2C0040 for ; Sat, 23 Feb 2013 05:41:25 +1100 (EST) Received: from localhost ([::1]:38413 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8xYg-0003Jy-S0 for incoming@patchwork.ozlabs.org; Fri, 22 Feb 2013 13:41:22 -0500 Received: from eggs.gnu.org ([208.118.235.92]:42238) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8xYU-0003J4-Cm for qemu-devel@nongnu.org; Fri, 22 Feb 2013 13:41:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U8xYS-0004jK-Um for qemu-devel@nongnu.org; Fri, 22 Feb 2013 13:41:10 -0500 Received: from thoth.sbs.de ([192.35.17.2]:18005) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8xYS-0004iX-Ju for qemu-devel@nongnu.org; Fri, 22 Feb 2013 13:41:08 -0500 Received: from mail1.siemens.de (localhost [127.0.0.1]) by thoth.sbs.de (8.13.6/8.13.6) with ESMTP id r1MIf5rd013964; Fri, 22 Feb 2013 19:41:06 +0100 Received: from mchn199C.mchp.siemens.de ([139.25.109.49]) by mail1.siemens.de (8.13.6/8.13.6) with ESMTP id r1MIf5TX006808; Fri, 22 Feb 2013 19:41:05 +0100 Message-ID: <5127BBC1.5070607@siemens.com> Date: Fri, 22 Feb 2013 19:41:05 +0100 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Anthony Liguori References: <1361367806-4599-1-git-send-email-aliguori@us.ibm.com> <1361367806-4599-10-git-send-email-aliguori@us.ibm.com> <5127B788.40701@siemens.com> In-Reply-To: <5127B788.40701@siemens.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 192.35.17.2 Cc: Kevin Wolf , "qemu-devel@nongnu.org" Subject: [Qemu-devel] [PATCH] gtk: Fix accelerator filtering X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- ui/gtk.c | 16 ++-------------- 1 files changed, 2 insertions(+), 14 deletions(-) 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, "/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); }