1/*
2 *
3 * Copyright © 2002 Keith Packard
4 *
5 * Permission to use, copy, modify, distribute, and sell this software and its
6 * documentation for any purpose is hereby granted without fee, provided that
7 * the above copyright notice appear in all copies and that both that
8 * copyright notice and this permission notice appear in supporting
9 * documentation, and that the name of Keith Packard not be used in
10 * advertising or publicity pertaining to distribution of the software without
11 * specific, written prior permission.  Keith Packard makes no
12 * representations about the suitability of this software for any purpose.  It
13 * is provided "as is" without express or implied warranty.
14 *
15 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21 * PERFORMANCE OF THIS SOFTWARE.
22 */
23
24#ifdef HAVE_CONFIG_H
25#include <config.h>
26#endif
27#include "Xrenderint.h"
28
29Cursor
30XRenderCreateCursor (Display	    *dpy,
31		     Picture	    source,
32		     unsigned int   x,
33		     unsigned int   y)
34{
35    XRenderExtDisplayInfo	*info = XRenderFindDisplay (dpy);
36    Cursor			cid;
37    xRenderCreateCursorReq	*req;
38
39    RenderCheckExtension (dpy, info, 0);
40    LockDisplay(dpy);
41    GetReq(RenderCreateCursor, req);
42    req->reqType = (CARD8) info->codes->major_opcode;
43    req->renderReqType = X_RenderCreateCursor;
44    req->cid = (CARD32) (cid = XAllocID (dpy));
45    req->src = (CARD32) source;
46    req->x = (CARD16) x;
47    req->y = (CARD16) y;
48
49    UnlockDisplay(dpy);
50    SyncHandle();
51    return cid;
52}
53
54Cursor
55XRenderCreateAnimCursor (Display	*dpy,
56			 int		ncursor,
57			 XAnimCursor	*cursors)
58{
59    XRenderExtDisplayInfo	*info = XRenderFindDisplay (dpy);
60    Cursor			cid;
61    xRenderCreateAnimCursorReq	*req;
62    long			len;
63
64    RenderCheckExtension (dpy, info, 0);
65    LockDisplay(dpy);
66    GetReq(RenderCreateAnimCursor, req);
67    req->reqType = (CARD8) info->codes->major_opcode;
68    req->renderReqType = X_RenderCreateAnimCursor;
69    req->cid = (CARD32) (cid = XAllocID (dpy));
70
71    len = (long) ncursor * SIZEOF (xAnimCursorElt) >> 2;
72    SetReqLen (req, len, len);
73    len <<= 2;
74    Data32 (dpy, (long *) cursors, len);
75
76    UnlockDisplay(dpy);
77    SyncHandle();
78    return cid;
79}
80