diff src/video/win32/SDL_win32window.c @ 3768:1b87a8beab9d gsoc2008_manymouse

Project part1
author Szymon Wilczek <kazeuser@gmail.com>
date Wed, 30 Jul 2008 16:09:24 +0000
parents abc8acb8e3d7
children 81b649bad6d2
line wrap: on
line diff
--- a/src/video/win32/SDL_win32window.c	Wed Jul 23 16:12:43 2008 +0000
+++ b/src/video/win32/SDL_win32window.c	Wed Jul 30 16:09:24 2008 +0000
@@ -19,6 +19,12 @@
     Sam Lantinga
     slouken@libsdl.org
 */
+
+#if (_WIN32_WINNT < 0x0501)
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0501
+#endif
+
 #include "SDL_config.h"
 
 #include "../SDL_sysvideo.h"
@@ -140,6 +146,7 @@
 int
 WIN_CreateWindow(_THIS, SDL_Window * window)
 {
+	RAWINPUTDEVICE Rid;
 	AXIS TabX,TabY;
 	LOGCONTEXT lc;
     HWND hwnd;
@@ -191,11 +198,11 @@
         CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, NULL, NULL,
                      SDL_Instance, NULL);
 	
-	WTInfo(WTI_DEFCONTEXT, 0, &lc);
-
+	WTInfo(WTI_DEFSYSCTX, 0, &lc);
 	lc.lcPktData = PACKETDATA;
 	lc.lcPktMode = PACKETMODE;
 	lc.lcOptions |= CXO_MESSAGES;
+	lc.lcOptions |= CXO_SYSTEM;
 	lc.lcMoveMask = PACKETDATA;
 	lc.lcBtnDnMask=lc.lcBtnUpMask = PACKETDATA;
 
@@ -226,6 +233,16 @@
 	}
 
 	g_hCtx[window->id] = WTOpen(hwnd, &lc, TRUE);
+
+	Rid.usUsagePage = 0x01; 
+	Rid.usUsage = 0x02; 
+	//Rid.usUsage = MOUSE_MOVE_ABSOLUTE;
+	Rid.dwFlags = RIDEV_INPUTSINK;   // adds HID mouse and also ignores legacy mouse messages
+	Rid.hwndTarget = hwnd;
+
+	RegisterRawInputDevices(&Rid, 1, sizeof(Rid));
+		
+
     WIN_PumpEvents(_this);
 
     if (!hwnd) {