Subversion Repositories Games.Prince of Persia

Rev

Rev 1 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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