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 the window won't be visible anyway and thus it will be shaped
to nothing */ 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), XMoveResizeWindow (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window), GDK_WINDOW_XID (window),
obj->x + obj->parent->abs_x, obj->x + obj->parent->abs_x,
obj->y + obj->parent->abs_y, obj->y + obj->parent->abs_y,
width, height); 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 static Bool

View File

@ -299,16 +299,16 @@ _gdk_x11_window_tmp_unset_bg (GdkWindow *window,
} }
void void
_gdk_x11_window_tmp_unset_parent_bg (GdkWindow *window, _gdk_x11_window_tmp_unset_parent_bg (GdkWindow *window)
gboolean recurse)
{ {
GdkWindowObject *private; GdkWindowObject *private;
private = (GdkWindowObject*) window; private = (GdkWindowObject*) window;
if (GDK_WINDOW_TYPE (private->parent) != GDK_WINDOW_ROOT) if (GDK_WINDOW_TYPE (private->parent) == GDK_WINDOW_ROOT)
window = _gdk_window_get_impl_window ((GdkWindow *)private->parent); return;
_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 void
@ -343,16 +343,17 @@ _gdk_x11_window_tmp_reset_bg (GdkWindow *window,
} }
void void
_gdk_x11_window_tmp_reset_parent_bg (GdkWindow *window, _gdk_x11_window_tmp_reset_parent_bg (GdkWindow *window)
gboolean recurse)
{ {
GdkWindowObject *private; GdkWindowObject *private;
private = (GdkWindowObject*) window; private = (GdkWindowObject*) window;
if (GDK_WINDOW_TYPE (private->parent) != GDK_WINDOW_ROOT) if (GDK_WINDOW_TYPE (private->parent) == GDK_WINDOW_ROOT)
return;
window = _gdk_window_get_impl_window ((GdkWindow *)private->parent); 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* static GdkColormap*
@ -1598,12 +1599,12 @@ gdk_window_x11_reparent (GdkWindow *window,
impl = GDK_WINDOW_IMPL_X11 (window_private->impl); impl = GDK_WINDOW_IMPL_X11 (window_private->impl);
_gdk_x11_window_tmp_unset_bg (window, TRUE); _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), XReparentWindow (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window), GDK_WINDOW_XID (window),
GDK_WINDOW_XID (new_parent), GDK_WINDOW_XID (new_parent),
parent_private->abs_x + x, parent_private->abs_y + y); 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); _gdk_x11_window_tmp_reset_bg (window, TRUE);
if (GDK_WINDOW_TYPE (new_parent) == GDK_WINDOW_FOREIGN) if (GDK_WINDOW_TYPE (new_parent) == GDK_WINDOW_FOREIGN)
@ -3401,7 +3402,10 @@ do_shape_combine_region (GdkWindow *window,
private->shaped = FALSE; private->shaped = FALSE;
if (shape == ShapeBounding) 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), XShapeCombineMask (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window), GDK_WINDOW_XID (window),
shape, shape,
@ -3409,7 +3413,10 @@ do_shape_combine_region (GdkWindow *window,
None, None,
ShapeSet); ShapeSet);
if (shape == ShapeBounding) 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);
}
} }
return; return;
} }
@ -3429,7 +3436,10 @@ do_shape_combine_region (GdkWindow *window,
&xrects, &n_rects); &xrects, &n_rects);
if (shape == ShapeBounding) 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), XShapeCombineRectangles (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window), GDK_WINDOW_XID (window),
shape, shape,
@ -3439,7 +3449,10 @@ do_shape_combine_region (GdkWindow *window,
YXBanded); YXBanded);
if (shape == ShapeBounding) 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); g_free (xrects);
} }

View File

@ -148,10 +148,8 @@ void _gdk_x11_window_tmp_unset_bg (GdkWindow *window,
gboolean recurse); gboolean recurse);
void _gdk_x11_window_tmp_reset_bg (GdkWindow *window, void _gdk_x11_window_tmp_reset_bg (GdkWindow *window,
gboolean recurse); gboolean recurse);
void _gdk_x11_window_tmp_unset_parent_bg (GdkWindow *window, void _gdk_x11_window_tmp_unset_parent_bg (GdkWindow *window);
gboolean recurse); void _gdk_x11_window_tmp_reset_parent_bg (GdkWindow *window);
void _gdk_x11_window_tmp_reset_parent_bg (GdkWindow *window,
gboolean recurse);
GdkCursor *_gdk_x11_window_get_cursor (GdkWindow *window); GdkCursor *_gdk_x11_window_get_cursor (GdkWindow *window);
void _gdk_x11_window_get_offsets (GdkWindow *window, void _gdk_x11_window_get_offsets (GdkWindow *window,