[PATCH] ephyr: Properly implement hardware cursors

Keith Packard keithp at keithp.com
Thu Aug 21 08:07:07 PDT 2014


Adam Jackson <ajax at redhat.com> writes:

> Technique is basically the same as in Xnest, just create a new cursor on
> the host server every time.  Could be optimized to remember cursors on
> the host and merely switch among them, if someone's feeling
> adventurous.

Could I convince you to add a check for ARGB cursor support on the
target display? That's just a check for Render 0.5 or newer, and then
falling back to the core cursor path -- DIX already computes a valid
core cursor for you, so it's pretty easy.


> +xcb_gcontext_t
> +hostx_get_cursor_gc(void)
> +{
> +    uint32_t mask = XCB_GC_FUNCTION |
> +                    XCB_GC_PLANE_MASK |
> +                    XCB_GC_FOREGROUND |
> +                    XCB_GC_BACKGROUND |
> +                    XCB_GC_CLIP_MASK;
> +    uint32_t val[] = {
> +        XCB_GX_COPY,    /* function */
> +        ~0,             /* planemask */
> +        1L,             /* foreground */
> +        0L,             /* background */
> +        None,           /* clipmask */
> +    };
> +
> +    if (HostX.curgc == None) {
> +        xcb_pixmap_t p = xcb_generate_id(HostX.conn);
> +        HostX.curgc = xcb_generate_id(HostX.conn);
> +
> +        xcb_create_pixmap(HostX.conn, 1, p, HostX.winroot /* XXX */,
> +                          1, 1);
> +        xcb_create_gc(HostX.conn, HostX.curgc, p, mask, val);
> +        xcb_free_pixmap(HostX.conn, p);
> +    }
> +
> +    return HostX.curgc;
> +}

Seems like it would be a bunch shorter to just pass in a suitable pixmap
(which you already have) than create another one here?

> +xcb_render_pictformat_t
> +hostx_get_argb_format(void)

Sigh. Would be nice if there were utility functions similar to those in
libXrender available for xcb. But, whatever.

This does point out that the DDX doesn't get to hear about animated
cursors. We could do this pretty easily; would that be fun here?

In any case, the rest of the code looks like good stuff and is

Reviewed-by: Keith Packard <keithp at keithp.com>

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 810 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20140821/da99447d/attachment.sig>


More information about the xorg-devel mailing list