src/video/x11/SDL_x11dyn.h
changeset 1575 3ba88cb7eb1b
parent 1438 1f4f09641645
child 1589 34cca785be57
     1.1 --- a/src/video/x11/SDL_x11dyn.h	Wed Mar 22 04:51:44 2006 +0000
     1.2 +++ b/src/video/x11/SDL_x11dyn.h	Wed Mar 22 05:00:59 2006 +0000
     1.3 @@ -39,59 +39,40 @@
     1.4  #endif
     1.5  
     1.6  /*
     1.7 - * Never reference Xlib directly...we might load it dynamically at runtime.
     1.8 - *  Even if we don't, for readability, we still use the function pointers
     1.9 - *  (although the symbol resolution will be done by the loader in that case).
    1.10 + * When using the "dynamic X11" functionality, we duplicate all the Xlib
    1.11 + *  symbols that would be referenced by SDL inside of SDL itself.
    1.12 + *  These duplicated symbols just serve as passthroughs to the functions
    1.13 + *  in Xlib, that was dynamically loaded.
    1.14   *
    1.15 - * We define SDL_X11_SYM and include SDL_x11sym.h to accomplish various
    1.16 - *  goals, without having to duplicate those function signatures.
    1.17 + * This allows us to use Xlib as-is when linking against it directly, but
    1.18 + *  also handles all the strange cases where there was code in the Xlib
    1.19 + *  headers that may or may not exist or vary on a given platform.
    1.20   */
    1.21  #ifdef __cplusplus
    1.22  extern "C" {
    1.23  #endif
    1.24  
    1.25 -#ifdef __osf__
    1.26 -extern int _XData32(Display *,register long *,unsigned);
    1.27 -extern void _XRead32(Display *,register long *,long);
    1.28 -extern void _SmtBufferOverflow(Display *,register smtDisplayPtr);
    1.29 -extern void _SmtIpError(Display *,register smtDisplayPtr, int);
    1.30 -extern int ipAllocateData(ChannelPtr, IPCard, IPDataPtr *);
    1.31 -extern int ipUnallocateAndSendData(ChannelPtr, IPCard);
    1.32 -#endif
    1.33 -
    1.34  /* evil function signatures... */
    1.35  typedef Bool (*SDL_X11_XESetWireToEventRetType)(Display*,XEvent*,xEvent*);
    1.36  typedef int (*SDL_X11_XSynchronizeRetType)(Display*);
    1.37  typedef Status (*SDL_X11_XESetEventToWireRetType)(Display*,XEvent*,xEvent*);
    1.38  typedef int (*SDL_X11_XSetExtensionErrorHandlerType)(Display *,char *,char *);
    1.39  
    1.40 -#define SDL_X11_SYM(req,ret,fn,params) extern ret (*p##fn) params;
    1.41 +int SDL_X11_LoadSymbols(void);
    1.42 +void SDL_X11_UnloadSymbols(void);
    1.43 +
    1.44 +/* That's really annoying...make this a function pointer no matter what. */
    1.45 +#ifdef X_HAVE_UTF8_STRING
    1.46 +extern XIC (*pXCreateIC)(XIM,...);
    1.47 +#endif
    1.48 +
    1.49 +/* These SDL_X11_HAVE_* flags are here whether you have dynamic X11 or not. */
    1.50 +#define SDL_X11_MODULE(modname) extern int SDL_X11_HAVE_##modname;
    1.51 +#define SDL_X11_SYM(rc,fn,params,args,ret)
    1.52  #include "SDL_x11sym.h"
    1.53 +#undef SDL_X11_MODULE
    1.54  #undef SDL_X11_SYM
    1.55  
    1.56 -/* Macro in the xlib headers, not an actual symbol... */
    1.57 -#define pXDestroyImage XDestroyImage
    1.58 -
    1.59 -/* Workaround code in headers... */
    1.60 -#if !__SDL_NO_REDEFINE_X11_HEADER_SYMS
    1.61 -#define _XFlush p_XFlush
    1.62 -#define _XFlushGCCache p_XFlushGCCache
    1.63 -#define _XReply p_XReply
    1.64 -#define _XSend p_XSend
    1.65 -#define XFree pXFree
    1.66 -#define _XData32 p_XData32
    1.67 -
    1.68 -#if defined(__osf__)
    1.69 -#define _SmtBufferOverflow p_SmtBufferOverflow
    1.70 -#define _SmtIpError p_SmtIpError
    1.71 -#define ipAllocateData pipAllocateData
    1.72 -#define ipUnallocateAndSendData pipUnallocateAndSendData
    1.73 -#endif
    1.74 -
    1.75 -#endif /* !__SDL_NO_REDEFINE_X11_HEADER_SYMS */
    1.76 -
    1.77 -int SDL_X11_LoadSymbols(void);
    1.78 -void SDL_X11_UnloadSymbols(void);
    1.79  
    1.80  #ifdef __cplusplus
    1.81  }