Mercurial > sdl-ios-xcode
annotate src/video/wincommon/SDL_syswm.c @ 1420:2405517b5eab
Added preliminary support for MiNT /dev/mouse driver (disabled atm)
author | Patrice Mandin <patmandin@gmail.com> |
---|---|
date | Thu, 23 Feb 2006 21:51:10 +0000 |
parents | d910939febfa |
children | bb6839704ed6 |
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:
1152
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:
1152
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:
1152
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:
1152
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:
1152
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:
1152
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:
1152
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 18 |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
36
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
22 #include "SDL_config.h" |
0 | 23 |
1330
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
24 #include "SDL_windows.h" |
0 | 25 |
26 #include "SDL_version.h" | |
27 #include "SDL_video.h" | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
28 #include "SDL_loadso.h" |
0 | 29 #include "SDL_syswm.h" |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
30 #include "../SDL_pixels_c.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
31 #include "../SDL_cursor_c.h" |
0 | 32 #include "SDL_syswm_c.h" |
439
3ac8344e3872
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
438
diff
changeset
|
33 #include "SDL_wingl_c.h" |
1152
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
34 |
0 | 35 |
36 #ifdef _WIN32_WCE | |
37 #define DISABLE_ICON_SUPPORT | |
38 #endif | |
39 | |
40 /* The screen icon -- needs to be freed on SDL_VideoQuit() */ | |
41 HICON screen_icn = NULL; | |
42 | |
1152
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
43 #ifdef _WIN32_WCE |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
44 |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
45 BOOL (WINAPI *CoreCatchInput)(int flag) = NULL; |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
46 int input_catched = 0; |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
47 HINSTANCE coredll = NULL; |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
48 |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
49 // the same API call that gx.dll does to catch the input |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
50 void LoadInputCatchFunc() |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
51 { |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
52 coredll = SDL_LoadObject("coredll.dll"); |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
53 if( coredll ) |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
54 { |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
55 CoreCatchInput = (int (WINAPI *)(int)) GetProcAddress(coredll, (const unsigned short *) 1453); |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
56 } |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
57 } |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
58 |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
59 #endif |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
60 |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
61 |
0 | 62 /* Win32 icon mask semantics are different from those of SDL: |
63 SDL applies the mask to the icon and copies result to desktop. | |
64 Win32 applies the mask to the desktop and XORs the icon on. | |
65 This means that the SDL mask needs to be applied to the icon and | |
66 then inverted and passed to Win32. | |
67 */ | |
68 void WIN_SetWMIcon(_THIS, SDL_Surface *icon, Uint8 *mask) | |
69 { | |
70 #ifdef DISABLE_ICON_SUPPORT | |
71 return; | |
72 #else | |
73 SDL_Palette *pal_256; | |
74 SDL_Surface *icon_256; | |
75 Uint8 *pdata, *pwin32; | |
76 Uint8 *mdata, *mwin32, m = 0; | |
77 int icon_len; | |
78 int icon_plen; | |
79 int icon_mlen; | |
80 int icon_pitch; | |
81 int mask_pitch; | |
82 SDL_Rect bounds; | |
83 int i, skip; | |
84 int row, col; | |
85 struct /* quasi-BMP format */ Win32Icon { | |
86 Uint32 biSize; | |
87 Sint32 biWidth; | |
88 Sint32 biHeight; | |
89 Uint16 biPlanes; | |
90 Uint16 biBitCount; | |
91 Uint32 biCompression; | |
92 Uint32 biSizeImage; | |
93 Sint32 biXPelsPerMeter; | |
94 Sint32 biYPelsPerMeter; | |
95 Uint32 biClrUsed; | |
96 Uint32 biClrImportant; | |
97 struct /* RGBQUAD -- note it's BGR ordered */ { | |
98 Uint8 rgbBlue; | |
99 Uint8 rgbGreen; | |
100 Uint8 rgbRed; | |
101 Uint8 rgbReserved; | |
102 } biColors[256]; | |
103 /* Pixels: | |
104 Uint8 pixels[] | |
105 */ | |
106 /* Mask: | |
107 Uint8 mask[] | |
108 */ | |
109 } *icon_win32; | |
110 | |
111 /* Allocate the win32 bmp icon and set everything to zero */ | |
112 icon_pitch = ((icon->w+3)&~3); | |
113 mask_pitch = ((icon->w+7)/8); | |
114 icon_plen = icon->h*icon_pitch; | |
115 icon_mlen = icon->h*mask_pitch; | |
116 icon_len = sizeof(*icon_win32)+icon_plen+icon_mlen; | |
1330
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
117 icon_win32 = (struct Win32Icon *)SDL_stack_alloc(Uint8, icon_len); |
0 | 118 if ( icon_win32 == NULL ) { |
119 return; | |
120 } | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1330
diff
changeset
|
121 SDL_memset(icon_win32, 0, icon_len); |
0 | 122 |
123 /* Set the basic BMP parameters */ | |
124 icon_win32->biSize = sizeof(*icon_win32)-sizeof(icon_win32->biColors); | |
125 icon_win32->biWidth = icon->w; | |
126 icon_win32->biHeight = icon->h*2; | |
127 icon_win32->biPlanes = 1; | |
128 icon_win32->biBitCount = 8; | |
129 icon_win32->biSizeImage = icon_plen+icon_mlen; | |
130 | |
131 /* Allocate a standard 256 color icon surface */ | |
132 icon_256 = SDL_CreateRGBSurface(SDL_SWSURFACE, icon->w, icon->h, | |
133 icon_win32->biBitCount, 0, 0, 0, 0); | |
134 if ( icon_256 == NULL ) { | |
1330
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
135 SDL_stack_free(icon_win32); |
0 | 136 return; |
137 } | |
138 pal_256 = icon_256->format->palette; | |
139 if (icon->format->palette && | |
140 (icon->format->BitsPerPixel == icon_256->format->BitsPerPixel)){ | |
141 Uint8 black; | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1330
diff
changeset
|
142 SDL_memcpy(pal_256->colors, icon->format->palette->colors, |
0 | 143 pal_256->ncolors*sizeof(SDL_Color)); |
144 /* Make sure that 0 is black! */ | |
145 black = SDL_FindColor(pal_256, 0x00, 0x00, 0x00); | |
146 pal_256->colors[black] = pal_256->colors[0]; | |
147 pal_256->colors[0].r = 0x00; | |
148 pal_256->colors[0].g = 0x00; | |
149 pal_256->colors[0].b = 0x00; | |
150 } else { | |
151 SDL_DitherColors(pal_256->colors, | |
152 icon_256->format->BitsPerPixel); | |
153 } | |
154 | |
155 /* Now copy color data to the icon BMP */ | |
156 for ( i=0; i<(1<<icon_win32->biBitCount); ++i ) { | |
157 icon_win32->biColors[i].rgbRed = pal_256->colors[i].r; | |
158 icon_win32->biColors[i].rgbGreen = pal_256->colors[i].g; | |
159 icon_win32->biColors[i].rgbBlue = pal_256->colors[i].b; | |
160 } | |
161 | |
162 /* Convert icon to a standard surface format. This may not always | |
163 be necessary, as Windows supports a variety of BMP formats, but | |
164 it greatly simplifies our code. | |
165 */ | |
1330
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
166 bounds.x = 0; |
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
167 bounds.y = 0; |
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
168 bounds.w = icon->w; |
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
169 bounds.h = icon->h; |
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
170 if ( SDL_LowerBlit(icon, &bounds, icon_256, &bounds) < 0 ) { |
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
171 SDL_stack_free(icon_win32); |
0 | 172 SDL_FreeSurface(icon_256); |
1330
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
173 return; |
0 | 174 } |
175 | |
176 /* Copy pixels upside-down to icon BMP, masked with the icon mask */ | |
177 if ( SDL_MUSTLOCK(icon_256) || (icon_256->pitch != icon_pitch) ) { | |
1330
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
178 SDL_stack_free(icon_win32); |
0 | 179 SDL_FreeSurface(icon_256); |
180 SDL_SetError("Warning: Unexpected icon_256 characteristics"); | |
181 return; | |
182 } | |
183 pdata = (Uint8 *)icon_256->pixels; | |
184 mdata = mask; | |
185 pwin32 = (Uint8 *)icon_win32+sizeof(*icon_win32)+icon_plen-icon_pitch; | |
186 skip = icon_pitch - icon->w; | |
187 for ( row=0; row<icon->h; ++row ) { | |
188 for ( col=0; col<icon->w; ++col ) { | |
189 if ( (col%8) == 0 ) { | |
190 m = *mdata++; | |
191 } | |
192 if ( (m&0x80) != 0x00 ) { | |
193 *pwin32 = *pdata; | |
194 } | |
195 m <<= 1; | |
196 ++pdata; | |
197 ++pwin32; | |
198 } | |
199 pdata += skip; | |
200 pwin32 += skip; | |
201 pwin32 -= 2*icon_pitch; | |
202 } | |
203 SDL_FreeSurface(icon_256); | |
204 | |
205 /* Copy mask inverted and upside-down to icon BMP */ | |
206 mdata = mask; | |
207 mwin32 = (Uint8 *)icon_win32 | |
208 +sizeof(*icon_win32)+icon_plen+icon_mlen-mask_pitch; | |
209 for ( row=0; row<icon->h; ++row ) { | |
210 for ( col=0; col<mask_pitch; ++col ) { | |
211 *mwin32++ = ~*mdata++; | |
212 } | |
213 mwin32 -= 2*mask_pitch; | |
214 } | |
215 | |
216 /* Finally, create the icon handle and set the window icon */ | |
217 screen_icn = CreateIconFromResourceEx((Uint8 *)icon_win32, icon_len, | |
218 TRUE, 0x00030000, icon->w, icon->h, LR_DEFAULTCOLOR); | |
219 if ( screen_icn == NULL ) { | |
220 SDL_SetError("Couldn't create Win32 icon handle"); | |
221 } else { | |
222 SetClassLong(SDL_Window, GCL_HICON, (LONG)screen_icn); | |
223 } | |
1330
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
224 SDL_stack_free(icon_win32); |
0 | 225 #endif /* DISABLE_ICON_SUPPORT */ |
226 } | |
227 | |
228 void WIN_SetWMCaption(_THIS, const char *title, const char *icon) | |
229 { | |
230 #ifdef _WIN32_WCE | |
231 /* WinCE uses the UNICODE version */ | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1330
diff
changeset
|
232 int nLen = SDL_strlen(title)+1; |
36
13ee9f4834ea
Windows CE patches contributed by Rainer Loritz
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
233 LPWSTR lpszW = alloca(nLen*2); |
0 | 234 MultiByteToWideChar(CP_ACP, 0, title, -1, lpszW, nLen); |
235 SetWindowText(SDL_Window, lpszW); | |
236 #else | |
237 SetWindowText(SDL_Window, title); | |
238 #endif | |
239 } | |
240 | |
241 int WIN_IconifyWindow(_THIS) | |
242 { | |
243 ShowWindow(SDL_Window, SW_MINIMIZE); | |
244 return(1); | |
245 } | |
246 | |
247 SDL_GrabMode WIN_GrabInput(_THIS, SDL_GrabMode mode) | |
248 { | |
249 if ( mode == SDL_GRAB_OFF ) { | |
250 ClipCursor(NULL); | |
251 if ( !(SDL_cursorstate & CURSOR_VISIBLE) ) { | |
252 /* RJR: March 28, 2000 | |
253 must be leaving relative mode, move mouse from | |
254 center of window to where it belongs ... */ | |
255 POINT pt; | |
256 int x, y; | |
257 SDL_GetMouseState(&x,&y); | |
258 pt.x = x; | |
259 pt.y = y; | |
260 ClientToScreen(SDL_Window, &pt); | |
261 SetCursorPos(pt.x,pt.y); | |
262 } | |
1152
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
263 #ifdef _WIN32_WCE |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
264 if( input_catched ) |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
265 { |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
266 if( !CoreCatchInput ) LoadInputCatchFunc(); |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
267 |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
268 if( CoreCatchInput ) |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
269 CoreCatchInput(0); |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
270 } |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
271 #endif |
0 | 272 } else { |
273 ClipCursor(&SDL_bounds); | |
274 if ( !(SDL_cursorstate & CURSOR_VISIBLE) ) { | |
275 /* RJR: March 28, 2000 | |
276 must be entering relative mode, get ready by | |
277 moving mouse to center of window ... */ | |
278 POINT pt; | |
279 pt.x = (SDL_VideoSurface->w/2); | |
280 pt.y = (SDL_VideoSurface->h/2); | |
281 ClientToScreen(SDL_Window, &pt); | |
282 SetCursorPos(pt.x, pt.y); | |
283 } | |
1152
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
284 #ifdef _WIN32_WCE |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
285 if( !input_catched ) |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
286 { |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
287 if( !CoreCatchInput ) LoadInputCatchFunc(); |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
288 |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
289 if( CoreCatchInput ) |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
290 CoreCatchInput(1); |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
291 } |
51a8702d8ecd
Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at
Ryan C. Gordon <icculus@icculus.org>
parents:
439
diff
changeset
|
292 #endif |
0 | 293 } |
294 return(mode); | |
295 } | |
296 | |
297 /* If 'info' is the right version, this function fills it and returns 1. | |
298 Otherwise, in case of a version mismatch, it returns -1. | |
299 */ | |
300 int WIN_GetWMInfo(_THIS, SDL_SysWMinfo *info) | |
301 { | |
302 if ( info->version.major <= SDL_MAJOR_VERSION ) { | |
303 info->window = SDL_Window; | |
438
f9c5f135a8b9
Added a way to get the Windows OpenGL context in SDL_syswm.h
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
304 if ( SDL_VERSIONNUM(info->version.major, |
f9c5f135a8b9
Added a way to get the Windows OpenGL context in SDL_syswm.h
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
305 info->version.minor, |
f9c5f135a8b9
Added a way to get the Windows OpenGL context in SDL_syswm.h
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
306 info->version.patch) >= |
439
3ac8344e3872
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
438
diff
changeset
|
307 SDL_VERSIONNUM(1, 2, 5) ) { |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
308 #if SDL_VIDEO_OPENGL |
438
f9c5f135a8b9
Added a way to get the Windows OpenGL context in SDL_syswm.h
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
309 info->hglrc = GL_hrc; |
f9c5f135a8b9
Added a way to get the Windows OpenGL context in SDL_syswm.h
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
310 #else |
f9c5f135a8b9
Added a way to get the Windows OpenGL context in SDL_syswm.h
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
311 info->hglrc = NULL; |
f9c5f135a8b9
Added a way to get the Windows OpenGL context in SDL_syswm.h
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
312 #endif |
f9c5f135a8b9
Added a way to get the Windows OpenGL context in SDL_syswm.h
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
313 } |
0 | 314 return(1); |
315 } else { | |
316 SDL_SetError("Application not compiled with SDL %d.%d\n", | |
317 SDL_MAJOR_VERSION, SDL_MINOR_VERSION); | |
318 return(-1); | |
319 } | |
320 } |