[gtk+] Set clip region to empty for non-viewable windows



commit 3c03683e0992bf34be2a32a41fc79cf5f5c8c716
Author: Alexander Larsson <alexl redhat com>
Date:   Mon Jul 20 23:15:34 2009 +0200

    Set clip region to empty for non-viewable windows
    
    This lets us avoid lots of viewable checks and still not waste
    time computing clip regions for non-viewable windows

 gdk/gdkwindow.c |   49 +++++++++++++++++++++++++++----------------------
 1 files changed, 27 insertions(+), 22 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 8bcec54..9e64a4d 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -783,33 +783,38 @@ recompute_visible_regions_internal (GdkWindowObject *private,
    * siblings in parents above window
    */
   clip_region_changed = FALSE;
-  if (recalculate_clip && private->viewable)
+  if (recalculate_clip)
     {
-      /* Calculate visible region (sans children) in parent window coords */
-      r.x = private->x;
-      r.y = private->y;
-      r.width = private->width;
-      r.height = private->height;
-      new_clip = gdk_region_rectangle (&r);
-
-      if (private->parent != NULL &&
-	  private->parent->window_type != GDK_WINDOW_ROOT &&
-	  /* For foreign children, don't remove local parents, as parent
-	     may not be mapped yet, and the non-native parents are not really
-	     enforced for it anyways. */
-	  private->window_type != GDK_WINDOW_FOREIGN)
+      if (private->viewable)
 	{
-	  gdk_region_intersect (new_clip, private->parent->clip_region);
+	  /* Calculate visible region (sans children) in parent window coords */
+	  r.x = private->x;
+	  r.y = private->y;
+	  r.width = private->width;
+	  r.height = private->height;
+	  new_clip = gdk_region_rectangle (&r);
+
+	  if (private->parent != NULL &&
+	      private->parent->window_type != GDK_WINDOW_ROOT &&
+	      /* For foreign children, don't remove local parents, as parent
+		 may not be mapped yet, and the non-native parents are not really
+		 enforced for it anyways. */
+	      private->window_type != GDK_WINDOW_FOREIGN)
+	    {
+	      gdk_region_intersect (new_clip, private->parent->clip_region);
 
-	  /* Remove all overlapping children from parent */
-	  remove_child_area (private->parent, private, FALSE, new_clip);
-	}
+	      /* Remove all overlapping children from parent */
+	      remove_child_area (private->parent, private, FALSE, new_clip);
+	    }
 
-      /* Convert from parent coords to window coords */
-      gdk_region_offset (new_clip, -private->x, -private->y);
+	  /* Convert from parent coords to window coords */
+	  gdk_region_offset (new_clip, -private->x, -private->y);
 
-      if (private->shape)
-	gdk_region_intersect (new_clip, private->shape);
+	  if (private->shape)
+	    gdk_region_intersect (new_clip, private->shape);
+	}
+      else
+	new_clip = gdk_region_new ();
 
       if (private->clip_region == NULL ||
 	  !gdk_region_equal (private->clip_region, new_clip))



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