No real changes, just refactor wxEventLoop/wxApp::ProcessIdle().
Old code called wxApp::ProcessIdle() from wxEventLoopManualRun::Run() which called wxEventLoop::ProcessIdle() which called wxApp methods from it. In the new version wxEventLoopManualRun::Run() calls wxEventLoopManualRun::ProcessIdle() which calls wxApp::ProcessIdle() which calls other wxApp methods which seems to make more sense and also allows overriding ProcessIdle() in either wxEventLoopManual or wxApp-derived classes. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61441 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
58dcd1ae52
commit
a758f601dd
@ -320,6 +320,8 @@ public:
|
||||
// wxEventLoop redirections
|
||||
// ------------------------
|
||||
|
||||
// all these functions are forwarded to the corresponding methods of the
|
||||
// currently active event loop -- and do nothing if there is none
|
||||
virtual bool Pending();
|
||||
virtual bool Dispatch();
|
||||
|
||||
@ -329,6 +331,13 @@ public:
|
||||
bool Yield(bool onlyIfNeeded = false);
|
||||
|
||||
virtual void WakeUpIdle();
|
||||
|
||||
// this method is called by the active event loop when there are no events
|
||||
// to process
|
||||
//
|
||||
// by default it generates the idle events and if you override it in your
|
||||
// derived class you should call the base class version to ensure that idle
|
||||
// events are still sent out
|
||||
virtual bool ProcessIdle();
|
||||
|
||||
|
||||
|
@ -99,12 +99,13 @@ public:
|
||||
// idle handling
|
||||
// -------------
|
||||
|
||||
// make sure that idle events are sent again
|
||||
// make sure that idle events are sent again
|
||||
virtual void WakeUpIdle();
|
||||
|
||||
// this virtual function is called when the application
|
||||
// becomes idle and normally just sends wxIdleEvent to all interested
|
||||
// parties
|
||||
// becomes idle and by default it forwards to wxApp::ProcessIdle() and
|
||||
// while it can be overridden in a custom event loop, you must call the
|
||||
// base class version to ensure that idle events are still generated
|
||||
//
|
||||
// it should return true if more idle events are needed, false if not
|
||||
virtual bool ProcessIdle();
|
||||
|
@ -333,9 +333,15 @@ void wxAppConsoleBase::WakeUpIdle()
|
||||
|
||||
bool wxAppConsoleBase::ProcessIdle()
|
||||
{
|
||||
wxEventLoopBase * const loop = wxEventLoopBase::GetActive();
|
||||
// process pending wx events before sending idle events
|
||||
ProcessPendingEvents();
|
||||
|
||||
return loop && loop->ProcessIdle();
|
||||
// synthesize an idle event and check if more of them are needed
|
||||
wxIdleEvent event;
|
||||
event.SetEventObject(this);
|
||||
ProcessEvent(event);
|
||||
|
||||
return event.MoreRequested();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -63,18 +63,7 @@ void wxEventLoopBase::WakeUpIdle()
|
||||
|
||||
bool wxEventLoopBase::ProcessIdle()
|
||||
{
|
||||
if (!wxTheApp)
|
||||
return false;
|
||||
|
||||
// process pending wx events before sending idle events
|
||||
wxTheApp->ProcessPendingEvents();
|
||||
|
||||
// synthetize an idle event and send it to wxApp
|
||||
wxIdleEvent event;
|
||||
event.SetEventObject(wxTheApp);
|
||||
wxTheApp->ProcessEvent(event);
|
||||
|
||||
return event.MoreRequested();
|
||||
return wxTheApp && wxTheApp->ProcessIdle();
|
||||
}
|
||||
|
||||
bool wxEventLoopBase::Yield(bool onlyIfNeeded)
|
||||
@ -135,7 +124,7 @@ int wxEventLoopManual::Run()
|
||||
|
||||
// generate and process idle events for as long as we don't
|
||||
// have anything else to do
|
||||
while ( !Pending() && (wxTheApp && wxTheApp->ProcessIdle()) )
|
||||
while ( !Pending() && ProcessIdle() )
|
||||
;
|
||||
|
||||
// if the "should exit" flag is set, the loop should terminate
|
||||
|
Loading…
Reference in New Issue
Block a user