[gtk+] gtkwindow: fix first allocation size



commit 6d77b9f3162d9f3d9ea214b765b6f937e4439237
Author: Christoph Reiter <creiter src gnome org>
Date:   Fri Jan 1 12:57:46 2016 +0100

    gtkwindow: fix first allocation size
    
    67ab00e01ec06d7b removed the fake configure code in gtk_window_show() and
    replaced it with a simple gtk_widget_realize(). The initial allocation
    code in realize() only allocates the natural size or the last requested
    size which now no longer is set, resulting in a too small first allocation.
    
    This builds a configure request to compute the allocation size instead
    which includes default size, CSD etc..
    
    This problem could be seen in case of a GtkPaned in a GtkWindow with a
    default size set and the pane position set as well. The first allocation
    would be the natural size of the GtkPaned which would clamp the pane
    position if too larg. Only the second allocation would fill the parent
    window using the now wrong pane position.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759705

 gtk/gtkwindow.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index cb98bd6..ae8a81e 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -7137,15 +7137,15 @@ gtk_window_realize (GtkWidget *widget)
       allocation.width == 1 &&
       allocation.height == 1)
     {
-      gint w, h;
+      GdkRectangle request;
+      gint default_width, default_height;
+
+      gtk_window_compute_configure_request (window, &request, NULL, NULL);
 
       allocation.x = 0;
       allocation.y = 0;
-
-      gtk_window_guess_default_size (window, &allocation.width, &allocation.height);
-      gtk_window_get_remembered_size (window, &w, &h);
-      allocation.width = MAX (allocation.width, w);
-      allocation.height = MAX (allocation.height, h);
+      allocation.width = request.width;
+      allocation.height = request.height;
       gtk_widget_size_allocate (widget, &allocation);
 
       gtk_widget_queue_resize (widget);


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