diff options
author | marha <marha@users.sourceforge.net> | 2011-11-09 17:05:56 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-11-09 17:05:56 +0100 |
commit | 72d7f8d5af476f12dc75eab4fa9d59364cbec190 (patch) | |
tree | 1efac13a52811bfd28ae51538b15f87cbfaf8939 /libX11/include/X11/Xlibint.h | |
parent | a3d796bcc7de83fd88b42e09c6a82a8df4f9b836 (diff) | |
parent | a8e5f06fe01732fbd643bc435dd3b8eaa602defe (diff) | |
download | vcxsrv-72d7f8d5af476f12dc75eab4fa9d59364cbec190.tar.gz vcxsrv-72d7f8d5af476f12dc75eab4fa9d59364cbec190.tar.bz2 vcxsrv-72d7f8d5af476f12dc75eab4fa9d59364cbec190.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
mesalib/src/mapi/glapi/glapi.h
Diffstat (limited to 'libX11/include/X11/Xlibint.h')
-rw-r--r-- | libX11/include/X11/Xlibint.h | 101 |
1 files changed, 34 insertions, 67 deletions
diff --git a/libX11/include/X11/Xlibint.h b/libX11/include/X11/Xlibint.h index 2ce356d15..80edeec9a 100644 --- a/libX11/include/X11/Xlibint.h +++ b/libX11/include/X11/Xlibint.h @@ -420,6 +420,30 @@ extern LockInfoPtr _Xglobal_lock; #define WORD64ALIGN #endif /* WORD64 */ +/** + * Return a len-sized request buffer for the request type. This function may + * flush the output queue. + * + * @param dpy The display connection + * @param type The request type + * @param len Length of the request in bytes + * + * @returns A pointer to the request buffer with a few default values + * initialized. + */ +extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len); + +/* GetReqSized is the same as GetReq but allows the caller to specify the + * size in bytes. 'sz' must be a multiple of 4! */ + +#if !defined(UNIXCPP) || defined(ANSICPP) +#define GetReqSized(name, sz, req) \ + req = (x##name##Req *) _XGetRequest(dpy, X_##name, sz) +#else +#define GetReqSized(name, sz, req) \ + req = (x/**/name/**/Req *) _XGetRequest(dpy, X_/**/name, sz) +#endif + /* * GetReq - Get the next available X request packet in the buffer and @@ -432,25 +456,10 @@ extern LockInfoPtr _Xglobal_lock; #if !defined(UNIXCPP) || defined(ANSICPP) #define GetReq(name, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\ - req->reqType = X_##name;\ - req->length = (SIZEOF(x##name##Req))>>2;\ - dpy->bufptr += SIZEOF(x##name##Req);\ - dpy->request++ - + GetReqSized(name, SIZEOF(x##name##Req), req) #else /* non-ANSI C uses empty comment instead of "##" for token concatenation */ #define GetReq(name, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ - req->reqType = X_/**/name;\ - req->length = (SIZEOF(x/**/name/**/Req))>>2;\ - dpy->bufptr += SIZEOF(x/**/name/**/Req);\ - dpy->request++ + GetReqSized(name, SIZEOF(x/**/name/**/Req), req) #endif /* GetReqExtra is the same as GetReq, but allocates "n" additional @@ -458,24 +467,10 @@ extern LockInfoPtr _Xglobal_lock; #if !defined(UNIXCPP) || defined(ANSICPP) #define GetReqExtra(name, n, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(x##name##Req) + n) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\ - req->reqType = X_##name;\ - req->length = (SIZEOF(x##name##Req) + n)>>2;\ - dpy->bufptr += SIZEOF(x##name##Req) + n;\ - dpy->request++ + GetReqSized(name, SIZEOF(x##name##Req) + n, req) #else #define GetReqExtra(name, n, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(x/**/name/**/Req) + n) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ - req->reqType = X_/**/name;\ - req->length = (SIZEOF(x/**/name/**/Req) + n)>>2;\ - dpy->bufptr += SIZEOF(x/**/name/**/Req) + n;\ - dpy->request++ + GetReqSized(name, SIZEOF(x/**/name/**/Req) + n, req) #endif @@ -487,26 +482,12 @@ extern LockInfoPtr _Xglobal_lock; #if !defined(UNIXCPP) || defined(ANSICPP) #define GetResReq(name, rid, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\ - req->reqType = X_##name;\ - req->length = 2;\ - req->id = (rid);\ - dpy->bufptr += SIZEOF(xResourceReq);\ - dpy->request++ + req = (xResourceReq *) _XGetRequest(dpy, X_##name, SIZEOF(xResourceReq)); \ + req->id = (rid) #else #define GetResReq(name, rid, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\ - req->reqType = X_/**/name;\ - req->length = 2;\ - req->id = (rid);\ - dpy->bufptr += SIZEOF(xResourceReq);\ - dpy->request++ + req = (xResourceReq *) _XGetRequest(dpy, X_/**/name, SIZEOF(xResourceReq)); \ + req->id = (rid) #endif /* @@ -515,24 +496,10 @@ extern LockInfoPtr _Xglobal_lock; */ #if !defined(UNIXCPP) || defined(ANSICPP) #define GetEmptyReq(name, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (xReq *) (dpy->last_req = dpy->bufptr);\ - req->reqType = X_##name;\ - req->length = 1;\ - dpy->bufptr += SIZEOF(xReq);\ - dpy->request++ + req = (xReq *) _XGetRequest(dpy, X_##name, SIZEOF(xReq)) #else #define GetEmptyReq(name, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (xReq *) (dpy->last_req = dpy->bufptr);\ - req->reqType = X_/**/name;\ - req->length = 1;\ - dpy->bufptr += SIZEOF(xReq);\ - dpy->request++ + req = (xReq *) _XGetRequest(dpy, X_/**/name, SIZEOF(xReq)) #endif #ifdef WORD64 |