comparison include/SDL_syswm.h @ 1662:782fd950bd46 SDL-1.3

Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API. WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid. The code is now run through a consistent indent format: indent -i4 -nut -nsc -br -ce The headers are being converted to automatically generate doxygen documentation.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 28 May 2006 13:04:16 +0000
parents 14717b52abc0
children 4da1ee79c9af
comparison
equal deleted inserted replaced
1661:281d3f4870e5 1662:782fd950bd46
18 18
19 Sam Lantinga 19 Sam Lantinga
20 slouken@libsdl.org 20 slouken@libsdl.org
21 */ 21 */
22 22
23 /* Include file for SDL custom system window manager hooks */ 23 /**
24 * \file SDL_syswm.h
25 *
26 * Include file for SDL custom system window manager hooks
27 */
24 28
25 #ifndef _SDL_syswm_h 29 #ifndef _SDL_syswm_h
26 #define _SDL_syswm_h 30 #define _SDL_syswm_h
27 31
28 #include "SDL_stdinc.h" 32 #include "SDL_stdinc.h"
29 #include "SDL_error.h" 33 #include "SDL_error.h"
34 #include "SDL_video.h"
30 #include "SDL_version.h" 35 #include "SDL_version.h"
31 36
32 #include "begin_code.h" 37 #include "begin_code.h"
33 /* Set up for C function definitions, even when using C++ */ 38 /* Set up for C function definitions, even when using C++ */
34 #ifdef __cplusplus 39 #ifdef __cplusplus
40 /* *INDENT-OFF* */
35 extern "C" { 41 extern "C" {
42 /* *INDENT-ON* */
36 #endif 43 #endif
37 44
38 /* Your application has access to a special type of event 'SDL_SYSWMEVENT', 45 /* Your application has access to a special type of event 'SDL_SYSWMEVENT',
39 which contains window-manager specific information and arrives whenever 46 which contains window-manager specific information and arrives whenever
40 an unhandled window event occurs. This event is ignored by default, but 47 an unhandled window event occurs. This event is ignored by default, but
41 you can enable it with SDL_EventState() 48 you can enable it with SDL_EventState()
42 */ 49 */
43 #ifdef SDL_PROTOTYPES_ONLY 50 #ifdef SDL_PROTOTYPES_ONLY
44 struct SDL_SysWMinfo; 51 struct SDL_SysWMinfo;
45 typedef struct SDL_SysWMinfo SDL_SysWMinfo;
46 #else 52 #else
47 53
48 /* This is the structure for custom window manager events */ 54 /* This is the structure for custom window manager events */
49 #if defined(SDL_VIDEO_DRIVER_X11) 55 #if defined(SDL_VIDEO_DRIVER_X11)
50 #if defined(__APPLE__) && defined(__MACH__) 56 #if defined(__APPLE__) && defined(__MACH__)
59 /* matches the re-define above */ 65 /* matches the re-define above */
60 #undef Cursor 66 #undef Cursor
61 #endif 67 #endif
62 68
63 /* These are the various supported subsystems under UNIX */ 69 /* These are the various supported subsystems under UNIX */
64 typedef enum { 70 typedef enum
65 SDL_SYSWM_X11 71 {
72 SDL_SYSWM_X11
66 } SDL_SYSWM_TYPE; 73 } SDL_SYSWM_TYPE;
67 74
68 /* The UNIX custom event structure */ 75 /* The UNIX custom event structure */
69 struct SDL_SysWMmsg { 76 struct SDL_SysWMmsg
70 SDL_version version; 77 {
71 SDL_SYSWM_TYPE subsystem; 78 SDL_version version;
72 union { 79 SDL_SYSWM_TYPE subsystem;
73 XEvent xevent; 80 union
74 } event; 81 {
82 XEvent xevent;
83 } event;
75 }; 84 };
76 85
77 /* The UNIX custom window manager information structure. 86 /* The UNIX custom window manager information structure.
78 When this structure is returned, it holds information about which 87 When this structure is returned, it holds information about which
79 low level system it is using, and will be one of SDL_SYSWM_TYPE. 88 low level system it is using, and will be one of SDL_SYSWM_TYPE.
80 */ 89 */
81 typedef struct SDL_SysWMinfo { 90 struct SDL_SysWMinfo
82 SDL_version version; 91 {
83 SDL_SYSWM_TYPE subsystem; 92 SDL_version version;
84 union { 93 SDL_SYSWM_TYPE subsystem;
85 struct { 94 union
86 Display *display; /* The X11 display */ 95 {
87 Window window; /* The X11 display window */ 96 struct
88 /* These locking functions should be called around 97 {
89 any X11 functions using the display variable. 98 Display *display; /* The X11 display */
90 They lock the event thread, so should not be 99 Window window; /* The X11 display window */
91 called around event functions or from event filters. 100 /* These locking functions should be called around
92 */ 101 any X11 functions using the display variable.
93 void (*lock_func)(void); 102 They lock the event thread, so should not be
94 void (*unlock_func)(void); 103 called around event functions or from event filters.
95 104 */
96 /* Introduced in SDL 1.0.2 */ 105 void (*lock_func) (void);
97 Window fswindow; /* The X11 fullscreen window */ 106 void (*unlock_func) (void);
98 Window wmwindow; /* The X11 managed input window */ 107
99 } x11; 108 /* Introduced in SDL 1.0.2 */
100 } info; 109 Window fswindow; /* The X11 fullscreen window */
101 } SDL_SysWMinfo; 110 Window wmwindow; /* The X11 managed input window */
111 } x11;
112 } info;
113 };
102 114
103 #elif defined(SDL_VIDEO_DRIVER_NANOX) 115 #elif defined(SDL_VIDEO_DRIVER_NANOX)
104 #include <microwin/nano-X.h> 116 #include <microwin/nano-X.h>
105 117
106 /* The generic custom event structure */ 118 /* The generic custom event structure */
107 struct SDL_SysWMmsg { 119 struct SDL_SysWMmsg
108 SDL_version version; 120 {
109 int data; 121 SDL_version version;
122 int data;
110 }; 123 };
111 124
112 /* The windows custom window manager information structure */ 125 /* The windows custom window manager information structure */
113 typedef struct SDL_SysWMinfo { 126 struct SDL_SysWMinfo
114 SDL_version version ; 127 {
115 GR_WINDOW_ID window ; /* The display window */ 128 SDL_version version;
116 } SDL_SysWMinfo; 129 GR_WINDOW_ID window; /* The display window */
130 };
117 131
118 #elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI) 132 #elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI)
119 #define WIN32_LEAN_AND_MEAN 133 #define WIN32_LEAN_AND_MEAN
120 #include <windows.h> 134 #include <windows.h>
121 135
122 /* The windows custom event structure */ 136 /* The windows custom event structure */
123 struct SDL_SysWMmsg { 137 struct SDL_SysWMmsg
124 SDL_version version; 138 {
125 HWND hwnd; /* The window for the message */ 139 SDL_version version;
126 UINT msg; /* The type of message */ 140 HWND hwnd; /* The window for the message */
127 WPARAM wParam; /* WORD message parameter */ 141 UINT msg; /* The type of message */
128 LPARAM lParam; /* LONG message parameter */ 142 WPARAM wParam; /* WORD message parameter */
143 LPARAM lParam; /* LONG message parameter */
129 }; 144 };
130 145
131 /* The windows custom window manager information structure */ 146 /* The windows custom window manager information structure */
132 typedef struct SDL_SysWMinfo { 147 struct SDL_SysWMinfo
133 SDL_version version; 148 {
134 HWND window; /* The Win32 display window */ 149 SDL_version version;
135 HGLRC hglrc; /* The OpenGL context, if any */ 150 HWND window; /* The Win32 display window */
136 } SDL_SysWMinfo; 151 HGLRC hglrc; /* The OpenGL context, if any */
152 };
137 153
138 #elif defined(SDL_VIDEO_DRIVER_RISCOS) 154 #elif defined(SDL_VIDEO_DRIVER_RISCOS)
139 155
140 /* RISC OS custom event structure */ 156 /* RISC OS custom event structure */
141 struct SDL_SysWMmsg { 157 struct SDL_SysWMmsg
142 SDL_version version; 158 {
143 int eventCode; /* The window for the message */ 159 SDL_version version;
144 int pollBlock[64]; 160 int eventCode; /* The window for the message */
161 int pollBlock[64];
145 }; 162 };
146 163
147 /* The RISC OS custom window manager information structure */ 164 /* The RISC OS custom window manager information structure */
148 typedef struct SDL_SysWMinfo { 165 struct SDL_SysWMinfo
149 SDL_version version; 166 {
150 int wimpVersion; /* Wimp version running under */ 167 SDL_version version;
151 int taskHandle; /* The RISC OS task handle */ 168 int wimpVersion; /* Wimp version running under */
152 int window; /* The RISC OS display window */ 169 int taskHandle; /* The RISC OS task handle */
153 } SDL_SysWMinfo; 170 int window; /* The RISC OS display window */
171 };
154 172
155 #elif defined(SDL_VIDEO_DRIVER_PHOTON) 173 #elif defined(SDL_VIDEO_DRIVER_PHOTON)
156 #include <sys/neutrino.h> 174 #include <sys/neutrino.h>
157 #include <Ph.h> 175 #include <Ph.h>
158 176
159 /* The QNX custom event structure */ 177 /* The QNX custom event structure */
160 struct SDL_SysWMmsg { 178 struct SDL_SysWMmsg
161 SDL_version version; 179 {
162 int data; 180 SDL_version version;
181 int data;
163 }; 182 };
164 183
165 /* The QNX custom window manager information structure */ 184 /* The QNX custom window manager information structure */
166 typedef struct SDL_SysWMinfo { 185 struct SDL_SysWMinfo
167 SDL_version version; 186 {
168 int data; 187 SDL_version version;
169 } SDL_SysWMinfo; 188 int data;
189 };
170 190
171 #else 191 #else
172 192
173 /* The generic custom event structure */ 193 /* The generic custom event structure */
174 struct SDL_SysWMmsg { 194 struct SDL_SysWMmsg
175 SDL_version version; 195 {
176 int data; 196 SDL_version version;
197 int data;
177 }; 198 };
178 199
179 /* The generic custom window manager information structure */ 200 /* The generic custom window manager information structure */
180 typedef struct SDL_SysWMinfo { 201 struct SDL_SysWMinfo
181 SDL_version version; 202 {
182 int data; 203 SDL_version version;
183 } SDL_SysWMinfo; 204 int data;
205 };
184 206
185 #endif /* video driver type */ 207 #endif /* video driver type */
186 208
187 #endif /* SDL_PROTOTYPES_ONLY */ 209 #endif /* SDL_PROTOTYPES_ONLY */
188 210
211 typedef struct SDL_SysWMinfo SDL_SysWMinfo;
212
189 /* Function prototypes */ 213 /* Function prototypes */
190 /* 214 /**
191 * This function gives you custom hooks into the window manager information. 215 * \fn SDL_bool SDL_GetWindowWMInfo (SDL_WindowID windowID, SDL_SysWMinfo * info)
192 * It fills the structure pointed to by 'info' with custom information and 216 *
193 * returns 1 if the function is implemented. If it's not implemented, or 217 * \brief This function allows access to driver-dependent window information.
194 * the version member of the 'info' structure is invalid, it returns 0. 218 *
219 * \param windowID The window about which information is being requested
220 * \param info This structure must be initialized with the SDL version, and is then filled in with information about the given window.
221 *
222 * \return SDL_TRUE if the function is implemented and the version member of the 'info' struct is valid, SDL_FALSE otherwise.
195 * 223 *
196 * You typically use this function like this: 224 * You typically use this function like this:
225 * \code
197 * SDL_SysWMInfo info; 226 * SDL_SysWMInfo info;
198 * SDL_VERSION(&info.version); 227 * SDL_VERSION(&info.version);
199 * if ( SDL_GetWMInfo(&info) ) { ... } 228 * if ( SDL_GetWindowWMInfo(&info) ) { ... }
229 * \endcode
200 */ 230 */
201 extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info); 231 extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo (SDL_WindowID windowID,
232 SDL_SysWMinfo * info);
202 233
203 234
204 /* Ends C function definitions when using C++ */ 235 /* Ends C function definitions when using C++ */
205 #ifdef __cplusplus 236 #ifdef __cplusplus
237 /* *INDENT-OFF* */
206 } 238 }
239 /* *INDENT-ON* */
207 #endif 240 #endif
208 #include "close_code.h" 241 #include "close_code.h"
209 242
210 #endif /* _SDL_syswm_h */ 243 #endif /* _SDL_syswm_h */
244
245 /* vi: set ts=4 sw=4 expandtab: */