|
|
BSD 4.3
#include <X/mit-copyright.h>
/* $Header: /var/lib/cvsd/repos/CSRG/43BSD/contrib/X/Xlib/XCreateCursor.c,v 1.1.1.1 2018/04/24 16:12:54 root Exp $ */
/* Copyright Massachusetts Institute of Technology 1985 */
#include "XlibInternal.h"
Cursor XCreateCursor (width, height, cursor, mask, xOffset, yOffset,
foreground, background, func)
short *cursor, *mask;
int width, height;
int xOffset, yOffset;
int func;
int foreground, background;
{
register Display *dpy;
register XReq *req;
XRep rep;
Bitmap cbitmap, mbitmap = 0;
int nbytes = BitmapSize (width, height);
Status status;
GetReq(X_StoreBitmap, 0);
req->param.s[0] = height;
req->param.s[1] = width;
Data (dpy, (char *)cursor, nbytes);
if (mask) {
GetReq(X_StoreBitmap, 0);
req->param.s[0] = height;
req->param.s[1] = width;
Data (dpy, (char *)mask, nbytes);
dpy->request--; /* to synchronize properly with XError packets */
}
cbitmap = _XReply (dpy, &rep) ? rep.param.l[0] : 0;
if (mask) {
dpy->request++;
mbitmap = _XReply (dpy, &rep) ? rep.param.l[0] : 0;
}
if (!cbitmap || (mask && !mbitmap)) {
/* an error occurred. Clean up and return. */
if (cbitmap)
XFreeBitmap (cbitmap);
if (mbitmap)
XFreeBitmap (mbitmap);
return (0);
}
GetReq(X_StoreCursor, 0);
req->func = func;
req->param.l[0] = cbitmap;
req->param.s[2] = foreground;
req->param.s[3] = background;
req->param.l[2] = mbitmap;
req->param.s[6] = xOffset;
req->param.s[7] = yOffset;
status = _XReply (dpy, &rep);
XFreeBitmap (cbitmap);
if (mbitmap)
XFreeBitmap (mbitmap);
return (status ? rep.param.l[0] : 0);
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.