New version of xfixes with client side cursor support

David Reveman davidr at
Tue Feb 20 01:50:39 PST 2007

On Mon, 2007-02-19 at 10:01 -0800, Keith Packard wrote: 
> On Mon, 2007-02-19 at 10:17 +0100, David Reveman wrote:
> > I still think it's the same problem. Compositing managers can't be sure
> > that they're painting the correct window contents at a specific location
> > on the screen in the same way that NameCursorPixmap doesn't allow you to
> > paint the core pointer cursor contents at the right spot.
> The window case is just temporal shift; it's the right window, but
> perhaps with stale contents. For the cursor, it's likely to be the wrong
> cursor entirely.

I think we look at this in two different ways. The request name should
probably have been NameCursorImagePixmap as it was never intended to
name the pixmap for a specific cursor but rather the image currently
used as cursor for the core pointer so there's no right or wrong cursor,
it's just that image. But I understand that this is not good enough.

However, having it actually name a specific cursor instead should be
good enough. Even if it's just naming the current cursor as the cursor
serial could be used to make sure that we're not drawing the wrong
cursor at the wrong spot.

This client side code should do it:

cursorChanged ()
pixmap = findCursorPixmapWithSerial (cursorSerial);
if (!pixmap)
    /* cursor is not bound to a pixmap */

    XGrabServer (dpy);

    image = XFixesGetCursorImage (dpy);

    /* current cursor changed, ignore this cursor change */
    if (image->cursor_serial != cursorSerial)
        XUngrabServer (dpy);

    /* bind cursor with cursorSerial to pixmap */
    pixmap = XFixesNameCursorPixmap (dpy, root);

    XUngrabServer (dpy);

    addCursorPixmapWithSerial (pixmap, cursorSerial);

updateCursor (pixmap);

I don't think there's any way to know when a cursor serial no longer
exist but simply just keeping the last 20 or so used cursors bound
should be good enough.

What do you think?

- David

More information about the xorg mailing list