Skip to content

Latest commit

 

History

History
226 lines (188 loc) · 6.17 KB

SDL_syswm.h

File metadata and controls

226 lines (188 loc) · 6.17 KB
 
Apr 26, 2001
Apr 26, 2001
1
2
/*
SDL - Simple DirectMedia Layer
Dec 31, 2011
Dec 31, 2011
3
Copyright (C) 1997-2012 Sam Lantinga
Apr 26, 2001
Apr 26, 2001
4
5
This library is free software; you can redistribute it and/or
Feb 1, 2006
Feb 1, 2006
6
modify it under the terms of the GNU Lesser General Public
Apr 26, 2001
Apr 26, 2001
7
License as published by the Free Software Foundation; either
Feb 1, 2006
Feb 1, 2006
8
version 2.1 of the License, or (at your option) any later version.
Apr 26, 2001
Apr 26, 2001
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
Feb 1, 2006
Feb 1, 2006
13
Lesser General Public License for more details.
Apr 26, 2001
Apr 26, 2001
14
Feb 1, 2006
Feb 1, 2006
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
Apr 26, 2001
Apr 26, 2001
18
19
Sam Lantinga
Dec 14, 2001
Dec 14, 2001
20
slouken@libsdl.org
Apr 26, 2001
Apr 26, 2001
21
22
*/
Sep 21, 2009
Sep 21, 2009
23
24
25
/** @file SDL_syswm.h
* Include file for SDL custom system window manager hooks
*/
Apr 26, 2001
Apr 26, 2001
26
27
28
29
#ifndef _SDL_syswm_h
#define _SDL_syswm_h
Feb 10, 2006
Feb 10, 2006
30
#include "SDL_stdinc.h"
Feb 10, 2006
Feb 10, 2006
31
#include "SDL_error.h"
Apr 26, 2001
Apr 26, 2001
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
Sep 21, 2009
Sep 21, 2009
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()
*/
Apr 26, 2001
Apr 26, 2001
46
47
48
49
50
#ifdef SDL_PROTOTYPES_ONLY
struct SDL_SysWMinfo;
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
#else
Feb 16, 2006
Feb 16, 2006
51
/* This is the structure for custom window manager events */
Apr 13, 2006
Apr 13, 2006
52
#if defined(SDL_VIDEO_DRIVER_X11)
Sep 8, 2005
Sep 8, 2005
53
#if defined(__APPLE__) && defined(__MACH__)
Mar 9, 2006
Mar 9, 2006
54
/* conflicts with Quickdraw.h */
Sep 8, 2005
Sep 8, 2005
55
56
57
#define Cursor X11Cursor
#endif
Apr 26, 2001
Apr 26, 2001
58
59
60
#include <X11/Xlib.h>
#include <X11/Xatom.h>
Sep 8, 2005
Sep 8, 2005
61
#if defined(__APPLE__) && defined(__MACH__)
Mar 9, 2006
Mar 9, 2006
62
/* matches the re-define above */
Sep 8, 2005
Sep 8, 2005
63
64
65
#undef Cursor
#endif
Sep 21, 2009
Sep 21, 2009
66
/** These are the various supported subsystems under UNIX */
Apr 26, 2001
Apr 26, 2001
67
68
69
70
typedef enum {
SDL_SYSWM_X11
} SDL_SYSWM_TYPE;
Sep 21, 2009
Sep 21, 2009
71
/** The UNIX custom event structure */
Apr 26, 2001
Apr 26, 2001
72
73
74
75
76
77
78
79
struct SDL_SysWMmsg {
SDL_version version;
SDL_SYSWM_TYPE subsystem;
union {
XEvent xevent;
} event;
};
Sep 21, 2009
Sep 21, 2009
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.
Apr 26, 2001
Apr 26, 2001
83
*/
Jul 18, 2004
Jul 18, 2004
84
typedef struct SDL_SysWMinfo {
Apr 26, 2001
Apr 26, 2001
85
86
87
88
SDL_version version;
SDL_SYSWM_TYPE subsystem;
union {
struct {
Sep 21, 2009
Sep 21, 2009
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.
Apr 26, 2001
Apr 26, 2001
96
*/
Sep 21, 2009
Sep 21, 2009
97
/*@{*/
Apr 26, 2001
Apr 26, 2001
98
99
void (*lock_func)(void);
void (*unlock_func)(void);
Sep 21, 2009
Sep 21, 2009
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 */
/*@}*/
Apr 26, 2001
Apr 26, 2001
112
113
114
115
} x11;
} info;
} SDL_SysWMinfo;
Apr 13, 2006
Apr 13, 2006
116
#elif defined(SDL_VIDEO_DRIVER_NANOX)
May 11, 2001
May 11, 2001
117
118
#include <microwin/nano-X.h>
Sep 21, 2009
Sep 21, 2009
119
/** The generic custom event structure */
May 11, 2001
May 11, 2001
120
121
122
123
124
struct SDL_SysWMmsg {
SDL_version version;
int data;
};
Sep 21, 2009
Sep 21, 2009
125
/** The windows custom window manager information structure */
Jul 18, 2004
Jul 18, 2004
126
typedef struct SDL_SysWMinfo {
May 11, 2001
May 11, 2001
127
128
129
130
SDL_version version ;
GR_WINDOW_ID window ; /* The display window */
} SDL_SysWMinfo;
May 3, 2006
May 3, 2006
131
#elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI)
Feb 25, 2006
Feb 25, 2006
132
133
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
Apr 26, 2001
Apr 26, 2001
134
Sep 21, 2009
Sep 21, 2009
135
/** The windows custom event structure */
Apr 26, 2001
Apr 26, 2001
136
137
struct SDL_SysWMmsg {
SDL_version version;
Sep 21, 2009
Sep 21, 2009
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 */
Apr 26, 2001
Apr 26, 2001
142
143
};
Sep 21, 2009
Sep 21, 2009
144
/** The windows custom window manager information structure */
Jul 18, 2004
Jul 18, 2004
145
typedef struct SDL_SysWMinfo {
Apr 26, 2001
Apr 26, 2001
146
SDL_version version;
Sep 21, 2009
Sep 21, 2009
147
148
HWND window; /**< The Win32 display window */
HGLRC hglrc; /**< The OpenGL context, if any */
Apr 26, 2001
Apr 26, 2001
149
150
} SDL_SysWMinfo;
Apr 13, 2006
Apr 13, 2006
151
#elif defined(SDL_VIDEO_DRIVER_RISCOS)
May 29, 2003
May 29, 2003
152
Sep 21, 2009
Sep 21, 2009
153
/** RISC OS custom event structure */
May 29, 2003
May 29, 2003
154
155
struct SDL_SysWMmsg {
SDL_version version;
Sep 21, 2009
Sep 21, 2009
156
int eventCode; /**< The window for the message */
May 29, 2003
May 29, 2003
157
158
159
int pollBlock[64];
};
Sep 21, 2009
Sep 21, 2009
160
/** The RISC OS custom window manager information structure */
Jul 18, 2004
Jul 18, 2004
161
typedef struct SDL_SysWMinfo {
May 29, 2003
May 29, 2003
162
SDL_version version;
Sep 21, 2009
Sep 21, 2009
163
164
165
int wimpVersion; /**< Wimp version running under */
int taskHandle; /**< The RISC OS task handle */
int window; /**< The RISC OS display window */
May 29, 2003
May 29, 2003
166
167
} SDL_SysWMinfo;
Apr 13, 2006
Apr 13, 2006
168
#elif defined(SDL_VIDEO_DRIVER_PHOTON)
Mar 4, 2004
Mar 4, 2004
169
170
171
#include <sys/neutrino.h>
#include <Ph.h>
Sep 21, 2009
Sep 21, 2009
172
/** The QNX custom event structure */
Mar 4, 2004
Mar 4, 2004
173
174
175
176
177
struct SDL_SysWMmsg {
SDL_version version;
int data;
};
Sep 21, 2009
Sep 21, 2009
178
/** The QNX custom window manager information structure */
Jul 18, 2004
Jul 18, 2004
179
typedef struct SDL_SysWMinfo {
Mar 4, 2004
Mar 4, 2004
180
181
182
183
SDL_version version;
int data;
} SDL_SysWMinfo;
Apr 26, 2001
Apr 26, 2001
184
185
#else
Sep 21, 2009
Sep 21, 2009
186
/** The generic custom event structure */
Apr 26, 2001
Apr 26, 2001
187
188
189
190
191
struct SDL_SysWMmsg {
SDL_version version;
int data;
};
Sep 21, 2009
Sep 21, 2009
192
/** The generic custom window manager information structure */
Jul 18, 2004
Jul 18, 2004
193
typedef struct SDL_SysWMinfo {
Apr 26, 2001
Apr 26, 2001
194
195
196
197
SDL_version version;
int data;
} SDL_SysWMinfo;
Feb 16, 2006
Feb 16, 2006
198
#endif /* video driver type */
Apr 26, 2001
Apr 26, 2001
199
200
201
202
#endif /* SDL_PROTOTYPES_ONLY */
/* Function prototypes */
Sep 21, 2009
Sep 21, 2009
203
/**
Apr 26, 2001
Apr 26, 2001
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
Jul 18, 2010
Jul 18, 2010
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.
Nov 30, 2004
Nov 30, 2004
209
210
*
* You typically use this function like this:
Sep 21, 2009
Sep 21, 2009
211
* @code
Jul 20, 2011
Jul 20, 2011
212
* SDL_SysWMinfo info;
Nov 30, 2004
Nov 30, 2004
213
214
* SDL_VERSION(&info.version);
* if ( SDL_GetWMInfo(&info) ) { ... }
Sep 21, 2009
Sep 21, 2009
215
* @endcode
Apr 26, 2001
Apr 26, 2001
216
*/
Apr 11, 2002
Apr 11, 2002
217
extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info);
Apr 26, 2001
Apr 26, 2001
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 */