[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 10/25] gtk: simplify resize
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 10/25] gtk: simplify resize |
Date: |
Wed, 21 May 2014 10:43:46 +0200 |
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 <address@hidden>
---
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
- [Qemu-devel] [PATCH 00/25] qemu gtk ui overhaul, Gerd Hoffmann, 2014/05/21
- [Qemu-devel] [PATCH 03/25] gtk: cleanup CONFIG_VTE ifdef a bit., Gerd Hoffmann, 2014/05/21
- [Qemu-devel] [PATCH 02/25] gtk: zap vte size requests, Gerd Hoffmann, 2014/05/21
- [Qemu-devel] [PATCH 04/25] gtk: Add a scrollbar for text consoles, Gerd Hoffmann, 2014/05/21
- [Qemu-devel] [PATCH 10/25] gtk: simplify resize,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 05/25] gtk: remove page numbering assumtions from the code, Gerd Hoffmann, 2014/05/21
- [Qemu-devel] [PATCH 06/25] gtk: VirtualConsole restruction, Gerd Hoffmann, 2014/05/21
- [Qemu-devel] [PATCH 09/25] gtk: use device type as label, Gerd Hoffmann, 2014/05/21
- [Qemu-devel] [PATCH 21/25] gtk: Add handling for the xfree86 keycodes, Gerd Hoffmann, 2014/05/21
- [Qemu-devel] [PATCH 08/25] gtk: support multiple gfx displays, Gerd Hoffmann, 2014/05/21
- [Qemu-devel] [PATCH 12/25] gtk: add tab to trace events, Gerd Hoffmann, 2014/05/21
- [Qemu-devel] [PATCH 11/25] gtk: allow moving tabs to windows and back., Gerd Hoffmann, 2014/05/21
- [Qemu-devel] [PATCH 14/25] gtk: keep track of grab owner, Gerd Hoffmann, 2014/05/21
- [Qemu-devel] [PATCH 13/25] gtk: add gd_grab trace event, Gerd Hoffmann, 2014/05/21
- [Qemu-devel] [PATCH 15/25] gtk: skip keyboard grab when hover autograb is active, Gerd Hoffmann, 2014/05/21