Browse Source

fix mouse motion when wheel is moved

David Rose 19 years ago
parent
commit
88f3ec86be
1 changed files with 6 additions and 4 deletions
  1. 6 4
      panda/src/windisplay/winGraphicsWindow.cxx

+ 6 - 4
panda/src/windisplay/winGraphicsWindow.cxx

@@ -1212,18 +1212,20 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
       case WM_MOUSEWHEEL:
         {
           int delta = GET_WHEEL_DELTA_WPARAM(wparam);
-          int x = translate_mouse(LOWORD(lparam));
-          int y = translate_mouse(HIWORD(lparam));
+
+          POINT point;
+          GetCursorPos(&point);
+          ScreenToClient(hwnd, &point);
           double time = get_message_time();
 
           if (delta >= 0) {
             while (delta > 0) {
-              handle_keypress(MouseButton::wheel_up(), x, y, time);
+              handle_keypress(MouseButton::wheel_up(), point.x, point.y, time);
               delta -= WHEEL_DELTA;
             }
           } else {
             while (delta < 0) {
-              handle_keypress(MouseButton::wheel_down(), x, y, time);
+              handle_keypress(MouseButton::wheel_down(), point.x, point.y, time);
               delta += WHEEL_DELTA;
             }
           }