From patchwork Thu Oct 30 19:34:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 39933 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E33502405B for ; Fri, 31 Oct 2014 16:10:10 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id ex7sf797759wid.8 for ; Fri, 31 Oct 2014 09:10:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:in-reply-to:references:cc:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=BmShVvPyGIqkd13OaHMWh9neqTf1+eezEDggPdZXBQU=; b=JXHC8OeCJWslg3aX93POE39ObZL0gtUTQQ6Y02KdbMQQnhF/vSIM6MBLfN70OeuLOe kAmpA5hgo2Oy0UPi2YRyoApTUjX0Adqm8m7iAJ9uUkELnFih3PJ/3ZXqk9n6R691Yk6r Pmu0tRW3L6b8CRvqvaTBkTrvTOIVX6BuGhp74xWUn9yIf0llwocIt+rf4GgC5Zeidsfq LzSAGIvqub87tf7/ZmNNZqRtC1kheY7algxgMoi4xsnz6CJf7XzS0hWOYRCY3QzzIWLh Ux7xHxJBf3Zi9zIu0/FeqGezbp3YxbsxMh5MgZozn4mossrbeaDFLBujQ/hR4Kb755h6 DtDw== X-Gm-Message-State: ALoCoQmxRkKGwK7Pu/gwHURCK2j4bcAopCLs4xZKfoeFJ7ft5dcGNK9yijLeCMIdKnR7mjKwaBDL X-Received: by 10.112.32.163 with SMTP id k3mr23891lbi.17.1414771810088; Fri, 31 Oct 2014 09:10:10 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.52 with SMTP id o20ls523202laa.3.gmail; Fri, 31 Oct 2014 09:10:09 -0700 (PDT) X-Received: by 10.112.148.161 with SMTP id tt1mr27816092lbb.67.1414771809896; Fri, 31 Oct 2014 09:10:09 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id sf5si17450373lbb.46.2014.10.31.09.10.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Oct 2014 09:10:09 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id gf13so6522575lab.17 for ; Fri, 31 Oct 2014 09:10:09 -0700 (PDT) X-Received: by 10.112.189.10 with SMTP id ge10mr27131066lbc.23.1414771809612; Fri, 31 Oct 2014 09:10:09 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp225828lbz; Fri, 31 Oct 2014 09:10:08 -0700 (PDT) X-Received: by 10.224.97.10 with SMTP id j10mr37873792qan.103.1414771808243; Fri, 31 Oct 2014 09:10:08 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id i16si17677110qaj.112.2014.10.31.09.10.07 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 31 Oct 2014 09:10:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:38696 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkEm6-0000Xz-Qw for patch@linaro.org; Fri, 31 Oct 2014 12:10:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50882) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkE8t-0005pk-A8 for qemu-devel@nongnu.org; Fri, 31 Oct 2014 11:30:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XjvUn-0005f2-1Y for qemu-devel@nongnu.org; Thu, 30 Oct 2014 15:35:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58810) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjvUm-0005el-PM for qemu-devel@nongnu.org; Thu, 30 Oct 2014 15:34:56 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s9UJYnOO015983 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 30 Oct 2014 15:34:50 -0400 Received: from colepc.home.com ([10.3.113.2]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s9UJYkFP015792; Thu, 30 Oct 2014 15:34:48 -0400 From: Cole Robinson To: qemu-devel@nongnu.org Date: Thu, 30 Oct 2014 15:34:34 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: manday@gmx.net, Gerd Hoffmann , Cole Robinson Subject: [Qemu-devel] [PATCH 3/4] gtk: Install vc accelerators on parent window 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: crobinso@redhat.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 So they are usable when we hide the menubar in upcoming patches. This has the accelerator text caveat as the fullscreen bit in the previous patch. Signed-off-by: Cole Robinson --- ui/gtk.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index af8b2d0..552a73b 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1020,6 +1020,12 @@ static void gd_menu_switch_vc(GtkMenuItem *item, void *opaque) } } +static void gd_accel_switch_vc(void *opaque) +{ + VirtualConsole *vc = opaque; + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(vc->menu_item), TRUE); +} + static void gd_menu_show_tabs(GtkMenuItem *item, void *opaque) { GtkDisplayState *s = opaque; @@ -1407,19 +1413,21 @@ static gboolean gd_focus_out_event(GtkWidget *widget, static GSList *gd_vc_menu_init(GtkDisplayState *s, VirtualConsole *vc, int idx, GSList *group, GtkWidget *view_menu) { - char path[32]; - - snprintf(path, sizeof(path), "/View/VC%d", idx); - vc->menu_item = gtk_radio_menu_item_new_with_mnemonic(group, vc->label); - group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(vc->menu_item)); - gtk_menu_item_set_accel_path(GTK_MENU_ITEM(vc->menu_item), path); - gtk_accel_map_add_entry(path, GDK_KEY_1 + idx, HOTKEY_MODIFIERS); + gtk_accel_group_connect(s->accel_group, GDK_KEY_1 + idx, + HOTKEY_MODIFIERS, 0, + g_cclosure_new_swap(G_CALLBACK(gd_accel_switch_vc), vc, NULL)); +#if GTK_CHECK_VERSION(3, 8, 0) + gtk_accel_label_set_accel( + GTK_ACCEL_LABEL(gtk_bin_get_child(GTK_BIN(vc->menu_item))), + GDK_KEY_1 + idx, HOTKEY_MODIFIERS); +#endif g_signal_connect(vc->menu_item, "activate", G_CALLBACK(gd_menu_switch_vc), s); gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), vc->menu_item); + group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(vc->menu_item)); return group; }