|
|
1.1 ! root 1: #include <X/mit-copyright.h> ! 2: ! 3: /* $Header: XCreateCursor.c,v 10.5 86/02/01 15:31:11 tony Rel $ */ ! 4: /* Copyright Massachusetts Institute of Technology 1985 */ ! 5: ! 6: #include "XlibInternal.h" ! 7: Cursor XCreateCursor (width, height, cursor, mask, xOffset, yOffset, ! 8: foreground, background, func) ! 9: short *cursor, *mask; ! 10: int width, height; ! 11: int xOffset, yOffset; ! 12: int func; ! 13: int foreground, background; ! 14: { ! 15: register Display *dpy; ! 16: register XReq *req; ! 17: XRep rep; ! 18: Bitmap cbitmap, mbitmap = 0; ! 19: int nbytes = BitmapSize (width, height); ! 20: Status status; ! 21: ! 22: GetReq(X_StoreBitmap, 0); ! 23: req->param.s[0] = height; ! 24: req->param.s[1] = width; ! 25: Data (dpy, (char *)cursor, nbytes); ! 26: ! 27: if (mask) { ! 28: GetReq(X_StoreBitmap, 0); ! 29: req->param.s[0] = height; ! 30: req->param.s[1] = width; ! 31: Data (dpy, (char *)mask, nbytes); ! 32: dpy->request--; /* to synchronize properly with XError packets */ ! 33: } ! 34: ! 35: cbitmap = _XReply (dpy, &rep) ? rep.param.l[0] : 0; ! 36: ! 37: if (mask) { ! 38: dpy->request++; ! 39: mbitmap = _XReply (dpy, &rep) ? rep.param.l[0] : 0; ! 40: } ! 41: ! 42: if (!cbitmap || (mask && !mbitmap)) { ! 43: /* an error occurred. Clean up and return. */ ! 44: if (cbitmap) ! 45: XFreeBitmap (cbitmap); ! 46: if (mbitmap) ! 47: XFreeBitmap (mbitmap); ! 48: return (0); ! 49: } ! 50: ! 51: GetReq(X_StoreCursor, 0); ! 52: req->func = func; ! 53: req->param.l[0] = cbitmap; ! 54: req->param.s[2] = foreground; ! 55: req->param.s[3] = background; ! 56: req->param.l[2] = mbitmap; ! 57: req->param.s[6] = xOffset; ! 58: req->param.s[7] = yOffset; ! 59: status = _XReply (dpy, &rep); ! 60: XFreeBitmap (cbitmap); ! 61: if (mbitmap) ! 62: XFreeBitmap (mbitmap); ! 63: return (status ? rep.param.l[0] : 0); ! 64: } ! 65:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.