[cairo] Screen* must be known in Xlib backend

Keith Packard keithp at keithp.com
Tue Jul 19 14:55:16 PDT 2005


On Tue, 2005-07-19 at 14:38 -0400, Owen Taylor wrote:

> An obvious question is whether we should be using a Screen * here or a
> screen number.

I used Screen * because it can be statically typechecked.

> So a using a screen number (just like Xft) would have been my expectation.

I can change this if you're really adamant, but I do like to encourage
type-safe interfaces where possible...

> So the right check is:
> 
> -               if (src->dpy == dst->dpy && !_surfaces_compatible (src, dst))
> +               /* If the source and destination are for the same screen,
> +                * then we can go ahead and check for compatibility now. Otherwise,
> +                * we have to wait until _cairo_xlib_surface_clone_similar() does
> +                * its work */
> +               if (src->dpy == dst->dpy && src->screen == dst->screen &&
> +                   !_surfaces_compatible (src, dst))

I've changed this to use:


                /* If these are on the same screen but otherwise incompatible,
                 * make a copy as core drawing can't cross depths and doesn't
                 * work rightacross visuals of the same depth
                 */
                if (_cairo_xlib_surface_same_screen (dst, src) &&
                    !_surfaces_compatible (dst, src))
                    return DO_UNSUPPORTED;

With _cairo_xlib_surface_same_screen implemented as:

/*
 * Return whether two xlib surfaces share the same
 * screen.  Both core and Render drawing require this
 * when using multiple drawables in an operation.
 */
static cairo_bool_t
_cairo_xlib_surface_same_screen (cairo_xlib_surface_t *dst,
                                 cairo_xlib_surface_t *src)
{
    return dst->dpy == src->dpy && dst->screen == src->screen;
}

Thanks, Owen.

-keith

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050719/0132582f/attachment.pgp


More information about the cairo mailing list