From: Cole Robinson <crobinso@redhat.com>
To: qemu-devel@nongnu.org
Cc: manday@gmx.net, Gerd Hoffmann <kraxel@redhat.com>,
Cole Robinson <crobinso@redhat.com>
Subject: [Qemu-devel] [PATCH 3/4] gtk: Install vc accelerators on parent window
Date: Thu, 30 Oct 2014 15:34:34 -0400 [thread overview]
Message-ID: <e3e19515da6b0b69363cefdf7c1f4059d30e142b.1414697380.git.crobinso@redhat.com> (raw)
In-Reply-To: <cover.1414697380.git.crobinso@redhat.com>
In-Reply-To: <cover.1414697380.git.crobinso@redhat.com>
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 <crobinso@redhat.com>
---
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), "<QEMU>/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;
}
--
2.1.0
next prev parent reply other threads:[~2014-10-31 15:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-30 19:34 [Qemu-devel] [PATCH 0/4] gtk: Hide menubar in fullscreen mode (lp 1294898) Cole Robinson
2014-10-30 19:34 ` [Qemu-devel] [PATCH 1/4] gtk: Grab accel_group from GtkDisplayState Cole Robinson
2014-10-30 19:34 ` [Qemu-devel] [PATCH 2/4] gtk: Install fullscreen accelerator on toplevel window Cole Robinson
2014-10-30 19:34 ` Cole Robinson [this message]
2014-10-30 19:34 ` [Qemu-devel] [PATCH 4/4] gtk: Hide the menubar when in fullscreen mode (lp 1294898) Cole Robinson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e3e19515da6b0b69363cefdf7c1f4059d30e142b.1414697380.git.crobinso@redhat.com \
--to=crobinso@redhat.com \
--cc=kraxel@redhat.com \
--cc=manday@gmx.net \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).