Avoid paint event recursion when the run loop is restarted inside the paint

event.  Usually for the purpose of showing an assertion dialog.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21794 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott
2003-07-09 14:24:47 +00:00
parent 18afa2acbe
commit 55c5be5e47
2 changed files with 14 additions and 1 deletions

View File

@@ -72,6 +72,7 @@ protected:
void SetNSView(WX_NSView cocoaNSView);
WX_NSView m_cocoaNSView;
WX_NSView m_dummyNSView;
bool m_isInPaint;
// ------------------------------------------------------------------------
// Implementation
// ------------------------------------------------------------------------

View File

@@ -33,6 +33,7 @@ void wxWindowCocoa::Init()
m_cocoaNSView = NULL;
m_dummyNSView = NULL;
m_isBeingDeleted = FALSE;
m_isInPaint = FALSE;
}
// Constructor
@@ -120,10 +121,21 @@ void wxWindowCocoa::SetNSView(WX_NSView cocoaNSView)
bool wxWindowCocoa::Cocoa_drawRect(const NSRect &rect)
{
wxLogDebug("Cocoa_drawRect");
// Recursion can happen if the event loop runs from within the paint
// handler. For instance, if an assertion dialog is shown.
// FIXME: This seems less than ideal.
if(m_isInPaint)
{
wxLogDebug("Paint event recursion!");
return false;
}
//FIXME: should probably turn that rect into the update region
m_isInPaint = TRUE;
wxPaintEvent event(m_windowId);
event.SetEventObject(this);
return GetEventHandler()->ProcessEvent(event);
bool ret = GetEventHandler()->ProcessEvent(event);
m_isInPaint = FALSE;
return ret;
}
void wxWindowCocoa::InitMouseEvent(wxMouseEvent& event, WX_NSEvent cocoaEvent)