From 35f5d0817a15e6e1ab6121a83da51fb8f5a9cb0c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 14 Feb 2015 15:05:29 +0000 Subject: [PATCH] Fix coordinates of wxSetCursorEvent in wxGTK. The event coordinates remained in the client coordinates of the window the initial event had been sent to, even when the event was propagated to its parent. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78489 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/window.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index f3ad26f9ee..ba38190cd7 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -1616,9 +1616,13 @@ gtk_window_button_release_callback( GtkWidget *WXUNUSED(widget), 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)) { win->GTKUpdateCursor(false, false, &event.GetCursor()); @@ -1628,8 +1632,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 (win->m_needCursorReset) win->GTKUpdateCursor(); }