(construct_mouse_wheel): Handle negative coordinates.
authorJason Rumney <jasonr@gnu.org>
Wed, 26 Apr 2006 18:19:13 +0000 (18:19 +0000)
committerJason Rumney <jasonr@gnu.org>
Wed, 26 Apr 2006 18:19:13 +0000 (18:19 +0000)
src/ChangeLog
src/w32term.c

index c47d597..45b9958 100644 (file)
@@ -1,5 +1,7 @@
 2006-04-26  Jason Rumney  <jasonr@gnu.org>
 
+       * w32term.c (construct_mouse_wheel): Handle negative coordinates.
+
        * w32fns.c (w32_wnd_proc) <WM_LBUTTONDOWN, WM_RBUTTONDOWN>:
        <WM_LBUTTONUP, WM_RBUTTONUP>: Call signal_user_input in the cases
        where we preempt mouse_button_timer.
index f0ef42f..2b5c9da 100644 (file)
@@ -3131,8 +3131,10 @@ construct_mouse_wheel (result, msg, f)
   result->modifiers = (msg->dwModifiers
                        | ((delta < 0 ) ? down_modifier : up_modifier));
 
-  p.x = LOWORD (msg->msg.lParam);
-  p.y = HIWORD (msg->msg.lParam);
+  /* With multiple monitors, we can legitimately get negative
+     coordinates, so cast to short to interpret them correctly.  */
+  p.x = (short) LOWORD (msg->msg.lParam);
+  p.y = (short) HIWORD (msg->msg.lParam);
   ScreenToClient (msg->msg.hwnd, &p);
   XSETINT (result->x, p.x);
   XSETINT (result->y, p.y);