From 36d0fac779fcdece1d990c4f4e4a8590f319f2c7 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 29 Jun 2016 21:25:24 +0200 Subject: Backport of _XGetRequest() To enable linking of a current libXrender libNX_X11 needs that symbol. This is a (manual) backport of the following upstream libX11 commit available at https://cgit.freedesktop.org/xorg/lib/libX11/commit/src/XlibInt.c?id=4a060f993bf676cf21ad9784e010f54134da7b40: Commit: 4a060f993bf676cf21ad9784e010f54134da7b40 Author: Peter Hutterer Date: Mon, 17 Oct 2011 09:45:15 +1000 Subject: Add _XGetRequest as substitute for GetReq/GetReqExtra --- nx-X11/lib/X11/XlibInt.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'nx-X11/lib/X11/XlibInt.c') diff --git a/nx-X11/lib/X11/XlibInt.c b/nx-X11/lib/X11/XlibInt.c index 49535fe18..64028d723 100644 --- a/nx-X11/lib/X11/XlibInt.c +++ b/nx-X11/lib/X11/XlibInt.c @@ -3732,6 +3732,36 @@ Screen *_XScreenOfWindow (dpy, w) return NULL; } +/* + * WARNING: This implementation's pre-conditions and post-conditions + * must remain compatible with the old macro-based implementations of + * GetReq, GetReqExtra, GetResReq, and GetEmptyReq. The portions of the + * Display structure affected by those macros are part of libX11's + * ABI. + */ +void *_XGetRequest(Display *dpy, CARD8 type, size_t len) +{ + xReq *req; + + WORD64ALIGN + + if (dpy->bufptr + len > dpy->bufmax) + _XFlush(dpy); + + if (len % 4) + fprintf(stderr, + "Xlib: request %d length %zd not a multiple of 4.\n", + type, len); + + dpy->last_req = dpy->bufptr; + + req = (xReq*)dpy->bufptr; + req->reqType = type; + req->length = len / 4; + dpy->bufptr += len; + dpy->request++; + return req; +} #if defined(WIN32) -- cgit v1.2.3 From bd2650ca0b17c8a8fc2bc278a998e10893d8147c Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 29 Jun 2016 21:44:08 +0200 Subject: Port _XEatDataWords This required for successful linking of libXrender against libNX_X11. Port from libXfixes commit b031e3b60fa1af9e49449f23d4a84395868be3ab We need this here to enable linking of current libXrender against libNX_X11 instead of the system's libX11 The original implementation of this function (libX11 commit 9f5d83706543696fc944c1835a403938c06f2cc5) uses xcb stuff which we do not have in libNX_X11. So we take a workaround from another lib. This workaround had been added temporarily to a couple of X extension libs, see e.g. https://lists.x.org/archives/xorg-devel/2013-July/036763.html. --- nx-X11/lib/X11/XlibInt.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'nx-X11/lib/X11/XlibInt.c') diff --git a/nx-X11/lib/X11/XlibInt.c b/nx-X11/lib/X11/XlibInt.c index 64028d723..175f5b92f 100644 --- a/nx-X11/lib/X11/XlibInt.c +++ b/nx-X11/lib/X11/XlibInt.c @@ -2751,6 +2751,30 @@ void _XEatData( #undef SCRATCHSIZE } +/* + Port from libXfixes commit + b031e3b60fa1af9e49449f23d4a84395868be3ab We need this here to + enable linking of current libXrender against libNX_X11 instead of + the system's libX11 + + The original implementation of this function (libX11 commit + 9f5d83706543696fc944c1835a403938c06f2cc5) uses xcb stuff which we + do not have in libNX_X11. So we take a workaround from another + lib. This workaround had been implemented temporarily in a couple + of X libs, see e.g. https://lists.x.org/archives/xorg-devel/2013-July/036763.html. +*/ +#include /* for LONG64 on 64-bit platforms */ +#include + +void _XEatDataWords(Display *dpy, unsigned long n) +{ +#ifndef LONG64 + if (n >= (ULONG_MAX >> 2)) + _XIOError(dpy); +#endif + _XEatData (dpy, n << 2); +} + /* * _XEnq - Place event packets on the display's queue. -- cgit v1.2.3