wok diff libsdl/stuff/sdl-1.2.14-add-XGetRequest-symbol.patch @ rev 22588

updated cgames (2.2 -> 2.2a)
author Hans-G?nter Theisgen
date Tue Jan 07 15:32:27 2020 +0100 (2020-01-07)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libsdl/stuff/sdl-1.2.14-add-XGetRequest-symbol.patch	Tue Jan 07 15:32:27 2020 +0100
     1.3 @@ -0,0 +1,70 @@
     1.4 +_XGetRequest API was backported to libx11-1.4.4 in:
     1.5 +http://git.openembedded.org/openembedded-core/commit/?id=e08604800fe1cb8f240f53c147ceb4ee08a29b91
     1.6 +
     1.7 +This breaks e.g. libsdl-image build with:
     1.8 +| /OE/shr-core/tmp-eglibc/sysroots/qemux86-64/usr/lib/libSDL.so: undefined reference to `_XGetRequest'
     1.9 +
    1.10 +For details see: https://bugzilla.redhat.com/show_bug.cgi?id=782251
    1.11 +
    1.12 +Upstrea-Status: Accepted
    1.13 +
    1.14 +@@ -, +, @@ 
    1.15 + added.
    1.16 + src/video/x11/SDL_x11dyn.c |   24 ++++++++++++++++++++++++
    1.17 + src/video/x11/SDL_x11sym.h |    6 ++++++
    1.18 + 2 files changed, 30 insertions(+), 0 deletions(-)
    1.19 +--- a/src/video/x11/SDL_x11dyn.c	
    1.20 ++++ a/src/video/x11/SDL_x11dyn.c	
    1.21 +@@ -109,6 +109,21 @@ char *(*pXGetICValues)(XIC, ...) = NULL;
    1.22 + #undef SDL_X11_SYM
    1.23 + 
    1.24 + 
    1.25 ++static void *SDL_XGetRequest_workaround(Display* dpy, CARD8 type, size_t len)
    1.26 ++{
    1.27 ++	xReq *req;
    1.28 ++	WORD64ALIGN
    1.29 ++	if (dpy->bufptr + len > dpy->bufmax)
    1.30 ++		_XFlush(dpy);
    1.31 ++	dpy->last_req = dpy->bufptr;
    1.32 ++	req = (xReq*)dpy->bufptr;
    1.33 ++	req->reqType = type;
    1.34 ++	req->length = len / 4;
    1.35 ++	dpy->bufptr += len;
    1.36 ++	dpy->request++;
    1.37 ++	return req;
    1.38 ++}
    1.39 ++
    1.40 + static int x11_load_refcount = 0;
    1.41 + 
    1.42 + void SDL_X11_UnloadSymbols(void)
    1.43 +@@ -168,6 +183,15 @@ int SDL_X11_LoadSymbols(void)
    1.44 + 		X11_GetSym("XGetICValues",&SDL_X11_HAVE_UTF8,(void **)&pXGetICValues);
    1.45 + 		#endif
    1.46 + 
    1.47 ++		/*
    1.48 ++		 * In case we're built with newer Xlib headers, we need to make sure
    1.49 ++		 *  that _XGetRequest() is available, even on older systems.
    1.50 ++		 *  Otherwise, various Xlib macros we use will call a NULL pointer.
    1.51 ++		 */
    1.52 ++		if (!SDL_X11_HAVE_XGETREQUEST) {
    1.53 ++			p_XGetRequest = SDL_XGetRequest_workaround;
    1.54 ++		}
    1.55 ++
    1.56 + 		if (SDL_X11_HAVE_BASEXLIB) {  /* all required symbols loaded. */
    1.57 + 			SDL_ClearError();
    1.58 + 		} else {
    1.59 +--- a/src/video/x11/SDL_x11sym.h	
    1.60 ++++ a/src/video/x11/SDL_x11sym.h	
    1.61 +@@ -170,6 +170,12 @@ SDL_X11_SYM(void,_XRead32,(Display *dpy,register long *data,long len),(dpy,data,
    1.62 + #endif
    1.63 + 
    1.64 + /*
    1.65 ++ * libX11 1.4.99.1 added _XGetRequest, and macros use it behind the scenes.
    1.66 ++ */
    1.67 ++SDL_X11_MODULE(XGETREQUEST)
    1.68 ++SDL_X11_SYM(void *,_XGetRequest,(Display* a,CARD8 b,size_t c),(a,b,c),return)
    1.69 ++
    1.70 ++/*
    1.71 +  * These only show up on some variants of Unix.
    1.72 +  */
    1.73 + #if defined(__osf__)