src/video/windows/SDL_windowsevents.c
changeset 8976 1a5d959d7b32
parent 8953 dc80dc0bd22e
child 9257 6f41196c2d6b
     1.1 --- a/src/video/windows/SDL_windowsevents.c	Sun Jul 06 20:41:39 2014 -0700
     1.2 +++ b/src/video/windows/SDL_windowsevents.c	Mon Jul 07 10:26:28 2014 -0700
     1.3 @@ -453,31 +453,30 @@
     1.4              /* Mouse data */
     1.5              if (inp.header.dwType == RIM_TYPEMOUSE) {
     1.6                  if (isRelative) {
     1.7 -                    RAWMOUSE* mouse = &inp.data.mouse;
     1.8 +                    RAWMOUSE* rawmouse = &inp.data.mouse;
     1.9  
    1.10 -                    if ((mouse->usFlags & 0x01) == MOUSE_MOVE_RELATIVE) {
    1.11 -                        SDL_SendMouseMotion(data->window, 0, 1, (int)mouse->lLastX, (int)mouse->lLastY);
    1.12 +                    if ((rawmouse->usFlags & 0x01) == MOUSE_MOVE_RELATIVE) {
    1.13 +                        SDL_SendMouseMotion(data->window, 0, 1, (int)rawmouse->lLastX, (int)rawmouse->lLastY);
    1.14                      } else {
    1.15                          /* synthesize relative moves from the abs position */
    1.16                          static SDL_Point initialMousePoint;
    1.17                          if (initialMousePoint.x == 0 && initialMousePoint.y == 0) {
    1.18 -                            initialMousePoint.x = mouse->lLastX;
    1.19 -                            initialMousePoint.y = mouse->lLastY;
    1.20 +                            initialMousePoint.x = rawmouse->lLastX;
    1.21 +                            initialMousePoint.y = rawmouse->lLastY;
    1.22                          }
    1.23  
    1.24 -                        SDL_SendMouseMotion(data->window, 0, 1, (int)(mouse->lLastX-initialMousePoint.x), (int)(mouse->lLastY-initialMousePoint.y) );
    1.25 +                        SDL_SendMouseMotion(data->window, 0, 1, (int)(rawmouse->lLastX-initialMousePoint.x), (int)(rawmouse->lLastY-initialMousePoint.y) );
    1.26  
    1.27 -                        initialMousePoint.x = mouse->lLastX;
    1.28 -                        initialMousePoint.y = mouse->lLastY;
    1.29 +                        initialMousePoint.x = rawmouse->lLastX;
    1.30 +                        initialMousePoint.y = rawmouse->lLastY;
    1.31                      }
    1.32 -                    WIN_CheckRawMouseButtons( mouse->usButtonFlags, data );
    1.33 +                    WIN_CheckRawMouseButtons(rawmouse->usButtonFlags, data);
    1.34                  } else if (isCapture) {
    1.35                      /* we check for where Windows thinks the system cursor lives in this case, so we don't really lose mouse accel, etc. */
    1.36                      POINT pt;
    1.37 -                    HWND hwnd = data->hwnd;
    1.38                      GetCursorPos(&pt);
    1.39                      if (WindowFromPoint(pt) != hwnd) {  /* if in the window, WM_MOUSEMOVE, etc, will cover it. */
    1.40 -                        ScreenToClient(data->hwnd, &pt);
    1.41 +                        ScreenToClient(hwnd, &pt);
    1.42                          SDL_SendMouseMotion(data->window, 0, 0, (int) pt.x, (int) pt.y);
    1.43                          SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_LBUTTON) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_LEFT);
    1.44                          SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_RBUTTON) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_RIGHT);
    1.45 @@ -892,7 +891,7 @@
    1.46              SDL_Window *window = data->window;
    1.47              if (window->hit_test) {
    1.48                  POINT winpoint = { (int) LOWORD(lParam), (int) HIWORD(lParam) };
    1.49 -                if (ScreenToClient(data->hwnd, &winpoint)) {
    1.50 +                if (ScreenToClient(hwnd, &winpoint)) {
    1.51                      const SDL_Point point = { (int) winpoint.x, (int) winpoint.y };
    1.52                      const SDL_HitTestResult rc = window->hit_test(window, &point, window->hit_test_data);
    1.53                      switch (rc) {
    1.54 @@ -905,6 +904,7 @@
    1.55                          case SDL_HITTEST_RESIZE_BOTTOM: return HTBOTTOM;
    1.56                          case SDL_HITTEST_RESIZE_BOTTOMLEFT: return HTBOTTOMLEFT;
    1.57                          case SDL_HITTEST_RESIZE_LEFT: return HTLEFT;
    1.58 +                        case SDL_HITTEST_NORMAL: return HTCLIENT;
    1.59                      }
    1.60                  }
    1.61                  /* If we didn't return, this will call DefWindowProc below. */