From 81be0b4311765c54dedfa16079444b844ef5cf8b Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Wed, 16 Nov 2005 14:40:41 +0000 Subject: call gtk_window_process_updates() so the animation keeps running even if 2005-11-16 Michael Natterer * gtk/gtkimage.c (animation_timeout): call gtk_window_process_updates() so the animation keeps running even if the main loop is busy with sources that eat a lot of cpu with high priority. Fixes bug #321444. (gtk_image_new_from_animation): document the fact that the animation will stop running if the main loop is busy with sources that have priorities higher than G_PRIORITY_DEFAULT. * tests/testimage.c: added test case that shows an animation even though a cpu-eating idle function is running. --- gtk/gtkimage.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'gtk/gtkimage.c') diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c index 1061253e1..a2f18baca 100644 --- a/gtk/gtkimage.c +++ b/gtk/gtkimage.c @@ -671,7 +671,12 @@ gtk_image_new_from_icon_set (GtkIconSet *icon_set, * The #GtkImage does not assume a reference to the * animation; you still need to unref it if you own references. * #GtkImage will add its own reference rather than adopting yours. - * + * + * Note that the animation frames are shown using a timeout with + * #G_PRIORITY_DEFAULT. When using animations to indicate busyness, + * keep in mind that the animation will only be shown if the main loop + * is not busy with something that has a higher priority. + * * Return value: a new #GtkImage widget **/ GtkWidget* @@ -1396,9 +1401,12 @@ animation_timeout (gpointer data) g_timeout_add (gdk_pixbuf_animation_iter_get_delay_time (image->data.anim.iter), animation_timeout, image); - + gtk_widget_queue_draw (GTK_WIDGET (image)); + if (GTK_WIDGET_DRAWABLE (image)) + gdk_window_process_updates (GTK_WIDGET (image)->window, TRUE); + GDK_THREADS_LEAVE (); return FALSE; -- cgit v1.2.1