diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 5b9be4ebf0..18ac3a2224 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -7176,13 +7176,16 @@ gtk_window_compute_hints (GtkWindow *window, guint *new_flags) { GtkWindowPrivate *priv = window->priv; + GtkWidget *widget; gint extra_width = 0; gint extra_height = 0; GtkWindowGeometryInfo *geometry_info; - int width, height; + GtkRequisition requisition; - gtk_window_guess_default_size (window, &width, &height); - geometry_info = gtk_window_get_geometry_info (window, FALSE); + widget = GTK_WIDGET (window); + + gtk_widget_get_preferred_size (widget, &requisition, NULL); + geometry_info = gtk_window_get_geometry_info (GTK_WINDOW (widget), FALSE); if (geometry_info) { @@ -7224,7 +7227,7 @@ gtk_window_compute_hints (GtkWindow *window, _gtk_widget_override_size_request (geometry_info->widget, TEMPORARY_SIZE, TEMPORARY_SIZE, ¤t_width, ¤t_height); - gtk_widget_get_preferred_size (GTK_WIDGET (window), + gtk_widget_get_preferred_size (widget, &requisition, NULL); _gtk_widget_restore_size_request (geometry_info->widget, current_width, current_height); @@ -7279,32 +7282,32 @@ gtk_window_compute_hints (GtkWindow *window, if (*new_flags & GDK_HINT_MIN_SIZE) { if (new_geometry->min_width < 0) - new_geometry->min_width = width; + new_geometry->min_width = requisition.width; else - new_geometry->min_width = MAX (width, new_geometry->min_width + extra_width); + new_geometry->min_width = MAX (requisition.width, new_geometry->min_width + extra_width); if (new_geometry->min_height < 0) - new_geometry->min_height = height; + new_geometry->min_height = requisition.height; else - new_geometry->min_height = MAX (height, new_geometry->min_height + extra_height); + new_geometry->min_height = MAX (requisition.height, new_geometry->min_height + extra_height); } else { *new_flags |= GDK_HINT_MIN_SIZE; - new_geometry->min_width = width; - new_geometry->min_height = height; + new_geometry->min_width = requisition.width; + new_geometry->min_height = requisition.height; } if (*new_flags & GDK_HINT_MAX_SIZE) { if (new_geometry->max_width < 0) - new_geometry->max_width = width; + new_geometry->max_width = requisition.width; else new_geometry->max_width += extra_width; if (new_geometry->max_height < 0) - new_geometry->max_height = height; + new_geometry->max_height = requisition.height; else new_geometry->max_height += extra_height; } @@ -7312,8 +7315,8 @@ gtk_window_compute_hints (GtkWindow *window, { *new_flags |= GDK_HINT_MAX_SIZE; - new_geometry->max_width = width; - new_geometry->max_height = height; + new_geometry->max_width = requisition.width; + new_geometry->max_height = requisition.height; } *new_flags |= GDK_HINT_WIN_GRAVITY;