Improvements to OnIdle processing
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21934 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -381,13 +381,15 @@ public:
|
|||||||
// it should return TRUE if more idle events are needed, FALSE if not
|
// it should return TRUE if more idle events are needed, FALSE if not
|
||||||
virtual bool ProcessIdle() ;
|
virtual bool ProcessIdle() ;
|
||||||
|
|
||||||
|
#if 0
|
||||||
// Send idle event to all top-level windows.
|
// Send idle event to all top-level windows.
|
||||||
// Returns TRUE if more idle time is requested.
|
// Returns TRUE if more idle time is requested.
|
||||||
virtual bool SendIdleEvents();
|
virtual bool SendIdleEvents();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Send idle event to window and all subwindows
|
// Send idle event to window and all subwindows
|
||||||
// Returns TRUE if more idle time is requested.
|
// Returns TRUE if more idle time is requested.
|
||||||
virtual bool SendIdleEvents(wxWindow* win);
|
virtual bool SendIdleEvents(wxWindow* win, wxIdleEvent& event);
|
||||||
|
|
||||||
|
|
||||||
// top level window functions
|
// top level window functions
|
||||||
|
@@ -877,7 +877,7 @@ public:
|
|||||||
virtual void OnInternalIdle() {}
|
virtual void OnInternalIdle() {}
|
||||||
|
|
||||||
// call internal idle recursively
|
// call internal idle recursively
|
||||||
void ProcessInternalIdle() ;
|
// void ProcessInternalIdle() ;
|
||||||
|
|
||||||
// get the handle of the window for the underlying window system: this
|
// get the handle of the window for the underlying window system: this
|
||||||
// is only used for wxWin itself or for user code which wants to call
|
// is only used for wxWin itself or for user code which wants to call
|
||||||
|
@@ -210,24 +210,29 @@ void wxAppBase::DeletePendingObjects()
|
|||||||
// Returns TRUE if more time is needed.
|
// Returns TRUE if more time is needed.
|
||||||
bool wxAppBase::ProcessIdle()
|
bool wxAppBase::ProcessIdle()
|
||||||
{
|
{
|
||||||
|
wxIdleEvent event;
|
||||||
|
bool needMore = FALSE;
|
||||||
wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
|
wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
|
||||||
node = wxTopLevelWindows.GetFirst();
|
node = wxTopLevelWindows.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxWindow* win = node->GetData();
|
wxWindow* win = node->GetData();
|
||||||
win->ProcessInternalIdle();
|
if (SendIdleEvents(win, event))
|
||||||
|
needMore = TRUE;
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxIdleEvent event;
|
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
bool processed = ProcessEvent(event);
|
(void) ProcessEvent(event);
|
||||||
|
if (event.MoreRequested())
|
||||||
|
needMore = TRUE;
|
||||||
|
|
||||||
wxUpdateUIEvent::ResetUpdateTime();
|
wxUpdateUIEvent::ResetUpdateTime();
|
||||||
|
|
||||||
return processed && event.MoreRequested();
|
return needMore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
// Send idle event to all top-level windows
|
// Send idle event to all top-level windows
|
||||||
bool wxAppBase::SendIdleEvents()
|
bool wxAppBase::SendIdleEvents()
|
||||||
{
|
{
|
||||||
@@ -244,26 +249,28 @@ bool wxAppBase::SendIdleEvents()
|
|||||||
|
|
||||||
return needMore;
|
return needMore;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Send idle event to window and all subwindows
|
// Send idle event to window and all subwindows
|
||||||
bool wxAppBase::SendIdleEvents(wxWindow* win)
|
bool wxAppBase::SendIdleEvents(wxWindow* win, wxIdleEvent& event)
|
||||||
{
|
{
|
||||||
bool needMore = FALSE;
|
bool needMore = FALSE;
|
||||||
|
|
||||||
|
win->OnInternalIdle();
|
||||||
if (wxIdleEvent::CanSend(win))
|
if (wxIdleEvent::CanSend(win))
|
||||||
{
|
{
|
||||||
wxIdleEvent event;
|
|
||||||
event.SetEventObject(win);
|
event.SetEventObject(win);
|
||||||
win->GetEventHandler()->ProcessEvent(event);
|
win->GetEventHandler()->ProcessEvent(event);
|
||||||
|
|
||||||
needMore = event.MoreRequested();
|
if (event.MoreRequested())
|
||||||
|
needMore = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
|
wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
|
||||||
while ( node )
|
while ( node )
|
||||||
{
|
{
|
||||||
wxWindow *win = node->GetData();
|
wxWindow *win = node->GetData();
|
||||||
if (SendIdleEvents(win))
|
if (SendIdleEvents(win, event))
|
||||||
needMore = TRUE;
|
needMore = TRUE;
|
||||||
|
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
|
@@ -1830,7 +1830,9 @@ void wxWindowBase::DoUpdateWindowUI(wxUpdateUIEvent& event)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
// call internal idle recursively
|
// call internal idle recursively
|
||||||
|
// may be obsolete (wait until OnIdle scheme stabilises)
|
||||||
void wxWindowBase::ProcessInternalIdle()
|
void wxWindowBase::ProcessInternalIdle()
|
||||||
{
|
{
|
||||||
OnInternalIdle();
|
OnInternalIdle();
|
||||||
@@ -1843,6 +1845,7 @@ void wxWindowBase::ProcessInternalIdle()
|
|||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// dialog units translations
|
// dialog units translations
|
||||||
|
@@ -551,11 +551,14 @@ void wxApp::OnIdle( wxIdleEvent &event )
|
|||||||
// 'Garbage' collection of windows deleted with Close()
|
// 'Garbage' collection of windows deleted with Close()
|
||||||
DeletePendingObjects();
|
DeletePendingObjects();
|
||||||
|
|
||||||
|
// Now done in ProcessIdle()
|
||||||
|
#if 0
|
||||||
// Send OnIdle events to all windows
|
// Send OnIdle events to all windows
|
||||||
bool needMore = SendIdleEvents();
|
bool needMore = SendIdleEvents();
|
||||||
|
|
||||||
if (needMore)
|
if (needMore)
|
||||||
event.RequestMore(TRUE);
|
event.RequestMore(TRUE);
|
||||||
|
#endif
|
||||||
|
|
||||||
s_inOnIdle = FALSE;
|
s_inOnIdle = FALSE;
|
||||||
}
|
}
|
||||||
|
@@ -551,11 +551,14 @@ void wxApp::OnIdle( wxIdleEvent &event )
|
|||||||
// 'Garbage' collection of windows deleted with Close()
|
// 'Garbage' collection of windows deleted with Close()
|
||||||
DeletePendingObjects();
|
DeletePendingObjects();
|
||||||
|
|
||||||
|
// Now done in ProcessIdle()
|
||||||
|
#if 0
|
||||||
// Send OnIdle events to all windows
|
// Send OnIdle events to all windows
|
||||||
bool needMore = SendIdleEvents();
|
bool needMore = SendIdleEvents();
|
||||||
|
|
||||||
if (needMore)
|
if (needMore)
|
||||||
event.RequestMore(TRUE);
|
event.RequestMore(TRUE);
|
||||||
|
#endif
|
||||||
|
|
||||||
s_inOnIdle = FALSE;
|
s_inOnIdle = FALSE;
|
||||||
}
|
}
|
||||||
|
@@ -1029,7 +1029,6 @@ void wxApp::OnIdle(wxIdleEvent& event)
|
|||||||
if ( s_inOnIdle )
|
if ( s_inOnIdle )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
s_inOnIdle = TRUE;
|
s_inOnIdle = TRUE;
|
||||||
|
|
||||||
// 'Garbage' collection of windows deleted with Close().
|
// 'Garbage' collection of windows deleted with Close().
|
||||||
@@ -1040,11 +1039,14 @@ void wxApp::OnIdle(wxIdleEvent& event)
|
|||||||
if ( pLog != NULL && pLog->HasPendingMessages() )
|
if ( pLog != NULL && pLog->HasPendingMessages() )
|
||||||
pLog->Flush();
|
pLog->Flush();
|
||||||
|
|
||||||
|
// Now done in ProcessIdle()
|
||||||
|
#if 0
|
||||||
// Send OnIdle events to all windows
|
// Send OnIdle events to all windows
|
||||||
bool needMore = SendIdleEvents();
|
bool needMore = SendIdleEvents();
|
||||||
|
|
||||||
if (needMore)
|
if (needMore)
|
||||||
event.RequestMore(TRUE);
|
event.RequestMore(TRUE);
|
||||||
|
#endif
|
||||||
|
|
||||||
// If they are pending events, we must process them: pending events are
|
// If they are pending events, we must process them: pending events are
|
||||||
// either events to the threads other than main or events posted with
|
// either events to the threads other than main or events posted with
|
||||||
|
@@ -1029,7 +1029,6 @@ void wxApp::OnIdle(wxIdleEvent& event)
|
|||||||
if ( s_inOnIdle )
|
if ( s_inOnIdle )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
s_inOnIdle = TRUE;
|
s_inOnIdle = TRUE;
|
||||||
|
|
||||||
// 'Garbage' collection of windows deleted with Close().
|
// 'Garbage' collection of windows deleted with Close().
|
||||||
@@ -1040,11 +1039,14 @@ void wxApp::OnIdle(wxIdleEvent& event)
|
|||||||
if ( pLog != NULL && pLog->HasPendingMessages() )
|
if ( pLog != NULL && pLog->HasPendingMessages() )
|
||||||
pLog->Flush();
|
pLog->Flush();
|
||||||
|
|
||||||
|
// Now done in ProcessIdle()
|
||||||
|
#if 0
|
||||||
// Send OnIdle events to all windows
|
// Send OnIdle events to all windows
|
||||||
bool needMore = SendIdleEvents();
|
bool needMore = SendIdleEvents();
|
||||||
|
|
||||||
if (needMore)
|
if (needMore)
|
||||||
event.RequestMore(TRUE);
|
event.RequestMore(TRUE);
|
||||||
|
#endif
|
||||||
|
|
||||||
// If they are pending events, we must process them: pending events are
|
// If they are pending events, we must process them: pending events are
|
||||||
// either events to the threads other than main or events posted with
|
// either events to the threads other than main or events posted with
|
||||||
|
@@ -294,9 +294,12 @@ void wxApp::OnIdle(wxIdleEvent &event)
|
|||||||
wxLog::FlushActive();
|
wxLog::FlushActive();
|
||||||
#endif // wxUSE_LOG
|
#endif // wxUSE_LOG
|
||||||
|
|
||||||
|
// Now done in ProcessIdle()
|
||||||
|
#if 0
|
||||||
// Send OnIdle events to all windows
|
// Send OnIdle events to all windows
|
||||||
if ( SendIdleEvents() )
|
if ( SendIdleEvents() )
|
||||||
event.RequestMore(TRUE);
|
event.RequestMore(TRUE);
|
||||||
|
#endif
|
||||||
|
|
||||||
s_inOnIdle = FALSE;
|
s_inOnIdle = FALSE;
|
||||||
}
|
}
|
||||||
|
@@ -233,11 +233,14 @@ void wxApp::OnIdle(wxIdleEvent& event)
|
|||||||
if ( pLog != NULL && pLog->HasPendingMessages() )
|
if ( pLog != NULL && pLog->HasPendingMessages() )
|
||||||
pLog->Flush();
|
pLog->Flush();
|
||||||
|
|
||||||
|
// Now done in ProcessIdle()
|
||||||
|
#if 0
|
||||||
// Send OnIdle events to all windows
|
// Send OnIdle events to all windows
|
||||||
bool needMore = SendIdleEvents();
|
bool needMore = SendIdleEvents();
|
||||||
|
|
||||||
if (needMore)
|
if (needMore)
|
||||||
event.RequestMore(TRUE);
|
event.RequestMore(TRUE);
|
||||||
|
#endif
|
||||||
|
|
||||||
inOnIdle = FALSE;
|
inOnIdle = FALSE;
|
||||||
}
|
}
|
||||||
|
@@ -828,6 +828,8 @@ void wxApp::OnIdle(wxIdleEvent& event)
|
|||||||
wxDC::ClearCache();
|
wxDC::ClearCache();
|
||||||
#endif // wxUSE_DC_CACHEING
|
#endif // wxUSE_DC_CACHEING
|
||||||
|
|
||||||
|
// Now done in ProcessIdle()
|
||||||
|
#if 0
|
||||||
// Send OnIdle events to all windows
|
// Send OnIdle events to all windows
|
||||||
if ( SendIdleEvents() )
|
if ( SendIdleEvents() )
|
||||||
{
|
{
|
||||||
@@ -835,6 +837,7 @@ void wxApp::OnIdle(wxIdleEvent& event)
|
|||||||
// idle events
|
// idle events
|
||||||
event.RequestMore(TRUE);
|
event.RequestMore(TRUE);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
wxIsInOnIdleFlag = FALSE;
|
wxIsInOnIdleFlag = FALSE;
|
||||||
}
|
}
|
||||||
|
@@ -807,6 +807,8 @@ void wxApp::OnIdle(
|
|||||||
wxDC::ClearCache();
|
wxDC::ClearCache();
|
||||||
#endif // wxUSE_DC_CACHEING
|
#endif // wxUSE_DC_CACHEING
|
||||||
|
|
||||||
|
// Now done in ProcessIdle()
|
||||||
|
#if 0
|
||||||
//
|
//
|
||||||
// Send OnIdle events to all windows
|
// Send OnIdle events to all windows
|
||||||
//
|
//
|
||||||
@@ -818,6 +820,8 @@ void wxApp::OnIdle(
|
|||||||
//
|
//
|
||||||
rEvent.RequestMore(TRUE);
|
rEvent.RequestMore(TRUE);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
gbInOnIdle = FALSE;
|
gbInOnIdle = FALSE;
|
||||||
} // end of wxApp::OnIdle
|
} // end of wxApp::OnIdle
|
||||||
|
|
||||||
|
@@ -717,11 +717,14 @@ void wxApp::OnIdle(wxIdleEvent& event)
|
|||||||
// 'Garbage' collection of windows deleted with Close()
|
// 'Garbage' collection of windows deleted with Close()
|
||||||
DeletePendingObjects();
|
DeletePendingObjects();
|
||||||
|
|
||||||
|
// Now done in ProcessIdle()
|
||||||
|
#if 0
|
||||||
// Send OnIdle events to all windows
|
// Send OnIdle events to all windows
|
||||||
bool needMore = SendIdleEvents();
|
bool needMore = SendIdleEvents();
|
||||||
|
|
||||||
if (needMore)
|
if (needMore)
|
||||||
event.RequestMore(TRUE);
|
event.RequestMore(TRUE);
|
||||||
|
#endif
|
||||||
|
|
||||||
s_inOnIdle = FALSE;
|
s_inOnIdle = FALSE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user