aboutsummaryrefslogtreecommitdiff
path: root/libX11/include/X11/Xlibint.h
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-11-09 16:58:33 +0100
committermarha <marha@users.sourceforge.net>2011-11-09 16:58:33 +0100
commita8e5f06fe01732fbd643bc435dd3b8eaa602defe (patch)
treeb18cd9881bc5a6d317edca6c38fa912bade00802 /libX11/include/X11/Xlibint.h
parent1ed503a856d9753a813951796bc6ba56c42ecd28 (diff)
downloadvcxsrv-a8e5f06fe01732fbd643bc435dd3b8eaa602defe.tar.gz
vcxsrv-a8e5f06fe01732fbd643bc435dd3b8eaa602defe.tar.bz2
vcxsrv-a8e5f06fe01732fbd643bc435dd3b8eaa602defe.zip
libX11 mesa pixman git update 9 nov 2011
Diffstat (limited to 'libX11/include/X11/Xlibint.h')
-rw-r--r--libX11/include/X11/Xlibint.h101
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