2 Simple DirectMedia Layer
3 Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
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 #ifndef WIN32_LEAN_AND_MEAN
56 #define WIN32_LEAN_AND_MEAN
61 #if defined(SDL_VIDEO_DRIVER_WINRT)
62 #include <Inspectable.h>
65 /* This is the structure for custom window manager events */
66 #if defined(SDL_VIDEO_DRIVER_X11)
67 #if defined(__APPLE__) && defined(__MACH__)
68 /* conflicts with Quickdraw.h */
69 #define Cursor X11Cursor
73 #include <X11/Xatom.h>
75 #if defined(__APPLE__) && defined(__MACH__)
76 /* matches the re-define above */
80 #endif /* defined(SDL_VIDEO_DRIVER_X11) */
82 #if defined(SDL_VIDEO_DRIVER_DIRECTFB)
86 #if defined(SDL_VIDEO_DRIVER_COCOA)
90 typedef struct _NSWindow NSWindow;
94 #if defined(SDL_VIDEO_DRIVER_UIKIT)
96 #include <UIKit/UIKit.h>
98 typedef struct _UIWindow UIWindow;
99 typedef struct _UIViewController UIViewController;
101 typedef Uint32 GLuint;
104 #if defined(SDL_VIDEO_DRIVER_ANDROID)
105 typedef struct ANativeWindow ANativeWindow;
106 typedef void *EGLSurface;
109 #if defined(SDL_VIDEO_DRIVER_VIVANTE)
114 * These are the various supported windowing subsystems
133 * The custom event structure.
138 SDL_SYSWM_TYPE subsystem;
141 #if defined(SDL_VIDEO_DRIVER_WINDOWS)
143 HWND hwnd; /**< The window for the message */
144 UINT msg; /**< The type of message */
145 WPARAM wParam; /**< WORD message parameter */
146 LPARAM lParam; /**< LONG message parameter */
149 #if defined(SDL_VIDEO_DRIVER_X11)
154 #if defined(SDL_VIDEO_DRIVER_DIRECTFB)
159 #if defined(SDL_VIDEO_DRIVER_COCOA)
162 /* Latest version of Xcode clang complains about empty structs in C v. C++:
163 error: empty struct has size 0 in C, size 1 in C++
166 /* No Cocoa window events yet */
169 #if defined(SDL_VIDEO_DRIVER_UIKIT)
173 /* No UIKit window events yet */
176 #if defined(SDL_VIDEO_DRIVER_VIVANTE)
180 /* No Vivante window events yet */
183 /* Can't have an empty union */
189 * The custom window manager information structure.
191 * When this structure is returned, it holds information about which
192 * low level system it is using, and will be one of SDL_SYSWM_TYPE.
197 SDL_SYSWM_TYPE subsystem;
200 #if defined(SDL_VIDEO_DRIVER_WINDOWS)
203 HWND window; /**< The window handle */
204 HDC hdc; /**< The window device context */
205 HINSTANCE hinstance; /**< The instance handle */
208 #if defined(SDL_VIDEO_DRIVER_WINRT)
211 IInspectable * window; /**< The WinRT CoreWindow */
214 #if defined(SDL_VIDEO_DRIVER_X11)
217 Display *display; /**< The X11 display */
218 Window window; /**< The X11 window */
221 #if defined(SDL_VIDEO_DRIVER_DIRECTFB)
224 IDirectFB *dfb; /**< The directfb main interface */
225 IDirectFBWindow *window; /**< The directfb window handle */
226 IDirectFBSurface *surface; /**< The directfb client surface */
229 #if defined(SDL_VIDEO_DRIVER_COCOA)
232 #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
233 NSWindow __unsafe_unretained *window; /**< The Cocoa window */
235 NSWindow *window; /**< The Cocoa window */
239 #if defined(SDL_VIDEO_DRIVER_UIKIT)
242 #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
243 UIWindow __unsafe_unretained *window; /**< The UIKit window */
245 UIWindow *window; /**< The UIKit window */
247 GLuint framebuffer; /**< The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */
248 GLuint colorbuffer; /**< The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */
249 GLuint resolveFramebuffer; /**< The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */
252 #if defined(SDL_VIDEO_DRIVER_WAYLAND)
255 struct wl_display *display; /**< Wayland display */
256 struct wl_surface *surface; /**< Wayland surface */
257 struct wl_shell_surface *shell_surface; /**< Wayland shell_surface (window manager handle) */
260 #if defined(SDL_VIDEO_DRIVER_MIR)
263 struct MirConnection *connection; /**< Mir display server connection */
264 struct MirSurface *surface; /**< Mir surface */
268 #if defined(SDL_VIDEO_DRIVER_ANDROID)
271 ANativeWindow *window;
276 #if defined(SDL_VIDEO_DRIVER_VIVANTE)
279 EGLNativeDisplayType display;
280 EGLNativeWindowType window;
284 /* Make sure this union is always 64 bytes (8 64-bit pointers). */
285 /* Be careful not to overflow this if you add a new target! */
290 #endif /* SDL_PROTOTYPES_ONLY */
292 typedef struct SDL_SysWMinfo SDL_SysWMinfo;
294 /* Function prototypes */
296 * \brief This function allows access to driver-dependent window information.
298 * \param window The window about which information is being requested
299 * \param info This structure must be initialized with the SDL version, and is
300 * then filled in with information about the given window.
302 * \return SDL_TRUE if the function is implemented and the version member of
303 * the \c info struct is valid, SDL_FALSE otherwise.
305 * You typically use this function like this:
307 * SDL_SysWMinfo info;
308 * SDL_VERSION(&info.version);
309 * if ( SDL_GetWindowWMInfo(window, &info) ) { ... }
312 extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
313 SDL_SysWMinfo * info);
316 /* Ends C function definitions when using C++ */
320 #include "close_code.h"
322 #endif /* SDL_syswm_h_ */
324 /* vi: set ts=4 sw=4 expandtab: */