11// from sdl_syswm.h
22
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+
312{ $IFDEF WINDOWS}
413 { $DEFINE SDL_VIDEO_DRIVER_WINDOWS}
514{ $ENDIF}
615
7- { $IF DEFINED (LINUX) OR DEFINED( UNIX) }
16+ { $IFDEF UNIX}
817 { $IF NOT (DEFINED(DARWIN) OR DEFINED(ANDROID))}
918 { $DEFINE SDL_VIDEO_DRIVER_X11}
10- { $ENDIF }
11- { $IFEND }
19+ { $IFEND }
20+ { $ENDIF }
1221
1322(*
1423 * 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.
1625 *)
1726{ $UNDEF SDL_VIDEO_DRIVER_DIRECTFB}
1827
5968 { $DEFINE SDL_VIDEO_DRIVER_OS2}
6069{ $ENDIF}
6170
71+ { SDL2-for-Pascal: Disabled because there are no FPC/Delphi units available. }
72+ { $UNDEF SDL_VIDEO_DRIVER_KMSDRM}
73+
6274{ $IFDEF HAIKU}
6375 { $DEFINE SDL_VIDEO_DRIVER_HAIKU}
6476{ $ENDIF}
6779{ **
6880 * These are the various supported windowing subsystems
6981 *}
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 );
86101
87102// / sdl_syswm.h uses anonymous structs, declared right in SDL_SysWMmsg and SDL_SysWMinfo.
88103// / Since Pascal does not allow this, we workaround by introducing named types.
104+ type
89105{ $IFDEF SDL_VIDEO_DRIVER_WINDOWS}
90106 __SYSWM_WINDOWS = record
91107 hwnd: HWND; { **< The window for the message }
92- msg: uInt ; { **< The type of message *}
108+ msg: UINT ; { **< The type of message *}
93109 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 *}
99111 end ;
100112{ $ENDIF}
101113
102114{ $IFDEF SDL_VIDEO_DRIVER_X11}
103115 __SYSWM_X11 = record
104116 event: { $IFDEF FPC} TXEvent { $ELSE} XEvent { $ENDIF} ;
105117 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}
106179 __WMINFO_X11 = record
107180 display: PDisplay; { **< The X11 display *}
108181 window: TWindow; { **< The X11 window *}
109182 end ;
110183{ $ENDIF}
111184
112185{ $IFDEF SDL_VIDEO_DRIVER_DIRECTFB}
113- __SYSWM_DIRECTFB = record
114- event: DFBEvent;
115- end ;
116186 __WMINFO_DIRECTFB = record
117187 dfb: IDirectFB; { **< The directfb main interface *}
118188 window: IDirectFBWindow; { **< The directfb window handle *}
@@ -121,20 +191,12 @@ Type
121191{ $ENDIF}
122192
123193{ $IFDEF SDL_VIDEO_DRIVER_COCOA}
124- __SYSWM_COCOA = record
125- (* No Cocoa window events yet *)
126- dummy: integer;
127- end ;
128194 __WMINFO_COCOA = record
129195 window: NSWindow; { * The Cocoa window *}
130196 end ;
131197{ $ENDIF}
132198
133199{ $IFDEF SDL_VIDEO_DRIVER_UIKIT}
134- __SYSWM_UIKIT = record
135- (* No UIKit window events yet *)
136- dummy: integer;
137- end ;
138200 __WMINFO_UIKIT = record
139201 window: UIWindow; { * The UIKit window *}
140202 framebuffer: GLuint; { * The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. *}
@@ -147,56 +209,54 @@ Type
147209 __WMINFO_WAYLAND = record
148210 display: wl_display; { **< Wayland display *}
149211 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 *}
151218 end ;
152219{ $ENDIF}
153220
154- { $IFDEF SDL_VIDEO_DRIVER_MIR}
221+ { $IFDEF SDL_VIDEO_DRIVER_MIR} { * no longer available, left for API/ABI compatibility. Remove in 2.1! * }
155222 __WMINFO_MIR = record
156223 connection: PMirConnection; { **< Mir display server connection *}
157224 surface: PMirSurface; { **< Mir surface *}
158225 end ;
159226{ $ENDIF}
160227
161- { $IFDEF SDL_VIDEO_DRIVER_WINRT}
162- __WMINFO_WINRT = record
163- window: IInspectable; { **< The WinRT CoreWindow *}
164- end ;
165- { $ENDIF}
166-
167228{ $IFDEF SDL_VIDEO_DRIVER_ANDROID}
168229 __WMINFO_ANDROID = record
169230 window: Pointer; // PANativeWindow;
170231 surface: Pointer; // PEGLSurface;
171232 end ;
172233{ $ENDIF}
173234
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 * }
178239 end ;
240+ { $ENDIF}
241+
242+ { $IFDEF SDL_VIDEO_DRIVER_VIVANTE}
179243 __WMINFO_VIVANTE = record
180244 display: EGLNativeDisplayType;
181245 window: EGLNativeWindowType;
182246 end ;
183247{ $ENDIF}
184248
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) *}
196254 end ;
197255{ $ENDIF}
198256
199257
258+
259+
200260{ **
201261 * The custom event structure.
202262 *}
@@ -273,27 +333,29 @@ Type
273333 { $IFDEF SDL_VIDEO_DRIVER_OS2}
274334 SDL_SYSWM_OS2: (os2: __WMINFO_OS2);
275335 { $ENDIF}
336+ { $IFDEF SDL_VIDEO_DRIVER_KMSDRM}
337+ SDL_SYSWM_KMSDRM: (kmsdrm: __WMINFO_KMSDRM);
338+ { $ENDIF}
276339 (* Ensure this union is always 64 bytes (8 64-bit pointers) *)
277340 SDL_SYSWM_UNKNOWN: (dummy: array [0 ..63 ] of Byte);
278341 end ;
279342
280- { * Function prototypes *}
281343(* *
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.
283347 *
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.
287351 *
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.
290357 *
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.
297359 *)
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;
299361 external SDL_LibName { $IFDEF DELPHI} { $IFDEF MACOS} name ' _SDL_GetWindowWMInfo' { $ENDIF} { $ENDIF} ;
0 commit comments