From a8b2285edf2eb1ef1dd1cb19abf130a871821dbf Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 12 Jan 2007 01:28:14 +0000 Subject: [PATCH] only set cursor immediately in SetCursor() if the mouse is currently inside the window or we capture it (fixes the problem introduced in rev 1.675 while still correcting the original bug that change was done to fix) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44201 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/window.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 313a182e1c..4dff286ca2 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -803,7 +803,30 @@ bool wxWindowMSW::SetCursor(const wxCursor& cursor) // don't "overwrite" busy cursor if ( m_cursor.Ok() && !wxIsBusy() ) { - ::SetCursor(GetHcursorOf(m_cursor)); + // normally we should change the cursor only if it's over this window + // but we should do it always if we capture the mouse currently + bool set = HasCapture(); + if ( !set ) + { + HWND hWnd = GetHwnd(); + + POINT point; +#ifdef __WXWINCE__ + ::GetCursorPosWinCE(&point); +#else + ::GetCursorPos(&point); +#endif + + RECT rect = wxGetWindowRect(hWnd); + + set = ::PtInRect(&rect, point) != 0; + } + + if ( set ) + { + ::SetCursor(GetHcursorOf(m_cursor)); + } + //else: will be set later when the mouse enters this window } return true;