Bug 1091 - WM_MOUSEWHEEL (scroll-event) not handled correctlly
authorNeil Roberts <neil@openedhand.com>
Thu, 7 Aug 2008 20:34:37 +0000 (20:34 +0000)
committerNeil Roberts <neil@openedhand.com>
Thu, 7 Aug 2008 20:34:37 +0000 (20:34 +0000)
* clutter/win32/clutter-event-win32.c (message_translate): The
coordinates in a WM_MOUSEWEEL message are given relative to the
screen so they need to be converted to client coordinates before
use. Thanks to Roman Yazmin.

ChangeLog
clutter/win32/clutter-event-win32.c

index d4ce20d..57b4a70 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-08-07  Neil Roberts  <neil@o-hand.com>
+
+       Bug 1091 - WM_MOUSEWHEEL (scroll-event) not handled correctlly
+
+       * clutter/win32/clutter-event-win32.c (message_translate): The
+       coordinates in a WM_MOUSEWEEL message are given relative to the
+       screen so they need to be converted to client coordinates before
+       use. Thanks to Roman Yazmin.
+
 2008-08-06  Emmanuele Bassi  <ebassi@openedhand.com>
 
        * clutter/clutter-child-meta.c:
index 22654ad..27ce160 100644 (file)
@@ -467,11 +467,17 @@ message_translate (ClutterBackend *backend,
 
       event->type = CLUTTER_SCROLL;
       event->scroll.time = msg->time;
-      event->scroll.x = GET_X_LPARAM (msg->lParam);
-      event->scroll.y = GET_Y_LPARAM (msg->lParam);
       event->scroll.modifier_state
        = get_modifier_state (LOWORD (msg->wParam));
 
+      /* conversion to window coordinates is required */
+      {
+       POINT pt = { GET_X_LPARAM (msg->lParam), GET_Y_LPARAM (msg->lParam) };
+       ScreenToClient (msg->hwnd, &pt);
+       event->scroll.x = pt.x;
+       event->scroll.y = pt.y;
+      }
+
       if (stage_win32->scroll_pos >= WHEEL_DELTA)
        {
          event->scroll.direction = CLUTTER_SCROLL_UP;