From owner-freebsd-ports-bugs@FreeBSD.ORG Sat Oct 21 22:30:23 2006 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8726016A403 for ; Sat, 21 Oct 2006 22:30:23 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id CF7B443D46 for ; Sat, 21 Oct 2006 22:30:22 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k9LMUMQF021652 for ; Sat, 21 Oct 2006 22:30:22 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k9LMUMlD021651; Sat, 21 Oct 2006 22:30:22 GMT (envelope-from gnats) Resent-Date: Sat, 21 Oct 2006 22:30:22 GMT Resent-Message-Id: <200610212230.k9LMUMlD021651@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Thomas Vogt Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9A16116A40F for ; Sat, 21 Oct 2006 22:21:45 +0000 (UTC) (envelope-from thomas@bert.mlan.solnet.ch) Received: from bert.mlan.solnet.ch (bert.mlan.solnet.ch [212.101.1.83]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9C23343D62 for ; Sat, 21 Oct 2006 22:21:44 +0000 (GMT) (envelope-from thomas@bert.mlan.solnet.ch) Received: from bert.mlan.solnet.ch (localhost.mlan.solnet.ch [127.0.0.1]) by bert.mlan.solnet.ch (8.13.8/8.13.8) with ESMTP id k9LMLgEb062117 for ; Sun, 22 Oct 2006 00:21:42 +0200 (CEST) (envelope-from thomas@bert.mlan.solnet.ch) Received: (from thomas@localhost) by bert.mlan.solnet.ch (8.13.8/8.13.8/Submit) id k9LMLgnt062116; Sun, 22 Oct 2006 00:21:42 +0200 (CEST) (envelope-from thomas) Message-Id: <200610212221.k9LMLgnt062116@bert.mlan.solnet.ch> Date: Sun, 22 Oct 2006 00:21:42 +0200 (CEST) From: Thomas Vogt To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/104662: [patch] x11/gnome-terminal 2.16 window auto-resizing bug X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Thomas Vogt List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Oct 2006 22:30:23 -0000 >Number: 104662 >Category: ports >Synopsis: [patch] x11/gnome-terminal 2.16 window auto-resizing bug >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Oct 21 22:30:21 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Thomas Vogt >Release: FreeBSD 6.2-PRERELEASE i386 >Organization: >Environment: System: FreeBSD bert.mlan.solnet.ch 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #12: Sun Oct 8 02:52:38 CEST 2006 root@bert.mlan.solnet.ch:/usr/obj/usr/src/sys/BERT i386 >Description: When opening a new tab in gnome-terminal, it will auto-resize the terminal wind ow. This happens when clicking forward through tabbed windows. The problem was disscussed here: http://www.marcuscom.com/pipermail/marcuscom-devel/2006-September/006280.html http://bugzilla.gnome.org/show_bug.cgi?id=342968 >How-To-Repeat: Open a new tab in gnome-terminal, resize it, open an other tab. gnome-terminal will resize the terminal window each time. >Fix: The patches are from: http://bugzilla.gnome.org/attachment.cgi?id=73241 --- gnome-terminal.orig/Makefile Sat Oct 14 10:35:28 2006 +++ gnome-terminal/Makefile Sun Oct 22 00:04:49 2006 @@ -8,6 +8,7 @@ PORTNAME= gnome-terminal PORTVERSION= 2.16.1 +PORTREVISION= 1 CATEGORIES= x11 gnome MASTER_SITES= ${MASTER_SITE_GNOME} MASTER_SITE_SUBDIR= sources/${PORTNAME}/${PORTVERSION:C/^([0-9]+\.[0-9]+).*/\1/} --- src/terminal-screen.c.orig Wed Oct 18 15:50:28 2006 +++ src/terminal-screen.c Wed Oct 18 15:49:42 2006 @@ -244,6 +244,10 @@ GtkAllocation *allocation) { GtkWidget *child; + GtkAllocation old_allocation; + + old_allocation.width = widget->allocation.width; + old_allocation.height = widget->allocation.height; widget->allocation = *allocation; @@ -251,6 +255,13 @@ g_assert (child != NULL); gtk_widget_size_allocate (child, allocation); + + if (old_allocation.width != allocation->width || + old_allocation.height != allocation->height) + { + GtkWidget *term = TERMINAL_SCREEN (widget)->priv->term; + gtk_widget_queue_resize_no_redraw (term); + } } static void @@ -278,22 +289,22 @@ #define URLPATH "/[" PATHCHARS "]*[^]'.}>) \t\r\n,\\\"]" terminal_widget_match_add (screen->priv->term, - "\\<" SCHEME "//(" USER "@)?[" HOSTCHARS ".]+" - "(:[0-9]+)?(" URLPATH ")?\\>/?", FLAVOR_AS_IS); + "[[:<:]]" SCHEME "//(" USER "@)?[" HOSTCHARS ".]+" + "(:[0-9]+)?(" URLPATH ")?[[:>:]]/?", FLAVOR_AS_IS); terminal_widget_match_add (screen->priv->term, - "\\<(www|ftp)[" HOSTCHARS "]*\\.[" HOSTCHARS ".]+" - "(:[0-9]+)?(" URLPATH ")?\\>/?", + "[[:<:]](www|ftp)[" HOSTCHARS "]*\\.[" HOSTCHARS ".]+" + "(:[0-9]+)?(" URLPATH ")?[[:>:]]/?", FLAVOR_DEFAULT_TO_HTTP); terminal_widget_match_add (screen->priv->term, - "\\<(mailto:)?[a-z0-9][a-z0-9.-]*@[a-z0-9]" - "[a-z0-9-]*(\\.[a-z0-9][a-z0-9-]*)+\\>", + "[[:<:]](mailto:)?[a-z0-9][a-z0-9.-]*@[a-z0-9]" + "[a-z0-9-]*(\\.[a-z0-9][a-z0-9-]*)+[[:>:]]", FLAVOR_EMAIL); terminal_widget_match_add (screen->priv->term, - "\\", FLAVOR_AS_IS); + "[[:<:]]news:[-A-Z\\^_a-z{|}~!\"#$%&'()*+,./0-9;:=?`]+" + "@[" HOSTCHARS ".]+(:[0-9]+)?[[:>:]]", FLAVOR_AS_IS); terminal_screen_setup_dnd (screen); @@ -548,7 +559,6 @@ */ terminal_screen_update_scrollbar (screen); terminal_window_update_icon (screen->priv->window); - terminal_window_update_geometry (screen->priv->window); } if (GTK_WIDGET_REALIZED (screen->priv->term)) @@ -909,7 +919,6 @@ terminal_widget_set_allow_bold (term, terminal_profile_get_allow_bold (profile)); - terminal_window_set_size (screen->priv->window, screen, TRUE); } static void @@ -1019,6 +1028,7 @@ GtkWidget* terminal_screen_get_widget (TerminalScreen *screen) { + if (screen == NULL) return NULL; return screen->priv->term; } --- src/terminal-window.c.orig Fri Sep 1 01:34:03 2006 +++ src/terminal-window.c Wed Oct 18 15:32:15 2006 @@ -157,6 +157,9 @@ const char *dir); static void new_window_callback (GtkWidget *menuitem, TerminalWindow *window); +static void size_request_callback (GtkWidget *widget, + GtkRequisition *requisition, + TerminalWindow *window); static void new_tab_callback (GtkWidget *menuitem, TerminalWindow *window); static gboolean key_press_callback (GtkWidget *widget, @@ -237,6 +240,8 @@ static void terminal_window_show (GtkWidget *widget); +static void update_geometry (TerminalWindow *window); + static gboolean confirm_close_window (TerminalWindow *window); static gpointer parent_class; @@ -871,7 +876,12 @@ gtk_box_pack_end (GTK_BOX (window->priv->main_vbox), window->priv->notebook, TRUE, TRUE, 0); - + + g_signal_connect (G_OBJECT (window->priv->main_vbox), + "size_request", + G_CALLBACK (size_request_callback), + window); + mi = append_menuitem (window->priv->menubar, "", NULL, NULL, NULL); @@ -1506,14 +1516,6 @@ gtk_widget_hide (window->priv->menubar); } reset_menubar_labels (window); - - if (window->priv->active_term) - { -#ifdef DEBUG_GEOMETRY - g_fprintf (stderr,"setting size after toggling menubar visibility\n"); -#endif - terminal_window_set_size (window, window->priv->active_term, TRUE); - } } gboolean @@ -1531,98 +1533,21 @@ } void -terminal_window_set_size (TerminalWindow *window, - TerminalScreen *screen, - gboolean even_if_mapped) -{ - terminal_window_set_size_force_grid (window, screen, even_if_mapped, -1, -1); -} - -void -terminal_window_set_size_force_grid (TerminalWindow *window, - TerminalScreen *screen, - gboolean even_if_mapped, - int force_grid_width, - int force_grid_height) -{ - /* Owen's hack from gnome-terminal */ - GtkWidget *widget; - GtkWidget *app; - GtkRequisition toplevel_request; - GtkRequisition widget_request; - int w, h; - int char_width; - int char_height; - int grid_width; - int grid_height; - int xpad; - int ypad; - - /* be sure our geometry is up-to-date */ - terminal_window_update_geometry (window); - widget = terminal_screen_get_widget (screen); - - app = gtk_widget_get_toplevel (widget); - g_assert (app != NULL); - - gtk_widget_size_request (app, &toplevel_request); - gtk_widget_size_request (widget, &widget_request); - -#ifdef DEBUG_GEOMETRY - g_fprintf (stderr,"set size: toplevel %dx%d widget %dx%d\n", - toplevel_request.width, toplevel_request.height, - widget_request.width, widget_request.height); -#endif - - w = toplevel_request.width - widget_request.width; - h = toplevel_request.height - widget_request.height; - - terminal_widget_get_cell_size (widget, &char_width, &char_height); - terminal_widget_get_size (widget, &grid_width, &grid_height); - - if (force_grid_width >= 0) - grid_width = force_grid_width; - if (force_grid_height >= 0) - grid_height = force_grid_height; - - terminal_widget_get_padding (widget, &xpad, &ypad); - - w += xpad + char_width * grid_width; - h += ypad + char_height * grid_height; - -#ifdef DEBUG_GEOMETRY - g_fprintf (stderr,"set size: grid %dx%d force %dx%d setting %dx%d pixels\n", - grid_width, grid_height, force_grid_width, force_grid_height, w, h); -#endif - - if (even_if_mapped && GTK_WIDGET_MAPPED (app)) { - gtk_window_resize (GTK_WINDOW (app), w, h); - } - else { - gtk_window_set_default_size (GTK_WINDOW (app), w, h); - } -} - -void terminal_window_set_active (TerminalWindow *window, TerminalScreen *screen) { - GtkWidget *widget; TerminalProfile *profile; + GtkWidget *old_widget, *new_widget; if (window->priv->active_term == screen) return; - widget = terminal_screen_get_widget (screen); - profile = terminal_screen_get_profile (screen); - if (!GTK_WIDGET_REALIZED (widget)) - gtk_widget_realize (widget); /* we need this for the char width */ - + old_widget = terminal_screen_get_widget (window->priv->active_term); window->priv->active_term = screen; + new_widget = terminal_screen_get_widget (window->priv->active_term); - terminal_window_update_geometry (window); terminal_window_update_icon (window); /* Override menubar setting if it wasn't restored from session */ @@ -1641,11 +1566,13 @@ gtk_notebook_page_num (GTK_NOTEBOOK (window->priv->notebook), GTK_WIDGET (screen))); - /* set size of window to current grid size */ -#ifdef DEBUG_GEOMETRY - g_fprintf (stderr,"setting size after flipping notebook pages\n"); -#endif - terminal_window_set_size (window, screen, TRUE); + /* Make sure that the widget is no longer hidden due to the workaround */ + gtk_widget_show (new_widget); + /* Workaround to remove gtknotebook's feature of computing its size based on + * all pages. When the widget is hidden, its size will not be taken into + * account. + */ + if (old_widget != NULL) gtk_widget_hide (old_widget); update_copy_sensitivity (window); @@ -1704,18 +1631,12 @@ GtkWidget* page_widget; TerminalScreen *screen; GtkWidget *menu_item; - int old_grid_width, old_grid_height; - GtkWidget *old_widget; - - old_widget = NULL; - old_grid_width = -1; - old_grid_height = -1; + GtkWidget *old_widget, *new_widget; if (window->priv->active_term == NULL) return; old_widget = terminal_screen_get_widget (window->priv->active_term); - terminal_widget_get_size (old_widget, &old_grid_width, &old_grid_height); page_widget = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), page_num); @@ -1725,17 +1646,19 @@ screen = TERMINAL_SCREEN (page_widget); g_assert (screen); - + terminal_window_set_active (window, screen); - - /* This is so we maintain the same grid moving among tabs with - * different fonts. - */ -#ifdef DEBUG_GEOMETRY - g_fprintf (stderr,"setting size in switch_page handler\n"); -#endif - terminal_window_set_size_force_grid (window, screen, TRUE, old_grid_width, old_grid_height); + new_widget = terminal_screen_get_widget (screen); + + if (old_widget != new_widget) { + int old_grid_width, old_grid_height; + /* This is so that we maintain the same grid */ + terminal_widget_get_size (old_widget, &old_grid_width, &old_grid_height); + terminal_widget_set_size (new_widget, old_grid_width, old_grid_height); + gtk_widget_queue_resize_no_redraw (new_widget); + } + update_tab_sensitivity (window); menu_item = screen_get_menuitem (screen); @@ -1836,7 +1759,6 @@ TerminalScreen *screen, TerminalWindow *window) { - gboolean single; /* Called from terminal_notebook_move_tab() */ if (find_screen (window, screen) != NULL) { g_assert (terminal_screen_get_window (screen) == window); @@ -1868,11 +1790,6 @@ reset_tab_menuitems (window); update_tab_sensitivity (window); - /* The tab bar may have disappeared */ - single = g_list_length (window->priv->terms) == 1; - if (single) - terminal_window_set_size (window, window->priv->active_term, TRUE); - /* Close window if no more terminals */ if (window->priv->terms == NULL) gtk_widget_destroy (GTK_WIDGET (window)); @@ -1921,7 +1838,7 @@ } void -terminal_window_update_geometry (TerminalWindow *window) +update_geometry (TerminalWindow *window) { GdkGeometry hints; GtkWidget *widget; @@ -2264,6 +2181,26 @@ NULL, name, -1); g_free (geometry); +} + +static void +size_request_callback (GtkWidget *widget, + GtkRequisition *requisition, + TerminalWindow *window) +{ + if (!window->priv->active_term) + return; + +#ifdef DEBUG_GEOMETRY + g_fprintf (stderr, "vbox size-request callback with size %dx%d\n", + requisition->width, requisition->height); +#endif + + if (GTK_WIDGET_MAPPED (window)) { + gtk_window_resize (GTK_WINDOW (window), requisition->width, + requisition->height); + } + update_geometry (window); } static void --- src/terminal-window.h.orig Mon Jul 10 20:32:21 2006 +++ src/terminal-window.h Wed Oct 18 15:32:15 2006 @@ -77,15 +77,6 @@ int terminal_window_get_screen_count (TerminalWindow *window); void terminal_window_update_icon (TerminalWindow *window); -void terminal_window_update_geometry (TerminalWindow *window); -void terminal_window_set_size (TerminalWindow *window, - TerminalScreen *screen, - gboolean even_if_mapped); -void terminal_window_set_size_force_grid (TerminalWindow *window, - TerminalScreen *screen, - gboolean even_if_mapped, - int force_grid_width, - int force_grid_height); void terminal_window_set_fullscreen (TerminalWindow *window, gboolean setting); >Release-Note: >Audit-Trail: >Unformatted: