1
1
// from sdl_syswm.h
2
2
3
+ { **
4
+ * \brief SDL_syswm.h
5
+ *
6
+ * Your application has access to a special type of event ::SDL_SYSWMEVENT,
7
+ * which contains window-manager specific information and arrives whenever
8
+ * an unhandled window event occurs. This event is ignored by default, but
9
+ * you can enable it with SDL_EventState().
10
+ *}
11
+
3
12
{ $IFDEF WINDOWS}
4
13
{ $DEFINE SDL_VIDEO_DRIVER_WINDOWS}
5
14
{ $ENDIF}
6
15
7
- { $IF DEFINED (LINUX) OR DEFINED( UNIX) }
16
+ { $IFDEF UNIX}
8
17
{ $IF NOT (DEFINED(DARWIN) OR DEFINED(ANDROID))}
9
18
{ $DEFINE SDL_VIDEO_DRIVER_X11}
10
- { $ENDIF }
11
- { $IFEND }
19
+ { $IFEND }
20
+ { $ENDIF }
12
21
13
22
(*
14
23
* Disabled because FPC does not ship a DirectFB unit.
15
- * If you have some working DirectDB bindings, feel welcome to enable this and check if it breaks anything.
24
+ * If you have some working DirectFB bindings, feel welcome to enable this and check if it breaks anything.
16
25
*)
17
26
{ $UNDEF SDL_VIDEO_DRIVER_DIRECTFB}
18
27
59
68
{ $DEFINE SDL_VIDEO_DRIVER_OS2}
60
69
{ $ENDIF}
61
70
71
+ { SDL2-for-Pascal: Disabled because there are no FPC/Delphi units available. }
72
+ { $UNDEF SDL_VIDEO_DRIVER_KMSDRM}
73
+
62
74
{ $IFDEF HAIKU}
63
75
{ $DEFINE SDL_VIDEO_DRIVER_HAIKU}
64
76
{ $ENDIF}
67
79
{ **
68
80
* These are the various supported windowing subsystems
69
81
*}
70
- Type
71
- TSDL_SYSWM_TYPE = (
72
- SDL_SYSWM_UNKNOWN,
73
- SDL_SYSWM_WINDOWS,
74
- SDL_SYSWM_X11,
75
- SDL_SYSWM_DIRECTFB,
76
- SDL_SYSWM_COCOA,
77
- SDL_SYSWM_UIKIT,
78
- SDL_SYSWM_WAYLAND, // Since SDL 2.0.2 - REMOVED in SDL 2.0.10!
79
- SDL_SYSWM_MIR, // Since SDL 2.0.2
80
- SDL_SYSWM_WINRT, // Since SDL 2.0.3
81
- SDL_SYSWM_ANDROID, // Since SDL 2.0.4
82
- SDL_SYSWM_VIVANTE, // Since SDL 2.0.5
83
- SDL_SYSWM_OS2, // Since SDL 2.0.6
84
- SDL_SYSWM_HAIKU // Since SDL 2.0.12
85
- );
82
+ type
83
+ TSDL_SYSWM_TYPE = type cint;
84
+
85
+ const
86
+ SDL_SYSWM_UNKNOWN = TSDL_SYSWM_TYPE(0 );
87
+ SDL_SYSWM_WINDOWS = TSDL_SYSWM_TYPE(1 );
88
+ SDL_SYSWM_X11 = TSDL_SYSWM_TYPE(2 );
89
+ SDL_SYSWM_DIRECTFB = TSDL_SYSWM_TYPE(3 );
90
+ SDL_SYSWM_COCOA = TSDL_SYSWM_TYPE(4 );
91
+ SDL_SYSWM_UIKIT = TSDL_SYSWM_TYPE(5 );
92
+ SDL_SYSWM_WAYLAND = TSDL_SYSWM_TYPE(6 );
93
+ SDL_SYSWM_MIR = TSDL_SYSWM_TYPE(7 ); // * no longer available, left for API/ABI compatibility. Remove in 2.1! *
94
+ SDL_SYSWM_WINRT = TSDL_SYSWM_TYPE(8 );
95
+ SDL_SYSWM_ANDROID = TSDL_SYSWM_TYPE(9 );
96
+ SDL_SYSWM_VIVANTE = TSDL_SYSWM_TYPE(10 );
97
+ SDL_SYSWM_OS2 = TSDL_SYSWM_TYPE(11 );
98
+ SDL_SYSWM_HAIKU = TSDL_SYSWM_TYPE(12 );
99
+ SDL_SYSWM_KMSDRM = TSDL_SYSWM_TYPE(13 );
100
+ SDL_SYSWM_RISCOS = TSDL_SYSWM_TYPE(14 );
86
101
87
102
// / sdl_syswm.h uses anonymous structs, declared right in SDL_SysWMmsg and SDL_SysWMinfo.
88
103
// / Since Pascal does not allow this, we workaround by introducing named types.
104
+ type
89
105
{ $IFDEF SDL_VIDEO_DRIVER_WINDOWS}
90
106
__SYSWM_WINDOWS = record
91
107
hwnd: HWND; { **< The window for the message }
92
- msg: uInt ; { **< The type of message *}
108
+ msg: UINT ; { **< The type of message *}
93
109
wParam: WPARAM; { **< WORD message parameter *}
94
- lParam: LPARAM; { **< WORD message parameter *}
95
- end ;
96
- __WMINFO_WINDOWS = record
97
- window: HWND; { **< The window handle *}
98
- hdc: HDC; { **< The window device context *}
110
+ lParam: LPARAM; { **< LONG message parameter *}
99
111
end ;
100
112
{ $ENDIF}
101
113
102
114
{ $IFDEF SDL_VIDEO_DRIVER_X11}
103
115
__SYSWM_X11 = record
104
116
event: { $IFDEF FPC} TXEvent { $ELSE} XEvent { $ENDIF} ;
105
117
end ;
118
+ { $ENDIF}
119
+
120
+ { $IFDEF SDL_VIDEO_DRIVER_DIRECTFB}
121
+ __SYSWM_DIRECTFB = record
122
+ event: DFBEvent;
123
+ end ;
124
+ { $ENDIF}
125
+
126
+ { $IFDEF SDL_VIDEO_DRIVER_COCOA}
127
+ __SYSWM_COCOA = record
128
+ (* No Cocoa window events yet *)
129
+ dummy: cint;
130
+ end ;
131
+ { $ENDIF}
132
+
133
+ { $IFDEF SDL_VIDEO_DRIVER_UIKIT}
134
+ __SYSWM_UIKIT = record
135
+ (* No UIKit window events yet *)
136
+ dummy: cint;
137
+ end ;
138
+ { $ENDIF}
139
+
140
+ { $IFDEF SDL_VIDEO_DRIVER_VIVANTE}
141
+ __SYSWM_VIVANTE = record
142
+ (* No Vivante window events yet *)
143
+ dummy: cint;
144
+ end ;
145
+ { $ENDIF}
146
+
147
+ { $IFDEF SDL_VIDEO_DRIVER_OS2}
148
+ __SYSWM_OS2 = record
149
+ fFrame: Boolean; { **< TRUE if hwnd is a frame window *}
150
+ hwnd: HWND; { **< The window receiving the message *}
151
+ msg: ULONG; { **< The message identifier *}
152
+ mp1: MPARAM; { **< The first first message parameter *}
153
+ mp2: MPARAM; { **< The second first message parameter *}
154
+ end ;
155
+ { $ENDIF}
156
+
157
+ { **
158
+ * The custom window manager information structure.
159
+ *
160
+ * When this structure is returned, it holds information about which
161
+ * low level system it is using, and will be one of SDL_SYSWM_TYPE.
162
+ *}
163
+
164
+ { $IFDEF SDL_VIDEO_DRIVER_WINDOWS}
165
+ __WMINFO_WINDOWS = record
166
+ window: HWND; { **< The window handle *}
167
+ hdc: HDC; { **< The window device context *}
168
+ hinstance: HINST; { **< The instance handle *}
169
+ end ;
170
+ { $ENDIF}
171
+
172
+ { $IFDEF SDL_VIDEO_DRIVER_WINRT}
173
+ __WMINFO_WINRT = record
174
+ window: IInspectable; { **< The WinRT CoreWindow *}
175
+ end ;
176
+ { $ENDIF}
177
+
178
+ { $IFDEF SDL_VIDEO_DRIVER_X11}
106
179
__WMINFO_X11 = record
107
180
display: PDisplay; { **< The X11 display *}
108
181
window: TWindow; { **< The X11 window *}
109
182
end ;
110
183
{ $ENDIF}
111
184
112
185
{ $IFDEF SDL_VIDEO_DRIVER_DIRECTFB}
113
- __SYSWM_DIRECTFB = record
114
- event: DFBEvent;
115
- end ;
116
186
__WMINFO_DIRECTFB = record
117
187
dfb: IDirectFB; { **< The directfb main interface *}
118
188
window: IDirectFBWindow; { **< The directfb window handle *}
@@ -121,20 +191,12 @@ Type
121
191
{ $ENDIF}
122
192
123
193
{ $IFDEF SDL_VIDEO_DRIVER_COCOA}
124
- __SYSWM_COCOA = record
125
- (* No Cocoa window events yet *)
126
- dummy: integer;
127
- end ;
128
194
__WMINFO_COCOA = record
129
195
window: NSWindow; { * The Cocoa window *}
130
196
end ;
131
197
{ $ENDIF}
132
198
133
199
{ $IFDEF SDL_VIDEO_DRIVER_UIKIT}
134
- __SYSWM_UIKIT = record
135
- (* No UIKit window events yet *)
136
- dummy: integer;
137
- end ;
138
200
__WMINFO_UIKIT = record
139
201
window: UIWindow; { * The UIKit window *}
140
202
framebuffer: GLuint; { * The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. *}
@@ -147,56 +209,54 @@ Type
147
209
__WMINFO_WAYLAND = record
148
210
display: wl_display; { **< Wayland display *}
149
211
surface: wl_surface; { **< Wayland surface *}
150
- shell_surface: wl_shell_surface; { **< Wayland shell_surface (window manager handle) *}
212
+ shell_surface: Pointer; { **< DEPRECATED Wayland shell_surface (window manager handle) *}
213
+ egl_window: wl_egl_window; { **< Wayland EGL window (native window) *}
214
+ xdg_surface: xdg_surface; { **< Wayland xdg surface (window manager handle) *}
215
+ xdg_toplevel: xdg_toplevel; { **< Wayland xdg toplevel role *}
216
+ xdg_popup: xdg_popup; { **< Wayland xdg popup role *}
217
+ xdg_positioner: xdg_positioner; { **< Wayland xdg positioner, for popup *}
151
218
end ;
152
219
{ $ENDIF}
153
220
154
- { $IFDEF SDL_VIDEO_DRIVER_MIR}
221
+ { $IFDEF SDL_VIDEO_DRIVER_MIR} { * no longer available, left for API/ABI compatibility. Remove in 2.1! * }
155
222
__WMINFO_MIR = record
156
223
connection: PMirConnection; { **< Mir display server connection *}
157
224
surface: PMirSurface; { **< Mir surface *}
158
225
end ;
159
226
{ $ENDIF}
160
227
161
- { $IFDEF SDL_VIDEO_DRIVER_WINRT}
162
- __WMINFO_WINRT = record
163
- window: IInspectable; { **< The WinRT CoreWindow *}
164
- end ;
165
- { $ENDIF}
166
-
167
228
{ $IFDEF SDL_VIDEO_DRIVER_ANDROID}
168
229
__WMINFO_ANDROID = record
169
230
window: Pointer; // PANativeWindow;
170
231
surface: Pointer; // PEGLSurface;
171
232
end ;
172
233
{ $ENDIF}
173
234
174
- { $IFDEF SDL_VIDEO_DRIVER_VIVANTE }
175
- __SYSWM_VIVANTE = record
176
- (* No Vivante window events yet *)
177
- dummy: integer;
235
+ { $IFDEF SDL_VIDEO_DRIVER_OS2 }
236
+ __WMINFO_OS2 = record
237
+ hwnd: HWND; { **< The window handle * }
238
+ hwndFrame: HWND; { **< The frame window handle * }
178
239
end ;
240
+ { $ENDIF}
241
+
242
+ { $IFDEF SDL_VIDEO_DRIVER_VIVANTE}
179
243
__WMINFO_VIVANTE = record
180
244
display: EGLNativeDisplayType;
181
245
window: EGLNativeWindowType;
182
246
end ;
183
247
{ $ENDIF}
184
248
185
- { $IFDEF SDL_VIDEO_DRIVER_OS2}
186
- __SYSWM_OS2 = record
187
- fFrame: Boolean; { **< TRUE if hwnd is a frame window *}
188
- hwnd: HWND; { **< The window receiving the message *}
189
- msg: uInt; { **< The message identifier *}
190
- mp1: MPARAM; { **< The first first message parameter *}
191
- mp2: MPARAM; { **< The second first message parameter *}
192
- end ;
193
- __WMINFO_OS2 = record
194
- hwnd: HWND; { **< The window handle *}
195
- hwndFrame: HWND; { **< The frame window handle *}
249
+ { $IFDEF SDL_VIDEO_DRIVER_KMSDRM}
250
+ __WMINFO_KMSDRM = record
251
+ dev_index: cint; { **< Device index (ex: the X in /dev/dri/cardX) *}
252
+ drm_fd: cint; { **< DRM FD (unavailable on Vulkan windows) *}
253
+ gbm_device: Pointer; // *gbm_dev {**< GBM device (unavailable on Vulkan windows) *}
196
254
end ;
197
255
{ $ENDIF}
198
256
199
257
258
+
259
+
200
260
{ **
201
261
* The custom event structure.
202
262
*}
@@ -273,27 +333,29 @@ Type
273
333
{ $IFDEF SDL_VIDEO_DRIVER_OS2}
274
334
SDL_SYSWM_OS2: (os2: __WMINFO_OS2);
275
335
{ $ENDIF}
336
+ { $IFDEF SDL_VIDEO_DRIVER_KMSDRM}
337
+ SDL_SYSWM_KMSDRM: (kmsdrm: __WMINFO_KMSDRM);
338
+ { $ENDIF}
276
339
(* Ensure this union is always 64 bytes (8 64-bit pointers) *)
277
340
SDL_SYSWM_UNKNOWN: (dummy: array [0 ..63 ] of Byte);
278
341
end ;
279
342
280
- { * Function prototypes *}
281
343
(* *
282
- * \brief This function allows access to driver-dependent window information.
344
+ * Get driver-specific information about a window.
345
+ *
346
+ * You must include SDL_syswm.h for the declaration of SDL_SysWMinfo.
283
347
*
284
- * \param window The window about which information is being requested
285
- * \param info This structure must be initialized with the SDL version, and is
286
- * then filled in with information about the given window.
348
+ * The caller must initialize the `info` structure's version by using
349
+ * `SDL_VERSION(& info.version)`, and then this function will fill in the rest
350
+ * of the structure with information about the given window.
287
351
*
288
- * \return SDL_TRUE if the function is implemented and the version member of
289
- * the \c info struct is valid, SDL_FALSE otherwise.
352
+ * \param window the window about which information is being requested
353
+ * \param info an SDL_SysWMinfo structure filled in with window information
354
+ * \returns SDL_TRUE if the function is implemented and the `version` member
355
+ * of the `info` struct is valid, or SDL_FALSE if the information
356
+ * could not be retrieved; call SDL_GetError() for more information.
290
357
*
291
- * You typically use this function like this:
292
- * \code
293
- * SDL_SysWMinfo info;
294
- * SDL_VERSION(&info.version);
295
- * if ( SDL_GetWindowWMInfo(window, &info) ) { ... }
296
- * \endcode
358
+ * \since This function is available since SDL 2.0.0.
297
359
*)
298
- Function SDL_GetWindowWMInfo (window:PSDL_Window; info : PSDL_SysWMinfo):TSDL_bool; cdecl;
360
+ function SDL_GetWindowWMInfo (window: PSDL_Window; info: PSDL_SysWMinfo): TSDL_bool; cdecl;
299
361
external SDL_LibName { $IFDEF DELPHI} { $IFDEF MACOS} name ' _SDL_GetWindowWMInfo' { $ENDIF} { $ENDIF} ;
0 commit comments