Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

325 rindas
8.8 KiB

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