]> git.saurik.com Git - wxWidgets.git/commitdiff
Make SetCursor work.
authorDavid Elliott <dfe@tgwbd.org>
Sun, 19 Aug 2007 04:01:13 +0000 (04:01 +0000)
committerDavid Elliott <dfe@tgwbd.org>
Sun, 19 Aug 2007 04:01:13 +0000 (04:01 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48171 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/cocoa/window.mm

index 5b881d3c0fcf274beed71d08161e5d47e4f52b22..390d250a93082e662228ac3a166b1bc688b9f1f4 100644 (file)
@@ -839,7 +839,15 @@ bool wxWindowCocoa::SetCursor(const wxCursor &cursor)
 {
     if(!wxWindowBase::SetCursor(cursor))
         return false;
+
+    // Set up the cursor rect so that invalidateCursorRectsForView: will destroy it.
+    // If we don't do this then Cocoa thinks (rightly) that we don't have any cursor
+    // rects and thus won't ever call resetCursorRects.
+    [GetNSView() addCursorRect: [GetNSView() visibleRect]  cursor: m_cursor.GetNSCursor()];
+
     // Invalidate the cursor rects so the cursor will change
+    // Note that it is not enough to remove the old one (if any) and add the new one.
+    // For the rects to work properly, Cocoa itself must call resetCursorRects.
     [[GetNSView() window] invalidateCursorRectsForView:GetNSView()];
     return true;
 }