diff options
author | jylefort <jylefort@FreeBSD.org> | 2006-10-26 16:14:09 +0800 |
---|---|---|
committer | jylefort <jylefort@FreeBSD.org> | 2006-10-26 16:14:09 +0800 |
commit | 2e8b169f4520747b7ba89fdfaf967cee5e4ec71c (patch) | |
tree | d458036dd1b22c82673a331d9e7bfaca1f50ac46 | |
parent | 395b548bfb239788712fe9bdbe0eb97d48efcab4 (diff) | |
download | freebsd-ports-gnome-2e8b169f4520747b7ba89fdfaf967cee5e4ec71c.tar.gz freebsd-ports-gnome-2e8b169f4520747b7ba89fdfaf967cee5e4ec71c.tar.zst freebsd-ports-gnome-2e8b169f4520747b7ba89fdfaf967cee5e4ec71c.zip |
Fix the obnoxious tab-related resize bugs.
PR: ports/104662
Submitted by: Thomas Vogt <thomas@bsdunix.ch>
Approved by: portmgr (marcus)
-rw-r--r-- | x11/gnome-terminal/Makefile | 1 | ||||
-rw-r--r-- | x11/gnome-terminal/files/patch-src_terminal-screen.c | 55 | ||||
-rw-r--r-- | x11/gnome-terminal/files/patch-src_terminal-window.c | 276 | ||||
-rw-r--r-- | x11/gnome-terminal/files/patch-src_terminal-window.h | 18 |
4 files changed, 347 insertions, 3 deletions
diff --git a/x11/gnome-terminal/Makefile b/x11/gnome-terminal/Makefile index ef60118c8920..4d4ef119304a 100644 --- a/x11/gnome-terminal/Makefile +++ b/x11/gnome-terminal/Makefile @@ -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/} diff --git a/x11/gnome-terminal/files/patch-src_terminal-screen.c b/x11/gnome-terminal/files/patch-src_terminal-screen.c index ffa05b4fcfd6..ed0df8903943 100644 --- a/x11/gnome-terminal/files/patch-src_terminal-screen.c +++ b/x11/gnome-terminal/files/patch-src_terminal-screen.c @@ -1,6 +1,31 @@ ---- src/terminal-screen.c.orig Wed May 17 17:02:36 2006 -+++ src/terminal-screen.c Thu May 18 15:30:27 2006 -@@ -278,22 +278,22 @@ terminal_screen_init (TerminalScreen *sc +--- 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, @@ -31,3 +56,27 @@ 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; + } + diff --git a/x11/gnome-terminal/files/patch-src_terminal-window.c b/x11/gnome-terminal/files/patch-src_terminal-window.c new file mode 100644 index 000000000000..8052c81135b5 --- /dev/null +++ b/x11/gnome-terminal/files/patch-src_terminal-window.c @@ -0,0 +1,276 @@ +--- 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 diff --git a/x11/gnome-terminal/files/patch-src_terminal-window.h b/x11/gnome-terminal/files/patch-src_terminal-window.h new file mode 100644 index 000000000000..f62e9f6571d2 --- /dev/null +++ b/x11/gnome-terminal/files/patch-src_terminal-window.h @@ -0,0 +1,18 @@ +--- 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); |