2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2009 Sam Lantinga
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.
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.
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
24 * Include file for SDL custom system window manager hooks
30 #include "SDL_stdinc.h"
31 #include "SDL_error.h"
32 #include "SDL_version.h"
34 #include "begin_code.h"
35 /* Set up for C function definitions, even when using C++ */
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()
46 #ifdef SDL_PROTOTYPES_ONLY
48 typedef struct SDL_SysWMinfo SDL_SysWMinfo;
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
59 #include <X11/Xatom.h>
61 #if defined(__APPLE__) && defined(__MACH__)
62 /* matches the re-define above */
66 /** These are the various supported subsystems under UNIX */
71 /** The UNIX custom event structure */
74 SDL_SYSWM_TYPE subsystem;
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.
84 typedef struct SDL_SysWMinfo {
86 SDL_SYSWM_TYPE subsystem;
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.
98 void (*lock_func)(void);
99 void (*unlock_func)(void);
102 /** @name Introduced in SDL 1.0.2 */
104 Window fswindow; /**< The X11 fullscreen window */
105 Window wmwindow; /**< The X11 managed input window */
108 /** @name Introduced in SDL 1.2.12 */
110 Display *gfxdisplay; /**< The X11 display to which rendering is done */
116 #elif defined(SDL_VIDEO_DRIVER_NANOX)
117 #include <microwin/nano-X.h>
119 /** The generic custom event structure */
120 struct SDL_SysWMmsg {
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 */
131 #elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI)
132 #define WIN32_LEAN_AND_MEAN
135 /** The windows custom event structure */
136 struct SDL_SysWMmsg {
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 */
144 /** The windows custom window manager information structure */
145 typedef struct SDL_SysWMinfo {
147 HWND window; /**< The Win32 display window */
148 HGLRC hglrc; /**< The OpenGL context, if any */
151 #elif defined(SDL_VIDEO_DRIVER_RISCOS)
153 /** RISC OS custom event structure */
154 struct SDL_SysWMmsg {
156 int eventCode; /**< The window for the message */
160 /** The RISC OS custom window manager information structure */
161 typedef struct SDL_SysWMinfo {
163 int wimpVersion; /**< Wimp version running under */
164 int taskHandle; /**< The RISC OS task handle */
165 int window; /**< The RISC OS display window */
168 #elif defined(SDL_VIDEO_DRIVER_PHOTON)
169 #include <sys/neutrino.h>
172 /** The QNX custom event structure */
173 struct SDL_SysWMmsg {
178 /** The QNX custom window manager information structure */
179 typedef struct SDL_SysWMinfo {
186 /** The generic custom event structure */
187 struct SDL_SysWMmsg {
192 /** The generic custom window manager information structure */
193 typedef struct SDL_SysWMinfo {
198 #endif /* video driver type */
200 #endif /* SDL_PROTOTYPES_ONLY */
202 /* Function prototypes */
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.
209 * You typically use this function like this:
211 * SDL_SysWMInfo info;
212 * SDL_VERSION(&info.version);
213 * if ( SDL_GetWMInfo(&info) ) { ... }
216 extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info);
219 /* Ends C function definitions when using C++ */
223 #include "close_code.h"
225 #endif /* _SDL_syswm_h */