[gtk+] Ensure recursing gdk_window_process_all_updates works



commit c4d2c38238f68bab1331631a4639c0fd49730cfd
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Sep 10 13:53:29 2009 +0200

    Ensure recursing gdk_window_process_all_updates works
    
    There are two issues here. First of all an ignored update didn't
    use to unset update_idle which could cause all further idle repaints
    to be ignored. (Bug #591583)
    
    Secondly, if we ignore the process_all_updates we may end up not updating
    the windows in update_windows unless something else triggers an update.
    So, we handle this by checking for recursions and scheduling a new update
    at the end of the outermost process_all_updates.

 gdk/gdkwindow.c |   28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 7820d46..8487922 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -4875,10 +4875,10 @@ gdk_window_schedule_update (GdkWindow *window)
     return;
 
   if (!update_idle)
-    {
-      update_idle = gdk_threads_add_idle_full (GDK_PRIORITY_REDRAW,
-				     gdk_window_update_idle, NULL, NULL);
-    }
+    update_idle =
+      gdk_threads_add_idle_full (GDK_PRIORITY_REDRAW,
+				 gdk_window_update_idle,
+				 NULL, NULL);
 }
 
 void
@@ -5187,11 +5187,19 @@ gdk_window_process_all_updates (void)
   GSList *old_update_windows = update_windows;
   GSList *tmp_list = update_windows;
   static gboolean in_process_all_updates = FALSE;
+  static gboolean got_recursive_update = FALSE;
 
   if (in_process_all_updates)
-    return;
+    {
+      /* We can't do this now since that would recurse, so
+	 delay it until after the recursion is done. */
+      got_recursive_update = TRUE;
+      update_idle = 0;
+      return;
+    }
 
   in_process_all_updates = TRUE;
+  got_recursive_update = FALSE;
 
   if (update_idle)
     g_source_remove (update_idle);
@@ -5227,6 +5235,16 @@ gdk_window_process_all_updates (void)
   _gdk_windowing_after_process_all_updates ();
 
   in_process_all_updates = FALSE;
+
+  /* If we ignored a recursive call, schedule a
+     redraw now so that it eventually happens,
+     otherwise we could miss an update if nothing
+     else schedules an update. */
+  if (got_recursive_update && !update_idle)
+    update_idle =
+      gdk_threads_add_idle_full (GDK_PRIORITY_REDRAW,
+				 gdk_window_update_idle,
+				 NULL, NULL);
 }
 
 /**



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]