forked from PascalGameDevelopment/SDL2-for-Pascal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsdlsyswm.inc
297 lines (268 loc) · 9.52 KB
/
sdlsyswm.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
// from sdl_syswm.h
{$IFDEF WINDOWS}
{$DEFINE SDL_VIDEO_DRIVER_WINDOWS}
{$ENDIF}
{$IF DEFINED (LINUX) OR DEFINED(UNIX)}
{$IF NOT (DEFINED(DARWIN) OR DEFINED(ANDROID))}
{$DEFINE SDL_VIDEO_DRIVER_X11}
{$ENDIF}
{$IFEND}
(*
* Disabled because FPC does not ship a DirectFB unit.
* If you have some working DirectDB bindings, feel welcome to enable this and check if it breaks anything.
*)
{$UNDEF SDL_VIDEO_DRIVER_DIRECTFB}
{$IFDEF DARWIN}
{$DEFINE SDL_VIDEO_DRIVER_COCOA}
{$ENDIF}
(*
* Disabled because it's a Mac-specific video driver and we have no means of testing it.
* If you own a Mac, feel welcome to enable this and check if it actually compiles and doesn't break anything.
*)
{$UNDEF SDL_VIDEO_DRIVER_UIKIT}
(*
* Disabled because FPC does not ship a Wayland unit.
* If you have some working Wayland bindings, feel welcome to enable this,
* check if it actually compiles and doesn't break anything.
*)
{$UNDEF SDL_VIDEO_DRIVER_WAYLAND}
(*
* Disabled because FPC does not ship a Mir unit.
* Also, support for Mir has been removed in SDL 2.0.10.
*)
{$UNDEF SDL_VIDEO_DRIVER_MIR}
(*
* Disabled because FPC does not support WinRT.
*)
{$UNDEF SDL_VIDEO_DRIVER_WINRT}
{$IFDEF ANDROID}
{$DEFINE SDL_VIDEO_DRIVER_ANDROID}
{$ENDIF}
(*
* Disabled because this is an embedded platform and we have no means of testing this.
* If you're actually working with Vivante, feel welcome to enable this
* and check if it compiles and works properly.
*)
{$UNDEF SDL_VIDEO_DRIVER_VIVANTE}
{$IFDEF OS2}
{$DEFINE SDL_VIDEO_DRIVER_OS2}
{$ENDIF}
{$IFDEF HAIKU}
{$DEFINE SDL_VIDEO_DRIVER_HAIKU}
{$ENDIF}
{**
* These are the various supported windowing subsystems
*}
Type
TSDL_SYSWM_TYPE = (
SDL_SYSWM_UNKNOWN,
SDL_SYSWM_WINDOWS,
SDL_SYSWM_X11,
SDL_SYSWM_DIRECTFB,
SDL_SYSWM_COCOA,
SDL_SYSWM_UIKIT,
SDL_SYSWM_WAYLAND, // Since SDL 2.0.2 - REMOVED in SDL 2.0.10!
SDL_SYSWM_MIR, // Since SDL 2.0.2
SDL_SYSWM_WINRT, // Since SDL 2.0.3
SDL_SYSWM_ANDROID, // Since SDL 2.0.4
SDL_SYSWM_VIVANTE, // Since SDL 2.0.5
SDL_SYSWM_OS2, // Since SDL 2.0.6
SDL_SYSWM_HAIKU // Since SDL 2.0.12
);
/// sdl_syswm.h uses anonymous structs, declared right in SDL_SysWMmsg and SDL_SysWMinfo.
/// Since Pascal does not allow this, we workaround by introducing named types.
{$IFDEF SDL_VIDEO_DRIVER_WINDOWS}
__SYSWM_WINDOWS = record
hwnd: HWND; {**< The window for the message }
msg: uInt; {**< The type of message *}
wParam: WPARAM; {**< WORD message parameter *}
lParam: LPARAM; {**< WORD message parameter *}
end;
__WMINFO_WINDOWS = record
window: HWND; {**< The window handle *}
hdc: HDC; {**< The window device context *}
end;
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_X11}
__SYSWM_X11 = record
event: {$IFDEF FPC} TXEvent {$ELSE} XEvent {$ENDIF};
end;
__WMINFO_X11 = record
display: PDisplay; {**< The X11 display *}
window: TWindow; {**< The X11 window *}
end;
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_DIRECTFB}
__SYSWM_DIRECTFB = record
event: DFBEvent;
end;
__WMINFO_DIRECTFB = record
dfb: IDirectFB; {**< The directfb main interface *}
window: IDirectFBWindow; {**< The directfb window handle *}
surface: IDirectFBSurface; {**< The directfb client surface *}
end;
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_COCOA}
__SYSWM_COCOA = record
(* No Cocoa window events yet *)
dummy: integer;
end;
__WMINFO_COCOA = record
window: NSWindow; {* The Cocoa window *}
end;
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_UIKIT}
__SYSWM_UIKIT = record
(* No UIKit window events yet *)
dummy: integer;
end;
__WMINFO_UIKIT = record
window: UIWindow; {* The UIKit window *}
framebuffer: GLuint; {* The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. *}
colorbuffer: GLuint; {* The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. *}
resolveFramebuffer: GLuint; {* The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. *}
end;
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_WAYLAND}
__WMINFO_WAYLAND = record
display: wl_display; {**< Wayland display *}
surface: wl_surface; {**< Wayland surface *}
shell_surface: wl_shell_surface; {**< Wayland shell_surface (window manager handle) *}
end;
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_MIR}
__WMINFO_MIR = record
connection: PMirConnection; {**< Mir display server connection *}
surface: PMirSurface; {**< Mir surface *}
end;
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_WINRT}
__WMINFO_WINRT = record
window: IInspectable; {**< The WinRT CoreWindow *}
end;
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_ANDROID}
__WMINFO_ANDROID = record
window: Pointer; // PANativeWindow;
surface: Pointer; // PEGLSurface;
end;
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_VIVANTE}
__SYSWM_VIVANTE = record
(* No Vivante window events yet *)
dummy: integer;
end;
__WMINFO_VIVANTE = record
display: EGLNativeDisplayType;
window: EGLNativeWindowType;
end;
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_OS2}
__SYSWM_OS2 = record
fFrame: Boolean; {**< TRUE if hwnd is a frame window *}
hwnd: HWND; {**< The window receiving the message *}
msg: uInt; {**< The message identifier *}
mp1: MPARAM; {**< The first first message parameter *}
mp2: MPARAM; {**< The second first message parameter *}
end;
__WMINFO_OS2 = record
hwnd: HWND; {**< The window handle *}
hwndFrame: HWND; {**< The frame window handle *}
end;
{$ENDIF}
{**
* The custom event structure.
*}
PSDL_SysWMmsg = ^TSDL_SysWMmsg;
TSDL_SysWMmsg = record
version: TSDL_version;
case subsystem: TSDL_SYSWM_TYPE of
{$IFDEF SDL_VIDEO_DRIVER_WINDOWS}
SDL_SYSWM_WINDOWS: (win: __SYSWM_WINDOWS);
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_X11}
SDL_SYSWM_X11: (x11: __SYSWM_X11);
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_DIRECTFB}
SDL_SYSWM_DIRECTFB: (dfb: __SYSWM_DIRECTFB);
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_COCOA}
SDL_SYSWM_COCOA: (cocoa: __SYSWM_COCOA);
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_UIKIT}
SDL_SYSWM_UIKIT: (uikit: __SYSWM_UIKIT);
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_VIVANTE}
SDL_SYSWM_VIVANTE: (vivante: __SYSWM_VIVANTE);
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_OS2}
SDL_SYSWM_OS2: (os2: __SYSWM_OS2);
{$ENDIF}
SDL_SYSWM_UNKNOWN: (dummy: integer);
end;
{**
* The 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.
*}
PSDL_SysWMinfo = ^TSDL_SysWMinfo;
TSDL_SysWMinfo = record
version: TSDL_version;
case subsystem: TSDL_SYSWM_TYPE of
{$IFDEF SDL_VIDEO_DRIVER_WINDOWS}
SDL_SYSWM_WINDOWS: (win : __WMINFO_WINDOWS);
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_WINRT}
SDL_SYSWM_WINRT: (winrt : __WMINFO_WINRT);
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_X11}
SDL_SYSWM_X11: (x11 : __WMINFO_X11);
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_DIRECTFB}
SDL_SYSWM_DIRECTFB: (dfb : __WMINFO_DIRECTFB);
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_COCOA}
SDL_SYSWM_COCOA: (cocoa : __WMINFO_COCOA);
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_UIKIT}
SDL_SYSWM_UIKIT: (uikit : __WMINFO_UIKIT);
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_WAYLAND}
SDL_SYSWM_WAYLAND: (wl : __WMINFO_WAYLAND);
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_MIR}
SDL_SYSWM_MIR: (mir : __WMINFO_MIR);
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_ANDROID}
SDL_SYSWM_ANDROID: (android: __WMINFO_ANDROID);
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_VIVANTE}
SDL_SYSWM_VIVANTE: (vivante: __WMINFO_VIVANTE);
{$ENDIF}
{$IFDEF SDL_VIDEO_DRIVER_OS2}
SDL_SYSWM_OS2: (os2: __WMINFO_OS2);
{$ENDIF}
(* Ensure this union is always 64 bytes (8 64-bit pointers) *)
SDL_SYSWM_UNKNOWN: (dummy: array[0..63] of Byte);
end;
{* Function prototypes *}
(**
* \brief This function allows access to driver-dependent window information.
*
* \param window The window about which information is being requested
* \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
* SDL_SysWMinfo info;
* SDL_VERSION(&info.version);
* if ( SDL_GetWindowWMInfo(window, &info) ) { ... }
* \endcode
*)
Function SDL_GetWindowWMInfo(window:PSDL_Window; info : PSDL_SysWMinfo):TSDL_bool; cdecl;
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetWindowWMInfo' {$ENDIF} {$ENDIF};