From patchwork Tue Nov 4 13:45:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 40157 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8AE8421894 for ; Tue, 4 Nov 2014 13:49:08 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id r20sf4032967wiv.2 for ; Tue, 04 Nov 2014 05:49:07 -0800 (PST) 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: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=Sr6abvbAUdx0jZKd9Bpaw5kyDhoVtBSDuYl60btXI90=; b=iZztGVx6IL6mDhSTiPo4Sw3Md1D7QZMiN412UBvPHWnO7iy7/8irEz91j9DT9YktB3 hhsCIRLZMTpjGfhV4UlFz40TqMnuPc53MPlOGaORyaeXzY87QTiwN4Uyky1UN0nxGTSd emB/3cb9w3QtC3jnxYZ3BTn7P83oH/+dFhPoNoLZtad96YhVe49RfbiRLVIsU9AHoWes 97B9kmTitDx6AUyK2ItXsoEJuvvOB5qsNhvTBmPABxY+aX5eBuhCxSZoTQaVYxlSuY0Y Egwihalg/qIsypx6g6bMJPaiS2HBeTUFdVVtnA2Zjk4nJTGY5wf1y/6orpQYT/WLYni6 xnDA== X-Gm-Message-State: ALoCoQkmkRY4YCNnW/P4It5ZVepNhTOqvlaqqmYTfWP55hf50/MMJ8ftbYRF4VuYUrUT/tF6joIB X-Received: by 10.112.247.74 with SMTP id yc10mr3025865lbc.8.1415108947739; Tue, 04 Nov 2014 05:49:07 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.9.168 with SMTP id a8ls822032lab.55.gmail; Tue, 04 Nov 2014 05:49:07 -0800 (PST) X-Received: by 10.152.28.134 with SMTP id b6mr2817877lah.12.1415108947182; Tue, 04 Nov 2014 05:49:07 -0800 (PST) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id b2si968559lah.6.2014.11.04.05.49.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Nov 2014 05:49:07 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by mail-lb0-f171.google.com with SMTP id b6so3127185lbj.2 for ; Tue, 04 Nov 2014 05:49:07 -0800 (PST) X-Received: by 10.152.6.228 with SMTP id e4mr59565570laa.71.1415108947076; Tue, 04 Nov 2014 05:49:07 -0800 (PST) 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.184.201 with SMTP id ew9csp117012lbc; Tue, 4 Nov 2014 05:49:06 -0800 (PST) X-Received: by 10.224.2.135 with SMTP id 7mr78128471qaj.64.1415108945785; Tue, 04 Nov 2014 05:49:05 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id v110si720546qge.87.2014.11.04.05.49.05 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 04 Nov 2014 05:49:05 -0800 (PST) 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]:40669 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XleTp-0003uw-1o for patch@linaro.org; Tue, 04 Nov 2014 08:49:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XleQv-0007rm-Rv for qemu-devel@nongnu.org; Tue, 04 Nov 2014 08:46:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XleQl-0003Zp-3c for qemu-devel@nongnu.org; Tue, 04 Nov 2014 08:46:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56339) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XleQk-0003ZP-QK for qemu-devel@nongnu.org; Tue, 04 Nov 2014 08:45:55 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sA4Djr05019427 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 4 Nov 2014 08:45:53 -0500 Received: from nilsson.home.kraxel.org (ovpn-116-42.ams2.redhat.com [10.36.116.42]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sA4Djqab008478; Tue, 4 Nov 2014 08:45:52 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 7E5EC81BB9; Tue, 4 Nov 2014 14:45:51 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 4 Nov 2014 14:45:44 +0100 Message-Id: <1415108746-21448-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1415108746-21448-1-git-send-email-kraxel@redhat.com> References: <1415108746-21448-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann , Anthony Liguori , Cole Robinson Subject: [Qemu-devel] [PULL v2 3/5] 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: kraxel@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.217.171 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 From: Cole Robinson 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 Signed-off-by: Gerd Hoffmann --- 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; }