[gtk+/quartz-integration: 86/108] window: Remove overeagerness with new size guessing
- From: John Ralls <jralls src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/quartz-integration: 86/108] window: Remove overeagerness with new size guessing
- Date: Wed, 4 May 2011 06:33:16 +0000 (UTC)
commit 4747c95fe6c68ed0f4b33ae42e2e51f337961c0f
Author: Benjamin Otte <otte redhat com>
Date: Sun May 1 07:19:55 2011 +0200
window: Remove overeagerness with new size guessing
Don't use the guessed size when we are interested in the minimum size.
So now we can really shrink menubars.
This reverts parts of 08b2ac1d90b4f3dfa76d6a76fa04ca28c6b7ba12
gtk/gtkwindow.c | 31 +++++++++++++++++--------------
1 files changed, 17 insertions(+), 14 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 5b9be4e..18ac3a2 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;
+
+ widget = GTK_WIDGET (window);
- gtk_window_guess_default_size (window, &width, &height);
- geometry_info = gtk_window_get_geometry_info (window, FALSE);
+ 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]