Fix position for wxKeyEvents in wxMSW.

Use ScreenToClient() instead of painstakingly (and incorrectly) transforming
the position in this function itself.

Closes #12024.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64286 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-05-11 10:39:42 +00:00
parent 5d029a1d7c
commit 1acbfd013d

View File

@@ -5619,20 +5619,10 @@ wxKeyEvent wxWindowMSW::CreateKeyEvent(wxEventType evType,
event.SetTimestamp(::GetMessageTime()); event.SetTimestamp(::GetMessageTime());
#endif #endif
// translate the position to client coords // translate the position to client coordinates
POINT pt; const wxPoint mousePos = ScreenToClient(wxGetMousePosition());
#ifdef __WXWINCE__ event.m_x = mousePos.x;
GetCursorPosWinCE(&pt); event.m_y = mousePos.y;
#else
GetCursorPos(&pt);
#endif
RECT rect;
GetWindowRect(GetHwnd(),&rect);
pt.x -= rect.left;
pt.y -= rect.top;
event.m_x = pt.x;
event.m_y = pt.y;
return event; return event;
} }