/
SDL_syswm.h
232 lines (194 loc) · 6.33 KB
1
2
/*
SDL - Simple DirectMedia Layer
3
Copyright (C) 1997-2012 Sam Lantinga
4
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Lesser General Public
7
License as published by the Free Software Foundation; either
8
version 2.1 of the License, or (at your option) any later version.
9
10
11
12
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Lesser General Public License for more details.
14
15
16
17
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19
Sam Lantinga
20
slouken@libsdl.org
21
22
*/
23
24
25
/** @file SDL_syswm.h
* Include file for SDL custom system window manager hooks
*/
26
27
28
29
#ifndef _SDL_syswm_h
#define _SDL_syswm_h
30
#include "SDL_stdinc.h"
31
#include "SDL_error.h"
32
33
#include "SDL_version.h"
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef SDL_PROTOTYPES_ONLY
# if defined(SDL_VIDEO_DRIVER_X11)
# if defined(__APPLE__) && defined(__MACH__)
# define Cursor X11Cursor /* conflicts with Quickdraw.h */
# endif
# include <X11/Xlib.h>
# include <X11/Xatom.h>
# if defined(__APPLE__) && defined(__MACH__)
# undef Cursor
# endif
# elif defined(SDL_VIDEO_DRIVER_NANOX)
# include <microwin/nano-X.h>
# elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI)
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# include <windows.h>
# elif defined(SDL_VIDEO_DRIVER_PHOTON)
# include <sys/neutrino.h>
# include <Ph.h>
# endif
#endif
57
58
59
60
61
62
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
63
64
65
66
67
68
/** @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()
*/
69
70
struct SDL_SysWMinfo;
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
71
72
#ifndef SDL_PROTOTYPES_ONLY
73
74
/* This is the structure for custom window manager events */
75
#if defined(SDL_VIDEO_DRIVER_X11)
76
77
/** These are the various supported subsystems under UNIX */
78
79
80
81
typedef enum {
SDL_SYSWM_X11
} SDL_SYSWM_TYPE;
82
/** The UNIX custom event structure */
83
84
85
86
87
88
89
90
struct SDL_SysWMmsg {
SDL_version version;
SDL_SYSWM_TYPE subsystem;
union {
XEvent xevent;
} event;
};
91
92
93
/** The UNIX custom window manager information structure.
* When this structure is returned, it holds information about which
* low level system it is using, and will be one of SDL_SYSWM_TYPE.
94
*/
95
struct SDL_SysWMinfo {
96
97
98
99
SDL_version version;
SDL_SYSWM_TYPE subsystem;
union {
struct {
100
101
102
103
104
105
106
Display *display; /**< The X11 display */
Window window; /**< The X11 display window */
/** These locking functions should be called around
* any X11 functions using the display variable,
* but not the gfxdisplay variable.
* They lock the event thread, so should not be
* called around event functions or from event filters.
107
*/
109
110
void (*lock_func)(void);
void (*unlock_func)(void);
111
112
113
114
115
116
117
118
119
120
121
122
/*@}*/
/** @name Introduced in SDL 1.0.2 */
/*@{*/
Window fswindow; /**< The X11 fullscreen window */
Window wmwindow; /**< The X11 managed input window */
/*@}*/
/** @name Introduced in SDL 1.2.12 */
/*@{*/
Display *gfxdisplay; /**< The X11 display to which rendering is done */
/*@}*/
123
124
} x11;
} info;
125
};
126
127
#elif defined(SDL_VIDEO_DRIVER_NANOX)
128
129
/** The generic custom event structure */
130
131
132
133
134
struct SDL_SysWMmsg {
SDL_version version;
int data;
};
135
/** The windows custom window manager information structure */
136
struct SDL_SysWMinfo {
137
138
SDL_version version ;
GR_WINDOW_ID window ; /* The display window */
139
};
140
141
#elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI)
142
143
/** The windows custom event structure */
144
145
struct SDL_SysWMmsg {
SDL_version version;
146
147
148
149
HWND hwnd; /**< The window for the message */
UINT msg; /**< The type of message */
WPARAM wParam; /**< WORD message parameter */
LPARAM lParam; /**< LONG message parameter */
150
151
};
152
/** The windows custom window manager information structure */
153
struct SDL_SysWMinfo {
154
SDL_version version;
155
156
HWND window; /**< The Win32 display window */
HGLRC hglrc; /**< The OpenGL context, if any */
157
};
158
159
#elif defined(SDL_VIDEO_DRIVER_RISCOS)
160
161
/** RISC OS custom event structure */
162
163
struct SDL_SysWMmsg {
SDL_version version;
164
int eventCode; /**< The window for the message */
165
166
167
int pollBlock[64];
};
168
/** The RISC OS custom window manager information structure */
169
struct SDL_SysWMinfo {
170
SDL_version version;
171
172
173
int wimpVersion; /**< Wimp version running under */
int taskHandle; /**< The RISC OS task handle */
int window; /**< The RISC OS display window */
174
};
175
176
#elif defined(SDL_VIDEO_DRIVER_PHOTON)
177
178
/** The QNX custom event structure */
179
180
181
182
183
struct SDL_SysWMmsg {
SDL_version version;
int data;
};
184
/** The QNX custom window manager information structure */
185
struct SDL_SysWMinfo {
186
187
SDL_version version;
int data;
188
};
189
190
191
#else
192
/** The generic custom event structure */
193
194
195
196
197
struct SDL_SysWMmsg {
SDL_version version;
int data;
};
198
/** The generic custom window manager information structure */
199
struct SDL_SysWMinfo {
200
201
SDL_version version;
int data;
202
};
203
204
#endif /* video driver type */
205
206
207
208
#endif /* SDL_PROTOTYPES_ONLY */
/* Function prototypes */
210
211
* This function gives you custom hooks into the window manager information.
* It fills the structure pointed to by 'info' with custom information and
212
213
214
* returns 0 if the function is not implemented, 1 if the function is
* implemented and no error occurred, and -1 if the version member of
* the 'info' structure is not filled in or not supported.
215
216
*
* You typically use this function like this:
217
* @code
218
* SDL_SysWMinfo info;
219
220
* SDL_VERSION(&info.version);
* if ( SDL_GetWMInfo(&info) ) { ... }
221
* @endcode
222
*/
223
extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info);
224
225
226
227
228
229
230
231
232
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_syswm_h */