Mouse wheel's WM_MOUSEWHEEL requires screen, not client, coordinates

Russ matchmovie at
Sat Dec 4 22:02:40 CST 2004

Patch by Russ Andersson, matchmovie at vs 12/01/04 source release.
Please CC direct to me re disposition, tnx.

The WM_MOUSEWHEEL message is specified to have absolute screen coordinates,
unlike the WM_LBUTTONDOWN etc messages, which are client coordinate 
system. WM_MOUSEWHEEL messages are delivered to the correct window (and appear 
to work), but have the wrong coordinates, so programs that use the coordinates
to redistibute the MOUSEWHEEL message (ie to override the focus) wind up 
delivering the MOUSEWHEEL messages to grossly incorrect windows, so much so
the mouse scroll is unusable. The SynthEyes program at shows 
this clearly, you can find multiple images of the overall screen-wide scroll 
wheel mapping within each subwindow, because the MOUSEWHEEL coordinates are 
being sent in client coordinates, not screen coordinates.

The problem is in windows/message.c, which does a translation from screen to
client coordinates right before delivery. This translation needs to be
suppressed for MOUSEWHEEL messages as below. The patch below solves the problem

Tnx, Russ

--- message.bac	2004-12-04 15:52:14.000000000 -0500
+++ message.c	2004-12-04 16:09:37.480044664 -0500
@@ -384,7 +384,9 @@
         /* coordinates don't get translated while tracking a menu */
         /* FIXME: should differentiate popups and top-level menus */
-        if (!(info.flags & GUI_INMENUMODE)) ScreenToClient( msg->hwnd, &pt );
+        /* also, MOUSEWHEEL messages stay in screen coords (RAndersson) */
+        if (!(info.flags & GUI_INMENUMODE) && msg->message != WM_MOUSEWHEEL)
+            ScreenToClient( msg->hwnd, &pt );
     msg->lParam = MAKELONG( pt.x, pt.y );

Do you Yahoo!? 
Yahoo! Mail - Find what you need with new enhanced search.

More information about the wine-patches mailing list