diff --git a/docs/changes.txt b/docs/changes.txt index be8d0cd8a9..dca685aacb 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -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 ----------------------------------------------------- diff --git a/src/common/evtloopcmn.cpp b/src/common/evtloopcmn.cpp index 626cb51b4d..e8123f3caa 100644 --- a/src/common/evtloopcmn.cpp +++ b/src/common/evtloopcmn.cpp @@ -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 diff --git a/src/dfb/evtloop.cpp b/src/dfb/evtloop.cpp index ac18c5b438..b8b004fcaf 100644 --- a/src/dfb/evtloop.cpp +++ b/src/dfb/evtloop.cpp @@ -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); } diff --git a/src/gtk/evtloop.cpp b/src/gtk/evtloop.cpp index 72fd51baa4..9e7a2f44d2 100644 --- a/src/gtk/evtloop.cpp +++ b/src/gtk/evtloop.cpp @@ -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