comparison src/video/wincommon/SDL_syswm.c @ 1152:51a8702d8ecd

Updates to PocketPC (WinCE) support, thanks to Dmitry Yakimov at activekitten.com.
author Ryan C. Gordon <icculus@icculus.org>
date Thu, 29 Sep 2005 09:43:00 +0000
parents 3ac8344e3872
children c9b51268668f
comparison
equal deleted inserted replaced
1151:be9c9c8f6d53 1152:51a8702d8ecd
34 #include "SDL_video.h" 34 #include "SDL_video.h"
35 #include "SDL_syswm.h" 35 #include "SDL_syswm.h"
36 #include "SDL_syswm_c.h" 36 #include "SDL_syswm_c.h"
37 #include "SDL_wingl_c.h" 37 #include "SDL_wingl_c.h"
38 #include "SDL_pixels_c.h" 38 #include "SDL_pixels_c.h"
39 #include "SDL_loadso.h"
40
39 41
40 #ifdef _WIN32_WCE 42 #ifdef _WIN32_WCE
41 #define DISABLE_ICON_SUPPORT 43 #define DISABLE_ICON_SUPPORT
42 #endif 44 #endif
43 45
45 we need "SDL_cursor_c.h" for mods to WIN_GrabInput */ 47 we need "SDL_cursor_c.h" for mods to WIN_GrabInput */
46 #include "SDL_cursor_c.h" 48 #include "SDL_cursor_c.h"
47 49
48 /* The screen icon -- needs to be freed on SDL_VideoQuit() */ 50 /* The screen icon -- needs to be freed on SDL_VideoQuit() */
49 HICON screen_icn = NULL; 51 HICON screen_icn = NULL;
52
53 #ifdef _WIN32_WCE
54
55 BOOL (WINAPI *CoreCatchInput)(int flag) = NULL;
56 int input_catched = 0;
57 HINSTANCE coredll = NULL;
58
59 // the same API call that gx.dll does to catch the input
60 void LoadInputCatchFunc()
61 {
62 coredll = SDL_LoadObject("coredll.dll");
63 if( coredll )
64 {
65 CoreCatchInput = (int (WINAPI *)(int)) GetProcAddress(coredll, (const unsigned short *) 1453);
66 }
67 }
68
69 #endif
70
50 71
51 /* Win32 icon mask semantics are different from those of SDL: 72 /* Win32 icon mask semantics are different from those of SDL:
52 SDL applies the mask to the icon and copies result to desktop. 73 SDL applies the mask to the icon and copies result to desktop.
53 Win32 applies the mask to the desktop and XORs the icon on. 74 Win32 applies the mask to the desktop and XORs the icon on.
54 This means that the SDL mask needs to be applied to the icon and 75 This means that the SDL mask needs to be applied to the icon and
243 pt.x = x; 264 pt.x = x;
244 pt.y = y; 265 pt.y = y;
245 ClientToScreen(SDL_Window, &pt); 266 ClientToScreen(SDL_Window, &pt);
246 SetCursorPos(pt.x,pt.y); 267 SetCursorPos(pt.x,pt.y);
247 } 268 }
269 #ifdef _WIN32_WCE
270 if( input_catched )
271 {
272 if( !CoreCatchInput ) LoadInputCatchFunc();
273
274 if( CoreCatchInput )
275 CoreCatchInput(0);
276 }
277 #endif
248 } else { 278 } else {
249 ClipCursor(&SDL_bounds); 279 ClipCursor(&SDL_bounds);
250 if ( !(SDL_cursorstate & CURSOR_VISIBLE) ) { 280 if ( !(SDL_cursorstate & CURSOR_VISIBLE) ) {
251 /* RJR: March 28, 2000 281 /* RJR: March 28, 2000
252 must be entering relative mode, get ready by 282 must be entering relative mode, get ready by
255 pt.x = (SDL_VideoSurface->w/2); 285 pt.x = (SDL_VideoSurface->w/2);
256 pt.y = (SDL_VideoSurface->h/2); 286 pt.y = (SDL_VideoSurface->h/2);
257 ClientToScreen(SDL_Window, &pt); 287 ClientToScreen(SDL_Window, &pt);
258 SetCursorPos(pt.x, pt.y); 288 SetCursorPos(pt.x, pt.y);
259 } 289 }
290 #ifdef _WIN32_WCE
291 if( !input_catched )
292 {
293 if( !CoreCatchInput ) LoadInputCatchFunc();
294
295 if( CoreCatchInput )
296 CoreCatchInput(1);
297 }
298 #endif
260 } 299 }
261 return(mode); 300 return(mode);
262 } 301 }
263 302
264 /* If 'info' is the right version, this function fills it and returns 1. 303 /* If 'info' is the right version, this function fills it and returns 1.