comparison src/video/x11/SDL_x11dyn.h @ 1168:045f186426e1

Dynamically load X11 libraries like we currently do for alsa, esd, etc. This allows you to run an SDL program on a system without Xlib, since it'll just report the x11 target unavailable at runtime.
author Ryan C. Gordon <icculus@icculus.org>
date Sat, 05 Nov 2005 19:53:37 +0000
parents
children 4b3e2294782d
comparison
equal deleted inserted replaced
1167:435c2e481299 1168:045f186426e1
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 #include <X11/extensions/extutil.h>
32
33 #ifndef NO_SHARED_MEMORY
34 #include <sys/ipc.h>
35 #include <sys/shm.h>
36 #include <X11/extensions/XShm.h>
37 #endif
38
39 /*
40 * Never reference Xlib directly...we might load it dynamically at runtime.
41 * Even if we don't, for readability, we still use the function pointers
42 * (although the symbol resolution will be done by the loader in that case).
43 *
44 * We define SDL_X11_SYM and include SDL_x11sym.h to accomplish various
45 * goals, without having to duplicate those function signatures.
46 */
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50
51 /* evil function signatures... */
52 typedef Bool (*SDL_X11_XESetWireToEventRetType)(Display*,XEvent*,xEvent*);
53 typedef int (*SDL_X11_XSynchronizeRetType)(Display*);
54 typedef Status (*SDL_X11_XESetEventToWireRetType)(Display*,XEvent*,xEvent*);
55
56 #define SDL_X11_SYM(ret,fn,params) extern ret (*p##fn) params;
57 #include "SDL_x11sym.h"
58 #undef SDL_X11_SYM
59
60 /* Macro in the xlib headers, not an actual symbol... */
61 #define pXDestroyImage XDestroyImage
62
63 int SDL_X11_LoadSymbols(void);
64 void SDL_X11_UnloadSymbols(void);
65
66 #ifdef __cplusplus
67 }
68 #endif
69
70 #endif /* !defined _SDL_x11dyn_h */
71