X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=sdl_omap.git;a=blobdiff_plain;f=src%2Fvideo%2Fx11%2FSDL_x11dyn.c;h=a7e800eacb80553681cf8a912788f6e837d9fc27;hp=4e549b3f07f2b3aa1a54d92e84cc5cf711d57a87;hb=d55fed6351f9d8aff0d8888056a4998c4d0271ce;hpb=3af1392358aa181d48c4d9676daac4e2206c49bd diff --git a/src/video/x11/SDL_x11dyn.c b/src/video/x11/SDL_x11dyn.c index 4e549b3..a7e800e 100644 --- a/src/video/x11/SDL_x11dyn.c +++ b/src/video/x11/SDL_x11dyn.c @@ -109,6 +109,21 @@ char *(*pXGetICValues)(XIC, ...) = NULL; #undef SDL_X11_SYM +static void *SDL_XGetRequest_workaround(Display* dpy, CARD8 type, size_t len) +{ + xReq *req; + WORD64ALIGN + if (dpy->bufptr + len > dpy->bufmax) + _XFlush(dpy); + dpy->last_req = dpy->bufptr; + req = (xReq*)dpy->bufptr; + req->reqType = type; + req->length = len / 4; + dpy->bufptr += len; + dpy->request++; + return req; +} + static int x11_load_refcount = 0; void SDL_X11_UnloadSymbols(void) @@ -168,6 +183,15 @@ int SDL_X11_LoadSymbols(void) X11_GetSym("XGetICValues",&SDL_X11_HAVE_UTF8,(void **)&pXGetICValues); #endif + /* + * In case we're built with newer Xlib headers, we need to make sure + * that _XGetRequest() is available, even on older systems. + * Otherwise, various Xlib macros we use will call a NULL pointer. + */ + if (!SDL_X11_HAVE_XGETREQUEST) { + p_XGetRequest = SDL_XGetRequest_workaround; + } + if (SDL_X11_HAVE_BASEXLIB) { /* all required symbols loaded. */ SDL_ClearError(); } else {