[Xcb] xcb_map_window flickering

Niklas Hambüchen nh2 at deditus.de
Fri Jun 25 14:50:37 PDT 2010


Hi all!

I recently was annoyed that, whenever I open a new window or switch
workspaces in the i3 window manager, there is a short, fast flickering
in that window. Usually, it is white and consists of at least one white
rectangle with the width of the window and about 1/4 of its height that
flashes up and disappears.

After some research in the i3 code, I found the following code snipped
and inserted some sleeps:

/*
 * Map the client, correctly restoring any state needed.
 *
 */
void client_map(xcb_connection_t *conn, Client *client) {
        /* Set WM_STATE_NORMAL because GTK applications don’t want to
drag & drop if we don’t.
         * Also, xprop(1) needs that to work. */
        long data[] = { XCB_WM_STATE_NORMAL, XCB_NONE };
        xcb_change_property(conn, XCB_PROP_MODE_REPLACE, client->child,
atoms[WM_STATE], atoms[WM_STATE], 32, 2, data);

#include <unistd.h>
DLOG("Before the pre-map flush\n");
sleep(1);

        xcb_flush(conn);

DLOG("after the pre-map flush, before the map\n");
sleep(1);

        xcb_map_window(conn, client->frame);

DLOG("after the map, before the flush\n");
sleep(1);

        xcb_flush(conn);

DLOG("after the flush\n");  // Flickering happens exactly when that line
appears
sleep(1);                   // it's very short, only some milliseconds
long and only one white flash
}

So it seems that the flickering is created somewhere in xcb_map_window().

I continued and checked whether that problem exists in other
non-composited window managers using Xcb. There is exactly the same
problem with awesome:
Switching fast between two workspaces with one urxvt terminal on each
ath the same place make stripes in the background color appear over the
scroll bar for a short time; xli flickers white; gnome-terminal is even
worse.

It looks like something paints some background colour rectangle which is
overdrawn by the actual window contents - but no idea where those
partial flashes come from.

I tried that on xf86-video-intel and nvidia-proprietary, on the native
machine and on Xephyr; it behaves exactly the same so I don't think it's
a driver problem.

Has somebody an idea? Perhaps it is even a crazy feature?

Greetings!

PS: I would really like to make a video of this but due to the nature of
the problem, recordmydesktop seems unable to record things happening
inside a xcb_flush.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/xcb/attachments/20100625/9f1bd875/attachment.pgp>


More information about the Xcb mailing list