comparison 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
comparison
equal deleted inserted replaced
3767:abc8acb8e3d7 3768:1b87a8beab9d
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 18
19 Sam Lantinga 19 Sam Lantinga
20 slouken@libsdl.org 20 slouken@libsdl.org
21 */ 21 */
22
23 #if (_WIN32_WINNT < 0x0501)
24 #undef _WIN32_WINNT
25 #define _WIN32_WINNT 0x0501
26 #endif
27
22 #include "SDL_config.h" 28 #include "SDL_config.h"
23 29
24 #include "../SDL_sysvideo.h" 30 #include "../SDL_sysvideo.h"
25 #include "../../events/SDL_keyboard_c.h" 31 #include "../../events/SDL_keyboard_c.h"
26 32
138 } 144 }
139 145
140 int 146 int
141 WIN_CreateWindow(_THIS, SDL_Window * window) 147 WIN_CreateWindow(_THIS, SDL_Window * window)
142 { 148 {
149 RAWINPUTDEVICE Rid;
143 AXIS TabX,TabY; 150 AXIS TabX,TabY;
144 LOGCONTEXT lc; 151 LOGCONTEXT lc;
145 HWND hwnd; 152 HWND hwnd;
146 HWND top; 153 HWND top;
147 RECT rect; 154 RECT rect;
189 196
190 hwnd = 197 hwnd =
191 CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, NULL, NULL, 198 CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, NULL, NULL,
192 SDL_Instance, NULL); 199 SDL_Instance, NULL);
193 200
194 WTInfo(WTI_DEFCONTEXT, 0, &lc); 201 WTInfo(WTI_DEFSYSCTX, 0, &lc);
195
196 lc.lcPktData = PACKETDATA; 202 lc.lcPktData = PACKETDATA;
197 lc.lcPktMode = PACKETMODE; 203 lc.lcPktMode = PACKETMODE;
198 lc.lcOptions |= CXO_MESSAGES; 204 lc.lcOptions |= CXO_MESSAGES;
205 lc.lcOptions |= CXO_SYSTEM;
199 lc.lcMoveMask = PACKETDATA; 206 lc.lcMoveMask = PACKETDATA;
200 lc.lcBtnDnMask=lc.lcBtnUpMask = PACKETDATA; 207 lc.lcBtnDnMask=lc.lcBtnUpMask = PACKETDATA;
201 208
202 WTInfo(WTI_DEVICES,DVC_X,&TabX); 209 WTInfo(WTI_DEVICES,DVC_X,&TabX);
203 WTInfo(WTI_DEVICES,DVC_Y,&TabY); 210 WTInfo(WTI_DEVICES,DVC_Y,&TabY);
224 } 231 }
225 g_hCtx=tmp_hctx; 232 g_hCtx=tmp_hctx;
226 } 233 }
227 234
228 g_hCtx[window->id] = WTOpen(hwnd, &lc, TRUE); 235 g_hCtx[window->id] = WTOpen(hwnd, &lc, TRUE);
236
237 Rid.usUsagePage = 0x01;
238 Rid.usUsage = 0x02;
239 //Rid.usUsage = MOUSE_MOVE_ABSOLUTE;
240 Rid.dwFlags = RIDEV_INPUTSINK; // adds HID mouse and also ignores legacy mouse messages
241 Rid.hwndTarget = hwnd;
242
243 RegisterRawInputDevices(&Rid, 1, sizeof(Rid));
244
245
229 WIN_PumpEvents(_this); 246 WIN_PumpEvents(_this);
230 247
231 if (!hwnd) { 248 if (!hwnd) {
232 WIN_SetError("Couldn't create window"); 249 WIN_SetError("Couldn't create window");
233 return -1; 250 return -1;