[gnome-terminal] Avoid changing the size during realize



commit b2e682189b32dda2b0eca105fe1ee057e5e8c544
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Wed Jun 17 17:10:04 2009 -0400

    Avoid changing the size during realize
    
    At the point when the the TerminalScreen is mapped, we are at a
    funny state:
    
     - The terminal window is mapped
     - GTK+ hasn't yet applied the default size
    
    Since the terminal window is mapped, we call gtk_window_resize()
    instead of gtk_window_set_default_size() and end up mapping with
    the wrong default size. (The observed effect is that depending on
    timing, the terminal will be reset to 80x24 when switching to
    a compositing window manager.)
    
    The simple fix is to not resize the window when the TerminalScreen
    is realized - changing sizing during realize is a poor idea in
    all cases - but rather at the start of show().
    
    http://bugzilla.gnome.org/show_bug.cgi?id=564648

 src/terminal-screen.c |    3 ---
 src/terminal-window.c |   10 +++++++---
 2 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index a1d3be3..9fa401f 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -334,9 +334,6 @@ terminal_screen_realize (GtkWidget *widget)
   vte_terminal_set_background_transparent (VTE_TERMINAL (screen),
                                            bg_type == TERMINAL_BACKGROUND_TRANSPARENT &&
                                            !terminal_window_uses_argb_visual (priv->window));
-
-  /* FIXME: why do this on realize? */
-  terminal_window_set_size (priv->window, screen, TRUE);
 }
 
 static void
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 9cc5ce7..9c9f8e1 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -2012,9 +2012,13 @@ terminal_window_show (GtkWidget *widget)
   GdkScreen *screen;
   GdkDisplay *display;
 
-  if (!GTK_WIDGET_REALIZED (widget))
-    gtk_widget_realize (widget);
-  
+  if (priv->active_screen != NULL)
+    {
+      /* At this point, we have our GdkScreen, and hence the right
+       * font size, so we can go ahead and size the window. */
+      terminal_window_set_size (window, priv->active_screen, FALSE);
+    }
+
   context = NULL;
   sn_display = NULL;
   if (priv->startup_id != NULL)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]