2 Simple DirectMedia Layer
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
25 * Include file for SDL custom system window manager hooks.
31 #include "SDL_stdinc.h"
32 #include "SDL_error.h"
33 #include "SDL_video.h"
34 #include "SDL_version.h"
36 #include "begin_code.h"
37 /* Set up for C function definitions, even when using C++ */
45 * Your application has access to a special type of event ::SDL_SYSWMEVENT,
46 * which contains window-manager specific information and arrives whenever
47 * an unhandled window event occurs. This event is ignored by default, but
48 * you can enable it with SDL_EventState().
50 #ifdef SDL_PROTOTYPES_ONLY
54 #if defined(SDL_VIDEO_DRIVER_WINDOWS)
55 #define WIN32_LEAN_AND_MEAN
59 #if defined(SDL_VIDEO_DRIVER_WINRT)
60 #include <Inspectable.h>
63 /* This is the structure for custom window manager events */
64 #if defined(SDL_VIDEO_DRIVER_X11)
65 #if defined(__APPLE__) && defined(__MACH__)
66 /* conflicts with Quickdraw.h */
67 #define Cursor X11Cursor
71 #include <X11/Xatom.h>
73 #if defined(__APPLE__) && defined(__MACH__)
74 /* matches the re-define above */
78 #endif /* defined(SDL_VIDEO_DRIVER_X11) */
80 #if defined(SDL_VIDEO_DRIVER_DIRECTFB)
84 #if defined(SDL_VIDEO_DRIVER_COCOA)
86 #include <Cocoa/Cocoa.h>
88 typedef struct _NSWindow NSWindow;
92 #if defined(SDL_VIDEO_DRIVER_UIKIT)
94 #include <UIKit/UIKit.h>
96 typedef struct _UIWindow UIWindow;
97 typedef struct _UIViewController UIViewController;
101 #if defined(SDL_VIDEO_DRIVER_MIR)
102 #include <mir_toolkit/mir_client_library.h>
107 * These are the various supported windowing subsystems
123 * The custom event structure.
128 SDL_SYSWM_TYPE subsystem;
131 #if defined(SDL_VIDEO_DRIVER_WINDOWS)
133 HWND hwnd; /**< The window for the message */
134 UINT msg; /**< The type of message */
135 WPARAM wParam; /**< WORD message parameter */
136 LPARAM lParam; /**< LONG message parameter */
139 #if defined(SDL_VIDEO_DRIVER_X11)
144 #if defined(SDL_VIDEO_DRIVER_DIRECTFB)
149 #if defined(SDL_VIDEO_DRIVER_COCOA)
152 /* No Cocoa window events yet */
155 #if defined(SDL_VIDEO_DRIVER_UIKIT)
158 /* No UIKit window events yet */
161 /* Can't have an empty union */
167 * The custom window manager information structure.
169 * When this structure is returned, it holds information about which
170 * low level system it is using, and will be one of SDL_SYSWM_TYPE.
175 SDL_SYSWM_TYPE subsystem;
178 #if defined(SDL_VIDEO_DRIVER_WINDOWS)
181 HWND window; /**< The window handle */
184 #if defined(SDL_VIDEO_DRIVER_WINRT)
187 IInspectable * window; /**< The WinRT CoreWindow */
190 #if defined(SDL_VIDEO_DRIVER_X11)
193 Display *display; /**< The X11 display */
194 Window window; /**< The X11 window */
197 #if defined(SDL_VIDEO_DRIVER_DIRECTFB)
200 IDirectFB *dfb; /**< The directfb main interface */
201 IDirectFBWindow *window; /**< The directfb window handle */
202 IDirectFBSurface *surface; /**< The directfb client surface */
205 #if defined(SDL_VIDEO_DRIVER_COCOA)
208 NSWindow *window; /* The Cocoa window */
211 #if defined(SDL_VIDEO_DRIVER_UIKIT)
214 UIWindow *window; /* The UIKit window */
217 #if defined(SDL_VIDEO_DRIVER_WAYLAND)
220 struct wl_display *display; /**< Wayland display */
221 struct wl_surface *surface; /**< Wayland surface */
222 struct wl_shell_surface *shell_surface; /**< Wayland shell_surface (window manager handle) */
225 #if defined(SDL_VIDEO_DRIVER_MIR)
228 MirConnection *connection; /**< Mir display server connection */
229 MirSurface *surface; /**< Mir surface */
233 /* Can't have an empty union */
238 #endif /* SDL_PROTOTYPES_ONLY */
240 typedef struct SDL_SysWMinfo SDL_SysWMinfo;
242 /* Function prototypes */
244 * \brief This function allows access to driver-dependent window information.
246 * \param window The window about which information is being requested
247 * \param info This structure must be initialized with the SDL version, and is
248 * then filled in with information about the given window.
250 * \return SDL_TRUE if the function is implemented and the version member of
251 * the \c info struct is valid, SDL_FALSE otherwise.
253 * You typically use this function like this:
255 * SDL_SysWMinfo info;
256 * SDL_VERSION(&info.version);
257 * if ( SDL_GetWindowWMInfo(window, &info) ) { ... }
260 extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
261 SDL_SysWMinfo * info);
264 /* Ends C function definitions when using C++ */
268 #include "close_code.h"
270 #endif /* _SDL_syswm_h */
272 /* vi: set ts=4 sw=4 expandtab: */