diff 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
line wrap: on
line diff
--- a/src/video/wincommon/SDL_syswm.c	Wed Sep 28 11:36:20 2005 +0000
+++ b/src/video/wincommon/SDL_syswm.c	Thu Sep 29 09:43:00 2005 +0000
@@ -36,6 +36,8 @@
 #include "SDL_syswm_c.h"
 #include "SDL_wingl_c.h"
 #include "SDL_pixels_c.h"
+#include "SDL_loadso.h"
+
 
 #ifdef _WIN32_WCE
 #define DISABLE_ICON_SUPPORT
@@ -48,6 +50,25 @@
 /* The screen icon -- needs to be freed on SDL_VideoQuit() */
 HICON   screen_icn = NULL;
 
+#ifdef _WIN32_WCE
+
+BOOL (WINAPI *CoreCatchInput)(int flag) = NULL;
+int input_catched = 0;
+HINSTANCE coredll = NULL;
+
+// the same API call that gx.dll does to catch the input
+void LoadInputCatchFunc()
+{
+	coredll = SDL_LoadObject("coredll.dll");
+	if( coredll )
+	{
+		CoreCatchInput = (int (WINAPI *)(int)) GetProcAddress(coredll, (const unsigned short *) 1453);
+	}
+}
+
+#endif
+
+
 /* Win32 icon mask semantics are different from those of SDL:
      SDL applies the mask to the icon and copies result to desktop.
      Win32 applies the mask to the desktop and XORs the icon on.
@@ -245,6 +266,15 @@
 			ClientToScreen(SDL_Window, &pt);
 			SetCursorPos(pt.x,pt.y);
 		}
+#ifdef _WIN32_WCE
+		if( input_catched )
+		{
+			if( !CoreCatchInput ) LoadInputCatchFunc();
+
+			if( CoreCatchInput )
+				CoreCatchInput(0);
+		}
+#endif
 	} else {
 		ClipCursor(&SDL_bounds);
 		if ( !(SDL_cursorstate & CURSOR_VISIBLE) ) {
@@ -257,6 +287,15 @@
 			ClientToScreen(SDL_Window, &pt);
 			SetCursorPos(pt.x, pt.y);
 		}
+#ifdef _WIN32_WCE
+		if( !input_catched )
+		{
+			if( !CoreCatchInput ) LoadInputCatchFunc();
+
+			if( CoreCatchInput )
+				CoreCatchInput(1);
+		}
+#endif
 	}
 	return(mode);
 }