This repository has been archived by the owner on Feb 11, 2021. It is now read-only.
/
SDL_syswm.h
241 lines (215 loc) · 6.09 KB
1
/*
2
3
Simple DirectMedia Layer
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
4
5
6
7
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
8
9
10
11
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
12
13
14
15
16
17
18
19
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
20
21
*/
22
/**
23
24
25
* \file SDL_syswm.h
*
* Include file for SDL custom system window manager hooks.
26
*/
27
28
29
30
#ifndef _SDL_syswm_h
#define _SDL_syswm_h
31
#include "SDL_stdinc.h"
32
#include "SDL_error.h"
33
#include "SDL_video.h"
34
35
36
37
38
#include "SDL_version.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
39
/* *INDENT-OFF* */
40
extern "C" {
41
/* *INDENT-ON* */
42
43
#endif
44
45
46
47
48
49
50
51
/**
* \file SDL_syswm.h
*
* Your application has access to a special type of event ::SDL_SYSWMEVENT,
* which contains window-manager specific information and arrives whenever
* an unhandled window event occurs. This event is ignored by default, but
* you can enable it with SDL_EventState().
*/
52
53
54
55
#ifdef SDL_PROTOTYPES_ONLY
struct SDL_SysWMinfo;
#else
56
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
57
58
59
60
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
61
/* This is the structure for custom window manager events */
62
#if defined(SDL_VIDEO_DRIVER_X11)
63
#if defined(__APPLE__) && defined(__MACH__)
64
/* conflicts with Quickdraw.h */
65
66
67
#define Cursor X11Cursor
#endif
68
69
70
#include <X11/Xlib.h>
#include <X11/Xatom.h>
71
#if defined(__APPLE__) && defined(__MACH__)
72
/* matches the re-define above */
73
74
75
#undef Cursor
#endif
76
77
78
#endif /* defined(SDL_VIDEO_DRIVER_X11) */
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
79
#include <directfb.h>
80
#endif
81
82
83
84
85
86
87
88
89
#if defined(SDL_VIDEO_DRIVER_COCOA)
#ifdef __OBJC__
#include <Cocoa/Cocoa.h>
#else
typedef struct _NSWindow NSWindow;
#endif
#endif
90
91
92
93
94
95
96
97
#if defined(SDL_VIDEO_DRIVER_UIKIT)
#ifdef __OBJC__
#include <UIKit/UIKit.h>
#else
typedef struct _UIWindow UIWindow;
#endif
#endif
98
/**
99
* These are the various supported windowing subsystems
100
*/
101
102
typedef enum
{
103
104
SDL_SYSWM_UNKNOWN,
SDL_SYSWM_WINDOWS,
105
106
SDL_SYSWM_X11,
SDL_SYSWM_DIRECTFB,
107
SDL_SYSWM_COCOA,
108
SDL_SYSWM_UIKIT,
109
110
} SDL_SYSWM_TYPE;
111
/**
112
* The custom event structure.
113
*/
114
115
116
117
118
119
struct SDL_SysWMmsg
{
SDL_version version;
SDL_SYSWM_TYPE subsystem;
union
{
120
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
121
122
123
124
125
126
struct {
HWND hwnd; /**< The window for the message */
UINT msg; /**< The type of message */
WPARAM wParam; /**< WORD message parameter */
LPARAM lParam; /**< LONG message parameter */
} win;
127
128
#endif
#if defined(SDL_VIDEO_DRIVER_X11)
129
130
131
struct {
XEvent event;
} x11;
132
133
#endif
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
134
135
136
struct {
DFBEvent event;
} dfb;
137
138
#endif
#if defined(SDL_VIDEO_DRIVER_COCOA)
139
140
141
142
struct
{
/* No Cocoa window events yet */
} cocoa;
143
144
#endif
#if defined(SDL_VIDEO_DRIVER_UIKIT)
145
146
147
148
struct
{
/* No UIKit window events yet */
} uikit;
149
#endif
150
151
/* Can't have an empty union */
int dummy;
152
} msg;
153
154
};
155
/**
156
* The custom window manager information structure.
157
158
159
*
* When this structure is returned, it holds information about which
* low level system it is using, and will be one of SDL_SYSWM_TYPE.
160
*/
161
162
163
164
165
166
struct SDL_SysWMinfo
{
SDL_version version;
SDL_SYSWM_TYPE subsystem;
union
{
167
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
168
169
struct
{
170
HWND window; /**< The window handle */
171
} win;
172
173
#endif
#if defined(SDL_VIDEO_DRIVER_X11)
174
175
struct
{
176
Display *display; /**< The X11 display */
177
Window window; /**< The X11 window */
178
} x11;
179
180
#endif
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
181
182
struct
{
183
184
185
IDirectFB *dfb; /**< The directfb main interface */
IDirectFBWindow *window; /**< The directfb window handle */
IDirectFBSurface *surface; /**< The directfb client surface */
186
} dfb;
187
188
#endif
#if defined(SDL_VIDEO_DRIVER_COCOA)
189
190
struct
{
191
NSWindow *window; /* The Cocoa window */
192
} cocoa;
193
194
#endif
#if defined(SDL_VIDEO_DRIVER_UIKIT)
195
196
197
198
struct
{
UIWindow *window; /* The UIKit window */
} uikit;
199
#endif
200
201
/* Can't have an empty union */
int dummy;
202
} info;
203
};
204
205
206
#endif /* SDL_PROTOTYPES_ONLY */
207
208
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
209
/* Function prototypes */
210
/**
211
212
* \brief This function allows access to driver-dependent window information.
*
213
* \param window The window about which information is being requested
214
215
216
217
218
219
220
221
* \param info This structure must be initialized with the SDL version, and is
* then filled in with information about the given window.
*
* \return SDL_TRUE if the function is implemented and the version member of
* the \c info struct is valid, SDL_FALSE otherwise.
*
* You typically use this function like this:
* \code
222
* SDL_SysWMinfo info;
223
224
225
* SDL_VERSION(&info.version);
* if ( SDL_GetWindowWMInfo(&info) ) { ... }
* \endcode
226
*/
227
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
228
SDL_SysWMinfo * info);
229
230
231
232
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
233
/* *INDENT-OFF* */
234
}
235
/* *INDENT-ON* */
236
237
238
239
#endif
#include "close_code.h"
#endif /* _SDL_syswm_h */
240
241
/* vi: set ts=4 sw=4 expandtab: */