[PATCH libX11] include: Add GetReqSized() for request buffers of specific size
Peter Hutterer
peter.hutterer at who-t.net
Thu Oct 13 22:17:45 PDT 2011
Some XI2 requests change in size over different versions and libXi would
need to hack around GetReq and GetReqExtra. Add a new GetReqSized so the
library can explicitly specify the size of the request in 4-byte units.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
Instead of hacking around in libXi with GetReq, let's just add a new macro.
include/X11/Xlibint.h | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h
index 2ce356d..083498f 100644
--- a/include/X11/Xlibint.h
+++ b/include/X11/Xlibint.h
@@ -478,6 +478,31 @@ extern LockInfoPtr _Xglobal_lock;
dpy->request++
#endif
+/* GetReqSized is the same as GetReq but allows the caller to specify the
+ * size in 4-byte units */
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define GetReqSized(name, sz, req) \
+ WORD64ALIGN\
+ if ((dpy->bufptr + sz * 4) > dpy->bufmax)\
+ _XFlush(dpy);\
+ req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\
+ req->reqType = X_##name;\
+ req->length = sz; \
+ dpy->bufptr += sz * 4;\
+ dpy->request++
+#else
+#define GetReqSized(name, sz, req) \
+ WORD64ALIGN\
+ if ((dpy->bufptr + sz * 4) > dpy->bufmax)\
+ _XFlush(dpy);\
+ req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
+ req->reqType = X_/**/name;\
+ req->length = sz; \
+ dpy->bufptr += sz * 4; \
+ dpy->request++
+#endif
+
+
/*
* GetResReq is for those requests that have a resource ID
--
1.7.6.4
More information about the xorg-devel
mailing list