diff options
author | Owen Taylor <otaylor@redhat.com> | 1999-09-01 14:51:02 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 1999-09-01 14:51:02 +0000 |
commit | 55c0a94c2cd6f552b8533de138d8465c1407fc6e (patch) | |
tree | 3138b1d9f5030b21df4383a62b4671bc1411a383 /gtk | |
parent | c64f52a36cc816210e46e9469fc9add92e8bf226 (diff) | |
download | gdk-pixbuf-55c0a94c2cd6f552b8533de138d8465c1407fc6e.tar.gz |
Removed GTK_WIDGET_REALIZED() assertion - we can compute the hints before
Wed Sep 1 10:38:37 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_compute_hints): Removed
GTK_WIDGET_REALIZED() assertion - we can compute the
hints before we are realized.
* gtk/gtkwindow.c (gtk_window_move_resize): Reorder
hint changing so that we have a value of hints_changed
when we decide whether to constrain the window size.
* gtk/gtkwindow.c (gtk_window_move_resize): Spelling fix.
* gtk/gtkwindow.c (gtk_window_constrain_size): cleanups,
change back to G_MAXINT.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkwindow.c | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index c2be03061..d599fe92c 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -1516,6 +1516,13 @@ gtk_window_move_resize (GtkWindow *window) /* Compute new set of hints for the window */ gtk_window_compute_hints (window, &new_geometry, &new_flags); + if (!gtk_window_compare_hints (&info->last_geometry, info->last_flags, + &new_geometry, new_flags)) + { + hints_changed = TRUE; + info->last_geometry = new_geometry; + info->last_flags = new_flags; + } gtk_widget_size_request (widget, NULL); gtk_window_compute_default_size (window, &new_width, &new_height); @@ -1559,19 +1566,15 @@ gtk_window_move_resize (GtkWindow *window) /* Now set hints if necessary, including new position */ - if (x != 1 && y != -1) - new_flags |= GDK_HINT_POS; - - if (!gtk_window_compare_hints (&info->last_geometry, info->last_flags, - &new_geometry, new_flags)) + if (x != 1 && y != -1 && !(new_flags & GDK_HINT_POS)) { + new_flags |= GDK_HINT_POS; hints_changed = TRUE; - gdk_window_set_geometry_hints (widget->window, - &new_geometry, - new_flags); - info->last_geometry = new_geometry; - info->last_flags = new_flags; } + if (hints_changed) + gdk_window_set_geometry_hints (widget->window, + &new_geometry, + new_flags); if (x != -1 && y != -1) { @@ -1591,7 +1594,7 @@ gtk_window_move_resize (GtkWindow *window) else gdk_window_get_geometry (widget->window, NULL, NULL, &width, &height, NULL); - /* handle actuall resizing: + /* handle actual resizing: * - handle reallocations due to configure events * - figure whether we need to request a new window size * - handle simple resizes within our widget tree @@ -1750,8 +1753,14 @@ gtk_window_constrain_size (GtkWindow *window, gint *new_width, gint *new_height) { - gint min_width = 0, min_height = 0, base_width = 0, base_height = 0; - gint xinc = 1, yinc = 1, max_width, max_height; + gint min_width = 0; + gint min_height = 0; + gint base_width = 0; + gint base_height = 0; + gint xinc = 1; + gint yinc = 1; + gint max_width = G_MAXINT; + gint max_height = G_MAXINT; #define FLOOR(value, base) ( ((gint) ((value) / (base))) * (base) ) @@ -1776,9 +1785,12 @@ gtk_window_constrain_size (GtkWindow *window, min_width = geometry->min_width; min_height = geometry->min_height; } - - max_width = (flags & GDK_HINT_MAX_SIZE) ? geometry->max_width : 32767; - max_height = (flags & GDK_HINT_MAX_SIZE) ? geometry->max_height : 32767; + + if (flags & GDK_HINT_MAX_SIZE) + { + max_width = geometry->max_width ; + max_height = geometry->max_height; + } if (flags & GDK_HINT_RESIZE_INC) { @@ -1861,7 +1873,6 @@ gtk_window_compute_hints (GtkWindow *window, GtkRequisition requisition; g_return_if_fail (GTK_IS_WINDOW (window)); - g_return_if_fail (GTK_WIDGET_REALIZED (window)); widget = GTK_WIDGET (window); |