From: David Elliott Date: Wed, 14 Apr 2004 05:56:52 +0000 (+0000) Subject: Cocoa_drawRect: Set m_updateRegion using the NSRect or if possible (Panther) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/dc5bcaefb5c58031751f4299329e685918d5105c?ds=sidebyside Cocoa_drawRect: Set m_updateRegion using the NSRect or if possible (Panther) using the array from [NSView -getRectsBeingDrawn:count:] git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26764 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/cocoa/window.mm b/src/cocoa/window.mm index b74cc3ca5e..7778c84c39 100644 --- a/src/cocoa/window.mm +++ b/src/cocoa/window.mm @@ -22,6 +22,9 @@ #import #import #import +#import + +#include // Turn this on to paint green over the dummy views for debugging #undef WXCOCOA_FILL_DUMMY_VIEW @@ -346,8 +349,21 @@ bool wxWindowCocoa::Cocoa_drawRect(const NSRect &rect) wxLogDebug(wxT("Paint event recursion!")); return false; } - //FIXME: should probably turn that rect into the update region m_isInPaint = TRUE; + + // Set m_updateRegion + const NSRect *rects = ▭ // The bounding box of the region + int countRects = 1; + // Try replacing the larger rectangle with a list of smaller ones: +NS_DURING + // This only works on Panther +// [GetNSView() getRectsBeingDrawn:&rects count:&countRects]; + // This compiles everywhere (and still only works on Panther) + objc_msgSend(GetNSView(),@selector(getRectsBeingDrawn:count:),&rects,&countRects); +NS_HANDLER +NS_ENDHANDLER + m_updateRegion = wxRegion(rects,countRects); + wxPaintEvent event(m_windowId); event.SetEventObject(this); bool ret = GetEventHandler()->ProcessEvent(event);