]> git.xonotic.org Git - xonotic/xonotic.git/blob - misc/builddeps/win32/sdl/include/SDL/SDL_syswm.h
More open bugs in SDL2 2.0.3.
[xonotic/xonotic.git] / misc / builddeps / win32 / sdl / include / SDL / SDL_syswm.h
1 /*
2     SDL - Simple DirectMedia Layer
3     Copyright (C) 1997-2009 Sam Lantinga
4
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Lesser General Public
7     License as published by the Free Software Foundation; either
8     version 2.1 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     Lesser General Public License for more details.
14
15     You should have received a copy of the GNU Lesser General Public
16     License along with this library; if not, write to the Free Software
17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
19     Sam Lantinga
20     slouken@libsdl.org
21 */
22
23 /** @file SDL_syswm.h
24  *  Include file for SDL custom system window manager hooks
25  */
26
27 #ifndef _SDL_syswm_h
28 #define _SDL_syswm_h
29
30 #include "SDL_stdinc.h"
31 #include "SDL_error.h"
32 #include "SDL_version.h"
33
34 #include "begin_code.h"
35 /* Set up for C function definitions, even when using C++ */
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 /** @file SDL_syswm.h
41  *  Your application has access to a special type of event 'SDL_SYSWMEVENT',
42  *  which contains window-manager specific information and arrives whenever
43  *  an unhandled window event occurs.  This event is ignored by default, but
44  *  you can enable it with SDL_EventState()
45  */
46 #ifdef SDL_PROTOTYPES_ONLY
47 struct SDL_SysWMinfo;
48 typedef struct SDL_SysWMinfo SDL_SysWMinfo;
49 #else
50
51 /* This is the structure for custom window manager events */
52 #if defined(SDL_VIDEO_DRIVER_X11)
53 #if defined(__APPLE__) && defined(__MACH__)
54 /* conflicts with Quickdraw.h */
55 #define Cursor X11Cursor
56 #endif
57
58 #include <X11/Xlib.h>
59 #include <X11/Xatom.h>
60
61 #if defined(__APPLE__) && defined(__MACH__)
62 /* matches the re-define above */
63 #undef Cursor
64 #endif
65
66 /** These are the various supported subsystems under UNIX */
67 typedef enum {
68         SDL_SYSWM_X11
69 } SDL_SYSWM_TYPE;
70
71 /** The UNIX custom event structure */
72 struct SDL_SysWMmsg {
73         SDL_version version;
74         SDL_SYSWM_TYPE subsystem;
75         union {
76             XEvent xevent;
77         } event;
78 };
79
80 /** The UNIX custom window manager information structure.
81  *  When this structure is returned, it holds information about which
82  *  low level system it is using, and will be one of SDL_SYSWM_TYPE.
83  */
84 typedef struct SDL_SysWMinfo {
85         SDL_version version;
86         SDL_SYSWM_TYPE subsystem;
87         union {
88             struct {
89                 Display *display;       /**< The X11 display */
90                 Window window;          /**< The X11 display window */
91                 /** These locking functions should be called around
92                  *  any X11 functions using the display variable, 
93                  *  but not the gfxdisplay variable.
94                  *  They lock the event thread, so should not be
95                  *  called around event functions or from event filters.
96                  */
97                 /*@{*/
98                 void (*lock_func)(void);
99                 void (*unlock_func)(void);
100                 /*@}*/
101
102                 /** @name Introduced in SDL 1.0.2 */
103                 /*@{*/
104                 Window fswindow;        /**< The X11 fullscreen window */
105                 Window wmwindow;        /**< The X11 managed input window */
106                 /*@}*/
107
108                 /** @name Introduced in SDL 1.2.12 */
109                 /*@{*/
110                 Display *gfxdisplay;    /**< The X11 display to which rendering is done */
111                 /*@}*/
112             } x11;
113         } info;
114 } SDL_SysWMinfo;
115
116 #elif defined(SDL_VIDEO_DRIVER_NANOX)
117 #include <microwin/nano-X.h>
118
119 /** The generic custom event structure */
120 struct SDL_SysWMmsg {
121         SDL_version version;
122         int data;
123 };
124
125 /** The windows custom window manager information structure */
126 typedef struct SDL_SysWMinfo {
127         SDL_version version ;
128         GR_WINDOW_ID window ;   /* The display window */
129 } SDL_SysWMinfo;
130
131 #elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI)
132 #define WIN32_LEAN_AND_MEAN
133 #include <windows.h>
134
135 /** The windows custom event structure */
136 struct SDL_SysWMmsg {
137         SDL_version version;
138         HWND hwnd;                      /**< The window for the message */
139         UINT msg;                       /**< The type of message */
140         WPARAM wParam;                  /**< WORD message parameter */
141         LPARAM lParam;                  /**< LONG message parameter */
142 };
143
144 /** The windows custom window manager information structure */
145 typedef struct SDL_SysWMinfo {
146         SDL_version version;
147         HWND window;                    /**< The Win32 display window */
148         HGLRC hglrc;                    /**< The OpenGL context, if any */
149 } SDL_SysWMinfo;
150
151 #elif defined(SDL_VIDEO_DRIVER_RISCOS)
152
153 /** RISC OS custom event structure */
154 struct SDL_SysWMmsg {
155         SDL_version version;
156         int eventCode;          /**< The window for the message */
157         int pollBlock[64];
158 };
159
160 /** The RISC OS custom window manager information structure */
161 typedef struct SDL_SysWMinfo {
162         SDL_version version;
163         int wimpVersion;    /**< Wimp version running under */
164         int taskHandle;     /**< The RISC OS task handle */
165         int window;             /**< The RISC OS display window */
166 } SDL_SysWMinfo;
167
168 #elif defined(SDL_VIDEO_DRIVER_PHOTON)
169 #include <sys/neutrino.h>
170 #include <Ph.h>
171
172 /** The QNX custom event structure */
173 struct SDL_SysWMmsg {
174         SDL_version version;
175         int data;
176 };
177
178 /** The QNX custom window manager information structure */
179 typedef struct SDL_SysWMinfo {
180         SDL_version version;
181         int data;
182 } SDL_SysWMinfo;
183
184 #else
185
186 /** The generic custom event structure */
187 struct SDL_SysWMmsg {
188         SDL_version version;
189         int data;
190 };
191
192 /** The generic custom window manager information structure */
193 typedef struct SDL_SysWMinfo {
194         SDL_version version;
195         int data;
196 } SDL_SysWMinfo;
197
198 #endif /* video driver type */
199
200 #endif /* SDL_PROTOTYPES_ONLY */
201
202 /* Function prototypes */
203 /**
204  * This function gives you custom hooks into the window manager information.
205  * It fills the structure pointed to by 'info' with custom information and
206  * returns 1 if the function is implemented.  If it's not implemented, or
207  * the version member of the 'info' structure is invalid, it returns 0. 
208  *
209  * You typically use this function like this:
210  * @code
211  * SDL_SysWMInfo info;
212  * SDL_VERSION(&info.version);
213  * if ( SDL_GetWMInfo(&info) ) { ... }
214  * @endcode
215  */
216 extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info);
217
218
219 /* Ends C function definitions when using C++ */
220 #ifdef __cplusplus
221 }
222 #endif
223 #include "close_code.h"
224
225 #endif /* _SDL_syswm_h */