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