[gtk+/client-side-windows: 197/284] Don't recursively set bg none on the parent when e.g. moving children



commit d9fcda1072bd6e38cd785014cceba2865cbbd1c4
Author: Alexander Larsson <alexl redhat com>
Date:   Tue Jan 27 16:43:03 2009 +0100

    Don't recursively set bg none on the parent when e.g. moving children
    
    To avoid drawing the window background of other windows in the area
    where the window was we set the bg to none recursively. However, this
    is quite costly it the moved window has many siblings. Furthermore, it
    is uncommon that siblings overlap, so this cost has little gain.
    
    So, we only set bg None on the parent, which means that there will
    be some more flicker in the uncommon case of overlapping siblings.
---
 gdk/x11/gdkgeometry-x11.c |    7 ++++-
 gdk/x11/gdkwindow-x11.c   |   49 ++++++++++++++++++++++++++++----------------
 gdk/x11/gdkwindow-x11.h   |    6 +---
 3 files changed, 38 insertions(+), 24 deletions(-)

diff --git a/gdk/x11/gdkgeometry-x11.c b/gdk/x11/gdkgeometry-x11.c
index 891fd94..6bd71c3 100644
--- a/gdk/x11/gdkgeometry-x11.c
+++ b/gdk/x11/gdkgeometry-x11.c
@@ -201,13 +201,16 @@ _gdk_window_move_resize_child (GdkWindow *window,
      the window won't be visible anyway and thus it will be shaped
      to nothing */
 
-  _gdk_x11_window_tmp_unset_parent_bg (window, TRUE);
+  
+  _gdk_x11_window_tmp_unset_parent_bg (window);
+  _gdk_x11_window_tmp_unset_bg (window, TRUE);
   XMoveResizeWindow (GDK_WINDOW_XDISPLAY (window),
 		     GDK_WINDOW_XID (window),
 		     obj->x + obj->parent->abs_x,
 		     obj->y + obj->parent->abs_y,
 		     width, height);
-  _gdk_x11_window_tmp_reset_parent_bg (window, TRUE);
+  _gdk_x11_window_tmp_reset_parent_bg (window);
+  _gdk_x11_window_tmp_reset_bg (window, TRUE);
 }
 
 static Bool
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 204e6bf..0089d1e 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -299,16 +299,16 @@ _gdk_x11_window_tmp_unset_bg (GdkWindow *window,
 }
 
 void
-_gdk_x11_window_tmp_unset_parent_bg (GdkWindow *window,
-				     gboolean   recurse)
+_gdk_x11_window_tmp_unset_parent_bg (GdkWindow *window)
 {
   GdkWindowObject *private;
   private = (GdkWindowObject*) window;
+
+  if (GDK_WINDOW_TYPE (private->parent) == GDK_WINDOW_ROOT)
+    return;
   
-  if (GDK_WINDOW_TYPE (private->parent) != GDK_WINDOW_ROOT)
-    window = _gdk_window_get_impl_window ((GdkWindow *)private->parent);
-  
-  _gdk_x11_window_tmp_unset_bg (window,	recurse);
+  window = _gdk_window_get_impl_window ((GdkWindow *)private->parent);
+  _gdk_x11_window_tmp_unset_bg (window,	FALSE);
 }
 
 void
@@ -343,16 +343,17 @@ _gdk_x11_window_tmp_reset_bg (GdkWindow *window,
 }
 
 void
-_gdk_x11_window_tmp_reset_parent_bg (GdkWindow *window,
-				     gboolean   recurse)
+_gdk_x11_window_tmp_reset_parent_bg (GdkWindow *window)
 {
   GdkWindowObject *private;
   private = (GdkWindowObject*) window;
 
-  if (GDK_WINDOW_TYPE (private->parent) != GDK_WINDOW_ROOT)
-    window = _gdk_window_get_impl_window ((GdkWindow *)private->parent);
+  if (GDK_WINDOW_TYPE (private->parent) == GDK_WINDOW_ROOT)
+    return;
+  
+  window = _gdk_window_get_impl_window ((GdkWindow *)private->parent);
 
-  _gdk_x11_window_tmp_reset_bg (window, recurse);
+  _gdk_x11_window_tmp_reset_bg (window, FALSE);
 }
 
 static GdkColormap*
@@ -1598,12 +1599,12 @@ gdk_window_x11_reparent (GdkWindow *window,
   impl = GDK_WINDOW_IMPL_X11 (window_private->impl);
 
   _gdk_x11_window_tmp_unset_bg (window, TRUE);
-  _gdk_x11_window_tmp_unset_parent_bg (window, FALSE);
+  _gdk_x11_window_tmp_unset_parent_bg (window);
   XReparentWindow (GDK_WINDOW_XDISPLAY (window),
 		   GDK_WINDOW_XID (window),
 		   GDK_WINDOW_XID (new_parent),
 		   parent_private->abs_x + x, parent_private->abs_y + y);
-  _gdk_x11_window_tmp_reset_parent_bg (window, FALSE);
+  _gdk_x11_window_tmp_reset_parent_bg (window);
   _gdk_x11_window_tmp_reset_bg (window, TRUE);
 
   if (GDK_WINDOW_TYPE (new_parent) == GDK_WINDOW_FOREIGN)
@@ -3401,15 +3402,21 @@ do_shape_combine_region (GdkWindow       *window,
 	    private->shaped = FALSE;
 	  
 	  if (shape == ShapeBounding)
-	    _gdk_x11_window_tmp_unset_parent_bg (window, TRUE);
+	    {
+	      _gdk_x11_window_tmp_unset_parent_bg (window);
+	      _gdk_x11_window_tmp_unset_bg (window, TRUE);
+	    }
 	  XShapeCombineMask (GDK_WINDOW_XDISPLAY (window),
 			     GDK_WINDOW_XID (window),
 			     shape,
 			     0, 0,
 			     None,
 			     ShapeSet);
-	  if (shape == ShapeBounding)
-	    _gdk_x11_window_tmp_reset_parent_bg (window, TRUE);
+ 	  if (shape == ShapeBounding)
+	    {
+	      _gdk_x11_window_tmp_reset_parent_bg (window);
+	      _gdk_x11_window_tmp_reset_bg (window, TRUE);
+	    }
 	}
       return;
     }
@@ -3429,7 +3436,10 @@ do_shape_combine_region (GdkWindow       *window,
                                    &xrects, &n_rects);
       
       if (shape == ShapeBounding)
-	_gdk_x11_window_tmp_unset_parent_bg (window, TRUE);
+	{
+	  _gdk_x11_window_tmp_unset_parent_bg (window);
+	  _gdk_x11_window_tmp_unset_bg (window, TRUE);
+	}
       XShapeCombineRectangles (GDK_WINDOW_XDISPLAY (window),
                                GDK_WINDOW_XID (window),
                                shape,
@@ -3439,7 +3449,10 @@ do_shape_combine_region (GdkWindow       *window,
                                YXBanded);
 
       if (shape == ShapeBounding)
-	_gdk_x11_window_tmp_reset_parent_bg (window, TRUE);
+	{
+	  _gdk_x11_window_tmp_reset_parent_bg (window);
+	  _gdk_x11_window_tmp_reset_bg (window, TRUE);
+	}
       
       g_free (xrects);
     }
diff --git a/gdk/x11/gdkwindow-x11.h b/gdk/x11/gdkwindow-x11.h
index 744ff2c..0ff1b43 100644
--- a/gdk/x11/gdkwindow-x11.h
+++ b/gdk/x11/gdkwindow-x11.h
@@ -148,10 +148,8 @@ void            _gdk_x11_window_tmp_unset_bg        (GdkWindow *window,
 						     gboolean   recurse);
 void            _gdk_x11_window_tmp_reset_bg        (GdkWindow *window,
 						     gboolean   recurse);
-void            _gdk_x11_window_tmp_unset_parent_bg (GdkWindow *window,
-						     gboolean   recurse);
-void            _gdk_x11_window_tmp_reset_parent_bg (GdkWindow *window,
-						     gboolean   recurse);
+void            _gdk_x11_window_tmp_unset_parent_bg (GdkWindow *window);
+void            _gdk_x11_window_tmp_reset_parent_bg (GdkWindow *window);
 
 GdkCursor      *_gdk_x11_window_get_cursor    (GdkWindow *window);
 void            _gdk_x11_window_get_offsets   (GdkWindow *window,



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