Corrects dynamic X11 code on Tru64 systems.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 30 Jan 2006 18:21:44 +0000
changeset 12992bf9dda618e5
parent 1298 e1b8e1b97b67
child 1300 fd068ab116ee
Corrects dynamic X11 code on Tru64 systems.

Fixes Bugzilla #87.
configure.in
src/video/x11/SDL_x11dyn.h
src/video/x11/SDL_x11sym.h
src/video/x11/SDL_x11video.c
     1.1 --- a/configure.in	Mon Jan 30 14:27:56 2006 +0000
     1.2 +++ b/configure.in	Mon Jan 30 18:21:44 2006 +0000
     1.3 @@ -619,6 +619,10 @@
     1.4                      x11_lib='/usr/X11R6/lib/libX11.6.dylib'
     1.5                      x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
     1.6                      ;;
     1.7 +                *-*-osf* )
     1.8 +                    x11_lib='libX11.so'
     1.9 +                    x11ext_lib='libXext.so'
    1.10 +                    ;;
    1.11                  *)
    1.12                      x11_lib='libX11.so.6'
    1.13                      x11ext_lib='libXext.so.6'
    1.14 @@ -2585,6 +2589,13 @@
    1.15          if test x$enable_timers = xyes; then
    1.16              COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
    1.17          fi
    1.18 +        # FIXME: If building without -lX11, you get the following messages.
    1.19 +        # Xlib: connection to ":0.0" refused by server
    1.20 +        # Xlib: XDM authorization key matches an existing client!
    1.21 +        # It only has to run xhost +localhost in a such case.
    1.22 +        #if test x$enable_x11_shared = xyes; then
    1.23 +        #    SYSTEM_LIBS="$SYSTEM_LIBS -lX11"
    1.24 +        #fi
    1.25          ;;
    1.26      *-*-qnx*)
    1.27          ARCH=qnx
     2.1 --- a/src/video/x11/SDL_x11dyn.h	Mon Jan 30 14:27:56 2006 +0000
     2.2 +++ b/src/video/x11/SDL_x11dyn.h	Mon Jan 30 18:21:44 2006 +0000
     2.3 @@ -72,10 +72,21 @@
     2.4  #define _XFlushGCCache p_XFlushGCCache
     2.5  #define _XReply p_XReply
     2.6  #define _XSend p_XSend
     2.7 +#define XFree pXFree
     2.8 +
     2.9 +#if !defined(__osf__) || defined(X11_DYNAMIC)
    2.10  #define _XData32 p_XData32
    2.11 -#define XFree pXFree
    2.12  #endif
    2.13  
    2.14 +#if defined(__osf__) && defined(X11_DYNAMIC)
    2.15 +#define _SmtBufferOverflow p_SmtBufferOverflow
    2.16 +#define _SmtIpError p_SmtIpError
    2.17 +#define ipAllocateData pipAllocateData
    2.18 +#define ipUnallocateAndSendData pipUnallocateAndSendData
    2.19 +#endif
    2.20 +
    2.21 +#endif /* !__SDL_NO_REDEFINE_X11_HEADER_SYMS */
    2.22 +
    2.23  int SDL_X11_LoadSymbols(void);
    2.24  void SDL_X11_UnloadSymbols(void);
    2.25  
     3.1 --- a/src/video/x11/SDL_x11sym.h	Mon Jan 30 14:27:56 2006 +0000
     3.2 +++ b/src/video/x11/SDL_x11sym.h	Mon Jan 30 18:21:44 2006 +0000
     3.3 @@ -139,11 +139,18 @@
     3.4   * These don't exist in 32-bit versions and are removed by Xlib macros, but
     3.5   *  64+ bit systems will use them.
     3.6   */
     3.7 -#ifdef LONG64
     3.8 +#if defined(LONG64) && !defined(__osf__) || defined(X11_DYNAMIC)
     3.9  SDL_X11_SYM(1,int,_XData32,(Display *dpy,register long *data,unsigned len))
    3.10  SDL_X11_SYM(1,void,_XRead32,(Display *dpy,register long *data,long len))
    3.11  #endif
    3.12  
    3.13 +#if defined(__osf__) && defined(X11_DYNAMIC)
    3.14 +SDL_X11_SYM(1,void,_SmtBufferOverflow,(Display *dpy,register smtDisplayPtr))
    3.15 +SDL_X11_SYM(1,void,_SmtIpError,(Display *dpy,register smtDisplayPtr, int))
    3.16 +SDL_X11_SYM(1,int,ipAllocateData,(ChannelPtr, IPCard, IPDataPtr *))
    3.17 +SDL_X11_SYM(1,int,ipUnallocateAndSendData,(ChannelPtr, IPCard))
    3.18 +#endif
    3.19 +
    3.20  #if NeedWidePrototypes
    3.21  SDL_X11_SYM(1,KeySym,XKeycodeToKeysym,(Display*,unsigned int,int))
    3.22  #else
     4.1 --- a/src/video/x11/SDL_x11video.c	Mon Jan 30 14:27:56 2006 +0000
     4.2 +++ b/src/video/x11/SDL_x11video.c	Mon Jan 30 18:21:44 2006 +0000
     4.3 @@ -436,6 +436,20 @@
     4.4  		local_X11 = 0;
     4.5  	}
     4.6  	SDL_Display = pXOpenDisplay(display);
     4.7 +#if defined(__osf__) && defined(X11_DYNAMIC)
     4.8 +	/* On Tru64 if linking without -lX11, it fails and you get following message.
     4.9 +	 * Xlib: connection to ":0.0" refused by server
    4.10 +	 * Xlib: XDM authorization key matches an existing client!
    4.11 +	 *
    4.12 +	 * It succeeds if retrying 1 second later
    4.13 +	 * or if running xhost +localhost on shell.
    4.14 +	 *
    4.15 +	 */
    4.16 +	if ( SDL_Display == NULL ) {
    4.17 +		SDL_Delay(1000);
    4.18 +		SDL_Display = pXOpenDisplay(display);
    4.19 +	}
    4.20 +#endif
    4.21  	if ( SDL_Display == NULL ) {
    4.22  		SDL_SetError("Couldn't open X11 display");
    4.23  		return(-1);