diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2015-03-13 12:47:00 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2015-05-06 08:38:05 +0200 |
commit | 1301e515eff267d4b8684e74a5b2c1b5cf03f103 (patch) | |
tree | 74c75c9ed9714ca1a8069d8c1de19bf7c324ef44 | |
parent | b7fb49f0c709a406f79372be397367ff2550373b (diff) |
gtk: add ui_info support
Pass new display size to the guest after window resizes.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r-- | ui/gtk.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -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; } |