Corrects dynamic X11 code on Tru64 systems.
Fixes Bugzilla #87.
--- a/configure.in Mon Jan 30 14:27:56 2006 +0000
+++ b/configure.in Mon Jan 30 18:21:44 2006 +0000
@@ -619,6 +619,10 @@
x11_lib='/usr/X11R6/lib/libX11.6.dylib'
x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
;;
+ *-*-osf* )
+ x11_lib='libX11.so'
+ x11ext_lib='libXext.so'
+ ;;
*)
x11_lib='libX11.so.6'
x11ext_lib='libXext.so.6'
@@ -2585,6 +2589,13 @@
if test x$enable_timers = xyes; then
COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
fi
+ # FIXME: If building without -lX11, you get the following messages.
+ # Xlib: connection to ":0.0" refused by server
+ # Xlib: XDM authorization key matches an existing client!
+ # It only has to run xhost +localhost in a such case.
+ #if test x$enable_x11_shared = xyes; then
+ # SYSTEM_LIBS="$SYSTEM_LIBS -lX11"
+ #fi
;;
*-*-qnx*)
ARCH=qnx
--- a/src/video/x11/SDL_x11dyn.h Mon Jan 30 14:27:56 2006 +0000
+++ b/src/video/x11/SDL_x11dyn.h Mon Jan 30 18:21:44 2006 +0000
@@ -72,10 +72,21 @@
#define _XFlushGCCache p_XFlushGCCache
#define _XReply p_XReply
#define _XSend p_XSend
+#define XFree pXFree
+
+#if !defined(__osf__) || defined(X11_DYNAMIC)
#define _XData32 p_XData32
-#define XFree pXFree
#endif
+#if defined(__osf__) && defined(X11_DYNAMIC)
+#define _SmtBufferOverflow p_SmtBufferOverflow
+#define _SmtIpError p_SmtIpError
+#define ipAllocateData pipAllocateData
+#define ipUnallocateAndSendData pipUnallocateAndSendData
+#endif
+
+#endif /* !__SDL_NO_REDEFINE_X11_HEADER_SYMS */
+
int SDL_X11_LoadSymbols(void);
void SDL_X11_UnloadSymbols(void);
--- a/src/video/x11/SDL_x11sym.h Mon Jan 30 14:27:56 2006 +0000
+++ b/src/video/x11/SDL_x11sym.h Mon Jan 30 18:21:44 2006 +0000
@@ -139,11 +139,18 @@
* These don't exist in 32-bit versions and are removed by Xlib macros, but
* 64+ bit systems will use them.
*/
-#ifdef LONG64
+#if defined(LONG64) && !defined(__osf__) || defined(X11_DYNAMIC)
SDL_X11_SYM(1,int,_XData32,(Display *dpy,register long *data,unsigned len))
SDL_X11_SYM(1,void,_XRead32,(Display *dpy,register long *data,long len))
#endif
+#if defined(__osf__) && defined(X11_DYNAMIC)
+SDL_X11_SYM(1,void,_SmtBufferOverflow,(Display *dpy,register smtDisplayPtr))
+SDL_X11_SYM(1,void,_SmtIpError,(Display *dpy,register smtDisplayPtr, int))
+SDL_X11_SYM(1,int,ipAllocateData,(ChannelPtr, IPCard, IPDataPtr *))
+SDL_X11_SYM(1,int,ipUnallocateAndSendData,(ChannelPtr, IPCard))
+#endif
+
#if NeedWidePrototypes
SDL_X11_SYM(1,KeySym,XKeycodeToKeysym,(Display*,unsigned int,int))
#else
--- a/src/video/x11/SDL_x11video.c Mon Jan 30 14:27:56 2006 +0000
+++ b/src/video/x11/SDL_x11video.c Mon Jan 30 18:21:44 2006 +0000
@@ -436,6 +436,20 @@
local_X11 = 0;
}
SDL_Display = pXOpenDisplay(display);
+#if defined(__osf__) && defined(X11_DYNAMIC)
+ /* On Tru64 if linking without -lX11, it fails and you get following message.
+ * Xlib: connection to ":0.0" refused by server
+ * Xlib: XDM authorization key matches an existing client!
+ *
+ * It succeeds if retrying 1 second later
+ * or if running xhost +localhost on shell.
+ *
+ */
+ if ( SDL_Display == NULL ) {
+ SDL_Delay(1000);
+ SDL_Display = pXOpenDisplay(display);
+ }
+#endif
if ( SDL_Display == NULL ) {
SDL_SetError("Couldn't open X11 display");
return(-1);