src/video/x11/SDL_x11dyn.h
author Ryan C. Gordon <icculus@icculus.org>
Wed, 01 Feb 2006 08:03:04 +0000
changeset 1314 2b3ebc327017
parent 1306 0c105755b110
child 1351 82c38796c7ca
permissions -rw-r--r--
Fixed dynamic X11 for now, I think.
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2004 Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Library General Public
     7     License as published by the Free Software Foundation; either
     8     version 2 of the License, or (at your option) any later version.
     9 
    10     This library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Library General Public License for more details.
    14 
    15     You should have received a copy of the GNU Library General Public
    16     License along with this library; if not, write to the Free
    17     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 
    23 #ifndef _SDL_x11dyn_h
    24 #define _SDL_x11dyn_h
    25 
    26 #include <X11/Xlib.h>
    27 #include <X11/Xutil.h>
    28 #include <X11/Xatom.h>
    29 #include <X11/Xproto.h>
    30 #include <X11/Xlibint.h>
    31 
    32 #include <Xext/extensions/extutil.h>
    33 
    34 #ifndef NO_SHARED_MEMORY
    35 #include <sys/ipc.h>
    36 #include <sys/shm.h>
    37 #include <X11/extensions/XShm.h>
    38 #endif
    39 
    40 /*
    41  * Never reference Xlib directly...we might load it dynamically at runtime.
    42  *  Even if we don't, for readability, we still use the function pointers
    43  *  (although the symbol resolution will be done by the loader in that case).
    44  *
    45  * We define SDL_X11_SYM and include SDL_x11sym.h to accomplish various
    46  *  goals, without having to duplicate those function signatures.
    47  */
    48 #ifdef __cplusplus
    49 extern "C" {
    50 #endif
    51 
    52 /* evil function signatures... */
    53 typedef Bool (*SDL_X11_XESetWireToEventRetType)(Display*,XEvent*,xEvent*);
    54 typedef int (*SDL_X11_XSynchronizeRetType)(Display*);
    55 typedef Status (*SDL_X11_XESetEventToWireRetType)(Display*,XEvent*,xEvent*);
    56 typedef int (*SDL_X11_XSetExtensionErrorHandlerType)(Display *,char *,char *);
    57 
    58 #define SDL_X11_SYM(req,ret,fn,params) extern ret (*p##fn) params;
    59 #include "SDL_x11sym.h"
    60 #undef SDL_X11_SYM
    61 
    62 /* Macro in the xlib headers, not an actual symbol... */
    63 #define pXDestroyImage XDestroyImage
    64 
    65 /* Workaround code in headers... */
    66 #if !__SDL_NO_REDEFINE_X11_HEADER_SYMS
    67 #define _XFlush p_XFlush
    68 #define _XFlushGCCache p_XFlushGCCache
    69 #define _XReply p_XReply
    70 #define _XSend p_XSend
    71 #define XFree pXFree
    72 #define _XData32 p_XData32
    73 
    74 #if defined(__osf__) && defined(X11_DYNAMIC)
    75 #define _SmtBufferOverflow p_SmtBufferOverflow
    76 #define _SmtIpError p_SmtIpError
    77 #define ipAllocateData pipAllocateData
    78 #define ipUnallocateAndSendData pipUnallocateAndSendData
    79 #endif
    80 
    81 #endif /* !__SDL_NO_REDEFINE_X11_HEADER_SYMS */
    82 
    83 int SDL_X11_LoadSymbols(void);
    84 void SDL_X11_UnloadSymbols(void);
    85 
    86 #ifdef __cplusplus
    87 }
    88 #endif
    89 
    90 #endif  /* !defined _SDL_x11dyn_h */
    91