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