Win32: Fix issue with SetCapture & negative values.
authorJørgen P. Tjernø <jorgen@valvesoftware.com>
Wed, 05 Jun 2013 12:00:18 -0700
changeset 727637814e7eeff3
parent 7275 0a6b3b998814
child 7277 1290cd7f34af
Win32: Fix issue with SetCapture & negative values.

This fixes an issue where we were using the wrong macros to extract the position from WM_MOUSEMOVE, so negative values were behaving incorrectly.
These would be generated in multimon situations, or if you use SetCapture.

Fixes http://bugzilla.libsdl.org/show_bug.cgi?id=1175
src/video/windows/SDL_windowsevents.c
     1.1 --- a/src/video/windows/SDL_windowsevents.c	Wed Jun 05 12:00:15 2013 -0700
     1.2 +++ b/src/video/windows/SDL_windowsevents.c	Wed Jun 05 12:00:18 2013 -0700
     1.3 @@ -33,6 +33,8 @@
     1.4  /* Dropfile support */
     1.5  #include <shellapi.h>
     1.6  
     1.7 +/* For GET_X_LPARAM, GET_Y_LPARAM. */
     1.8 +#include <windowsx.h>
     1.9  
    1.10  /*#define WMMSG_DEBUG*/
    1.11  #ifdef WMMSG_DEBUG
    1.12 @@ -381,7 +383,7 @@
    1.13  
    1.14      case WM_MOUSEMOVE:
    1.15          if( !SDL_GetMouse()->relative_mode )
    1.16 -            SDL_SendMouseMotion(data->window, 0, 0, LOWORD(lParam), HIWORD(lParam));
    1.17 +            SDL_SendMouseMotion(data->window, 0, 0, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
    1.18          /* don't break here, fall through to check the wParam like the button presses */
    1.19      case WM_LBUTTONUP:
    1.20      case WM_RBUTTONUP: