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
This commit is contained in:
Vadim Zeitlin
2015-02-14 15:05:29 +00:00
parent 9aa6171f55
commit 35f5d0817a

View File

@@ -1616,9 +1616,13 @@ gtk_window_button_release_callback( GtkWidget *WXUNUSED(widget),
static void SendSetCursorEvent(wxWindowGTK* win, int x, int y) 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; wxWindowGTK* w = win;
do { for ( ;; )
{
wxSetCursorEvent event(posClient.x, posClient.y);
if (w->GTKProcessEvent(event)) if (w->GTKProcessEvent(event))
{ {
win->GTKUpdateCursor(false, false, &event.GetCursor()); win->GTKUpdateCursor(false, false, &event.GetCursor());
@@ -1628,8 +1632,12 @@ static void SendSetCursorEvent(wxWindowGTK* win, int x, int y)
// this is how wxMSW works... // this is how wxMSW works...
if (w->GetCursor().IsOk()) if (w->GetCursor().IsOk())
break; break;
w = w->GetParent(); w = w->GetParent();
} while (w); if ( !w )
break;
posClient = w->ScreenToClient(posScreen);
}
if (win->m_needCursorReset) if (win->m_needCursorReset)
win->GTKUpdateCursor(); win->GTKUpdateCursor();
} }