🛠️🐜 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.

331 lines
9.1 KiB

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