Index: gdkwindow.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkwindow.c,v
retrieving revision 1.159
diff -u -p -u -r1.159 gdkwindow.c
--- gdkwindow.c	13 Mar 2004 18:27:55 -0000	1.159
+++ gdkwindow.c	13 Jun 2004 19:54:25 -0000
@@ -1986,11 +1986,33 @@ gdk_window_copy_to_image (GdkDrawable   
 
 /* Code for dirty-region queueing
  */
-
 static GSList *update_windows = NULL;
 static guint update_idle = 0;
 static gboolean debug_updates = FALSE;
 
+static gboolean
+gdk_window_update_idle (gpointer data)
+{
+  GDK_THREADS_ENTER ();
+  gdk_window_process_all_updates ();
+  GDK_THREADS_LEAVE ();
+  
+  return FALSE;
+}
+
+static void
+gdk_window_schedule_update (GdkWindow *window)
+{
+  if (window && GDK_WINDOW_OBJECT (window)->update_freeze_count)
+    return;
+
+  if (!update_idle)
+    {
+      update_idle = g_idle_add_full (GDK_PRIORITY_REDRAW,
+				     gdk_window_update_idle, NULL, NULL);
+    }
+}
+
 static void
 gdk_window_process_updates_internal (GdkWindow *window)
 {
@@ -2096,7 +2118,13 @@ gdk_window_process_all_updates (void)
   
   while (tmp_list)
     {
-      gdk_window_process_updates_internal (tmp_list->data);
+      GdkWindowObject *private = (GdkWindowObject *)tmp_list->data;
+      
+      if (private->update_freeze_count)
+	update_windows = g_slist_prepend (update_windows, private);
+      else
+	gdk_window_process_updates_internal (tmp_list->data);
+      
       g_object_unref (tmp_list->data);
       tmp_list = tmp_list->next;
     }
@@ -2106,16 +2134,6 @@ gdk_window_process_all_updates (void)
   flush_all_displays ();
 }
 
-static gboolean
-gdk_window_update_idle (gpointer data)
-{
-  GDK_THREADS_ENTER ();
-  gdk_window_process_all_updates ();
-  GDK_THREADS_LEAVE ();
-  
-  return FALSE;
-}
-
 /**
  * gdk_window_process_updates:
  * @window: a #GdkWindow
@@ -2140,7 +2158,7 @@ gdk_window_process_updates (GdkWindow *w
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
   
-  if (private->update_area)
+  if (private->update_area && !private->freeze_count)
     {      
       gdk_window_process_updates_internal (window);
       update_windows = g_slist_remove (update_windows, window);
@@ -2285,9 +2303,7 @@ gdk_window_invalidate_maybe_recurse (Gdk
 	  update_windows = g_slist_prepend (update_windows, window);
 	  private->update_area = gdk_region_copy (visible_region);
 	  
-	  if (!private->update_freeze_count && !update_idle)
-	    update_idle = g_idle_add_full (GDK_PRIORITY_REDRAW,
-					   gdk_window_update_idle, NULL, NULL);
+	  gdk_window_schedule_update (window);
 	}
       
       if (child_func)
@@ -2459,10 +2475,8 @@ gdk_window_thaw_updates (GdkWindow *wind
   g_return_if_fail (GDK_IS_WINDOW (window));
   g_return_if_fail (private->update_freeze_count > 0);
 
-  private->update_freeze_count--;
-  if (!private->update_freeze_count && private->update_area && !update_idle)
-    update_idle = g_idle_add_full (GDK_PRIORITY_REDRAW,
-				   gdk_window_update_idle, NULL, NULL);
+  if (--private->update_freeze_count == 0)
+    gdk_window_schedule_update (window);
 }
 
 /**
