From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ypb15-0004dv-Pl for qemu-devel@nongnu.org; Tue, 05 May 2015 07:28:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ypb12-00051Q-Jj for qemu-devel@nongnu.org; Tue, 05 May 2015 07:27:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59427) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ypb12-0004zN-3S for qemu-devel@nongnu.org; Tue, 05 May 2015 07:27:56 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 9E71E8E91E for ; Tue, 5 May 2015 11:27:55 +0000 (UTC) From: Gerd Hoffmann Date: Tue, 5 May 2015 13:27:44 +0200 Message-Id: <1430825266-30300-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1430825266-30300-1-git-send-email-kraxel@redhat.com> References: <1430825266-30300-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 3/5] gtk: add ui_info support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Pass new display size to the guest after window resizes. Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ui/gtk.c b/ui/gtk.c index 51ea1b9..9163b43 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1478,6 +1478,19 @@ static gboolean gd_focus_out_event(GtkWidget *widget, return TRUE; } +static gboolean gd_configure(GtkWidget *widget, + GdkEventConfigure *cfg, gpointer opaque) +{ + VirtualConsole *vc = opaque; + QemuUIInfo info; + + memset(&info, 0, sizeof(info)); + info.width = cfg->width; + info.height = cfg->height; + dpy_set_ui_info(vc->gfx.dcl.con, &info); + return FALSE; +} + /** Virtual Console Callbacks **/ static GSList *gd_vc_menu_init(GtkDisplayState *s, VirtualConsole *vc, @@ -1655,6 +1668,8 @@ static void gd_connect_vc_gfx_signals(VirtualConsole *vc) G_CALLBACK(gd_leave_event), vc); g_signal_connect(vc->gfx.drawing_area, "focus-out-event", G_CALLBACK(gd_focus_out_event), vc); + g_signal_connect(vc->gfx.drawing_area, "configure-event", + G_CALLBACK(gd_configure), vc); } else { g_signal_connect(vc->gfx.drawing_area, "key-press-event", G_CALLBACK(gd_text_key_down), vc); @@ -1772,6 +1787,10 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc, gd_connect_vc_gfx_signals(vc); group = gd_vc_menu_init(s, vc, idx, group, view_menu); + if (dpy_ui_info_supported(vc->gfx.dcl.con)) { + gtk_menu_item_activate(GTK_MENU_ITEM(s->zoom_fit_item)); + } + return group; } -- 1.8.3.1