gtk: simplify resize
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 <kraxel@redhat.com>
This commit is contained in:
parent
6a24ced5ca
commit
d3ef575080
34
ui/gtk.c
34
ui/gtk.c
@ -296,35 +296,23 @@ static void gd_update_caption(GtkDisplayState *s)
|
|||||||
static void gd_update_windowsize(VirtualConsole *vc)
|
static void gd_update_windowsize(VirtualConsole *vc)
|
||||||
{
|
{
|
||||||
GtkDisplayState *s = vc->s;
|
GtkDisplayState *s = vc->s;
|
||||||
|
|
||||||
if (!s->full_screen) {
|
|
||||||
GtkRequisition req;
|
|
||||||
double sx, sy;
|
double sx, sy;
|
||||||
|
|
||||||
if (s->free_scale) {
|
if (vc->type != GD_VC_GFX || s->full_screen) {
|
||||||
sx = vc->gfx.scale_x;
|
return;
|
||||||
sy = vc->gfx.scale_y;
|
}
|
||||||
|
|
||||||
vc->gfx.scale_y = 1.0;
|
if (s->free_scale) {
|
||||||
vc->gfx.scale_x = 1.0;
|
|
||||||
} else {
|
|
||||||
sx = 1.0;
|
sx = 1.0;
|
||||||
sy = 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,
|
||||||
gtk_widget_set_size_request
|
surface_width(vc->gfx.ds) * sx,
|
||||||
(vc->gfx.drawing_area,
|
surface_height(vc->gfx.ds) * sy);
|
||||||
surface_width(vc->gfx.ds) * vc->gfx.scale_x,
|
gtk_window_resize(GTK_WINDOW(s->window), 320, 240);
|
||||||
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
|
|
||||||
|
|
||||||
gtk_window_resize(GTK_WINDOW(s->window),
|
|
||||||
req.width * sx, req.height * sy);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gd_update_full_redraw(VirtualConsole *vc)
|
static void gd_update_full_redraw(VirtualConsole *vc)
|
||||||
|
Loading…
Reference in New Issue
Block a user