comparison src/video/win32/SDL_win32events.c @ 3260:85bf3f297b5c

Kenneth Bull to SDL I noticed in trunk/SDL/src/video/win32/SDL_win32events.c, in this code here... ... if the device handle isn't found in mice[], which it won't be if the mouse was plugged in after SDL_Init, then you end up with an uninitialized value in index, which is then passed to various SDL_SendMouse* functions.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 07 Sep 2009 16:04:44 +0000
parents 83c87f2b2aab
children f43c8f688f77
comparison
equal deleted inserted replaced
3259:22ac66da0765 3260:85bf3f297b5c
234 234
235 case WM_INPUT: /* mouse events */ 235 case WM_INPUT: /* mouse events */
236 { 236 {
237 LPBYTE lpb; 237 LPBYTE lpb;
238 const RAWINPUTHEADER *header; 238 const RAWINPUTHEADER *header;
239 int index; 239 int index = -1;
240 int i; 240 int i;
241 int size = 0; 241 int size = 0;
242 const RAWMOUSE *raw_mouse = NULL; 242 const RAWMOUSE *raw_mouse = NULL;
243 POINT point; 243 POINT point;
244 USHORT flags; 244 USHORT flags;
258 for (i = 0; i < total_mice; ++i) { 258 for (i = 0; i < total_mice; ++i) {
259 if (mice[i] == header->hDevice) { 259 if (mice[i] == header->hDevice) {
260 index = i; 260 index = i;
261 break; 261 break;
262 } 262 }
263 }
264 if (index < 0) {
265 /* New mouse? Should we dynamically update mouse list? */
266 return (0);
263 } 267 }
264 268
265 GetCursorPos(&point); 269 GetCursorPos(&point);
266 ScreenToClient(hwnd, &point); 270 ScreenToClient(hwnd, &point);
267 271