From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36654) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XleQv-0007rf-OX 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-0003Zw-HC for qemu-devel@nongnu.org; Tue, 04 Nov 2014 08:46:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56344) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XleQl-0003Zl-8t for qemu-devel@nongnu.org; Tue, 04 Nov 2014 08:45:55 -0500 From: Gerd Hoffmann Date: Tue, 4 Nov 2014 14:45:43 +0100 Message-Id: <1415108746-21448-3-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> Subject: [Qemu-devel] [PULL v2 2/5] gtk: Install fullscreen accelerator on toplevel window List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Anthony Liguori , Cole Robinson From: Cole Robinson 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 Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index 97ac4c9..af8b2d0 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -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), - "/View/Full Screen"); - gtk_accel_map_add_entry("/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(); -- 1.8.3.1