]> git.saurik.com Git - wxWidgets.git/commitdiff
only set cursor immediately in SetCursor() if the mouse is currently inside the windo...
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 12 Jan 2007 01:28:14 +0000 (01:28 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 12 Jan 2007 01:28:14 +0000 (01:28 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44201 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/window.cpp

index 313a182e1cdfec0a98965e723c78ae07c331a4de..4dff286ca23b6e3002ed859ba829b420399bcd02 100644 (file)
@@ -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;