From 68b65c7333ac55b5e462dead7ae12bfd6d4a201c Mon Sep 17 00:00:00 2001 From: AliKet Date: Fri, 8 Apr 2022 00:14:28 +0200 Subject: [PATCH] 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. --- src/generic/scrlwing.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp index aff2ee6a52..93456bcd1a 100644 --- a/src/generic/scrlwing.cpp +++ b/src/generic/scrlwing.cpp @@ -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);