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-2013 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 /* 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 #include <Cocoa/Cocoa.h>
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 #endif
94 #endif
95 
99 typedef enum
100 {
101  SDL_SYSWM_UNKNOWN,
102  SDL_SYSWM_WINDOWS,
103  SDL_SYSWM_X11,
104  SDL_SYSWM_DIRECTFB,
105  SDL_SYSWM_COCOA,
106  SDL_SYSWM_UIKIT,
108 
113 {
114  SDL_version version;
115  SDL_SYSWM_TYPE subsystem;
116  union
117  {
118 #if defined(SDL_VIDEO_DRIVER_WINDOWS)
119  struct {
120  HWND hwnd;
121  UINT msg;
122  WPARAM wParam;
123  LPARAM lParam;
124  } win;
125 #endif
126 #if defined(SDL_VIDEO_DRIVER_X11)
127  struct {
128  XEvent event;
129  } x11;
130 #endif
131 #if defined(SDL_VIDEO_DRIVER_DIRECTFB)
132  struct {
133  DFBEvent event;
134  } dfb;
135 #endif
136 #if defined(SDL_VIDEO_DRIVER_COCOA)
137  struct
138  {
139  /* No Cocoa window events yet */
140  } cocoa;
141 #endif
142 #if defined(SDL_VIDEO_DRIVER_UIKIT)
143  struct
144  {
145  /* No UIKit window events yet */
146  } uikit;
147 #endif
148  /* Can't have an empty union */
149  int dummy;
150  } msg;
151 };
152 
160 {
161  SDL_version version;
162  SDL_SYSWM_TYPE subsystem;
163  union
164  {
165 #if defined(SDL_VIDEO_DRIVER_WINDOWS)
166  struct
167  {
168  HWND window;
169  } win;
170 #endif
171 #if defined(SDL_VIDEO_DRIVER_X11)
172  struct
173  {
174  Display *display;
175  Window window;
176  } x11;
177 #endif
178 #if defined(SDL_VIDEO_DRIVER_DIRECTFB)
179  struct
180  {
181  IDirectFB *dfb;
182  IDirectFBWindow *window;
183  IDirectFBSurface *surface;
184  } dfb;
185 #endif
186 #if defined(SDL_VIDEO_DRIVER_COCOA)
187  struct
188  {
189  NSWindow *window; /* The Cocoa window */
190  } cocoa;
191 #endif
192 #if defined(SDL_VIDEO_DRIVER_UIKIT)
193  struct
194  {
195  UIWindow *window; /* The UIKit window */
196  } uikit;
197 #endif
198  /* Can't have an empty union */
199  int dummy;
200  } info;
201 };
202 
203 #endif /* SDL_PROTOTYPES_ONLY */
204 
205 typedef struct SDL_SysWMinfo SDL_SysWMinfo;
206 
207 /* Function prototypes */
225 extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
226  SDL_SysWMinfo * info);
227 
228 
229 /* Ends C function definitions when using C++ */
230 #ifdef __cplusplus
231 }
232 #endif
233 #include "close_code.h"
234 
235 #endif /* _SDL_syswm_h */
236 
237 /* vi: set ts=4 sw=4 expandtab: */
struct SDL_Window SDL_Window
The type used to identify a window.
Definition: SDL_video.h:89
Definition: SDL_syswm.h:159
General event structure.
Definition: SDL_events.h:495
SDL_SYSWM_TYPE
Definition: SDL_syswm.h:99
Information the version of SDL in use.
Definition: SDL_version.h:51
Display * display
Definition: SDL_syswm.h:174
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:112
Window window
Definition: SDL_syswm.h:175