/
SDL_syswm.h
226 lines (188 loc) · 6.17 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
34
35
36
37
38
39
#include "SDL_version.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
40
41
42
43
44
45
/** @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()
*/
46
47
48
49
50
#ifdef SDL_PROTOTYPES_ONLY
struct SDL_SysWMinfo;
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
#else
51
/* This is the structure for custom window manager events */
52
#if defined(SDL_VIDEO_DRIVER_X11)
53
#if defined(__APPLE__) && defined(__MACH__)
54
/* conflicts with Quickdraw.h */
55
56
57
#define Cursor X11Cursor
#endif
58
59
60
#include <X11/Xlib.h>
#include <X11/Xatom.h>
61
#if defined(__APPLE__) && defined(__MACH__)
62
/* matches the re-define above */
63
64
65
#undef Cursor
#endif
66
/** These are the various supported subsystems under UNIX */
67
68
69
70
typedef enum {
SDL_SYSWM_X11
} SDL_SYSWM_TYPE;
71
/** The UNIX custom event structure */
72
73
74
75
76
77
78
79
struct SDL_SysWMmsg {
SDL_version version;
SDL_SYSWM_TYPE subsystem;
union {
XEvent xevent;
} event;
};
80
81
82
/** 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.
83
*/
84
typedef struct SDL_SysWMinfo {
85
86
87
88
SDL_version version;
SDL_SYSWM_TYPE subsystem;
union {
struct {
89
90
91
92
93
94
95
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.
96
*/
98
99
void (*lock_func)(void);
void (*unlock_func)(void);
100
101
102
103
104
105
106
107
108
109
110
111
/*@}*/
/** @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 */
/*@}*/
112
113
114
115
} x11;
} info;
} SDL_SysWMinfo;
116
#elif defined(SDL_VIDEO_DRIVER_NANOX)
117
118
#include <microwin/nano-X.h>
119
/** The generic custom event structure */
120
121
122
123
124
struct SDL_SysWMmsg {
SDL_version version;
int data;
};
125
/** The windows custom window manager information structure */
126
typedef struct SDL_SysWMinfo {
127
128
129
130
SDL_version version ;
GR_WINDOW_ID window ; /* The display window */
} SDL_SysWMinfo;
131
#elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI)
132
133
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
134
135
/** The windows custom event structure */
136
137
struct SDL_SysWMmsg {
SDL_version version;
138
139
140
141
HWND hwnd; /**< The window for the message */
UINT msg; /**< The type of message */
WPARAM wParam; /**< WORD message parameter */
LPARAM lParam; /**< LONG message parameter */
142
143
};
144
/** The windows custom window manager information structure */
145
typedef struct SDL_SysWMinfo {
146
SDL_version version;
147
148
HWND window; /**< The Win32 display window */
HGLRC hglrc; /**< The OpenGL context, if any */
149
150
} SDL_SysWMinfo;
151
#elif defined(SDL_VIDEO_DRIVER_RISCOS)
152
153
/** RISC OS custom event structure */
154
155
struct SDL_SysWMmsg {
SDL_version version;
156
int eventCode; /**< The window for the message */
157
158
159
int pollBlock[64];
};
160
/** The RISC OS custom window manager information structure */
161
typedef struct SDL_SysWMinfo {
162
SDL_version version;
163
164
165
int wimpVersion; /**< Wimp version running under */
int taskHandle; /**< The RISC OS task handle */
int window; /**< The RISC OS display window */
166
167
} SDL_SysWMinfo;
168
#elif defined(SDL_VIDEO_DRIVER_PHOTON)
169
170
171
#include <sys/neutrino.h>
#include <Ph.h>
172
/** The QNX custom event structure */
173
174
175
176
177
struct SDL_SysWMmsg {
SDL_version version;
int data;
};
178
/** The QNX custom window manager information structure */
179
typedef struct SDL_SysWMinfo {
180
181
182
183
SDL_version version;
int data;
} SDL_SysWMinfo;
184
185
#else
186
/** The generic custom event structure */
187
188
189
190
191
struct SDL_SysWMmsg {
SDL_version version;
int data;
};
192
/** The generic custom window manager information structure */
193
typedef struct SDL_SysWMinfo {
194
195
196
197
SDL_version version;
int data;
} SDL_SysWMinfo;
198
#endif /* video driver type */
199
200
201
202
#endif /* SDL_PROTOTYPES_ONLY */
/* Function prototypes */
204
205
* This function gives you custom hooks into the window manager information.
* It fills the structure pointed to by 'info' with custom information and
206
207
208
* 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.
209
210
*
* You typically use this function like this:
211
* @code
212
* SDL_SysWMinfo info;
213
214
* SDL_VERSION(&info.version);
* if ( SDL_GetWMInfo(&info) ) { ... }
215
* @endcode
216
*/
217
extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info);
218
219
220
221
222
223
224
225
226
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_syswm_h */