Mercurial > sdl-ios-xcode
annotate include/SDL_syswm.h @ 4151:cab9823cb55e SDL-1.2
Prevent crash from unaligned memory access on sparc64, etc.
Fixes Bugzilla #602. I suspect this will crash elsewhere if the system
actually had modelines to report, though.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Mon, 08 Sep 2008 07:33:05 +0000 |
parents | be84332e761e |
children | a1b03ba2fcd0 |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1133
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1133
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0 | 7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1133
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0 | 9 |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1133
diff
changeset
|
13 Lesser General Public License for more details. |
0 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1133
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1133
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1133
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 18 |
19 Sam Lantinga | |
251
b8688cfdc232
Updated the headers with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
94
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
22 | |
23 /* Include file for SDL custom system window manager hooks */ | |
24 | |
25 #ifndef _SDL_syswm_h | |
26 #define _SDL_syswm_h | |
27 | |
1356
67114343400d
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
1330
diff
changeset
|
28 #include "SDL_stdinc.h" |
1358
c71e05b4dc2e
More header massaging... works great on Windows. ;-)
Sam Lantinga <slouken@libsdl.org>
parents:
1356
diff
changeset
|
29 #include "SDL_error.h" |
0 | 30 #include "SDL_version.h" |
31 | |
32 #include "begin_code.h" | |
33 /* Set up for C function definitions, even when using C++ */ | |
34 #ifdef __cplusplus | |
35 extern "C" { | |
36 #endif | |
37 | |
38 /* Your application has access to a special type of event 'SDL_SYSWMEVENT', | |
39 which contains window-manager specific information and arrives whenever | |
40 an unhandled window event occurs. This event is ignored by default, but | |
41 you can enable it with SDL_EventState() | |
42 */ | |
43 #ifdef SDL_PROTOTYPES_ONLY | |
44 struct SDL_SysWMinfo; | |
45 typedef struct SDL_SysWMinfo SDL_SysWMinfo; | |
46 #else | |
47 | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
48 /* This is the structure for custom window manager events */ |
1626 | 49 #if defined(SDL_VIDEO_DRIVER_X11) |
1133
609c060fd2a2
The MacOSX Carbon/Cocoa/X11 all in one library patch. Relevant emails:
Ryan C. Gordon <icculus@icculus.org>
parents:
1035
diff
changeset
|
50 #if defined(__APPLE__) && defined(__MACH__) |
1487
dc6b59e925a2
Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
1433
diff
changeset
|
51 /* conflicts with Quickdraw.h */ |
1133
609c060fd2a2
The MacOSX Carbon/Cocoa/X11 all in one library patch. Relevant emails:
Ryan C. Gordon <icculus@icculus.org>
parents:
1035
diff
changeset
|
52 #define Cursor X11Cursor |
609c060fd2a2
The MacOSX Carbon/Cocoa/X11 all in one library patch. Relevant emails:
Ryan C. Gordon <icculus@icculus.org>
parents:
1035
diff
changeset
|
53 #endif |
609c060fd2a2
The MacOSX Carbon/Cocoa/X11 all in one library patch. Relevant emails:
Ryan C. Gordon <icculus@icculus.org>
parents:
1035
diff
changeset
|
54 |
0 | 55 #include <X11/Xlib.h> |
56 #include <X11/Xatom.h> | |
57 | |
1133
609c060fd2a2
The MacOSX Carbon/Cocoa/X11 all in one library patch. Relevant emails:
Ryan C. Gordon <icculus@icculus.org>
parents:
1035
diff
changeset
|
58 #if defined(__APPLE__) && defined(__MACH__) |
1487
dc6b59e925a2
Cleaning up warnings on MacOS X
Sam Lantinga <slouken@libsdl.org>
parents:
1433
diff
changeset
|
59 /* matches the re-define above */ |
1133
609c060fd2a2
The MacOSX Carbon/Cocoa/X11 all in one library patch. Relevant emails:
Ryan C. Gordon <icculus@icculus.org>
parents:
1035
diff
changeset
|
60 #undef Cursor |
609c060fd2a2
The MacOSX Carbon/Cocoa/X11 all in one library patch. Relevant emails:
Ryan C. Gordon <icculus@icculus.org>
parents:
1035
diff
changeset
|
61 #endif |
609c060fd2a2
The MacOSX Carbon/Cocoa/X11 all in one library patch. Relevant emails:
Ryan C. Gordon <icculus@icculus.org>
parents:
1035
diff
changeset
|
62 |
0 | 63 /* These are the various supported subsystems under UNIX */ |
64 typedef enum { | |
65 SDL_SYSWM_X11 | |
66 } SDL_SYSWM_TYPE; | |
67 | |
68 /* The UNIX custom event structure */ | |
69 struct SDL_SysWMmsg { | |
70 SDL_version version; | |
71 SDL_SYSWM_TYPE subsystem; | |
72 union { | |
73 XEvent xevent; | |
74 } event; | |
75 }; | |
76 | |
77 /* The UNIX custom window manager information structure. | |
78 When this structure is returned, it holds information about which | |
79 low level system it is using, and will be one of SDL_SYSWM_TYPE. | |
80 */ | |
911
04a403e4ccf5
Date: Mon, 3 May 2004 03:15:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
870
diff
changeset
|
81 typedef struct SDL_SysWMinfo { |
0 | 82 SDL_version version; |
83 SDL_SYSWM_TYPE subsystem; | |
84 union { | |
85 struct { | |
86 Display *display; /* The X11 display */ | |
87 Window window; /* The X11 display window */ | |
88 /* These locking functions should be called around | |
3872 | 89 any X11 functions using the display variable, |
90 but not the gfxdisplay variable. | |
0 | 91 They lock the event thread, so should not be |
92 called around event functions or from event filters. | |
93 */ | |
94 void (*lock_func)(void); | |
95 void (*unlock_func)(void); | |
96 | |
97 /* Introduced in SDL 1.0.2 */ | |
98 Window fswindow; /* The X11 fullscreen window */ | |
99 Window wmwindow; /* The X11 managed input window */ | |
3872 | 100 |
101 /* Introduced in SDL 1.2.12 */ | |
102 Display *gfxdisplay; /* The X11 display to which rendering is done */ | |
0 | 103 } x11; |
104 } info; | |
105 } SDL_SysWMinfo; | |
106 | |
1626 | 107 #elif defined(SDL_VIDEO_DRIVER_NANOX) |
30
57bf11a5efd7
Added initial support for Nano-X (thanks Hsieh-Fu!)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
108 #include <microwin/nano-X.h> |
57bf11a5efd7
Added initial support for Nano-X (thanks Hsieh-Fu!)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
109 |
57bf11a5efd7
Added initial support for Nano-X (thanks Hsieh-Fu!)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
110 /* The generic custom event structure */ |
57bf11a5efd7
Added initial support for Nano-X (thanks Hsieh-Fu!)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
111 struct SDL_SysWMmsg { |
57bf11a5efd7
Added initial support for Nano-X (thanks Hsieh-Fu!)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
112 SDL_version version; |
57bf11a5efd7
Added initial support for Nano-X (thanks Hsieh-Fu!)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
113 int data; |
57bf11a5efd7
Added initial support for Nano-X (thanks Hsieh-Fu!)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
114 }; |
57bf11a5efd7
Added initial support for Nano-X (thanks Hsieh-Fu!)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
115 |
57bf11a5efd7
Added initial support for Nano-X (thanks Hsieh-Fu!)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
116 /* The windows custom window manager information structure */ |
911
04a403e4ccf5
Date: Mon, 3 May 2004 03:15:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
870
diff
changeset
|
117 typedef struct SDL_SysWMinfo { |
30
57bf11a5efd7
Added initial support for Nano-X (thanks Hsieh-Fu!)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
118 SDL_version version ; |
57bf11a5efd7
Added initial support for Nano-X (thanks Hsieh-Fu!)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
119 GR_WINDOW_ID window ; /* The display window */ |
57bf11a5efd7
Added initial support for Nano-X (thanks Hsieh-Fu!)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
120 } SDL_SysWMinfo; |
57bf11a5efd7
Added initial support for Nano-X (thanks Hsieh-Fu!)
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
121 |
1760
a9be6a3a51d1
Patch from Dmitry Yakimov to fix building on WinCE
Sam Lantinga <slouken@libsdl.org>
parents:
1626
diff
changeset
|
122 #elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI) |
1433
bb6839704ed6
SDL_windows.h is no longer necessary
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
123 #define WIN32_LEAN_AND_MEAN |
bb6839704ed6
SDL_windows.h is no longer necessary
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
124 #include <windows.h> |
0 | 125 |
126 /* The windows custom event structure */ | |
127 struct SDL_SysWMmsg { | |
128 SDL_version version; | |
129 HWND hwnd; /* The window for the message */ | |
130 UINT msg; /* The type of message */ | |
131 WPARAM wParam; /* WORD message parameter */ | |
132 LPARAM lParam; /* LONG message parameter */ | |
133 }; | |
134 | |
135 /* The windows custom window manager information structure */ | |
911
04a403e4ccf5
Date: Mon, 3 May 2004 03:15:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
870
diff
changeset
|
136 typedef struct SDL_SysWMinfo { |
0 | 137 SDL_version version; |
138 HWND window; /* The Win32 display window */ | |
438
f9c5f135a8b9
Added a way to get the Windows OpenGL context in SDL_syswm.h
Sam Lantinga <slouken@libsdl.org>
parents:
337
diff
changeset
|
139 HGLRC hglrc; /* The OpenGL context, if any */ |
0 | 140 } SDL_SysWMinfo; |
141 | |
1626 | 142 #elif defined(SDL_VIDEO_DRIVER_RISCOS) |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
471
diff
changeset
|
143 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
471
diff
changeset
|
144 /* RISC OS custom event structure */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
471
diff
changeset
|
145 struct SDL_SysWMmsg { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
471
diff
changeset
|
146 SDL_version version; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
471
diff
changeset
|
147 int eventCode; /* The window for the message */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
471
diff
changeset
|
148 int pollBlock[64]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
471
diff
changeset
|
149 }; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
471
diff
changeset
|
150 |
1035
974ba6ae0fa3
Date: Wed, 26 Jan 2005 13:37:09 GMT
Sam Lantinga <slouken@libsdl.org>
parents:
1026
diff
changeset
|
151 /* The RISC OS custom window manager information structure */ |
911
04a403e4ccf5
Date: Mon, 3 May 2004 03:15:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
870
diff
changeset
|
152 typedef struct SDL_SysWMinfo { |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
471
diff
changeset
|
153 SDL_version version; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
471
diff
changeset
|
154 int wimpVersion; /* Wimp version running under */ |
1035
974ba6ae0fa3
Date: Wed, 26 Jan 2005 13:37:09 GMT
Sam Lantinga <slouken@libsdl.org>
parents:
1026
diff
changeset
|
155 int taskHandle; /* The RISC OS task handle */ |
974ba6ae0fa3
Date: Wed, 26 Jan 2005 13:37:09 GMT
Sam Lantinga <slouken@libsdl.org>
parents:
1026
diff
changeset
|
156 int window; /* The RISC OS display window */ |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
471
diff
changeset
|
157 } SDL_SysWMinfo; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
471
diff
changeset
|
158 |
1626 | 159 #elif defined(SDL_VIDEO_DRIVER_PHOTON) |
870
95f22f17e44a
Date: Wed, 3 Mar 2004 12:44:21 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
160 #include <sys/neutrino.h> |
95f22f17e44a
Date: Wed, 3 Mar 2004 12:44:21 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
161 #include <Ph.h> |
95f22f17e44a
Date: Wed, 3 Mar 2004 12:44:21 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
162 |
95f22f17e44a
Date: Wed, 3 Mar 2004 12:44:21 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
163 /* The QNX custom event structure */ |
95f22f17e44a
Date: Wed, 3 Mar 2004 12:44:21 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
164 struct SDL_SysWMmsg { |
95f22f17e44a
Date: Wed, 3 Mar 2004 12:44:21 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
165 SDL_version version; |
95f22f17e44a
Date: Wed, 3 Mar 2004 12:44:21 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
166 int data; |
95f22f17e44a
Date: Wed, 3 Mar 2004 12:44:21 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
167 }; |
95f22f17e44a
Date: Wed, 3 Mar 2004 12:44:21 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
168 |
95f22f17e44a
Date: Wed, 3 Mar 2004 12:44:21 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
169 /* The QNX custom window manager information structure */ |
911
04a403e4ccf5
Date: Mon, 3 May 2004 03:15:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
870
diff
changeset
|
170 typedef struct SDL_SysWMinfo { |
870
95f22f17e44a
Date: Wed, 3 Mar 2004 12:44:21 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
171 SDL_version version; |
95f22f17e44a
Date: Wed, 3 Mar 2004 12:44:21 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
172 int data; |
95f22f17e44a
Date: Wed, 3 Mar 2004 12:44:21 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
173 } SDL_SysWMinfo; |
95f22f17e44a
Date: Wed, 3 Mar 2004 12:44:21 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
174 |
0 | 175 #else |
176 | |
177 /* The generic custom event structure */ | |
178 struct SDL_SysWMmsg { | |
179 SDL_version version; | |
180 int data; | |
181 }; | |
182 | |
183 /* The generic custom window manager information structure */ | |
911
04a403e4ccf5
Date: Mon, 3 May 2004 03:15:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
870
diff
changeset
|
184 typedef struct SDL_SysWMinfo { |
0 | 185 SDL_version version; |
186 int data; | |
187 } SDL_SysWMinfo; | |
188 | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
189 #endif /* video driver type */ |
0 | 190 |
191 #endif /* SDL_PROTOTYPES_ONLY */ | |
192 | |
193 /* Function prototypes */ | |
194 /* | |
195 * This function gives you custom hooks into the window manager information. | |
196 * It fills the structure pointed to by 'info' with custom information and | |
197 * returns 1 if the function is implemented. If it's not implemented, or | |
198 * the version member of the 'info' structure is invalid, it returns 0. | |
999
8be85fa59cf3
Added a usage example for SDL_GetWMInfo()
Sam Lantinga <slouken@libsdl.org>
parents:
911
diff
changeset
|
199 * |
8be85fa59cf3
Added a usage example for SDL_GetWMInfo()
Sam Lantinga <slouken@libsdl.org>
parents:
911
diff
changeset
|
200 * You typically use this function like this: |
8be85fa59cf3
Added a usage example for SDL_GetWMInfo()
Sam Lantinga <slouken@libsdl.org>
parents:
911
diff
changeset
|
201 * SDL_SysWMInfo info; |
8be85fa59cf3
Added a usage example for SDL_GetWMInfo()
Sam Lantinga <slouken@libsdl.org>
parents:
911
diff
changeset
|
202 * SDL_VERSION(&info.version); |
8be85fa59cf3
Added a usage example for SDL_GetWMInfo()
Sam Lantinga <slouken@libsdl.org>
parents:
911
diff
changeset
|
203 * if ( SDL_GetWMInfo(&info) ) { ... } |
0 | 204 */ |
337
9154ec9ca3d2
Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
205 extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info); |
0 | 206 |
207 | |
208 /* Ends C function definitions when using C++ */ | |
209 #ifdef __cplusplus | |
210 } | |
211 #endif | |
212 #include "close_code.h" | |
213 | |
214 #endif /* _SDL_syswm_h */ |