aboutsummaryrefslogtreecommitdiffstats
path: root/distrib
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2012-05-03 10:31:08 -0700
committerJesse Hall <jessehall@google.com>2012-05-03 12:19:13 -0700
commit43a16f4e595909472e3e3e46cc3393e31323e18c (patch)
treeacc9be0312da37f89c9fcc137a81a0ca7744e9b9 /distrib
parent1efe36f95c788400c8b504b9055173bc8f9a4d15 (diff)
downloadexternal_qemu-43a16f4e595909472e3e3e46cc3393e31323e18c.zip
external_qemu-43a16f4e595909472e3e3e46cc3393e31323e18c.tar.gz
external_qemu-43a16f4e595909472e3e3e46cc3393e31323e18c.tar.bz2
Add dynamic symbol for _XGetRequest, which libX11 1.4.99.1 added
This is a cherry-pick from upstream to fix build errors on some Linux distros. Problem and patch pointed out by "quho" -- thanks! Upstream changeset: http://hg.libsdl.org/SDL/rev/e1264a758d50 Change-Id: I423c6ce2dfd7c6e53954b6fe76b156f12ae643f2
Diffstat (limited to 'distrib')
-rw-r--r--distrib/sdl-1.2.12/src/video/x11/SDL_x11dyn.c24
-rw-r--r--distrib/sdl-1.2.12/src/video/x11/SDL_x11sym.h6
2 files changed, 30 insertions, 0 deletions
diff --git a/distrib/sdl-1.2.12/src/video/x11/SDL_x11dyn.c b/distrib/sdl-1.2.12/src/video/x11/SDL_x11dyn.c
index 7b99d73..6e97c32 100644
--- a/distrib/sdl-1.2.12/src/video/x11/SDL_x11dyn.c
+++ b/distrib/sdl-1.2.12/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();
XInitThreads();
diff --git a/distrib/sdl-1.2.12/src/video/x11/SDL_x11sym.h b/distrib/sdl-1.2.12/src/video/x11/SDL_x11sym.h
index b8d90e4..610982c 100644
--- a/distrib/sdl-1.2.12/src/video/x11/SDL_x11sym.h
+++ b/distrib/sdl-1.2.12/src/video/x11/SDL_x11sym.h
@@ -181,6 +181,12 @@ SDL_X11_SYM(void,_XRead32,(Display *dpy,register long *data,long len),(dpy,data,
#endif
/*
+ * libX11 1.4.99.1 added _XGetRequest, and macros use it behind the scenes.
+ */
+SDL_X11_MODULE(XGETREQUEST)
+SDL_X11_SYM(void *,_XGetRequest,(Display* a,CARD8 b,size_t c),(a,b,c),return)
+
+/*
* These only show up on some variants of Unix.
*/
#if defined(__osf__)