[gtk+/client-side-windows: 253/284] Clear background on expose with no EXPOSURE_MASK



commit 7d51b4179d1974ffec96ba7901cdee82e80e1c75
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Feb 5 15:38:51 2009 +0100

    Clear background on expose with no EXPOSURE_MASK
    
    Apps that set no exposure mask rely on the system clearing things
    to the window background, so we need to do this ourselves.
    
    Also, don't do this on foreign windows, as they are not controlled
    by us. In fact don't do exposes on foreign windows either.
---
 gdk/gdkwindow.c |   44 ++++++++++++++++++++++++++++++--------------
 1 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index a6e2696..1245e57 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -4443,21 +4443,37 @@ _gdk_window_process_updates_recurse (GdkWindow *window,
       gdk_region_destroy (child_region);
     }
 
-  if (private->event_mask & GDK_EXPOSURE_MASK &&
-      !gdk_region_empty (expose_region))
+  if (!gdk_region_empty (expose_region) &&
+      private->window_type != GDK_WINDOW_FOREIGN)
     {
-      GdkEvent event;
-      
-      event.expose.type = GDK_EXPOSE;
-      event.expose.window = g_object_ref (window);
-      event.expose.send_event = FALSE;
-      event.expose.count = 0;
-      event.expose.region = expose_region;
-      gdk_region_get_clipbox (expose_region, &event.expose.area);
-      
-      (*_gdk_event_func) (&event, _gdk_event_data);
-      
-      g_object_unref (window);
+      if (private->event_mask & GDK_EXPOSURE_MASK)
+	{
+	  GdkEvent event;
+	  
+	  event.expose.type = GDK_EXPOSE;
+	  event.expose.window = g_object_ref (window);
+	  event.expose.send_event = FALSE;
+	  event.expose.count = 0;
+	  event.expose.region = expose_region;
+	  gdk_region_get_clipbox (expose_region, &event.expose.area);
+	  
+	  (*_gdk_event_func) (&event, _gdk_event_data);
+	  
+	  g_object_unref (window);
+	}
+      else
+	{
+	  /* No exposure mask set, so nothing will be drawn, the
+	   * app relies on the background being what it specified
+	   * for the window. So, we need to clear this manually.
+	   *
+	   * We use begin/end_paint around the clear so that we can
+	   * piggyback on the implicit paint */
+	  
+	  gdk_window_begin_paint_region (window, expose_region);
+	  gdk_window_clear_region_internal (window, expose_region, FALSE);
+	  gdk_window_end_paint (window);
+	}
     }
 }
 



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