Fix mouse wheel event coordinates in wxFrame in wxMSW.

The screen to client conversion for this event coordinates took the toolbar
height into account twice, resulting in a wrong value if the event was handled
in a frame that did have a toolbar.

Closes #15812.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75563 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2014-01-05 21:11:12 +00:00
parent 93df189c11
commit c2a117f4d1

View File

@ -5606,9 +5606,15 @@ wxWindowMSW::HandleMouseWheel(wxMouseWheelAxis axis,
// notice that WM_MOUSEWHEEL position is in screen coords (as it's
// forwarded up to the parent by DefWindowProc()) and not in the client
// ones as all the other messages, translate them to the client coords for
// consistency
const wxPoint
pt = ScreenToClient(wxPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)));
// consistency -- but do it using Windows function and not our own one
// because InitMouseEvent() expects coordinates in Windows client
// coordinates and not wx ones (the difference being the height of the
// toolbar, if any).
POINT pt;
pt.x = GET_X_LPARAM(lParam);
pt.y = GET_Y_LPARAM(lParam);
::ScreenToClient(GetHwnd(), &pt);
wxMouseEvent event(wxEVT_MOUSEWHEEL);
InitMouseEvent(event, pt.x, pt.y, LOWORD(wParam));
event.m_wheelRotation = (short)HIWORD(wParam);