From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Woq3M-0006jx-E1 for qemu-devel@nongnu.org; Mon, 26 May 2014 04:14:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Woq3E-0006n9-FM for qemu-devel@nongnu.org; Mon, 26 May 2014 04:14:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25443) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Woq3E-0006ml-61 for qemu-devel@nongnu.org; Mon, 26 May 2014 04:14:32 -0400 From: Gerd Hoffmann Date: Mon, 26 May 2014 10:14:19 +0200 Message-Id: <1401092059-18503-25-git-send-email-kraxel@redhat.com> In-Reply-To: <1401092059-18503-1-git-send-email-kraxel@redhat.com> References: <1401092059-18503-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PULL 24/24] gtk: workaround gtk2 vte resize issue List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Anthony Liguori Hack isn't pretty, but gets the job done. See source code comment for details. Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/ui/gtk.c b/ui/gtk.c index ac5dbe0..b908936 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -85,6 +85,20 @@ # define VTE_CHECK_VERSION(a, b, c) 0 #endif +#if defined(CONFIG_VTE) && !GTK_CHECK_VERSION(3, 0, 0) +/* + * The gtk2 vte terminal widget seriously messes up the window resize + * for some reason. You basically can't make the qemu window smaller + * any more because the toplevel window geoemtry hints are overridden. + * + * Workaround that by hiding all vte widgets, except the one in the + * current tab. + * + * Luckily everything works smooth in gtk3. + */ +# define VTE_RESIZE_HACK 1 +#endif + /* Compatibility define to let us build on both Gtk2 and Gtk3 */ #if GTK_CHECK_VERSION(3, 0, 0) static inline void gdk_drawable_get_size(GdkWindow *w, gint *ww, gint *wh) @@ -1301,10 +1315,21 @@ static void gd_change_page(GtkNotebook *nb, gpointer arg1, guint arg2, return; } +#ifdef VTE_RESIZE_HACK + vc = gd_vc_find_current(s); + if (vc && vc->type == GD_VC_VTE) { + gtk_widget_hide(vc->vte.terminal); + } +#endif vc = gd_vc_find_by_page(s, arg2); if (!vc) { return; } +#ifdef VTE_RESIZE_HACK + if (vc->type == GD_VC_VTE) { + gtk_widget_show(vc->vte.terminal); + } +#endif gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(vc->menu_item), TRUE); on_vga = (vc->type == GD_VC_GFX); @@ -1845,6 +1870,21 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover) gtk_widget_show_all(s->window); +#ifdef VTE_RESIZE_HACK + { + VirtualConsole *cur = gd_vc_find_current(s); + int i; + + for (i = 0; i < s->nb_vcs; i++) { + VirtualConsole *vc = &s->vc[i]; + if (vc && vc->type == GD_VC_VTE && vc != cur) { + gtk_widget_hide(vc->vte.terminal); + } + } + gd_update_windowsize(cur); + } +#endif + if (full_screen) { gtk_menu_item_activate(GTK_MENU_ITEM(s->full_screen_item)); } -- 1.8.3.1