src/video/x11/SDL_x11dyn.h
changeset 7827 a03ec8de0426
parent 6885 700f1b25f77f
child 8093 b43765095a6f
equal deleted inserted replaced
7826:a87057441d01 7827:a03ec8de0426
    67 #endif
    67 #endif
    68 #if SDL_VIDEO_DRIVER_X11_XVIDMODE
    68 #if SDL_VIDEO_DRIVER_X11_XVIDMODE
    69 #include <X11/extensions/xf86vmode.h>
    69 #include <X11/extensions/xf86vmode.h>
    70 #endif
    70 #endif
    71 
    71 
    72 /*
       
    73  * When using the "dynamic X11" functionality, we duplicate all the Xlib
       
    74  *  symbols that would be referenced by SDL inside of SDL itself.
       
    75  *  These duplicated symbols just serve as passthroughs to the functions
       
    76  *  in Xlib, that was dynamically loaded.
       
    77  *
       
    78  * This allows us to use Xlib as-is when linking against it directly, but
       
    79  *  also handles all the strange cases where there was code in the Xlib
       
    80  *  headers that may or may not exist or vary on a given platform.
       
    81  */
       
    82 #ifdef __cplusplus
    72 #ifdef __cplusplus
    83 extern "C"
    73 extern "C"
    84 {
    74 {
    85 #endif
    75 #endif
    86 
    76 
    87 /* evil function signatures... */
    77 /* evil function signatures... */
    88     typedef Bool(*SDL_X11_XESetWireToEventRetType) (Display *, XEvent *,
    78 typedef Bool(*SDL_X11_XESetWireToEventRetType) (Display *, XEvent *, xEvent *);
    89                                                     xEvent *);
    79 typedef int (*SDL_X11_XSynchronizeRetType) (Display *);
    90     typedef int (*SDL_X11_XSynchronizeRetType) (Display *);
    80 typedef Status(*SDL_X11_XESetEventToWireRetType) (Display *, XEvent *, xEvent *);
    91     typedef Status(*SDL_X11_XESetEventToWireRetType) (Display *, XEvent *,
       
    92                                                       xEvent *);
       
    93 
    81 
    94     int SDL_X11_LoadSymbols(void);
    82 int SDL_X11_LoadSymbols(void);
    95     void SDL_X11_UnloadSymbols(void);
    83 void SDL_X11_UnloadSymbols(void);
    96 
    84 
    97 /* That's really annoying...make these function pointers no matter what. */
    85 /* Declare all the function pointers and wrappers... */
       
    86 #define SDL_X11_MODULE(modname)
       
    87 #define SDL_X11_SYM(rc,fn,params,args,ret) \
       
    88     typedef rc (*SDL_DYNX11FN_##fn) params; \
       
    89     extern SDL_DYNX11FN_##fn X11_##fn;
       
    90 #include "SDL_x11sym.h"
       
    91 #undef SDL_X11_MODULE
       
    92 #undef SDL_X11_SYM
       
    93 
       
    94 /* Annoying varargs entry point... */
    98 #ifdef X_HAVE_UTF8_STRING
    95 #ifdef X_HAVE_UTF8_STRING
    99     extern XIC(*pXCreateIC) (XIM, ...);
    96 typedef XIC(*SDL_DYNX11FN_XCreateIC) (XIM,...);
   100     extern char *(*pXGetICValues) (XIC, ...);
    97 typedef char *(*SDL_DYNX11FN_XGetICValues) (XIC, ...);
       
    98 extern SDL_DYNX11FN_XCreateIC X11_XCreateIC;
       
    99 extern SDL_DYNX11FN_XGetICValues X11_XGetICValues;
   101 #endif
   100 #endif
   102 
   101 
   103 /* These SDL_X11_HAVE_* flags are here whether you have dynamic X11 or not. */
   102 /* These SDL_X11_HAVE_* flags are here whether you have dynamic X11 or not. */
   104 #define SDL_X11_MODULE(modname) extern int SDL_X11_HAVE_##modname;
   103 #define SDL_X11_MODULE(modname) extern int SDL_X11_HAVE_##modname;
   105 #define SDL_X11_SYM(rc,fn,params,args,ret)
   104 #define SDL_X11_SYM(rc,fn,params,args,ret)
   106 #include "SDL_x11sym.h"
   105 #include "SDL_x11sym.h"
   107 #undef SDL_X11_MODULE
   106 #undef SDL_X11_MODULE
   108 #undef SDL_X11_SYM
   107 #undef SDL_X11_SYM
   109 
   108 
   110 
       
   111 #ifdef __cplusplus
   109 #ifdef __cplusplus
   112 }
   110 }
   113 #endif
   111 #endif
   114 
   112 
   115 #endif                          /* !defined _SDL_x11dyn_h */
   113 #endif                          /* !defined _SDL_x11dyn_h */