From patchwork Tue Nov 4 10:41:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 40111 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7AEBE240A6 for ; Tue, 4 Nov 2014 10:44:17 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id c41sf3911370eek.8 for ; Tue, 04 Nov 2014 02:44:16 -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=SkIypYVcQkwAHO0Ksdi876aF+naUffrYZM1+KyTEiEfc0lZgwy4KDdpRBU0YhwCkkd j2IVUeMTqX1MNJAXAOln+qWBLExNFax+4xbJpYNsviAi55kd4qRWCWK2SlziJWWVaicB 5UV382nyz0Vn7Du39xY8lGhFwvoaQ6KGqzKeivpo1XvjM2FOQZrweIZyPQainY0qJHT5 VzlU9h+3SM0lSYqrFNsvWq3p5mCfC8Lk4TD5/etGtCVs1PTSrkjrcwCu9YMmuqVA2uBg 0RDBAjPFnRvoEFzaR9jl7bd7DOs9o0Oo/vz/DihfA69t9SZBen1uRTmegsf2ZUOAWWpv ckcg== X-Gm-Message-State: ALoCoQkZ6+Ep4rz3a/8G9d5HyhrlFiE8h/PgWTHipaAXKcUafQMR7hPlg8jvTF9ejoSKmpVkfVRI X-Received: by 10.112.254.226 with SMTP id al2mr8451104lbd.1.1415097856627; Tue, 04 Nov 2014 02:44:16 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.138 with SMTP id q10ls871597laj.83.gmail; Tue, 04 Nov 2014 02:44:16 -0800 (PST) X-Received: by 10.152.37.231 with SMTP id b7mr42103843lak.72.1415097856320; Tue, 04 Nov 2014 02:44:16 -0800 (PST) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id vr4si36895986lbb.110.2014.11.04.02.44.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Nov 2014 02:44:15 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by mail-la0-f52.google.com with SMTP id pv20so634476lab.11 for ; Tue, 04 Nov 2014 02:44:15 -0800 (PST) X-Received: by 10.152.116.102 with SMTP id jv6mr58423457lab.40.1415097855910; Tue, 04 Nov 2014 02:44:15 -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 ew9csp95155lbc; Tue, 4 Nov 2014 02:44:11 -0800 (PST) X-Received: by 10.224.112.66 with SMTP id v2mr1400506qap.22.1415097850820; Tue, 04 Nov 2014 02:44:10 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id k45si11902700qgd.92.2014.11.04.02.44.10 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 04 Nov 2014 02:44:10 -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]:39668 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xlbas-0001Nn-1A for patch@linaro.org; Tue, 04 Nov 2014 05:44:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlbYJ-00065Z-I2 for qemu-devel@nongnu.org; Tue, 04 Nov 2014 05:41:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XlbY8-00021l-S8 for qemu-devel@nongnu.org; Tue, 04 Nov 2014 05:41:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58414) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlbY8-00021c-Iu for qemu-devel@nongnu.org; Tue, 04 Nov 2014 05:41:20 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sA4AfHxH011583 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 4 Nov 2014 05:41:17 -0500 Received: from nilsson.home.kraxel.org (ovpn-116-42.ams2.redhat.com [10.36.116.42]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sA4AfGsO025867; Tue, 4 Nov 2014 05:41:17 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 111D581BB9; Tue, 4 Nov 2014 11:41:16 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 4 Nov 2014 11:41:09 +0100 Message-Id: <1415097671-15343-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1415097671-15343-1-git-send-email-kraxel@redhat.com> References: <1415097671-15343-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 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 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.215.52 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; }