Fix synthetic mouse events produced by wxAutoScrollTimer

Simplify the code translating from screen to client coordinates and make
it correct by using ScreenToClient() directly instead of emulating it
manually, which doesn't work quite right, at least in wxGTK.

Closes #22289.
This commit is contained in:
AliKet
2022-04-08 00:14:28 +02:00
committed by Vadim Zeitlin
parent e92f8cbce8
commit 68b65c7333

View File

@@ -147,12 +147,7 @@ void wxAutoScrollTimer::Notify()
// the mouse event coordinates should be client, not screen as
// returned by wxGetMousePosition
wxWindow *parentTop = m_win;
while ( parentTop->GetParent() )
parentTop = parentTop->GetParent();
wxPoint ptOrig = parentTop->GetPosition();
event2.m_x -= ptOrig.x;
event2.m_y -= ptOrig.y;
m_win->ScreenToClient(&event2.m_x, &event2.m_y);
event2.SetEventObject(m_win);