diff --git a/docs/changes.txt b/docs/changes.txt index fad051e735..eb8774adcb 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -589,6 +589,7 @@ wxGTK: - Fix infinite sizing loop with GTK3 when using wxScrolled with a non-default target window. - Fix crashes in wxGTK3 when running with non-X11 backend (Marco Trevisan). +- Fix coordinates of wxSetCursorEvent propagated to parent windows. wxMSW: diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 388da76cee..6cc60836e8 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -1552,9 +1552,13 @@ static const wxCursor* gs_overrideCursor; static void SendSetCursorEvent(wxWindowGTK* win, int x, int y) { - wxSetCursorEvent event(x, y); + wxPoint posClient(x, y); + const wxPoint posScreen = win->ClientToScreen(posClient); + wxWindowGTK* w = win; - do { + for ( ;; ) + { + wxSetCursorEvent event(posClient.x, posClient.y); if (w->GTKProcessEvent(event)) { gs_overrideCursor = &event.GetCursor(); @@ -1566,8 +1570,12 @@ static void SendSetCursorEvent(wxWindowGTK* win, int x, int y) // this is how wxMSW works... if (w->GetCursor().IsOk()) break; + w = w->GetParent(); - } while (w); + if ( !w ) + break; + posClient = w->ScreenToClient(posScreen); + } if (gs_needCursorResetMap[win]) win->GTKUpdateCursor(); }