Commit 21457ced authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Add a function gdk_window_invalidate_maybe_recurse() for use in "shallow

Sun Nov  4 16:02:08 2001  Owen Taylor  <otaylor@redhat.com>

        * gdk/gdkwindow.[ch]: Add a function gdk_window_invalidate_maybe_recurse()
        for use in "shallow invalidation" of a widget. (Windows belonging
        to the widget, but not to the widget's children)

        * gtk/gtkprivate.h gtk/gtkwidget.c gtk/gtksizegroup.c: Add private
        flags GTK_ALLOC_NEEDED, GTK_REQUEST_NEEDED.  These flags are set
        up on ancestors up to the resize container on queue_resize. Size
        requests only actually take place if GTK_REQUEST_NEEDED, size
        allocations only take place if GTK_ALLOC_NEEDED or the size
        changed.

        * gtk/gtkcontainer.c gtk/gtkwidget.c: Remove
        container->resize_widgets and the RESIZE_NEEDED flag since the
        above flags are sufficient to figure out what needs to be
        resized/reallocated. Remove code manipulating
        container->resize_widget.

        * gtk/gtkwidget.[ch]: Add gtk_widget_set_redraw_on_alloc(); this
        allows widgets to turn off being automatically invalidated is when
        they are resized.

        * gtk/gtkwidget.[ch] (gtk_widget_size_allocate): Invalidation when
        a widget is resized or moved is "shallow" as described above -
        only the windows that need to be invalidated are invalidated.

        * gtk/gtkbox.c gtk/gtktable.c gtk/gtkalignment.c docs/Changes-2.0.txt:
        Make these widget's init functions call
        gtk_widget_set_redraw_on_allocate(widget,FALSE).

        * gtk/gtkwindow.c (gtk_window_configure_event): Call
        _gtk_container_queue_resize(), since we don't want
        redrawing. (Probably could be done for other
        calls to gtk_widget_queue_resize() in gtkwindow.c,
        but this is the most important one.)

        * gtk/gtkwindow.c (gtk_window_move_resize): Don't call
        gtk_widget_queue_draw() - size_allocate() handles
        that as appropriate.

        * gtk/gtkframe.c (gtk_frame_size_allocate): Invalidate instead
        of queue_clear() to avoid invalidating children.
parent bc5849a5
Sun Nov 4 16:02:08 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.[ch]: Add a function gdk_window_invalidate_maybe_recurse()
for use in "shallow invalidation" of a widget. (Windows belonging
to the widget, but not to the widget's children)
* gtk/gtkprivate.h gtk/gtkwidget.c gtk/gtksizegroup.c: Add private
flags GTK_ALLOC_NEEDED, GTK_REQUEST_NEEDED. These flags are set
up on ancestors up to the resize container on queue_resize. Size
requests only actually take place if GTK_REQUEST_NEEDED, size
allocations only take place if GTK_ALLOC_NEEDED or the size
changed.
* gtk/gtkcontainer.c gtk/gtkwidget.c: Remove
container->resize_widgets and the RESIZE_NEEDED flag since the
above flags are sufficient to figure out what needs to be
resized/reallocated. Remove code manipulating
container->resize_widget.
* gtk/gtkwidget.[ch]: Add gtk_widget_set_redraw_on_alloc(); this
allows widgets to turn off being automatically invalidated is when
they are resized.
* gtk/gtkwidget.[ch] (gtk_widget_size_allocate): Invalidation when
a widget is resized or moved is "shallow" as described above -
only the windows that need to be invalidated are invalidated.
* gtk/gtkbox.c gtk/gtktable.c gtk/gtkalignment.c docs/Changes-2.0.txt:
Make these widget's init functions call
gtk_widget_set_redraw_on_allocate(widget,FALSE).
* gtk/gtkwindow.c (gtk_window_configure_event): Call
_gtk_container_queue_resize(), since we don't want
redrawing. (Probably could be done for other
calls to gtk_widget_queue_resize() in gtkwindow.c,
but this is the most important one.)
* gtk/gtkwindow.c (gtk_window_move_resize): Don't call
gtk_widget_queue_draw() - size_allocate() handles
that as appropriate.
* gtk/gtkframe.c (gtk_frame_size_allocate): Invalidate instead
of queue_clear() to avoid invalidating children.
2001-11-04 jacob berkman <jacob@ximian.com>
* gtk/gtkmain.c (find_module): don't free the module name until
......
Sun Nov 4 16:02:08 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.[ch]: Add a function gdk_window_invalidate_maybe_recurse()
for use in "shallow invalidation" of a widget. (Windows belonging
to the widget, but not to the widget's children)
* gtk/gtkprivate.h gtk/gtkwidget.c gtk/gtksizegroup.c: Add private
flags GTK_ALLOC_NEEDED, GTK_REQUEST_NEEDED. These flags are set
up on ancestors up to the resize container on queue_resize. Size
requests only actually take place if GTK_REQUEST_NEEDED, size
allocations only take place if GTK_ALLOC_NEEDED or the size
changed.
* gtk/gtkcontainer.c gtk/gtkwidget.c: Remove
container->resize_widgets and the RESIZE_NEEDED flag since the
above flags are sufficient to figure out what needs to be
resized/reallocated. Remove code manipulating
container->resize_widget.
* gtk/gtkwidget.[ch]: Add gtk_widget_set_redraw_on_alloc(); this
allows widgets to turn off being automatically invalidated is when
they are resized.
* gtk/gtkwidget.[ch] (gtk_widget_size_allocate): Invalidation when
a widget is resized or moved is "shallow" as described above -
only the windows that need to be invalidated are invalidated.
* gtk/gtkbox.c gtk/gtktable.c gtk/gtkalignment.c docs/Changes-2.0.txt:
Make these widget's init functions call
gtk_widget_set_redraw_on_allocate(widget,FALSE).
* gtk/gtkwindow.c (gtk_window_configure_event): Call
_gtk_container_queue_resize(), since we don't want
redrawing. (Probably could be done for other
calls to gtk_widget_queue_resize() in gtkwindow.c,
but this is the most important one.)
* gtk/gtkwindow.c (gtk_window_move_resize): Don't call
gtk_widget_queue_draw() - size_allocate() handles
that as appropriate.
* gtk/gtkframe.c (gtk_frame_size_allocate): Invalidate instead
of queue_clear() to avoid invalidating children.
2001-11-04 jacob berkman <jacob@ximian.com>
* gtk/gtkmain.c (find_module): don't free the module name until
......
Sun Nov 4 16:02:08 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.[ch]: Add a function gdk_window_invalidate_maybe_recurse()
for use in "shallow invalidation" of a widget. (Windows belonging
to the widget, but not to the widget's children)
* gtk/gtkprivate.h gtk/gtkwidget.c gtk/gtksizegroup.c: Add private
flags GTK_ALLOC_NEEDED, GTK_REQUEST_NEEDED. These flags are set
up on ancestors up to the resize container on queue_resize. Size
requests only actually take place if GTK_REQUEST_NEEDED, size
allocations only take place if GTK_ALLOC_NEEDED or the size
changed.
* gtk/gtkcontainer.c gtk/gtkwidget.c: Remove
container->resize_widgets and the RESIZE_NEEDED flag since the
above flags are sufficient to figure out what needs to be
resized/reallocated. Remove code manipulating
container->resize_widget.
* gtk/gtkwidget.[ch]: Add gtk_widget_set_redraw_on_alloc(); this
allows widgets to turn off being automatically invalidated is when
they are resized.
* gtk/gtkwidget.[ch] (gtk_widget_size_allocate): Invalidation when
a widget is resized or moved is "shallow" as described above -
only the windows that need to be invalidated are invalidated.
* gtk/gtkbox.c gtk/gtktable.c gtk/gtkalignment.c docs/Changes-2.0.txt:
Make these widget's init functions call
gtk_widget_set_redraw_on_allocate(widget,FALSE).
* gtk/gtkwindow.c (gtk_window_configure_event): Call
_gtk_container_queue_resize(), since we don't want
redrawing. (Probably could be done for other
calls to gtk_widget_queue_resize() in gtkwindow.c,
but this is the most important one.)
* gtk/gtkwindow.c (gtk_window_move_resize): Don't call
gtk_widget_queue_draw() - size_allocate() handles
that as appropriate.
* gtk/gtkframe.c (gtk_frame_size_allocate): Invalidate instead
of queue_clear() to avoid invalidating children.
2001-11-04 jacob berkman <jacob@ximian.com>
* gtk/gtkmain.c (find_module): don't free the module name until
......
Sun Nov 4 16:02:08 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.[ch]: Add a function gdk_window_invalidate_maybe_recurse()
for use in "shallow invalidation" of a widget. (Windows belonging
to the widget, but not to the widget's children)
* gtk/gtkprivate.h gtk/gtkwidget.c gtk/gtksizegroup.c: Add private
flags GTK_ALLOC_NEEDED, GTK_REQUEST_NEEDED. These flags are set
up on ancestors up to the resize container on queue_resize. Size
requests only actually take place if GTK_REQUEST_NEEDED, size
allocations only take place if GTK_ALLOC_NEEDED or the size
changed.
* gtk/gtkcontainer.c gtk/gtkwidget.c: Remove
container->resize_widgets and the RESIZE_NEEDED flag since the
above flags are sufficient to figure out what needs to be
resized/reallocated. Remove code manipulating
container->resize_widget.
* gtk/gtkwidget.[ch]: Add gtk_widget_set_redraw_on_alloc(); this
allows widgets to turn off being automatically invalidated is when
they are resized.
* gtk/gtkwidget.[ch] (gtk_widget_size_allocate): Invalidation when
a widget is resized or moved is "shallow" as described above -
only the windows that need to be invalidated are invalidated.
* gtk/gtkbox.c gtk/gtktable.c gtk/gtkalignment.c docs/Changes-2.0.txt:
Make these widget's init functions call
gtk_widget_set_redraw_on_allocate(widget,FALSE).
* gtk/gtkwindow.c (gtk_window_configure_event): Call
_gtk_container_queue_resize(), since we don't want
redrawing. (Probably could be done for other
calls to gtk_widget_queue_resize() in gtkwindow.c,
but this is the most important one.)
* gtk/gtkwindow.c (gtk_window_move_resize): Don't call
gtk_widget_queue_draw() - size_allocate() handles
that as appropriate.
* gtk/gtkframe.c (gtk_frame_size_allocate): Invalidate instead
of queue_clear() to avoid invalidating children.
2001-11-04 jacob berkman <jacob@ximian.com>
* gtk/gtkmain.c (find_module): don't free the module name until
......
Sun Nov 4 16:02:08 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.[ch]: Add a function gdk_window_invalidate_maybe_recurse()
for use in "shallow invalidation" of a widget. (Windows belonging
to the widget, but not to the widget's children)
* gtk/gtkprivate.h gtk/gtkwidget.c gtk/gtksizegroup.c: Add private
flags GTK_ALLOC_NEEDED, GTK_REQUEST_NEEDED. These flags are set
up on ancestors up to the resize container on queue_resize. Size
requests only actually take place if GTK_REQUEST_NEEDED, size
allocations only take place if GTK_ALLOC_NEEDED or the size
changed.
* gtk/gtkcontainer.c gtk/gtkwidget.c: Remove
container->resize_widgets and the RESIZE_NEEDED flag since the
above flags are sufficient to figure out what needs to be
resized/reallocated. Remove code manipulating
container->resize_widget.
* gtk/gtkwidget.[ch]: Add gtk_widget_set_redraw_on_alloc(); this
allows widgets to turn off being automatically invalidated is when
they are resized.
* gtk/gtkwidget.[ch] (gtk_widget_size_allocate): Invalidation when
a widget is resized or moved is "shallow" as described above -
only the windows that need to be invalidated are invalidated.
* gtk/gtkbox.c gtk/gtktable.c gtk/gtkalignment.c docs/Changes-2.0.txt:
Make these widget's init functions call
gtk_widget_set_redraw_on_allocate(widget,FALSE).
* gtk/gtkwindow.c (gtk_window_configure_event): Call
_gtk_container_queue_resize(), since we don't want
redrawing. (Probably could be done for other
calls to gtk_widget_queue_resize() in gtkwindow.c,
but this is the most important one.)
* gtk/gtkwindow.c (gtk_window_move_resize): Don't call
gtk_widget_queue_draw() - size_allocate() handles
that as appropriate.
* gtk/gtkframe.c (gtk_frame_size_allocate): Invalidate instead
of queue_clear() to avoid invalidating children.
2001-11-04 jacob berkman <jacob@ximian.com>
* gtk/gtkmain.c (find_module): don't free the module name until
......
Sun Nov 4 16:02:08 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.[ch]: Add a function gdk_window_invalidate_maybe_recurse()
for use in "shallow invalidation" of a widget. (Windows belonging
to the widget, but not to the widget's children)
* gtk/gtkprivate.h gtk/gtkwidget.c gtk/gtksizegroup.c: Add private
flags GTK_ALLOC_NEEDED, GTK_REQUEST_NEEDED. These flags are set
up on ancestors up to the resize container on queue_resize. Size
requests only actually take place if GTK_REQUEST_NEEDED, size
allocations only take place if GTK_ALLOC_NEEDED or the size
changed.
* gtk/gtkcontainer.c gtk/gtkwidget.c: Remove
container->resize_widgets and the RESIZE_NEEDED flag since the
above flags are sufficient to figure out what needs to be
resized/reallocated. Remove code manipulating
container->resize_widget.
* gtk/gtkwidget.[ch]: Add gtk_widget_set_redraw_on_alloc(); this
allows widgets to turn off being automatically invalidated is when
they are resized.
* gtk/gtkwidget.[ch] (gtk_widget_size_allocate): Invalidation when
a widget is resized or moved is "shallow" as described above -
only the windows that need to be invalidated are invalidated.
* gtk/gtkbox.c gtk/gtktable.c gtk/gtkalignment.c docs/Changes-2.0.txt:
Make these widget's init functions call
gtk_widget_set_redraw_on_allocate(widget,FALSE).
* gtk/gtkwindow.c (gtk_window_configure_event): Call
_gtk_container_queue_resize(), since we don't want
redrawing. (Probably could be done for other
calls to gtk_widget_queue_resize() in gtkwindow.c,
but this is the most important one.)
* gtk/gtkwindow.c (gtk_window_move_resize): Don't call
gtk_widget_queue_draw() - size_allocate() handles
that as appropriate.
* gtk/gtkframe.c (gtk_frame_size_allocate): Invalidate instead
of queue_clear() to avoid invalidating children.
2001-11-04 jacob berkman <jacob@ximian.com>
* gtk/gtkmain.c (find_module): don't free the module name until
......
Sun Nov 4 16:02:08 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.[ch]: Add a function gdk_window_invalidate_maybe_recurse()
for use in "shallow invalidation" of a widget. (Windows belonging
to the widget, but not to the widget's children)
* gtk/gtkprivate.h gtk/gtkwidget.c gtk/gtksizegroup.c: Add private
flags GTK_ALLOC_NEEDED, GTK_REQUEST_NEEDED. These flags are set
up on ancestors up to the resize container on queue_resize. Size
requests only actually take place if GTK_REQUEST_NEEDED, size
allocations only take place if GTK_ALLOC_NEEDED or the size
changed.
* gtk/gtkcontainer.c gtk/gtkwidget.c: Remove
container->resize_widgets and the RESIZE_NEEDED flag since the
above flags are sufficient to figure out what needs to be
resized/reallocated. Remove code manipulating
container->resize_widget.
* gtk/gtkwidget.[ch]: Add gtk_widget_set_redraw_on_alloc(); this
allows widgets to turn off being automatically invalidated is when
they are resized.
* gtk/gtkwidget.[ch] (gtk_widget_size_allocate): Invalidation when
a widget is resized or moved is "shallow" as described above -
only the windows that need to be invalidated are invalidated.
* gtk/gtkbox.c gtk/gtktable.c gtk/gtkalignment.c docs/Changes-2.0.txt:
Make these widget's init functions call
gtk_widget_set_redraw_on_allocate(widget,FALSE).
* gtk/gtkwindow.c (gtk_window_configure_event): Call
_gtk_container_queue_resize(), since we don't want
redrawing. (Probably could be done for other
calls to gtk_widget_queue_resize() in gtkwindow.c,
but this is the most important one.)
* gtk/gtkwindow.c (gtk_window_move_resize): Don't call
gtk_widget_queue_draw() - size_allocate() handles
that as appropriate.
* gtk/gtkframe.c (gtk_frame_size_allocate): Invalidate instead
of queue_clear() to avoid invalidating children.
2001-11-04 jacob berkman <jacob@ximian.com>
* gtk/gtkmain.c (find_module): don't free the module name until
......
......@@ -508,3 +508,9 @@ Incompatible Changes from GTK+-1.2 to GTK+-2.0:
are deprecated, as GdkRgb works on any colormap and visual. You no
longer need to gtk_widget_push_cmap (gtk_preview_get_cmap ()) in
your code.
* The GtkBox, GtkTable, and GtkAlignment widgets now call
gtk_widget_set_redraw_on_allocate (widget, FALSE); on themselves.
If you want to actually draw contents in a widget derived from
one of these widgets, you'll probably want to change this
in your init() function.
......@@ -100,6 +100,16 @@ GtkIMContext
@imcontext: the object which received the signal.
@arg1:
<!-- ##### SIGNAL GtkIMContext::delete-surrounding ##### -->
<para>
</para>
@imcontext: the object which received the signal.
@arg1:
@arg2:
@Returns:
<!-- ##### SIGNAL GtkIMContext::preedit-changed ##### -->
<para>
......@@ -121,3 +131,11 @@ GtkIMContext
@imcontext: the object which received the signal.
<!-- ##### SIGNAL GtkIMContext::retrieve-surrounding ##### -->
<para>
</para>
@imcontext: the object which received the signal.
@Returns:
......@@ -2152,10 +2152,12 @@ gdk_window_invalidate_rect (GdkWindow *window,
}
/**
* gdk_window_invalidate_region:
* gdk_window_invalidate_maybe_recurse:
* @window: a #GdkWindow
* @region: a #GdkRegion
* @invalidate_children: %TRUE to also invalidate child windows
* @child_func: function to use to decide if to recurse to a child,
* %NULL means never recurse.
* @child_func_data: data passed to @child_func
*
* Adds @region to the update area for @window. The update area is the
* region that needs to be redrawn, or "dirty region." The call
......@@ -2169,16 +2171,16 @@ gdk_window_invalidate_rect (GdkWindow *window,
* normally there's no need to do that manually, you just need to
* invalidate regions that you know should be redrawn.
*
* The @invalidate_children parameter controls whether the region of
* The @child_func parameter controls whether the region of
* each child window that intersects @region will also be invalidated.
* If %FALSE, then the update area for child windows will remain
* unaffected.
*
* Only children for whic @child_func returns TRUE will have the area
* invalidated.
**/
void
gdk_window_invalidate_region (GdkWindow *window,
GdkRegion *region,
gboolean invalidate_children)
gdk_window_invalidate_maybe_recurse (GdkWindow *window,
GdkRegion *region,
gboolean (*child_func) (GdkWindow *, gpointer),
gpointer user_data)
{
GdkWindowObject *private = (GdkWindowObject *)window;
GdkRegion *visible_region;
......@@ -2233,7 +2235,7 @@ gdk_window_invalidate_region (GdkWindow *window,
gdk_window_update_idle, NULL, NULL);
}
if (invalidate_children)
if (child_func)
{
GList *tmp_list;
......@@ -2242,8 +2244,8 @@ gdk_window_invalidate_region (GdkWindow *window,
{
GdkWindowObject *child = tmp_list->data;
tmp_list = tmp_list->next;
if (!child->input_only)
if (!child->input_only && (*child_func) ((GdkWindow *)child, user_data))
{
GdkRegion *child_region;
gint x, y;
......@@ -2265,6 +2267,48 @@ gdk_window_invalidate_region (GdkWindow *window,
gdk_region_destroy (visible_region);
}
static gboolean
true_predicate (GdkWindow *window,
gpointer user_data)
{
return TRUE;
}
/**
* gdk_window_invalidate_region:
* @window: a #GdkWindow
* @region: a #GdkRegion
* @invalidate_children: %TRUE to also invalidate child windows
*
* Adds @region to the update area for @window. The update area is the
* region that needs to be redrawn, or "dirty region." The call
* gdk_window_process_updates() sends one or more expose events to the
* window, which together cover the entire update area. An
* application would normally redraw the contents of @window in
* response to those expose events.
*
* GDK will call gdk_window_process_all_updates() on your behalf
* whenever your program returns to the main loop and becomes idle, so
* normally there's no need to do that manually, you just need to
* invalidate regions that you know should be redrawn.
*
* The @invalidate_children parameter controls whether the region of
* each child window that intersects @region will also be invalidated.
* If %FALSE, then the update area for child windows will remain
* unaffected. See gdk_window_invalidate_maybe_recurse if you need
* fine grained control over which children are invalidated.
**/
void
gdk_window_invalidate_region (GdkWindow *window,
GdkRegion *region,
gboolean invalidate_children)
{
gdk_window_invalidate_maybe_recurse (window, region,
invalidate_children ?
true_predicate : (gboolean (*) (GdkWindow *, gpointer))NULL,
NULL);
}
/**
* gdk_window_get_update_area:
* @window: a #GdkWindow
......
......@@ -491,12 +491,16 @@ void gdk_window_begin_move_drag (GdkWindow *window,
guint32 timestamp);
/* Interface for dirty-region queueing */
void gdk_window_invalidate_rect (GdkWindow *window,
GdkRectangle *rect,
gboolean invalidate_children);
void gdk_window_invalidate_region (GdkWindow *window,
GdkRegion *region,
gboolean invalidate_children);
void gdk_window_invalidate_rect (GdkWindow *window,
GdkRectangle *rect,
gboolean invalidate_children);
void gdk_window_invalidate_region (GdkWindow *window,
GdkRegion *region,
gboolean invalidate_children);
void gdk_window_invalidate_maybe_recurse (GdkWindow *window,
GdkRegion *region,
gboolean (*child_func) (GdkWindow *, gpointer),
gpointer user_data);
GdkRegion *gdk_window_get_update_area (GdkWindow *window);
void gdk_window_freeze_updates (GdkWindow *window);
......
......@@ -139,6 +139,7 @@ static void
gtk_alignment_init (GtkAlignment *alignment)
{
GTK_WIDGET_SET_FLAGS (alignment, GTK_NO_WINDOW);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (alignment), FALSE);
alignment->xalign = 0.5;
alignment->yalign = 0.5;
......
......@@ -168,7 +168,8 @@ static void
gtk_box_init (GtkBox *box)
{
GTK_WIDGET_SET_FLAGS (box, GTK_NO_WINDOW);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (box), FALSE);
box->children = NULL;
box->spacing = 0;
box->homogeneous = FALSE;
......
......@@ -698,7 +698,6 @@ gtk_container_init (GtkContainer *container)
container->need_resize = FALSE;
container->resize_mode = GTK_RESIZE_PARENT;
container->reallocate_redraws = FALSE;
container->resize_widgets = NULL;
}
static void
......@@ -713,8 +712,6 @@ gtk_container_destroy (GtkObject *object)
if (GTK_CONTAINER_RESIZE_PENDING (container))
_gtk_container_dequeue_resize_handler (container);
if (container->resize_widgets)
_gtk_container_clear_resize_widgets (container);
/* do this before walking child widgets, to avoid
* removing children from focus chain one by one.
......@@ -899,28 +896,6 @@ _gtk_container_dequeue_resize_handler (GtkContainer *container)
GTK_PRIVATE_UNSET_FLAG (container, GTK_RESIZE_PENDING);
}
void
_gtk_container_clear_resize_widgets (GtkContainer *container)
{
GSList *node;
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_CONTAINER (container));
node = container->resize_widgets;
while (node)
{
GtkWidget *widget = node->data;
GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
node = node->next;
}
g_slist_free (container->resize_widgets);
container->resize_widgets = NULL;
}
void
gtk_container_set_resize_mode (GtkContainer *container,
GtkResizeMode resize_mode)
......@@ -940,14 +915,8 @@ gtk_container_set_resize_mode (GtkContainer *container,
{
container->resize_mode = resize_mode;
if (resize_mode == GTK_RESIZE_IMMEDIATE)
gtk_container_check_resize (container);
else
{
_gtk_container_clear_resize_widgets (container);
gtk_widget_queue_resize (GTK_WIDGET (container));
}
g_object_notify (G_OBJECT (container), "resize_mode");
gtk_widget_queue_resize (GTK_WIDGET (container));
g_object_notify (G_OBJECT (container), "resize_mode");
}
}
......@@ -987,7 +956,7 @@ gtk_container_get_resize_container (GtkContainer *container)
while (widget->parent)
{
widget = widget->parent;
if (GTK_IS_RESIZE_CONTAINER (widget) && !GTK_WIDGET_RESIZE_NEEDED (widget))
if (GTK_IS_RESIZE_CONTAINER (widget))
break;
}
......@@ -997,32 +966,52 @@ gtk_container_get_resize_container (GtkContainer *container)
static gboolean
gtk_container_idle_sizer (gpointer data)
{
static gboolean initialized = 0;
static GTimeVal last_time;
GTimeVal current_time;
GDK_THREADS_ENTER ();
/* we may be invoked with a container_resize_queue of NULL, because
* queue_resize could have been adding an extra idle function while
* the queue still got processed. we better just ignore such case
* than trying to explicitely work around them with some extra flags,
* since it doesn't cause any actual harm.
*/
while (container_resize_queue)
if (container_resize_queue)
{
GSList *slist;
GtkWidget *widget;
slist = container_resize_queue;
container_resize_queue = slist->next;
widget = slist->data;
g_slist_free_1 (slist);
GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_PENDING);
gtk_container_check_resize (GTK_CONTAINER (widget));
/* we may be invoked with a container_resize_queue of NULL, because
* queue_resize could have been adding an extra idle function while
* the queue still got processed. we better just ignore such case
* than trying to explicitely work around them with some extra flags,
* since it doesn't cause any actual harm.
*/
while (container_resize_queue)
{
GSList *slist;
GtkWidget *widget;
slist = container_resize_queue;
container_resize_queue = slist->next;
widget = slist->data;
g_slist_free_1 (slist);
GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_PENDING);
gtk_container_check_resize (GTK_CONTAINER (widget));
}
gdk_window_process_all_updates ();
g_get_current_time (&current_time);
if (initialized)
{
gdouble diff = ((current_time.tv_usec - last_time.tv_usec) / 1000. +
(current_time.tv_sec - last_time.tv_sec) * 1000.);
/* g_print ("Frame time: %g msec\n", diff); */
}
else
initialized = TRUE;
last_time = current_time;
GDK_THREADS_LEAVE ();
}
gdk_window_process_all_updates ();
GDK_THREADS_LEAVE ();
return FALSE;
}