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.
This commit is contained in:
Alexander Larsson 2009-01-27 16:43:03 +01:00 committed by Alexander Larsson
parent de2d5f299d
commit d9fcda1072
3 changed files with 38 additions and 24 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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,