comparison include/SDL_syswm.h @ 4900:69d9db65f248

Merged the Windows custom window system hooks into the union used by X11. Added Cocoa custom window system hooks
author Sam Lantinga <slouken@libsdl.org>
date Mon, 27 Sep 2010 01:24:05 -0700
parents 5d529386db73
children 50d0bff24d81
comparison
equal deleted inserted replaced
4899:5d529386db73 4900:69d9db65f248
52 */ 52 */
53 #ifdef SDL_PROTOTYPES_ONLY 53 #ifdef SDL_PROTOTYPES_ONLY
54 struct SDL_SysWMinfo; 54 struct SDL_SysWMinfo;
55 #else 55 #else
56 56
57 #if defined(SDL_VIDEO_DRIVER_WIN32)
58 #define WIN32_LEAN_AND_MEAN
59 #include <windows.h>
60 #endif
61
57 /* This is the structure for custom window manager events */ 62 /* This is the structure for custom window manager events */
58 #if defined(SDL_VIDEO_DRIVER_X11) || defined(SDL_VIDEO_DRIVER_DIRECTFB)
59 #if defined(SDL_VIDEO_DRIVER_X11) 63 #if defined(SDL_VIDEO_DRIVER_X11)
60 #if defined(__APPLE__) && defined(__MACH__) 64 #if defined(__APPLE__) && defined(__MACH__)
61 /* conflicts with Quickdraw.h */ 65 /* conflicts with Quickdraw.h */
62 #define Cursor X11Cursor 66 #define Cursor X11Cursor
63 #endif 67 #endif
73 #endif /* defined(SDL_VIDEO_DRIVER_X11) */ 77 #endif /* defined(SDL_VIDEO_DRIVER_X11) */
74 78
75 #if defined(SDL_VIDEO_DRIVER_DIRECTFB) 79 #if defined(SDL_VIDEO_DRIVER_DIRECTFB)
76 #include <directfb/directfb.h> 80 #include <directfb/directfb.h>
77 #endif 81 #endif
82
83 #if defined(SDL_VIDEO_DRIVER_COCOA)
84 #ifdef __OBJC__
85 #include <Cocoa/Cocoa.h>
86 #else
87 typedef struct _NSWindow NSWindow;
88 #endif
89 #endif
90
78 /** 91 /**
79 * These are the various supported subsystems under UNIX. 92 * These are the various supported windowing subsystems
80 */ 93 */
81 typedef enum 94 typedef enum
82 { 95 {
83 #if defined(SDL_VIDEO_DRIVER_X11) 96 SDL_SYSWM_UNKNOWN,
97 SDL_SYSWM_WINDOWS,
84 SDL_SYSWM_X11, 98 SDL_SYSWM_X11,
85 #endif
86 #if defined(SDL_VIDEO_DRIVER_DIRECTFB)
87 SDL_SYSWM_DIRECTFB, 99 SDL_SYSWM_DIRECTFB,
88 #endif 100 SDL_SYSWM_COCOA,
89 } SDL_SYSWM_TYPE; 101 } SDL_SYSWM_TYPE;
90 102
91 /** 103 /**
92 * The UNIX custom event structure. 104 * The custom event structure.
93 */ 105 */
94 struct SDL_SysWMmsg 106 struct SDL_SysWMmsg
95 { 107 {
96 SDL_version version; 108 SDL_version version;
97 SDL_SYSWM_TYPE subsystem; 109 SDL_SYSWM_TYPE subsystem;
98 union 110 union
99 { 111 {
112 #if defined(SDL_VIDEO_DRIVER_WIN32)
113 struct {
114 HWND hwnd; /**< The window for the message */
115 UINT msg; /**< The type of message */
116 WPARAM wParam; /**< WORD message parameter */
117 LPARAM lParam; /**< LONG message parameter */
118 } win;
119 #endif
100 #if defined(SDL_VIDEO_DRIVER_X11) 120 #if defined(SDL_VIDEO_DRIVER_X11)
101 XEvent xevent; 121 struct {
122 XEvent event;
123 } x11;
102 #endif 124 #endif
103 #if defined(SDL_VIDEO_DRIVER_DIRECTFB) 125 #if defined(SDL_VIDEO_DRIVER_DIRECTFB)
104 DFBEvent dfb_event; 126 struct {
105 #endif 127 DFBEvent event;
106 } event; 128 } dfb;
129 #endif
130 #if defined(SDL_VIDEO_DRIVER_COCOA)
131 struct
132 {
133 /* No Cocoa window events yet */
134 } cocoa;
135 #endif
136 } msg;
107 }; 137 };
108 138
109 /** 139 /**
110 * The UNIX custom window manager information structure. 140 * The custom window manager information structure.
111 * 141 *
112 * When this structure is returned, it holds information about which 142 * When this structure is returned, it holds information about which
113 * low level system it is using, and will be one of SDL_SYSWM_TYPE. 143 * low level system it is using, and will be one of SDL_SYSWM_TYPE.
114 */ 144 */
115 struct SDL_SysWMinfo 145 struct SDL_SysWMinfo
116 { 146 {
117 SDL_version version; 147 SDL_version version;
118 SDL_SYSWM_TYPE subsystem; 148 SDL_SYSWM_TYPE subsystem;
119 union 149 union
120 { 150 {
151 #if defined(SDL_VIDEO_DRIVER_WIN32)
152 struct
153 {
154 HWND window; /**< The Win32 display window */
155 } win;
156 #endif
121 #if defined(SDL_VIDEO_DRIVER_X11) 157 #if defined(SDL_VIDEO_DRIVER_X11)
122 struct 158 struct
123 { 159 {
124 Display *display; /**< The X11 display */ 160 Display *display; /**< The X11 display */
125 Window window; /**< The X11 display window */ 161 Window window; /**< The X11 display window */
126 } x11; 162 } x11;
127 #endif 163 #endif
128 #if defined(SDL_VIDEO_DRIVER_DIRECTFB) 164 #if defined(SDL_VIDEO_DRIVER_DIRECTFB)
129 struct 165 struct
130 { 166 {
131 IDirectFB *dfb; /**< The directfb main interface */ 167 IDirectFB *dfb; /**< The directfb main interface */
132 IDirectFBWindow *window; /**< The directfb window handle */ 168 IDirectFBWindow *window; /**< The directfb window handle */
133 IDirectFBSurface *surface; /**< The directfb client surface */ 169 IDirectFBSurface *surface; /**< The directfb client surface */
134 } directfb; 170 } dfb;
171 #endif
172 #if defined(SDL_VIDEO_DRIVER_COCOA)
173 struct
174 {
175 NSWindow *window;
176 } cocoa;
135 #endif 177 #endif
136 } info; 178 } info;
137 }; 179 };
138
139 #elif defined(SDL_VIDEO_DRIVER_WIN32)
140 #define WIN32_LEAN_AND_MEAN
141 #include <windows.h>
142
143 /**
144 * The windows custom event structure.
145 */
146 struct SDL_SysWMmsg
147 {
148 SDL_version version;
149 HWND hwnd; /**< The window for the message */
150 UINT msg; /**< The type of message */
151 WPARAM wParam; /**< WORD message parameter */
152 LPARAM lParam; /**< LONG message parameter */
153 };
154
155 /**
156 * The windows custom window manager information structure.
157 */
158 struct SDL_SysWMinfo
159 {
160 SDL_version version;
161 HWND window; /**< The Win32 display window */
162 };
163
164 #elif defined(SDL_VIDEO_DRIVER_RISCOS)
165
166 /**
167 * RISC OS custom event structure.
168 */
169 struct SDL_SysWMmsg
170 {
171 SDL_version version;
172 int eventCode; /**< The window for the message */
173 int pollBlock[64];
174 };
175
176 /**
177 * The RISC OS custom window manager information structure.
178 */
179 struct SDL_SysWMinfo
180 {
181 SDL_version version;
182 int wimpVersion; /**< Wimp version running under */
183 int taskHandle; /**< The RISC OS task handle */
184 int window; /**< The RISC OS display window */
185 };
186
187 #elif defined(SDL_VIDEO_DRIVER_PHOTON) || defined(SDL_VIDEO_DRIVER_QNXGF)
188 #include <sys/neutrino.h>
189 #if defined(SDL_VIDEO_OPENGL_ES)
190 #include <gf/gf.h>
191 #endif /* SDL_VIDEO_OPENGL_ES */
192 #include <Ph.h>
193
194 /**
195 * The QNX custom event structure.
196 */
197 struct SDL_SysWMmsg
198 {
199 SDL_version version;
200 int data;
201 };
202
203 /**
204 * The QNX Photon custom window manager information structure.
205 */
206 struct SDL_SysWMinfo
207 {
208 SDL_version version;
209 int data;
210 };
211
212 #else
213
214 /**
215 * The generic custom event structure.
216 */
217 struct SDL_SysWMmsg
218 {
219 SDL_version version;
220 int data;
221 };
222
223 /**
224 * The generic custom window manager information structure.
225 */
226 struct SDL_SysWMinfo
227 {
228 SDL_version version;
229 int data;
230 };
231
232 #endif /* video driver type */
233 180
234 #endif /* SDL_PROTOTYPES_ONLY */ 181 #endif /* SDL_PROTOTYPES_ONLY */
235 182
236 typedef struct SDL_SysWMinfo SDL_SysWMinfo; 183 typedef struct SDL_SysWMinfo SDL_SysWMinfo;
237 184