From: Václav Slavík Date: Mon, 18 Dec 2006 17:24:06 +0000 (+0000) Subject: wxDFB: fix events processing to support sockets events X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/757b694ba86ee675b6028aed470611a6ef302491 wxDFB: fix events processing to support sockets events git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43999 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/dfb/evtloop.h b/include/wx/dfb/evtloop.h index cf77e26c13..9845acd265 100644 --- a/include/wx/dfb/evtloop.h +++ b/include/wx/dfb/evtloop.h @@ -31,6 +31,10 @@ public: // returns DirectFB event buffer used by wx static wxIDirectFBEventBufferPtr GetDirectFBEventBuffer(); + // wxYield implementation: iterate the loop as long as there are any + // pending events + void Yield(); + protected: virtual void WakeUp(); virtual void OnNextIteration(); diff --git a/src/dfb/app.cpp b/src/dfb/app.cpp index 5f7a8004eb..e84aa6ae98 100644 --- a/src/dfb/app.cpp +++ b/src/dfb/app.cpp @@ -138,10 +138,7 @@ bool wxApp::Yield(bool onlyIfNeeded) wxLog::Suspend(); if ( wxEventLoop::GetActive() ) - { - while (wxEventLoop::GetActive()->Pending()) - wxEventLoop::GetActive()->Dispatch(); - } + wxEventLoop::GetActive()->Yield(); // it's necessary to call ProcessIdle() to update the frames sizes which // might have been changed (it also will update other things set from diff --git a/src/dfb/evtloop.cpp b/src/dfb/evtloop.cpp index 30ed0b7259..2ecc94a9b4 100644 --- a/src/dfb/evtloop.cpp +++ b/src/dfb/evtloop.cpp @@ -86,9 +86,6 @@ bool wxEventLoop::Dispatch() // NB: we don't block indefinitely waiting for an event, but instead // time out after a brief period in order to make sure that // OnNextIteration() will be called frequently enough - // - // FIXME: call NotifyTimers() and wxSocketEventDispatcher::RunLoop() from here - // (and loop) instead? const int TIMEOUT = 100; if ( ms_buffer->WaitForEventWithTimeout(0, TIMEOUT) ) @@ -127,8 +124,6 @@ void wxEventLoop::WakeUp() void wxEventLoop::OnNextIteration() { - // see the comment in Dispatch - #if wxUSE_TIMER wxTimer::NotifyTimers(); #endif @@ -139,6 +134,16 @@ void wxEventLoop::OnNextIteration() #endif } +void wxEventLoop::Yield() +{ + // process all pending events: + while ( Pending() ) + Dispatch(); + + // handle timers, sockets etc. + OnNextIteration(); +} + //----------------------------------------------------------------------------- // DirectFB -> wxWidgets events translation