11f0ac6a5Smrg/*
21f0ac6a5Smrg *
31f0ac6a5Smrg * Copyright © 2002 Keith Packard
41f0ac6a5Smrg *
51f0ac6a5Smrg * Permission to use, copy, modify, distribute, and sell this software and its
61f0ac6a5Smrg * documentation for any purpose is hereby granted without fee, provided that
71f0ac6a5Smrg * the above copyright notice appear in all copies and that both that
81f0ac6a5Smrg * copyright notice and this permission notice appear in supporting
91f0ac6a5Smrg * documentation, and that the name of Keith Packard not be used in
101f0ac6a5Smrg * advertising or publicity pertaining to distribution of the software without
111f0ac6a5Smrg * specific, written prior permission.  Keith Packard makes no
121f0ac6a5Smrg * representations about the suitability of this software for any purpose.  It
131f0ac6a5Smrg * is provided "as is" without express or implied warranty.
141f0ac6a5Smrg *
151f0ac6a5Smrg * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
161f0ac6a5Smrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
171f0ac6a5Smrg * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
181f0ac6a5Smrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
191f0ac6a5Smrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
201f0ac6a5Smrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
211f0ac6a5Smrg * PERFORMANCE OF THIS SOFTWARE.
221f0ac6a5Smrg */
231f0ac6a5Smrg
241f0ac6a5Smrg#ifdef HAVE_CONFIG_H
251f0ac6a5Smrg#include <config.h>
261f0ac6a5Smrg#endif
271f0ac6a5Smrg#include "Xrenderint.h"
281f0ac6a5Smrg
291f0ac6a5SmrgCursor
301f0ac6a5SmrgXRenderCreateCursor (Display	    *dpy,
311f0ac6a5Smrg		     Picture	    source,
321f0ac6a5Smrg		     unsigned int   x,
331f0ac6a5Smrg		     unsigned int   y)
341f0ac6a5Smrg{
35d21ab8bcSmrg    XRenderExtDisplayInfo	*info = XRenderFindDisplay (dpy);
361f0ac6a5Smrg    Cursor			cid;
371f0ac6a5Smrg    xRenderCreateCursorReq	*req;
381f0ac6a5Smrg
391f0ac6a5Smrg    RenderCheckExtension (dpy, info, 0);
401f0ac6a5Smrg    LockDisplay(dpy);
411f0ac6a5Smrg    GetReq(RenderCreateCursor, req);
42d21ab8bcSmrg    req->reqType = (CARD8) info->codes->major_opcode;
431f0ac6a5Smrg    req->renderReqType = X_RenderCreateCursor;
44d21ab8bcSmrg    req->cid = (CARD32) (cid = XAllocID (dpy));
45d21ab8bcSmrg    req->src = (CARD32) source;
46d21ab8bcSmrg    req->x = (CARD16) x;
47d21ab8bcSmrg    req->y = (CARD16) y;
486fae4e5dSmrg
491f0ac6a5Smrg    UnlockDisplay(dpy);
501f0ac6a5Smrg    SyncHandle();
511f0ac6a5Smrg    return cid;
521f0ac6a5Smrg}
531f0ac6a5Smrg
541f0ac6a5SmrgCursor
551f0ac6a5SmrgXRenderCreateAnimCursor (Display	*dpy,
561f0ac6a5Smrg			 int		ncursor,
571f0ac6a5Smrg			 XAnimCursor	*cursors)
581f0ac6a5Smrg{
59d21ab8bcSmrg    XRenderExtDisplayInfo	*info = XRenderFindDisplay (dpy);
601f0ac6a5Smrg    Cursor			cid;
611f0ac6a5Smrg    xRenderCreateAnimCursorReq	*req;
621f0ac6a5Smrg    long			len;
631f0ac6a5Smrg
641f0ac6a5Smrg    RenderCheckExtension (dpy, info, 0);
651f0ac6a5Smrg    LockDisplay(dpy);
661f0ac6a5Smrg    GetReq(RenderCreateAnimCursor, req);
67d21ab8bcSmrg    req->reqType = (CARD8) info->codes->major_opcode;
681f0ac6a5Smrg    req->renderReqType = X_RenderCreateAnimCursor;
69d21ab8bcSmrg    req->cid = (CARD32) (cid = XAllocID (dpy));
706fae4e5dSmrg
711f0ac6a5Smrg    len = (long) ncursor * SIZEOF (xAnimCursorElt) >> 2;
721f0ac6a5Smrg    SetReqLen (req, len, len);
731f0ac6a5Smrg    len <<= 2;
741f0ac6a5Smrg    Data32 (dpy, (long *) cursors, len);
756fae4e5dSmrg
761f0ac6a5Smrg    UnlockDisplay(dpy);
771f0ac6a5Smrg    SyncHandle();
781f0ac6a5Smrg    return cid;
791f0ac6a5Smrg}
80