🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

327 lines
9.0 KiB

  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. /**
  19. * \file SDL_syswm.h
  20. *
  21. * Include file for SDL custom system window manager hooks.
  22. */
  23. #ifndef SDL_syswm_h_
  24. #define SDL_syswm_h_
  25. #include "SDL_stdinc.h"
  26. #include "SDL_error.h"
  27. #include "SDL_video.h"
  28. #include "SDL_version.h"
  29. /**
  30. * \brief SDL_syswm.h
  31. *
  32. * Your application has access to a special type of event ::SDL_SYSWMEVENT,
  33. * which contains window-manager specific information and arrives whenever
  34. * an unhandled window event occurs. This event is ignored by default, but
  35. * you can enable it with SDL_EventState().
  36. */
  37. struct SDL_SysWMinfo;
  38. #if !defined(SDL_PROTOTYPES_ONLY)
  39. #if defined(SDL_VIDEO_DRIVER_WINDOWS)
  40. #ifndef WIN32_LEAN_AND_MEAN
  41. #define WIN32_LEAN_AND_MEAN
  42. #endif
  43. #include <windows.h>
  44. #endif
  45. #if defined(SDL_VIDEO_DRIVER_WINRT)
  46. #include <Inspectable.h>
  47. #endif
  48. /* This is the structure for custom window manager events */
  49. #if defined(SDL_VIDEO_DRIVER_X11)
  50. #if defined(__APPLE__) && defined(__MACH__)
  51. /* conflicts with Quickdraw.h */
  52. #define Cursor X11Cursor
  53. #endif
  54. #include <X11/Xlib.h>
  55. #include <X11/Xatom.h>
  56. #if defined(__APPLE__) && defined(__MACH__)
  57. /* matches the re-define above */
  58. #undef Cursor
  59. #endif
  60. #endif /* defined(SDL_VIDEO_DRIVER_X11) */
  61. #if defined(SDL_VIDEO_DRIVER_DIRECTFB)
  62. #include <directfb.h>
  63. #endif
  64. #if defined(SDL_VIDEO_DRIVER_COCOA)
  65. #ifdef __OBJC__
  66. @class NSWindow;
  67. #else
  68. typedef struct _NSWindow NSWindow;
  69. #endif
  70. #endif
  71. #if defined(SDL_VIDEO_DRIVER_UIKIT)
  72. #ifdef __OBJC__
  73. #include <UIKit/UIKit.h>
  74. #else
  75. typedef struct _UIWindow UIWindow;
  76. typedef struct _UIViewController UIViewController;
  77. #endif
  78. typedef Uint32 GLuint;
  79. #endif
  80. #if defined(SDL_VIDEO_DRIVER_ANDROID)
  81. typedef struct ANativeWindow ANativeWindow;
  82. typedef void *EGLSurface;
  83. #endif
  84. #if defined(SDL_VIDEO_DRIVER_VIVANTE)
  85. #include "SDL_egl.h"
  86. #endif
  87. #endif /* SDL_PROTOTYPES_ONLY */
  88. #include "begin_code.h"
  89. /* Set up for C function definitions, even when using C++ */
  90. #ifdef __cplusplus
  91. extern "C" {
  92. #endif
  93. #if !defined(SDL_PROTOTYPES_ONLY)
  94. /**
  95. * These are the various supported windowing subsystems
  96. */
  97. typedef enum
  98. {
  99. SDL_SYSWM_UNKNOWN,
  100. SDL_SYSWM_WINDOWS,
  101. SDL_SYSWM_X11,
  102. SDL_SYSWM_DIRECTFB,
  103. SDL_SYSWM_COCOA,
  104. SDL_SYSWM_UIKIT,
  105. SDL_SYSWM_WAYLAND,
  106. SDL_SYSWM_MIR, /* no longer available, left for API/ABI compatibility. Remove in 2.1! */
  107. SDL_SYSWM_WINRT,
  108. SDL_SYSWM_ANDROID,
  109. SDL_SYSWM_VIVANTE,
  110. SDL_SYSWM_OS2
  111. } SDL_SYSWM_TYPE;
  112. /**
  113. * The custom event structure.
  114. */
  115. struct SDL_SysWMmsg
  116. {
  117. SDL_version version;
  118. SDL_SYSWM_TYPE subsystem;
  119. union
  120. {
  121. #if defined(SDL_VIDEO_DRIVER_WINDOWS)
  122. struct {
  123. HWND hwnd; /**< The window for the message */
  124. UINT msg; /**< The type of message */
  125. WPARAM wParam; /**< WORD message parameter */
  126. LPARAM lParam; /**< LONG message parameter */
  127. } win;
  128. #endif
  129. #if defined(SDL_VIDEO_DRIVER_X11)
  130. struct {
  131. XEvent event;
  132. } x11;
  133. #endif
  134. #if defined(SDL_VIDEO_DRIVER_DIRECTFB)
  135. struct {
  136. DFBEvent event;
  137. } dfb;
  138. #endif
  139. #if defined(SDL_VIDEO_DRIVER_COCOA)
  140. struct
  141. {
  142. /* Latest version of Xcode clang complains about empty structs in C v. C++:
  143. error: empty struct has size 0 in C, size 1 in C++
  144. */
  145. int dummy;
  146. /* No Cocoa window events yet */
  147. } cocoa;
  148. #endif
  149. #if defined(SDL_VIDEO_DRIVER_UIKIT)
  150. struct
  151. {
  152. int dummy;
  153. /* No UIKit window events yet */
  154. } uikit;
  155. #endif
  156. #if defined(SDL_VIDEO_DRIVER_VIVANTE)
  157. struct
  158. {
  159. int dummy;
  160. /* No Vivante window events yet */
  161. } vivante;
  162. #endif
  163. /* Can't have an empty union */
  164. int dummy;
  165. } msg;
  166. };
  167. /**
  168. * The custom window manager information structure.
  169. *
  170. * When this structure is returned, it holds information about which
  171. * low level system it is using, and will be one of SDL_SYSWM_TYPE.
  172. */
  173. struct SDL_SysWMinfo
  174. {
  175. SDL_version version;
  176. SDL_SYSWM_TYPE subsystem;
  177. union
  178. {
  179. #if defined(SDL_VIDEO_DRIVER_WINDOWS)
  180. struct
  181. {
  182. HWND window; /**< The window handle */
  183. HDC hdc; /**< The window device context */
  184. HINSTANCE hinstance; /**< The instance handle */
  185. } win;
  186. #endif
  187. #if defined(SDL_VIDEO_DRIVER_WINRT)
  188. struct
  189. {
  190. IInspectable * window; /**< The WinRT CoreWindow */
  191. } winrt;
  192. #endif
  193. #if defined(SDL_VIDEO_DRIVER_X11)
  194. struct
  195. {
  196. Display *display; /**< The X11 display */
  197. Window window; /**< The X11 window */
  198. } x11;
  199. #endif
  200. #if defined(SDL_VIDEO_DRIVER_DIRECTFB)
  201. struct
  202. {
  203. IDirectFB *dfb; /**< The directfb main interface */
  204. IDirectFBWindow *window; /**< The directfb window handle */
  205. IDirectFBSurface *surface; /**< The directfb client surface */
  206. } dfb;
  207. #endif
  208. #if defined(SDL_VIDEO_DRIVER_COCOA)
  209. struct
  210. {
  211. #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
  212. NSWindow __unsafe_unretained *window; /**< The Cocoa window */
  213. #else
  214. NSWindow *window; /**< The Cocoa window */
  215. #endif
  216. } cocoa;
  217. #endif
  218. #if defined(SDL_VIDEO_DRIVER_UIKIT)
  219. struct
  220. {
  221. #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
  222. UIWindow __unsafe_unretained *window; /**< The UIKit window */
  223. #else
  224. UIWindow *window; /**< The UIKit window */
  225. #endif
  226. GLuint framebuffer; /**< The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */
  227. GLuint colorbuffer; /**< The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */
  228. GLuint resolveFramebuffer; /**< The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */
  229. } uikit;
  230. #endif
  231. #if defined(SDL_VIDEO_DRIVER_WAYLAND)
  232. struct
  233. {
  234. struct wl_display *display; /**< Wayland display */
  235. struct wl_surface *surface; /**< Wayland surface */
  236. struct wl_shell_surface *shell_surface; /**< Wayland shell_surface (window manager handle) */
  237. } wl;
  238. #endif
  239. #if defined(SDL_VIDEO_DRIVER_MIR) /* no longer available, left for API/ABI compatibility. Remove in 2.1! */
  240. struct
  241. {
  242. void *connection; /**< Mir display server connection */
  243. void *surface; /**< Mir surface */
  244. } mir;
  245. #endif
  246. #if defined(SDL_VIDEO_DRIVER_ANDROID)
  247. struct
  248. {
  249. ANativeWindow *window;
  250. EGLSurface surface;
  251. } android;
  252. #endif
  253. #if defined(SDL_VIDEO_DRIVER_VIVANTE)
  254. struct
  255. {
  256. EGLNativeDisplayType display;
  257. EGLNativeWindowType window;
  258. } vivante;
  259. #endif
  260. /* Make sure this union is always 64 bytes (8 64-bit pointers). */
  261. /* Be careful not to overflow this if you add a new target! */
  262. Uint8 dummy[64];
  263. } info;
  264. };
  265. #endif /* SDL_PROTOTYPES_ONLY */
  266. typedef struct SDL_SysWMinfo SDL_SysWMinfo;
  267. /* Function prototypes */
  268. /**
  269. * \brief This function allows access to driver-dependent window information.
  270. *
  271. * \param window The window about which information is being requested
  272. * \param info This structure must be initialized with the SDL version, and is
  273. * then filled in with information about the given window.
  274. *
  275. * \return SDL_TRUE if the function is implemented and the version member of
  276. * the \c info struct is valid, SDL_FALSE otherwise.
  277. *
  278. * You typically use this function like this:
  279. * \code
  280. * SDL_SysWMinfo info;
  281. * SDL_VERSION(&info.version);
  282. * if ( SDL_GetWindowWMInfo(window, &info) ) { ... }
  283. * \endcode
  284. */
  285. extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
  286. SDL_SysWMinfo * info);
  287. /* Ends C function definitions when using C++ */
  288. #ifdef __cplusplus
  289. }
  290. #endif
  291. #include "close_code.h"
  292. #endif /* SDL_syswm_h_ */
  293. /* vi: set ts=4 sw=4 expandtab: */