Counter Strike : Global Offensive Source Code
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.

260 lines
6.7 KiB

  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2014 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. #include "begin_code.h"
  30. /* Set up for C function definitions, even when using C++ */
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. /**
  35. * \file SDL_syswm.h
  36. *
  37. * Your application has access to a special type of event ::SDL_SYSWMEVENT,
  38. * which contains window-manager specific information and arrives whenever
  39. * an unhandled window event occurs. This event is ignored by default, but
  40. * you can enable it with SDL_EventState().
  41. */
  42. #ifdef SDL_PROTOTYPES_ONLY
  43. struct SDL_SysWMinfo;
  44. #else
  45. #if defined(SDL_VIDEO_DRIVER_WINDOWS)
  46. #define WIN32_LEAN_AND_MEAN
  47. #include <windows.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. #include <Cocoa/Cocoa.h>
  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. #endif
  78. #endif
  79. #if defined(SDL_VIDEO_DRIVER_MIR)
  80. #include <mir_toolkit/mir_client_library.h>
  81. #endif
  82. /**
  83. * These are the various supported windowing subsystems
  84. */
  85. typedef enum
  86. {
  87. SDL_SYSWM_UNKNOWN,
  88. SDL_SYSWM_WINDOWS,
  89. SDL_SYSWM_X11,
  90. SDL_SYSWM_DIRECTFB,
  91. SDL_SYSWM_COCOA,
  92. SDL_SYSWM_UIKIT,
  93. SDL_SYSWM_WAYLAND,
  94. SDL_SYSWM_MIR,
  95. } SDL_SYSWM_TYPE;
  96. /**
  97. * The custom event structure.
  98. */
  99. struct SDL_SysWMmsg
  100. {
  101. SDL_version version;
  102. SDL_SYSWM_TYPE subsystem;
  103. union
  104. {
  105. #if defined(SDL_VIDEO_DRIVER_WINDOWS)
  106. struct {
  107. HWND hwnd; /**< The window for the message */
  108. UINT msg; /**< The type of message */
  109. WPARAM wParam; /**< WORD message parameter */
  110. LPARAM lParam; /**< LONG message parameter */
  111. } win;
  112. #endif
  113. #if defined(SDL_VIDEO_DRIVER_X11)
  114. struct {
  115. XEvent event;
  116. } x11;
  117. #endif
  118. #if defined(SDL_VIDEO_DRIVER_DIRECTFB)
  119. struct {
  120. DFBEvent event;
  121. } dfb;
  122. #endif
  123. #if defined(SDL_VIDEO_DRIVER_COCOA)
  124. struct
  125. {
  126. /* No Cocoa window events yet */
  127. } cocoa;
  128. #endif
  129. #if defined(SDL_VIDEO_DRIVER_UIKIT)
  130. struct
  131. {
  132. /* No UIKit window events yet */
  133. } uikit;
  134. #endif
  135. /* Can't have an empty union */
  136. int dummy;
  137. } msg;
  138. };
  139. /**
  140. * The custom window manager information structure.
  141. *
  142. * When this structure is returned, it holds information about which
  143. * low level system it is using, and will be one of SDL_SYSWM_TYPE.
  144. */
  145. struct SDL_SysWMinfo
  146. {
  147. SDL_version version;
  148. SDL_SYSWM_TYPE subsystem;
  149. union
  150. {
  151. #if defined(SDL_VIDEO_DRIVER_WINDOWS)
  152. struct
  153. {
  154. HWND window; /**< The window handle */
  155. } win;
  156. #endif
  157. #if defined(SDL_VIDEO_DRIVER_X11)
  158. struct
  159. {
  160. Display *display; /**< The X11 display */
  161. Window window; /**< The X11 window */
  162. } x11;
  163. #endif
  164. #if defined(SDL_VIDEO_DRIVER_DIRECTFB)
  165. struct
  166. {
  167. IDirectFB *dfb; /**< The directfb main interface */
  168. IDirectFBWindow *window; /**< The directfb window handle */
  169. IDirectFBSurface *surface; /**< The directfb client surface */
  170. } dfb;
  171. #endif
  172. #if defined(SDL_VIDEO_DRIVER_COCOA)
  173. struct
  174. {
  175. NSWindow *window; /* The Cocoa window */
  176. } cocoa;
  177. #endif
  178. #if defined(SDL_VIDEO_DRIVER_UIKIT)
  179. struct
  180. {
  181. UIWindow *window; /* The UIKit window */
  182. } uikit;
  183. #endif
  184. #if defined(SDL_VIDEO_DRIVER_WAYLAND)
  185. struct
  186. {
  187. struct wl_display *display; /**< Wayland display */
  188. struct wl_surface *surface; /**< Wayland surface */
  189. struct wl_shell_surface *shell_surface; /**< Wayland shell_surface (window manager handle) */
  190. } wl;
  191. #endif
  192. #if defined(SDL_VIDEO_DRIVER_MIR)
  193. struct
  194. {
  195. MirConnection *connection; /**< Mir display server connection */
  196. MirSurface *surface; /**< Mir surface */
  197. } mir;
  198. #endif
  199. /* Can't have an empty union */
  200. int dummy;
  201. } info;
  202. };
  203. #endif /* SDL_PROTOTYPES_ONLY */
  204. typedef struct SDL_SysWMinfo SDL_SysWMinfo;
  205. /* Function prototypes */
  206. /**
  207. * \brief This function allows access to driver-dependent window information.
  208. *
  209. * \param window The window about which information is being requested
  210. * \param info This structure must be initialized with the SDL version, and is
  211. * then filled in with information about the given window.
  212. *
  213. * \return SDL_TRUE if the function is implemented and the version member of
  214. * the \c info struct is valid, SDL_FALSE otherwise.
  215. *
  216. * You typically use this function like this:
  217. * \code
  218. * SDL_SysWMinfo info;
  219. * SDL_VERSION(&info.version);
  220. * if ( SDL_GetWindowWMInfo(window, &info) ) { ... }
  221. * \endcode
  222. */
  223. extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
  224. SDL_SysWMinfo * info);
  225. /* Ends C function definitions when using C++ */
  226. #ifdef __cplusplus
  227. }
  228. #endif
  229. #include "close_code.h"
  230. #endif /* _SDL_syswm_h */
  231. /* vi: set ts=4 sw=4 expandtab: */