From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51672) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Whe8Y-000618-Ik for qemu-devel@nongnu.org; Tue, 06 May 2014 08:06:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Whe8O-0001Xx-4q for qemu-devel@nongnu.org; Tue, 06 May 2014 08:06:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42695) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Whe8N-0001XV-SB for qemu-devel@nongnu.org; Tue, 06 May 2014 08:06:08 -0400 From: Gerd Hoffmann Date: Tue, 6 May 2014 14:05:46 +0200 Message-Id: <1399377958-20076-11-git-send-email-kraxel@redhat.com> In-Reply-To: <1399377958-20076-1-git-send-email-kraxel@redhat.com> References: <1399377958-20076-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 10/22] gtk: simplify resize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Anthony Liguori Simply ask for a small window size. When the widgets don't fit in gtk will automatically make the window large enougth to make things fit, no need to try (and fail) duplicate that logic in qemu. Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 40 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index a8393dd..6790cf8 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -296,35 +296,23 @@ static void gd_update_caption(GtkDisplayState *s) static void gd_update_windowsize(VirtualConsole *vc) { GtkDisplayState *s = vc->s; + double sx, sy; - if (!s->full_screen) { - GtkRequisition req; - double sx, sy; - - if (s->free_scale) { - sx = vc->gfx.scale_x; - sy = vc->gfx.scale_y; - - vc->gfx.scale_y = 1.0; - vc->gfx.scale_x = 1.0; - } else { - sx = 1.0; - sy = 1.0; - } - - gtk_widget_set_size_request - (vc->gfx.drawing_area, - surface_width(vc->gfx.ds) * vc->gfx.scale_x, - surface_height(vc->gfx.ds) * vc->gfx.scale_y); -#if GTK_CHECK_VERSION(3, 0, 0) - gtk_widget_get_preferred_size(s->vbox, NULL, &req); -#else - gtk_widget_size_request(s->vbox, &req); -#endif + if (vc->type != GD_VC_GFX || s->full_screen) { + return; + } - gtk_window_resize(GTK_WINDOW(s->window), - req.width * sx, req.height * sy); + if (s->free_scale) { + sx = 1.0; + sy = 1.0; + } else { + sx = vc->gfx.scale_x; + sy = vc->gfx.scale_y; } + gtk_widget_set_size_request(vc->gfx.drawing_area, + surface_width(vc->gfx.ds) * sx, + surface_height(vc->gfx.ds) * sy); + gtk_window_resize(GTK_WINDOW(s->window), 320, 240); } static void gd_update_full_redraw(VirtualConsole *vc) -- 1.8.3.1