diff options
author | Cole Robinson <crobinso@redhat.com> | 2014-10-30 15:34:33 -0400 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2014-11-04 08:15:21 +0100 |
commit | 954149146193a8acd592b3055a14aad122490127 (patch) | |
tree | 212240a1042f3fb2a5b90de0a9ddb6acd8c9f362 /ui/gtk.c | |
parent | 400519d24a56636ef45d4137d0cc84aafe6f0ed8 (diff) | |
download | hqemu-954149146193a8acd592b3055a14aad122490127.zip hqemu-954149146193a8acd592b3055a14aad122490127.tar.gz |
gtk: Install fullscreen accelerator on toplevel window
Instead of installing it on the menu. This will be needed to keep the
fullscreen keyboard shortcut working when we hide the menu (in future
patches).
On gtk < 3.8, this has the unfortunate side effect of no longer listing
the key combo in the UI. We could manually change the label in that case,
but it will look visually out of place, and I'm not sure if anyone really
cares.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/gtk.c')
-rw-r--r-- | ui/gtk.c | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -1123,6 +1123,12 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque) gd_update_cursor(vc); } +static void gd_accel_full_screen(void *opaque) +{ + GtkDisplayState *s = opaque; + gtk_menu_item_activate(GTK_MENU_ITEM(s->full_screen_item)); +} + static void gd_menu_zoom_in(GtkMenuItem *item, void *opaque) { GtkDisplayState *s = opaque; @@ -1704,10 +1710,14 @@ static GtkWidget *gd_create_menu_view(GtkDisplayState *s) gtk_menu_set_accel_group(GTK_MENU(view_menu), s->accel_group); s->full_screen_item = gtk_menu_item_new_with_mnemonic(_("_Fullscreen")); - gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->full_screen_item), - "<QEMU>/View/Full Screen"); - gtk_accel_map_add_entry("<QEMU>/View/Full Screen", GDK_KEY_f, - HOTKEY_MODIFIERS); + + gtk_accel_group_connect(s->accel_group, GDK_KEY_f, HOTKEY_MODIFIERS, 0, + g_cclosure_new_swap(G_CALLBACK(gd_accel_full_screen), s, NULL)); +#if GTK_CHECK_VERSION(3, 8, 0) + gtk_accel_label_set_accel( + GTK_ACCEL_LABEL(gtk_bin_get_child(GTK_BIN(s->full_screen_item))), + GDK_KEY_f, HOTKEY_MODIFIERS); +#endif gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), s->full_screen_item); separator = gtk_separator_menu_item_new(); |