Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
241 lines (215 loc) · 6.09 KB

SDL_syswm.h

File metadata and controls

241 lines (215 loc) · 6.09 KB
 
Apr 26, 2001
Apr 26, 2001
1
/*
Apr 8, 2011
Apr 8, 2011
2
3
Simple DirectMedia Layer
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
Apr 26, 2001
Apr 26, 2001
4
Apr 8, 2011
Apr 8, 2011
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.
Apr 26, 2001
Apr 26, 2001
8
Apr 8, 2011
Apr 8, 2011
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:
Apr 26, 2001
Apr 26, 2001
12
Apr 8, 2011
Apr 8, 2011
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.
Apr 26, 2001
Apr 26, 2001
20
21
*/
Jul 10, 2006
Jul 10, 2006
22
/**
Oct 19, 2009
Oct 19, 2009
23
24
25
* \file SDL_syswm.h
*
* Include file for SDL custom system window manager hooks.
Jul 10, 2006
Jul 10, 2006
26
*/
Apr 26, 2001
Apr 26, 2001
27
28
29
30
#ifndef _SDL_syswm_h
#define _SDL_syswm_h
Feb 10, 2006
Feb 10, 2006
31
#include "SDL_stdinc.h"
Feb 10, 2006
Feb 10, 2006
32
#include "SDL_error.h"
Jul 10, 2006
Jul 10, 2006
33
#include "SDL_video.h"
Apr 26, 2001
Apr 26, 2001
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
Jul 10, 2006
Jul 10, 2006
39
/* *INDENT-OFF* */
Apr 26, 2001
Apr 26, 2001
40
extern "C" {
Jul 10, 2006
Jul 10, 2006
41
/* *INDENT-ON* */
Apr 26, 2001
Apr 26, 2001
42
43
#endif
Oct 19, 2009
Oct 19, 2009
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().
*/
Apr 26, 2001
Apr 26, 2001
52
53
54
55
#ifdef SDL_PROTOTYPES_ONLY
struct SDL_SysWMinfo;
#else
Jan 21, 2011
Jan 21, 2011
56
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
Sep 27, 2010
Sep 27, 2010
57
58
59
60
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
Feb 16, 2006
Feb 16, 2006
61
/* This is the structure for custom window manager events */
Apr 13, 2006
Apr 13, 2006
62
#if defined(SDL_VIDEO_DRIVER_X11)
Sep 8, 2005
Sep 8, 2005
63
#if defined(__APPLE__) && defined(__MACH__)
Mar 9, 2006
Mar 9, 2006
64
/* conflicts with Quickdraw.h */
Sep 8, 2005
Sep 8, 2005
65
66
67
#define Cursor X11Cursor
#endif
Apr 26, 2001
Apr 26, 2001
68
69
70
#include <X11/Xlib.h>
#include <X11/Xatom.h>
Sep 8, 2005
Sep 8, 2005
71
#if defined(__APPLE__) && defined(__MACH__)
Mar 9, 2006
Mar 9, 2006
72
/* matches the re-define above */
Sep 8, 2005
Sep 8, 2005
73
74
75
#undef Cursor
#endif
Sep 27, 2010
Sep 27, 2010
76
77
78
#endif /* defined(SDL_VIDEO_DRIVER_X11) */
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
Feb 6, 2011
Feb 6, 2011
79
#include <directfb.h>
Sep 27, 2010
Sep 27, 2010
80
#endif
Sep 27, 2010
Sep 27, 2010
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
Jan 21, 2011
Jan 21, 2011
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
Oct 19, 2009
Oct 19, 2009
98
/**
Sep 27, 2010
Sep 27, 2010
99
* These are the various supported windowing subsystems
Oct 19, 2009
Oct 19, 2009
100
*/
Jul 10, 2006
Jul 10, 2006
101
102
typedef enum
{
Sep 27, 2010
Sep 27, 2010
103
104
SDL_SYSWM_UNKNOWN,
SDL_SYSWM_WINDOWS,
Sep 27, 2010
Sep 27, 2010
105
106
SDL_SYSWM_X11,
SDL_SYSWM_DIRECTFB,
Sep 27, 2010
Sep 27, 2010
107
SDL_SYSWM_COCOA,
Jan 21, 2011
Jan 21, 2011
108
SDL_SYSWM_UIKIT,
Apr 26, 2001
Apr 26, 2001
109
110
} SDL_SYSWM_TYPE;
Oct 19, 2009
Oct 19, 2009
111
/**
Sep 27, 2010
Sep 27, 2010
112
* The custom event structure.
Oct 19, 2009
Oct 19, 2009
113
*/
Jul 10, 2006
Jul 10, 2006
114
115
116
117
118
119
struct SDL_SysWMmsg
{
SDL_version version;
SDL_SYSWM_TYPE subsystem;
union
{
Jan 21, 2011
Jan 21, 2011
120
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
Sep 27, 2010
Sep 27, 2010
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;
Jan 21, 2011
Jan 21, 2011
127
128
#endif
#if defined(SDL_VIDEO_DRIVER_X11)
Sep 27, 2010
Sep 27, 2010
129
130
131
struct {
XEvent event;
} x11;
Jan 21, 2011
Jan 21, 2011
132
133
#endif
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
Sep 27, 2010
Sep 27, 2010
134
135
136
struct {
DFBEvent event;
} dfb;
Jan 21, 2011
Jan 21, 2011
137
138
#endif
#if defined(SDL_VIDEO_DRIVER_COCOA)
Sep 27, 2010
Sep 27, 2010
139
140
141
142
struct
{
/* No Cocoa window events yet */
} cocoa;
Jan 21, 2011
Jan 21, 2011
143
144
#endif
#if defined(SDL_VIDEO_DRIVER_UIKIT)
Jan 21, 2011
Jan 21, 2011
145
146
147
148
struct
{
/* No UIKit window events yet */
} uikit;
Jan 21, 2011
Jan 21, 2011
149
#endif
Jan 21, 2011
Jan 21, 2011
150
151
/* Can't have an empty union */
int dummy;
Jan 21, 2011
Jan 21, 2011
152
} msg;
Apr 26, 2001
Apr 26, 2001
153
154
};
Oct 19, 2009
Oct 19, 2009
155
/**
Sep 27, 2010
Sep 27, 2010
156
* The custom window manager information structure.
Oct 19, 2009
Oct 19, 2009
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.
Apr 26, 2001
Apr 26, 2001
160
*/
Jul 10, 2006
Jul 10, 2006
161
162
163
164
165
166
struct SDL_SysWMinfo
{
SDL_version version;
SDL_SYSWM_TYPE subsystem;
union
{
Jan 21, 2011
Jan 21, 2011
167
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
Sep 27, 2010
Sep 27, 2010
168
169
struct
{
Sep 30, 2010
Sep 30, 2010
170
HWND window; /**< The window handle */
Sep 27, 2010
Sep 27, 2010
171
} win;
Jan 21, 2011
Jan 21, 2011
172
173
#endif
#if defined(SDL_VIDEO_DRIVER_X11)
Jul 10, 2006
Jul 10, 2006
174
175
struct
{
Sep 27, 2010
Sep 27, 2010
176
Display *display; /**< The X11 display */
Sep 30, 2010
Sep 30, 2010
177
Window window; /**< The X11 window */
Jul 10, 2006
Jul 10, 2006
178
} x11;
Jan 21, 2011
Jan 21, 2011
179
180
#endif
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
Sep 27, 2010
Sep 27, 2010
181
182
struct
{
Sep 30, 2010
Sep 30, 2010
183
184
185
IDirectFB *dfb; /**< The directfb main interface */
IDirectFBWindow *window; /**< The directfb window handle */
IDirectFBSurface *surface; /**< The directfb client surface */
Sep 27, 2010
Sep 27, 2010
186
} dfb;
Jan 21, 2011
Jan 21, 2011
187
188
#endif
#if defined(SDL_VIDEO_DRIVER_COCOA)
Sep 27, 2010
Sep 27, 2010
189
190
struct
{
Sep 30, 2010
Sep 30, 2010
191
NSWindow *window; /* The Cocoa window */
Sep 27, 2010
Sep 27, 2010
192
} cocoa;
Jan 21, 2011
Jan 21, 2011
193
194
#endif
#if defined(SDL_VIDEO_DRIVER_UIKIT)
Jan 21, 2011
Jan 21, 2011
195
196
197
198
struct
{
UIWindow *window; /* The UIKit window */
} uikit;
Jan 21, 2011
Jan 21, 2011
199
#endif
Jan 21, 2011
Jan 21, 2011
200
201
/* Can't have an empty union */
int dummy;
Jan 21, 2011
Jan 21, 2011
202
} info;
Jul 10, 2006
Jul 10, 2006
203
};
Apr 26, 2001
Apr 26, 2001
204
205
206
#endif /* SDL_PROTOTYPES_ONLY */
Jul 10, 2006
Jul 10, 2006
207
208
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
Apr 26, 2001
Apr 26, 2001
209
/* Function prototypes */
Jul 10, 2006
Jul 10, 2006
210
/**
Oct 19, 2009
Oct 19, 2009
211
212
* \brief This function allows access to driver-dependent window information.
*
Jul 18, 2010
Jul 18, 2010
213
* \param window The window about which information is being requested
Oct 19, 2009
Oct 19, 2009
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
Sep 26, 2010
Sep 26, 2010
222
* SDL_SysWMinfo info;
Oct 19, 2009
Oct 19, 2009
223
224
225
* SDL_VERSION(&info.version);
* if ( SDL_GetWindowWMInfo(&info) ) { ... }
* \endcode
Apr 26, 2001
Apr 26, 2001
226
*/
Jan 21, 2010
Jan 21, 2010
227
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
Jul 10, 2006
Jul 10, 2006
228
SDL_SysWMinfo * info);
Apr 26, 2001
Apr 26, 2001
229
230
231
232
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
Jul 10, 2006
Jul 10, 2006
233
/* *INDENT-OFF* */
Apr 26, 2001
Apr 26, 2001
234
}
Jul 10, 2006
Jul 10, 2006
235
/* *INDENT-ON* */
Apr 26, 2001
Apr 26, 2001
236
237
238
239
#endif
#include "close_code.h"
#endif /* _SDL_syswm_h */
Jul 10, 2006
Jul 10, 2006
240
241
/* vi: set ts=4 sw=4 expandtab: */