Send idle events from inside wxYield() in all ports, including wxMSW.

This means it can be now done in wxEventLoopBase itself and calls to
ProcessIdle() in the port-specific code are not needed any more, so remove
them.

This introduces a change in behaviour for wxMSW, where idle event handlers
were not invoked from inside wxYield() at all previously, and for wxOSX, where
only a single idle event is now generated from wxYield() instead of a stream
of them until no idle handler needs any more of them as before. But on the
bright side, the new behaviour seems to make most sense and is now the same in
all ports.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78222 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2014-12-05 22:17:23 +00:00
parent 340d7f67b6
commit 90639b8339
7 changed files with 18 additions and 37 deletions

View File

@ -17,6 +17,10 @@ Changes in behaviour not resulting in compilation errors
wxINTERPOLATION_DEFAULT and not wxINTERPOLATION_GOOD as in 3.0 for
consistency with OS X, call SetInterpolationQuality() explicitly if needed.
- Calling wxYield() in wxMSW now generates wxEVT_IDLE events, just as in the
other ports, but this can be unexpected for the applications not expecting
their idle handlers to be called from inside wxYield().
Changes in behaviour which may result in build errors
-----------------------------------------------------

View File

@ -153,14 +153,24 @@ bool wxEventLoopBase::YieldFor(long eventsToProcess)
void wxEventLoopBase::DoYieldFor(long eventsToProcess)
{
// Normally yielding dispatches not only the pending native events, but
// also the events pending in wxWidgets itself.
// also the events pending in wxWidgets itself and idle events.
//
// Notice however that we must not do it if we're asked to process only the
// events of specific kind, as pending events could be of any kind at all
// (ideal would be to have a filtering version of ProcessPendingEvents()
// too but we don't have this right now).
if ( eventsToProcess == wxEVT_CATEGORY_ALL && wxTheApp )
wxTheApp->ProcessPendingEvents();
// too but we don't have this right now) and idle events are typically
// unexpected when yielding for the specific event kinds only.
if ( eventsToProcess == wxEVT_CATEGORY_ALL )
{
if ( wxTheApp )
wxTheApp->ProcessPendingEvents();
// We call it just once, even if it returns true, because we don't want
// to get stuck inside wxYield() forever if the application does some
// constant background processing in its idle handler, we do need to
// get back to the main loop soon.
ProcessIdle();
}
}
#if wxUSE_EVENTLOOP_SOURCE

View File

@ -213,10 +213,5 @@ void wxGUIEventLoop::DoYieldFor(long eventsToProcess)
// handle timers, sockets etc.
OnNextIteration();
// it's necessary to call ProcessIdle() to update the frames sizes which
// might have been changed (it also will update other things set from
// OnUpdateUI() which is a nice (and desired) side effect)
while ( ProcessIdle() ) {}
wxEventLoopBase::DoYieldFor(eventsToProcess);
}

View File

@ -385,20 +385,6 @@ void wxGUIEventLoop::DoYieldFor(long eventsToProcess)
wxEventLoopBase::DoYieldFor(eventsToProcess);
if (eventsToProcess != wxEVT_CATEGORY_CLIPBOARD)
{
// It's necessary to call ProcessIdle() to update the frames sizes which
// might have been changed (it also will update other things set from
// OnUpdateUI() which is a nice (and desired) side effect). But we
// call ProcessIdle() only once since this is not meant for longish
// background jobs (controlled by wxIdleEvent::RequestMore() and the
// return value of Processidle().
ProcessIdle();
}
//else: if we are inside ~wxClipboardSync() and we call ProcessIdle() and
// the user app contains an UI update handler which calls wxClipboard::IsSupported,
// then we fall into a never-ending loop...
// put all unprocessed GDK events back in the queue
GdkDisplay* disp = gdk_window_get_display(wxGetTopLevelGDK());
for (size_t i=0; i<m_arrGdkEvents.GetCount(); i++)

View File

@ -160,14 +160,6 @@ void wxGUIEventLoop::DoYieldFor(long eventsToProcess)
while (gtk_events_pending())
gtk_main_iteration();
// It's necessary to call ProcessIdle() to update the frames sizes which
// might have been changed (it also will update other things set from
// OnUpdateUI() which is a nice (and desired) side effect). But we
// call ProcessIdle() only once since this is not meant for longish
// background jobs (controlled by wxIdleEvent::RequestMore() and the
// return value of Processidle().
ProcessIdle();
wxEventLoopBase::DoYieldFor(eventsToProcess);
}

View File

@ -190,11 +190,6 @@ void wxCFEventLoop::DoYieldFor(long eventsToProcess)
while ( DoProcessEvents() == 1 )
;
// it's necessary to call ProcessIdle() to update the frames sizes which
// might have been changed (it also will update other things set from
// OnUpdateUI() which is a nice (and desired) side effect)
while ( ProcessIdle() ) {}
wxEventLoopBase::DoYieldFor(eventsToProcess);
}

View File

@ -261,7 +261,6 @@ void wxGUIEventLoop::DoYieldFor(long eventsToProcess)
#if wxUSE_TIMER
wxGenericTimerImpl::NotifyTimers();
#endif
ProcessIdle();
wxEventLoopBase::DoYieldFor(eventsToProcess);
}