slouken@0
|
1 |
/*
|
slouken@5535
|
2 |
Simple DirectMedia Layer
|
slouken@8149
|
3 |
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
slouken@0
|
4 |
|
slouken@5535
|
5 |
This software is provided 'as-is', without any express or implied
|
slouken@5535
|
6 |
warranty. In no event will the authors be held liable for any damages
|
slouken@5535
|
7 |
arising from the use of this software.
|
slouken@0
|
8 |
|
slouken@5535
|
9 |
Permission is granted to anyone to use this software for any purpose,
|
slouken@5535
|
10 |
including commercial applications, and to alter it and redistribute it
|
slouken@5535
|
11 |
freely, subject to the following restrictions:
|
slouken@0
|
12 |
|
slouken@5535
|
13 |
1. The origin of this software must not be misrepresented; you must not
|
slouken@5535
|
14 |
claim that you wrote the original software. If you use this software
|
slouken@5535
|
15 |
in a product, an acknowledgment in the product documentation would be
|
slouken@5535
|
16 |
appreciated but is not required.
|
slouken@5535
|
17 |
2. Altered source versions must be plainly marked as such, and must not be
|
slouken@5535
|
18 |
misrepresented as being the original software.
|
slouken@5535
|
19 |
3. This notice may not be removed or altered from any source distribution.
|
slouken@0
|
20 |
*/
|
slouken@0
|
21 |
|
slouken@1895
|
22 |
/**
|
slouken@3407
|
23 |
* \file SDL_syswm.h
|
slouken@7191
|
24 |
*
|
slouken@3407
|
25 |
* Include file for SDL custom system window manager hooks.
|
slouken@1895
|
26 |
*/
|
slouken@0
|
27 |
|
slouken@0
|
28 |
#ifndef _SDL_syswm_h
|
slouken@0
|
29 |
#define _SDL_syswm_h
|
slouken@0
|
30 |
|
slouken@1356
|
31 |
#include "SDL_stdinc.h"
|
slouken@1358
|
32 |
#include "SDL_error.h"
|
slouken@1895
|
33 |
#include "SDL_video.h"
|
slouken@0
|
34 |
#include "SDL_version.h"
|
slouken@0
|
35 |
|
slouken@0
|
36 |
#include "begin_code.h"
|
slouken@0
|
37 |
/* Set up for C function definitions, even when using C++ */
|
slouken@0
|
38 |
#ifdef __cplusplus
|
slouken@0
|
39 |
extern "C" {
|
slouken@0
|
40 |
#endif
|
slouken@0
|
41 |
|
slouken@3407
|
42 |
/**
|
slouken@3407
|
43 |
* \file SDL_syswm.h
|
slouken@7191
|
44 |
*
|
slouken@3407
|
45 |
* Your application has access to a special type of event ::SDL_SYSWMEVENT,
|
slouken@3407
|
46 |
* which contains window-manager specific information and arrives whenever
|
slouken@3407
|
47 |
* an unhandled window event occurs. This event is ignored by default, but
|
slouken@3407
|
48 |
* you can enable it with SDL_EventState().
|
slouken@3407
|
49 |
*/
|
slouken@0
|
50 |
#ifdef SDL_PROTOTYPES_ONLY
|
slouken@0
|
51 |
struct SDL_SysWMinfo;
|
slouken@0
|
52 |
#else
|
slouken@0
|
53 |
|
slouken@5062
|
54 |
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
|
jorgen@8968
|
55 |
#ifndef WIN32_LEAN_AND_MEAN
|
slouken@4900
|
56 |
#define WIN32_LEAN_AND_MEAN
|
jorgen@8968
|
57 |
#endif
|
slouken@4900
|
58 |
#include <windows.h>
|
slouken@4900
|
59 |
#endif
|
slouken@4900
|
60 |
|
dludwig@8463
|
61 |
#if defined(SDL_VIDEO_DRIVER_WINRT)
|
dludwig@8527
|
62 |
#include <Inspectable.h>
|
dludwig@8463
|
63 |
#endif
|
dludwig@8463
|
64 |
|
slouken@1361
|
65 |
/* This is the structure for custom window manager events */
|
slouken@1626
|
66 |
#if defined(SDL_VIDEO_DRIVER_X11)
|
icculus@1133
|
67 |
#if defined(__APPLE__) && defined(__MACH__)
|
slouken@1487
|
68 |
/* conflicts with Quickdraw.h */
|
icculus@1133
|
69 |
#define Cursor X11Cursor
|
icculus@1133
|
70 |
#endif
|
icculus@1133
|
71 |
|
slouken@0
|
72 |
#include <X11/Xlib.h>
|
slouken@0
|
73 |
#include <X11/Xatom.h>
|
slouken@0
|
74 |
|
icculus@1133
|
75 |
#if defined(__APPLE__) && defined(__MACH__)
|
slouken@1487
|
76 |
/* matches the re-define above */
|
icculus@1133
|
77 |
#undef Cursor
|
icculus@1133
|
78 |
#endif
|
icculus@1133
|
79 |
|
slouken@4899
|
80 |
#endif /* defined(SDL_VIDEO_DRIVER_X11) */
|
slouken@4899
|
81 |
|
slouken@4899
|
82 |
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
|
slouken@5199
|
83 |
#include <directfb.h>
|
slouken@4899
|
84 |
#endif
|
slouken@4900
|
85 |
|
slouken@4900
|
86 |
#if defined(SDL_VIDEO_DRIVER_COCOA)
|
slouken@4900
|
87 |
#ifdef __OBJC__
|
jorgen@8812
|
88 |
@class NSWindow;
|
slouken@4900
|
89 |
#else
|
slouken@4900
|
90 |
typedef struct _NSWindow NSWindow;
|
slouken@4900
|
91 |
#endif
|
slouken@4900
|
92 |
#endif
|
slouken@4900
|
93 |
|
slouken@5056
|
94 |
#if defined(SDL_VIDEO_DRIVER_UIKIT)
|
slouken@5056
|
95 |
#ifdef __OBJC__
|
slouken@5056
|
96 |
#include <UIKit/UIKit.h>
|
slouken@5056
|
97 |
#else
|
slouken@5056
|
98 |
typedef struct _UIWindow UIWindow;
|
dludwig@8305
|
99 |
typedef struct _UIViewController UIViewController;
|
slouken@5056
|
100 |
#endif
|
slouken@5056
|
101 |
#endif
|
slouken@5056
|
102 |
|
slouken@8799
|
103 |
#if defined(SDL_VIDEO_DRIVER_ANDROID)
|
slouken@8799
|
104 |
typedef struct ANativeWindow ANativeWindow;
|
slouken@8799
|
105 |
typedef void *EGLSurface;
|
slouken@8799
|
106 |
#endif
|
slouken@8799
|
107 |
|
slouken@7191
|
108 |
/**
|
slouken@4900
|
109 |
* These are the various supported windowing subsystems
|
slouken@3407
|
110 |
*/
|
slouken@1895
|
111 |
typedef enum
|
slouken@1895
|
112 |
{
|
slouken@4900
|
113 |
SDL_SYSWM_UNKNOWN,
|
slouken@4900
|
114 |
SDL_SYSWM_WINDOWS,
|
slouken@4899
|
115 |
SDL_SYSWM_X11,
|
slouken@4899
|
116 |
SDL_SYSWM_DIRECTFB,
|
slouken@4900
|
117 |
SDL_SYSWM_COCOA,
|
slouken@5056
|
118 |
SDL_SYSWM_UIKIT,
|
gabomdq@8134
|
119 |
SDL_SYSWM_WAYLAND,
|
icculus@8153
|
120 |
SDL_SYSWM_MIR,
|
slouken@8799
|
121 |
SDL_SYSWM_WINRT,
|
slouken@8799
|
122 |
SDL_SYSWM_ANDROID
|
slouken@0
|
123 |
} SDL_SYSWM_TYPE;
|
slouken@0
|
124 |
|
slouken@3407
|
125 |
/**
|
slouken@4900
|
126 |
* The custom event structure.
|
slouken@3407
|
127 |
*/
|
slouken@1895
|
128 |
struct SDL_SysWMmsg
|
slouken@1895
|
129 |
{
|
slouken@1895
|
130 |
SDL_version version;
|
slouken@1895
|
131 |
SDL_SYSWM_TYPE subsystem;
|
slouken@1895
|
132 |
union
|
slouken@1895
|
133 |
{
|
slouken@5062
|
134 |
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
|
slouken@4900
|
135 |
struct {
|
slouken@4900
|
136 |
HWND hwnd; /**< The window for the message */
|
slouken@4900
|
137 |
UINT msg; /**< The type of message */
|
slouken@4900
|
138 |
WPARAM wParam; /**< WORD message parameter */
|
slouken@4900
|
139 |
LPARAM lParam; /**< LONG message parameter */
|
slouken@4900
|
140 |
} win;
|
slouken@5065
|
141 |
#endif
|
slouken@5065
|
142 |
#if defined(SDL_VIDEO_DRIVER_X11)
|
slouken@4900
|
143 |
struct {
|
slouken@4900
|
144 |
XEvent event;
|
slouken@4900
|
145 |
} x11;
|
slouken@5065
|
146 |
#endif
|
slouken@5065
|
147 |
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
|
slouken@4900
|
148 |
struct {
|
slouken@4900
|
149 |
DFBEvent event;
|
slouken@4900
|
150 |
} dfb;
|
slouken@5065
|
151 |
#endif
|
slouken@5065
|
152 |
#if defined(SDL_VIDEO_DRIVER_COCOA)
|
slouken@4900
|
153 |
struct
|
slouken@4900
|
154 |
{
|
jorgen@9153
|
155 |
/* Latest version of Xcode clang complains about empty structs in C v. C++:
|
jorgen@9153
|
156 |
error: empty struct has size 0 in C, size 1 in C++
|
jorgen@9153
|
157 |
*/
|
jorgen@9153
|
158 |
int dummy;
|
slouken@4900
|
159 |
/* No Cocoa window events yet */
|
slouken@4900
|
160 |
} cocoa;
|
slouken@5065
|
161 |
#endif
|
slouken@5065
|
162 |
#if defined(SDL_VIDEO_DRIVER_UIKIT)
|
slouken@5056
|
163 |
struct
|
slouken@5056
|
164 |
{
|
slouken@5056
|
165 |
/* No UIKit window events yet */
|
slouken@5056
|
166 |
} uikit;
|
slouken@5065
|
167 |
#endif
|
slouken@5063
|
168 |
/* Can't have an empty union */
|
slouken@5063
|
169 |
int dummy;
|
slouken@5056
|
170 |
} msg;
|
slouken@0
|
171 |
};
|
slouken@0
|
172 |
|
slouken@3407
|
173 |
/**
|
slouken@4900
|
174 |
* The custom window manager information structure.
|
slouken@3407
|
175 |
*
|
slouken@3407
|
176 |
* When this structure is returned, it holds information about which
|
slouken@3407
|
177 |
* low level system it is using, and will be one of SDL_SYSWM_TYPE.
|
slouken@0
|
178 |
*/
|
slouken@1895
|
179 |
struct SDL_SysWMinfo
|
slouken@1895
|
180 |
{
|
slouken@1895
|
181 |
SDL_version version;
|
slouken@1895
|
182 |
SDL_SYSWM_TYPE subsystem;
|
slouken@1895
|
183 |
union
|
slouken@1895
|
184 |
{
|
slouken@5062
|
185 |
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
|
slouken@4900
|
186 |
struct
|
slouken@4900
|
187 |
{
|
slouken@4903
|
188 |
HWND window; /**< The window handle */
|
slouken@4900
|
189 |
} win;
|
slouken@5065
|
190 |
#endif
|
dludwig@8411
|
191 |
#if defined(SDL_VIDEO_DRIVER_WINRT)
|
dludwig@8411
|
192 |
struct
|
dludwig@8411
|
193 |
{
|
dludwig@8527
|
194 |
IInspectable * window; /**< The WinRT CoreWindow */
|
dludwig@8411
|
195 |
} winrt;
|
dludwig@8411
|
196 |
#endif
|
slouken@5065
|
197 |
#if defined(SDL_VIDEO_DRIVER_X11)
|
slouken@1895
|
198 |
struct
|
slouken@1895
|
199 |
{
|
slouken@4900
|
200 |
Display *display; /**< The X11 display */
|
slouken@4903
|
201 |
Window window; /**< The X11 window */
|
slouken@1895
|
202 |
} x11;
|
slouken@5065
|
203 |
#endif
|
slouken@5065
|
204 |
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
|
slouken@4899
|
205 |
struct
|
slouken@4899
|
206 |
{
|
slouken@4903
|
207 |
IDirectFB *dfb; /**< The directfb main interface */
|
slouken@4903
|
208 |
IDirectFBWindow *window; /**< The directfb window handle */
|
slouken@4903
|
209 |
IDirectFBSurface *surface; /**< The directfb client surface */
|
slouken@4900
|
210 |
} dfb;
|
slouken@5065
|
211 |
#endif
|
slouken@5065
|
212 |
#if defined(SDL_VIDEO_DRIVER_COCOA)
|
slouken@4900
|
213 |
struct
|
slouken@4900
|
214 |
{
|
slouken@9099
|
215 |
#if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
|
icculus@9035
|
216 |
NSWindow __unsafe_unretained *window; /* The Cocoa window */
|
icculus@9035
|
217 |
#else
|
icculus@9035
|
218 |
NSWindow *window; /* The Cocoa window */
|
icculus@9035
|
219 |
#endif
|
slouken@4900
|
220 |
} cocoa;
|
slouken@5065
|
221 |
#endif
|
slouken@5065
|
222 |
#if defined(SDL_VIDEO_DRIVER_UIKIT)
|
slouken@5056
|
223 |
struct
|
slouken@5056
|
224 |
{
|
slouken@9099
|
225 |
#if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
|
icculus@9035
|
226 |
UIWindow __unsafe_unretained *window; /* The UIKit window */
|
icculus@9035
|
227 |
#else
|
icculus@9035
|
228 |
UIWindow *window; /* The UIKit window */
|
icculus@9035
|
229 |
#endif
|
slouken@5056
|
230 |
} uikit;
|
slouken@5065
|
231 |
#endif
|
gabomdq@8134
|
232 |
#if defined(SDL_VIDEO_DRIVER_WAYLAND)
|
gabomdq@8134
|
233 |
struct
|
gabomdq@8134
|
234 |
{
|
gabomdq@8134
|
235 |
struct wl_display *display; /**< Wayland display */
|
gabomdq@8134
|
236 |
struct wl_surface *surface; /**< Wayland surface */
|
gabomdq@8134
|
237 |
struct wl_shell_surface *shell_surface; /**< Wayland shell_surface (window manager handle) */
|
gabomdq@8134
|
238 |
} wl;
|
gabomdq@8134
|
239 |
#endif
|
icculus@8155
|
240 |
#if defined(SDL_VIDEO_DRIVER_MIR)
|
icculus@8155
|
241 |
struct
|
icculus@8155
|
242 |
{
|
brandon@8731
|
243 |
struct MirConnection *connection; /**< Mir display server connection */
|
brandon@8731
|
244 |
struct MirSurface *surface; /**< Mir surface */
|
icculus@8155
|
245 |
} mir;
|
icculus@8155
|
246 |
#endif
|
icculus@8155
|
247 |
|
slouken@8799
|
248 |
#if defined(SDL_VIDEO_DRIVER_ANDROID)
|
slouken@8799
|
249 |
struct
|
slouken@8799
|
250 |
{
|
slouken@8799
|
251 |
ANativeWindow *window;
|
slouken@8799
|
252 |
EGLSurface surface;
|
slouken@8799
|
253 |
} android;
|
slouken@8799
|
254 |
#endif
|
slouken@8799
|
255 |
|
slouken@5063
|
256 |
/* Can't have an empty union */
|
slouken@5063
|
257 |
int dummy;
|
slouken@5056
|
258 |
} info;
|
slouken@1895
|
259 |
};
|
slouken@0
|
260 |
|
slouken@0
|
261 |
#endif /* SDL_PROTOTYPES_ONLY */
|
slouken@0
|
262 |
|
slouken@1895
|
263 |
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
|
slouken@1895
|
264 |
|
slouken@0
|
265 |
/* Function prototypes */
|
slouken@1895
|
266 |
/**
|
slouken@3407
|
267 |
* \brief This function allows access to driver-dependent window information.
|
slouken@7191
|
268 |
*
|
slouken@4530
|
269 |
* \param window The window about which information is being requested
|
slouken@7191
|
270 |
* \param info This structure must be initialized with the SDL version, and is
|
slouken@3407
|
271 |
* then filled in with information about the given window.
|
slouken@7191
|
272 |
*
|
slouken@7191
|
273 |
* \return SDL_TRUE if the function is implemented and the version member of
|
slouken@3407
|
274 |
* the \c info struct is valid, SDL_FALSE otherwise.
|
slouken@7191
|
275 |
*
|
slouken@3407
|
276 |
* You typically use this function like this:
|
slouken@3407
|
277 |
* \code
|
slouken@4895
|
278 |
* SDL_SysWMinfo info;
|
slouken@3407
|
279 |
* SDL_VERSION(&info.version);
|
slouken@7455
|
280 |
* if ( SDL_GetWindowWMInfo(window, &info) ) { ... }
|
slouken@3407
|
281 |
* \endcode
|
slouken@0
|
282 |
*/
|
slouken@3685
|
283 |
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
|
slouken@1895
|
284 |
SDL_SysWMinfo * info);
|
slouken@0
|
285 |
|
slouken@0
|
286 |
|
slouken@0
|
287 |
/* Ends C function definitions when using C++ */
|
slouken@0
|
288 |
#ifdef __cplusplus
|
slouken@0
|
289 |
}
|
slouken@0
|
290 |
#endif
|
slouken@0
|
291 |
#include "close_code.h"
|
slouken@0
|
292 |
|
slouken@0
|
293 |
#endif /* _SDL_syswm_h */
|
slouken@1895
|
294 |
|
slouken@1895
|
295 |
/* vi: set ts=4 sw=4 expandtab: */
|