sdlsyswm.inc 9.3 KB

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