1
0

patch-src_video_x11_SDL_x11dyn_c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. --- SDL-1.2.14.orig/src/video/x11/SDL_x11dyn.c 2009-10-13 01:07:15.000000000 +0200
  2. +++ SDL-1.2.14/src/video/x11/SDL_x11dyn.c 2013-07-12 12:15:17.000000000 +0200
  3. @@ -108,6 +108,20 @@ char *(*pXGetICValues)(XIC, ...) = NULL;
  4. #undef SDL_X11_MODULE
  5. #undef SDL_X11_SYM
  6. +static void *SDL_XGetRequest_workaround(Display* dpy, CARD8 type, size_t len)
  7. +{
  8. + xReq *req;
  9. + WORD64ALIGN
  10. + if (dpy->bufptr + len > dpy->bufmax)
  11. + _XFlush(dpy);
  12. + dpy->last_req = dpy->bufptr;
  13. + req = (xReq*)dpy->bufptr;
  14. + req->reqType = type;
  15. + req->length = len / 4;
  16. + dpy->bufptr += len;
  17. + dpy->request++;
  18. + return req;
  19. +}
  20. static int x11_load_refcount = 0;
  21. @@ -168,6 +182,15 @@ int SDL_X11_LoadSymbols(void)
  22. X11_GetSym("XGetICValues",&SDL_X11_HAVE_UTF8,(void **)&pXGetICValues);
  23. #endif
  24. + /*
  25. + * In case we're built with newer Xlib headers, we need to make sure
  26. + * that _XGetRequest() is available, even on older systems.
  27. + * Otherwise, various Xlib macros we use will call a NULL pointer.
  28. + */
  29. + if (!SDL_X11_HAVE_XGETREQUEST) {
  30. + p_XGetRequest = SDL_XGetRequest_workaround;
  31. + }
  32. +
  33. if (SDL_X11_HAVE_BASEXLIB) { /* all required symbols loaded. */
  34. SDL_ClearError();
  35. } else {