My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
SDL_syswm.h
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2014 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 
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 #include "begin_code.h"
37 /* Set up for C function definitions, even when using C++ */
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
50 #ifdef SDL_PROTOTYPES_ONLY
51 struct SDL_SysWMinfo;
52 #else
53 
54 #if defined(SDL_VIDEO_DRIVER_WINDOWS)
55 #define WIN32_LEAN_AND_MEAN
56 #include <windows.h>
57 #endif
58 
59 #if defined(SDL_VIDEO_DRIVER_WINRT)
60 #include <Inspectable.h>
61 #endif
62 
63 /* This is the structure for custom window manager events */
64 #if defined(SDL_VIDEO_DRIVER_X11)
65 #if defined(__APPLE__) && defined(__MACH__)
66 /* conflicts with Quickdraw.h */
67 #define Cursor X11Cursor
68 #endif
69 
70 #include <X11/Xlib.h>
71 #include <X11/Xatom.h>
72 
73 #if defined(__APPLE__) && defined(__MACH__)
74 /* matches the re-define above */
75 #undef Cursor
76 #endif
77 
78 #endif /* defined(SDL_VIDEO_DRIVER_X11) */
79 
80 #if defined(SDL_VIDEO_DRIVER_DIRECTFB)
81 #include <directfb.h>
82 #endif
83 
84 #if defined(SDL_VIDEO_DRIVER_COCOA)
85 #ifdef __OBJC__
86 #include <Cocoa/Cocoa.h>
87 #else
88 typedef struct _NSWindow NSWindow;
89 #endif
90 #endif
91 
92 #if defined(SDL_VIDEO_DRIVER_UIKIT)
93 #ifdef __OBJC__
94 #include <UIKit/UIKit.h>
95 #else
96 typedef struct _UIWindow UIWindow;
97 typedef struct _UIViewController UIViewController;
98 #endif
99 #endif
100 
101 #if defined(SDL_VIDEO_DRIVER_MIR)
102 #include <mir_toolkit/mir_client_library.h>
103 #endif
104 
105 
109 typedef enum
110 {
111  SDL_SYSWM_UNKNOWN,
112  SDL_SYSWM_WINDOWS,
113  SDL_SYSWM_X11,
114  SDL_SYSWM_DIRECTFB,
115  SDL_SYSWM_COCOA,
116  SDL_SYSWM_UIKIT,
117  SDL_SYSWM_WAYLAND,
118  SDL_SYSWM_MIR,
119  SDL_SYSWM_WINRT,
121 
126 {
127  SDL_version version;
128  SDL_SYSWM_TYPE subsystem;
129  union
130  {
131 #if defined(SDL_VIDEO_DRIVER_WINDOWS)
132  struct {
133  HWND hwnd;
134  UINT msg;
135  WPARAM wParam;
136  LPARAM lParam;
137  } win;
138 #endif
139 #if defined(SDL_VIDEO_DRIVER_X11)
140  struct {
141  XEvent event;
142  } x11;
143 #endif
144 #if defined(SDL_VIDEO_DRIVER_DIRECTFB)
145  struct {
146  DFBEvent event;
147  } dfb;
148 #endif
149 #if defined(SDL_VIDEO_DRIVER_COCOA)
150  struct
151  {
152  /* No Cocoa window events yet */
153  } cocoa;
154 #endif
155 #if defined(SDL_VIDEO_DRIVER_UIKIT)
156  struct
157  {
158  /* No UIKit window events yet */
159  } uikit;
160 #endif
161  /* Can't have an empty union */
162  int dummy;
163  } msg;
164 };
165 
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;
182  } win;
183 #endif
184 #if defined(SDL_VIDEO_DRIVER_WINRT)
185  struct
186  {
187  IInspectable * window;
188  } winrt;
189 #endif
190 #if defined(SDL_VIDEO_DRIVER_X11)
191  struct
192  {
193  Display *display;
194  Window window;
195  } x11;
196 #endif
197 #if defined(SDL_VIDEO_DRIVER_DIRECTFB)
198  struct
199  {
200  IDirectFB *dfb;
201  IDirectFBWindow *window;
202  IDirectFBSurface *surface;
203  } dfb;
204 #endif
205 #if defined(SDL_VIDEO_DRIVER_COCOA)
206  struct
207  {
208  NSWindow *window; /* The Cocoa window */
209  } cocoa;
210 #endif
211 #if defined(SDL_VIDEO_DRIVER_UIKIT)
212  struct
213  {
214  UIWindow *window; /* The UIKit window */
215  } uikit;
216 #endif
217 #if defined(SDL_VIDEO_DRIVER_WAYLAND)
218  struct
219  {
220  struct wl_display *display;
221  struct wl_surface *surface;
222  struct wl_shell_surface *shell_surface;
223  } wl;
224 #endif
225 #if defined(SDL_VIDEO_DRIVER_MIR)
226  struct
227  {
228  MirConnection *connection;
229  MirSurface *surface;
230  } mir;
231 #endif
232 
233  /* Can't have an empty union */
234  int dummy;
235  } info;
236 };
237 
238 #endif /* SDL_PROTOTYPES_ONLY */
239 
240 typedef struct SDL_SysWMinfo SDL_SysWMinfo;
241 
242 /* Function prototypes */
260 extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
261  SDL_SysWMinfo * info);
262 
263 
264 /* Ends C function definitions when using C++ */
265 #ifdef __cplusplus
266 }
267 #endif
268 #include "close_code.h"
269 
270 #endif /* _SDL_syswm_h */
271 
272 /* vi: set ts=4 sw=4 expandtab: */
struct SDL_Window SDL_Window
The type used to identify a window.
Definition: SDL_video.h:89
struct wl_shell_surface * shell_surface
Definition: SDL_syswm.h:222
struct wl_display * display
Definition: SDL_syswm.h:220
Definition: SDL_syswm.h:172
struct wl_surface * surface
Definition: SDL_syswm.h:221
General event structure.
Definition: SDL_events.h:498
SDL_SYSWM_TYPE
Definition: SDL_syswm.h:109
Information the version of SDL in use.
Definition: SDL_version.h:51
Display * display
Definition: SDL_syswm.h:193
DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window *window, SDL_SysWMinfo *info)
This function allows access to driver-dependent window information.
Definition: SDL_syswm.h:125
Window window
Definition: SDL_syswm.h:194