aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/include
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2018-08-22 22:30:34 +0200
committerUlrich Sibiller <uli42@gmx.de>2018-10-22 23:23:06 +0200
commite1938c189223164f3a75cf848e90ecc1d2e55d15 (patch)
tree01098708cb7f48349664b1d712c6a77af6bd008c /nx-X11/lib/include
parent3dc4595560b34242fe4705af8c93d0024eeb2c56 (diff)
downloadnx-libs-e1938c189223164f3a75cf848e90ecc1d2e55d15.tar.gz
nx-libs-e1938c189223164f3a75cf848e90ecc1d2e55d15.tar.bz2
nx-libs-e1938c189223164f3a75cf848e90ecc1d2e55d15.zip
libNX_X11: upgrade to X.org upstream version 1.6.6
We are at X.Org libX11 upstream commit 733f64b Fixes: ArcticaProject/nx-libs #716, #719 and #720
Diffstat (limited to 'nx-X11/lib/include')
-rw-r--r--nx-X11/lib/include/X11/Xlibint.h125
1 files changed, 122 insertions, 3 deletions
diff --git a/nx-X11/lib/include/X11/Xlibint.h b/nx-X11/lib/include/X11/Xlibint.h
index b325182e3..d38c87ee3 100644
--- a/nx-X11/lib/include/X11/Xlibint.h
+++ b/nx-X11/lib/include/X11/Xlibint.h
@@ -63,6 +63,7 @@ from The Open Group.
* Warning, there be dragons here....
*/
+#include <stdint.h>
#include <nx-X11/Xlib.h>
#include <nx-X11/Xproto.h> /* to declare xEvent */
#include <nx-X11/XlibConf.h> /* for configured options like XTHREADS */
@@ -231,10 +232,122 @@ struct _XDisplay
XGenericEventCookie * /* in */,
XGenericEventCookie * /* out*/);
void *cookiejar; /* cookie events returned but not claimed */
+#ifndef LONG64
+ unsigned long last_request_read_upper32bit;
+ unsigned long request_upper32bit;
+#endif
};
#define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n)
+/*
+ * access "last_request_read" and "request" with 64bit
+ * warning: the value argument of the SET-macros must not
+ * have any side-effects because it may get called twice.
+ */
+#ifndef LONG64
+/* accessors for 32-bit unsigned long */
+
+#define X_DPY_GET_REQUEST(dpy) \
+ ( \
+ ((uint64_t)(((struct _XDisplay*)dpy)->request)) \
+ + (((uint64_t)(((struct _XDisplay*)dpy)->request_upper32bit)) << 32) \
+ )
+
+#define X_DPY_SET_REQUEST(dpy, value) \
+ ( \
+ (((struct _XDisplay*)dpy)->request = \
+ (value) & 0xFFFFFFFFUL), \
+ (((struct _XDisplay*)dpy)->request_upper32bit = \
+ ((uint64_t)(value)) >> 32), \
+ (void)0 /* don't use the result */ \
+ )
+
+#define X_DPY_GET_LAST_REQUEST_READ(dpy) \
+ ( \
+ ((uint64_t)(((struct _XDisplay*)dpy)->last_request_read)) \
+ + ( \
+ ((uint64_t)( \
+ ((struct _XDisplay*)dpy)->last_request_read_upper32bit \
+ )) << 32 \
+ ) \
+ )
+
+#define X_DPY_SET_LAST_REQUEST_READ(dpy, value) \
+ ( \
+ (((struct _XDisplay*)dpy)->last_request_read = \
+ (value) & 0xFFFFFFFFUL), \
+ (((struct _XDisplay*)dpy)->last_request_read_upper32bit = \
+ ((uint64_t)(value)) >> 32), \
+ (void)0 /* don't use the result */ \
+ )
+
+/*
+ * widen a 32-bit sequence number to a 64 sequence number.
+ * This macro makes the following assumptions:
+ * - ulseq refers to a sequence that has already been sent
+ * - ulseq means the most recent possible sequence number
+ * with these lower 32 bits.
+ *
+ * The following optimization is used:
+ * The comparison result is taken a 0 or 1 to avoid a branch.
+ */
+#define X_DPY_WIDEN_UNSIGNED_LONG_SEQ(dpy, ulseq) \
+ ( \
+ ((uint64_t)ulseq) \
+ + \
+ (( \
+ ((uint64_t)(((struct _XDisplay*)dpy)->request_upper32bit)) \
+ - (uint64_t)( \
+ (ulseq) > (((struct _XDisplay*)dpy)->request) \
+ ) \
+ ) << 32) \
+ )
+
+#define X_DPY_REQUEST_INCREMENT(dpy) \
+ ( \
+ ((struct _XDisplay*)dpy)->request++, \
+ ( \
+ (((struct _XDisplay*)dpy)->request == 0) ? ( \
+ ((struct _XDisplay*)dpy)->request_upper32bit++ \
+ ) : 0 \
+ ), \
+ (void)0 /* don't use the result */ \
+ )
+
+
+#define X_DPY_REQUEST_DECREMENT(dpy) \
+ ( \
+ ( \
+ (((struct _XDisplay*)dpy)->request == 0) ? (\
+ ((struct _XDisplay*)dpy)->request--, /* wrap */ \
+ ((struct _XDisplay*)dpy)->request_upper32bit-- \
+ ) : ( \
+ ((struct _XDisplay*)dpy)->request-- \
+ ) \
+ ), \
+ (void)0 /* don't use the result */ \
+ )
+
+#else
+/* accessors for 64-bit unsigned long */
+#define X_DPY_GET_REQUEST(dpy) \
+ (((struct _XDisplay*)dpy)->request)
+#define X_DPY_SET_REQUEST(dpy, value) \
+ ((struct _XDisplay*)dpy)->request = (value)
+
+#define X_DPY_GET_LAST_REQUEST_READ(dpy) \
+ (((struct _XDisplay*)dpy)->last_request_read)
+#define X_DPY_SET_LAST_REQUEST_READ(dpy, value) \
+ ((struct _XDisplay*)dpy)->last_request_read = (value)
+
+#define X_DPY_WIDEN_UNSIGNED_LONG_SEQ(dpy, ulseq) ulseq
+
+#define X_DPY_REQUEST_INCREMENT(dpy) ((struct _XDisplay*)dpy)->request++
+#define X_DPY_REQUEST_DECREMENT(dpy) ((struct _XDisplay*)dpy)->request--
+#endif
+
+
#ifndef _XEVENT_
/*
* _QEvent datatype for use in input queueing.
@@ -484,12 +597,13 @@ extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len);
* GetEmptyReq is for those requests that have no arguments
* at all.
*/
+
#define GetEmptyReq(name, req) \
req = (xReq *) _XGetRequest(dpy, X_##name, SIZEOF(xReq))
/*
* MakeBigReq sets the CARD16 "req->length" to 0 and inserts a new CARD32
- * length, after req->length, before the data in the request. The new length
+ * length, after req->length, before the data in the request. The new length
* includes the "n" extra 32-bit words.
*
* Do not use MakeBigReq if there is no data already in the request.
@@ -524,7 +638,7 @@ extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len);
* or by "badlen" if "n" is too large.
*
* Do not use SetReqLen if "req" does not already have data after the
- * xReq header. req->length must already be >= 2.
+ * xReq header. req->length must already be >= 2.
*/
#ifndef __clang_analyzer__
#define SetReqLen(req,n,badlen) \
@@ -563,7 +677,7 @@ extern void _XFlushGCCache(Display *dpy, GC gc);
dpy->bufptr += ((len) + 3) & ~3;\
} else\
_XSend(dpy, data, len);\
- }
+}
#endif /* DataRoutineIsProcedure */
@@ -701,6 +815,11 @@ typedef struct _XInternalAsync {
XPointer data;
} _XAsyncHandler;
+/*
+ * This struct is part of the ABI and is defined by value
+ * in user-code. This means that we cannot make
+ * the sequence-numbers 64bit.
+ */
typedef struct _XAsyncEState {
unsigned long min_sequence_number;
unsigned long max_sequence_number;