[gtk+/client-side-windows: 84/284] Send expose events to exposed area when changing the window shape



commit 78bbac87edbd984717782c303b02862a81372a80
Author: Alexander Larsson <alex localhost localdomain>
Date:   Fri Jan 16 15:09:39 2009 +0100

    Send expose events to exposed area when changing the window shape
---
 gdk/gdkwindow.c |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 1555e4a..dd99982 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -6382,6 +6382,7 @@ gdk_window_shape_combine_region (GdkWindow       *window,
                                  gint             offset_y)
 {
   GdkWindowObject *private;
+  GdkRegion *old_region, *new_region, *diff;
 
   g_return_if_fail (GDK_IS_WINDOW (window));
 
@@ -6394,6 +6395,10 @@ gdk_window_shape_combine_region (GdkWindow       *window,
 
   if (private->shape)
     gdk_region_destroy (private->shape);
+  
+  old_region = NULL;
+  if (GDK_WINDOW_IS_MAPPED (window))
+    old_region = gdk_region_copy (private->clip_region);
 
   if (shape_region)
     {
@@ -6404,6 +6409,37 @@ gdk_window_shape_combine_region (GdkWindow       *window,
     private->shape = NULL;
   
   recompute_visible_regions (private, TRUE, FALSE);
+
+  if (old_region)
+    {
+      new_region = gdk_region_copy (private->clip_region);
+
+      /* New area in the window, needs invalidation */
+      diff = gdk_region_copy (new_region);
+      gdk_region_subtract (diff, old_region);
+
+      gdk_window_invalidate_region (window, diff, TRUE);
+
+      gdk_region_destroy (diff);
+
+      if (private->parent != NULL &&
+	  GDK_WINDOW_TYPE (private->parent) != GDK_WINDOW_ROOT)
+	{
+	  /* New area in the non-root parent window, needs invalidation */
+	  diff = gdk_region_copy (old_region);
+	  gdk_region_subtract (diff, new_region);
+	  
+	  /* Adjust region to parent window coords */
+	  gdk_region_offset (diff, private->x, private->y);
+	  
+	  gdk_window_invalidate_region (GDK_WINDOW (private->parent), diff, TRUE);
+	  
+	  gdk_region_destroy (diff);
+	}
+
+      gdk_region_destroy (new_region);
+      gdk_region_destroy (old_region);
+    }
 }
 
 static void



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