From c760a54a3478a84dac9871d77119f9bd095c55df Mon Sep 17 00:00:00 2001 From: Adam Dingle <adam@yorba.org> Date: Wed, 8 May 2013 10:39:28 -0400 Subject: [PATCH] Revert "window: restore size after hide/show properly" This reverts commit 38b62e4660a470cdda94480d3ab6da467125998e. Conflicts: gtk/gtkwindow.c --- gtk/gtkwindow.c | 70 ++++++++++++++++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 30 deletions(-) diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 23d999f..d009fc2 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -143,6 +143,7 @@ struct _GtkWindowPrivate * and on unrealize (for size). */ guint need_default_position : 1; + guint need_default_size : 1; guint above_initially : 1; guint accept_focus : 1; @@ -1155,6 +1156,7 @@ gtk_window_init (GtkWindow *window) priv->resizable = TRUE; priv->configure_notify_received = FALSE; priv->position = GTK_WIN_POS_NONE; + priv->need_default_size = TRUE; priv->need_default_position = TRUE; priv->modal = FALSE; priv->gdk_type_hint = GDK_WINDOW_TYPE_HINT_NORMAL; @@ -4946,6 +4948,7 @@ gtk_window_map (GtkWidget *widget) } /* No longer use the default settings */ + priv->need_default_size = FALSE; priv->need_default_position = FALSE; if (priv->reset_type_hint) @@ -5156,14 +5159,6 @@ gtk_window_get_remembered_size (GtkWindow *window, *height = gdk_window_get_height (gdk_window); return; } - - info = gtk_window_get_geometry_info (window, FALSE); - if (info) - { - /* MAX() works even if the last request is unset with -1 */ - *width = MAX (*width, info->last.configure_request.width); - *height = MAX (*height, info->last.configure_request.height); - } } static void @@ -5369,6 +5364,7 @@ gtk_window_unrealize (GtkWidget *widget) * * Default positioning is reset on unmap, instead of unrealize. */ + priv->need_default_size = TRUE; info = gtk_window_get_geometry_info (window, FALSE); if (info) { @@ -6568,6 +6564,7 @@ gtk_window_compute_configure_request_size (GtkWindow *window, gint *width, gint *height) { + GtkWindowPrivate *priv = window->priv; GtkWindowGeometryInfo *info; int w, h; @@ -6577,32 +6574,45 @@ gtk_window_compute_configure_request_size (GtkWindow *window, info = gtk_window_get_geometry_info (window, FALSE); - gtk_window_guess_default_size (window, width, height); + if (priv->need_default_size) + { + gtk_window_guess_default_size (window, width, height); gtk_window_get_remembered_size (window, &w, &h); *width = MAX (*width, w); *height = MAX (*height, h); - /* If window is empty so requests 0, default to random nonzero size */ - if (*width == 0 && *height == 0) - { - *width = 200; - *height = 200; - } - - /* Override with default size */ - - if (info) - { - if (info->default_width > 0) - *width = info->default_width; - if (info->default_height > 0) - *height = info->default_height; - - if (info->default_is_geometry) - geometry_size_to_pixels (geometry, flags, - info->default_width > 0 ? width : NULL, - info->default_height > 0 ? height : NULL); - } + /* If window is empty so requests 0, default to random nonzero size */ + if (*width == 0 && *height == 0) + { + *width = 200; + *height = 200; + } + + /* Override with default size */ + + if (info) + { + if (info->default_width > 0) + *width = info->default_width; + if (info->default_height > 0) + *height = info->default_height; + + if (info->default_is_geometry) + geometry_size_to_pixels (geometry, flags, + info->default_width > 0 ? width : NULL, + info->default_height > 0 ? height : NULL); + } + } + else + { + GtkAllocation allocation; + + gtk_widget_get_allocation (GTK_WIDGET (window), &allocation); + + /* Default to keeping current size */ + *width = allocation.width; + *height = allocation.height; + } /* Override any size with gtk_window_resize() values */ if (info) -- 1.8.1.2