X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/16d17da6ca6d8c9eb1f5b2659a2c5b6dd42b26db..bc0f253462cfaf5ca6617ba9fad9987014a66e4e:/src/motif/evtloop.cpp diff --git a/src/motif/evtloop.cpp b/src/motif/evtloop.cpp index 84999bb11e..7fd2475e66 100644 --- a/src/motif/evtloop.cpp +++ b/src/motif/evtloop.cpp @@ -17,11 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __VMS -#define XtParent XTPARENT -#define XtDisplay XTDISPLAY -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -33,6 +28,7 @@ #endif //WX_PRECOMP #include "wx/evtloop.h" +#include "wx/thread.h" #ifdef __VMS__ #pragma message disable nosimpint @@ -101,15 +97,15 @@ bool wxEventLoopImpl::SendIdleMessage() // wxEventLoop running and exiting // ---------------------------------------------------------------------------- -wxEventLoop::~wxEventLoop() +wxGUIEventLoop::~wxGUIEventLoop() { - wxASSERT_MSG( !m_impl, _T("should have been deleted in Run()") ); + wxASSERT_MSG( !m_impl, wxT("should have been deleted in Run()") ); } -int wxEventLoop::Run() +int wxGUIEventLoop::Run() { // event loops are not recursive, you need to create another loop! - wxCHECK_MSG( !IsRunning(), -1, _T("can't reenter a message loop") ); + wxCHECK_MSG( !IsRunning(), -1, wxT("can't reenter a message loop") ); wxEventLoopActivator activate(this); @@ -131,9 +127,9 @@ int wxEventLoop::Run() return exitcode; } -void wxEventLoop::Exit(int rc) +void wxGUIEventLoop::Exit(int rc) { - wxCHECK_RET( IsRunning(), _T("can't call Exit() if not running") ); + wxCHECK_RET( IsRunning(), wxT("can't call Exit() if not running") ); m_impl->SetExitCode(rc); m_impl->SetKeepGoing( false ); @@ -141,16 +137,30 @@ void wxEventLoop::Exit(int rc) ::wxBreakDispatch(); } +bool wxGUIEventLoop::YieldFor(long eventsToProcess) +{ + m_isInsideYield = true; + m_eventsToProcessInsideYield = eventsToProcess; + + while (wxTheApp && wxTheApp->Pending()) + // TODO: implement event filtering using the eventsToProcess mask + wxTheApp->Dispatch(); + + m_isInsideYield = false; + + return true; +} + // ---------------------------------------------------------------------------- // wxEventLoop message processing dispatching // ---------------------------------------------------------------------------- -bool wxEventLoop::Pending() const +bool wxGUIEventLoop::Pending() const { return XtAppPending( (XtAppContext)wxTheApp->GetAppContext() ) != 0; } -bool wxEventLoop::Dispatch() +bool wxGUIEventLoop::Dispatch() { XEvent event; XtAppContext context = (XtAppContext)wxTheApp->GetAppContext(); @@ -302,7 +312,7 @@ bool CheckForKeyDown(XEvent* event) wxKeyEvent keyEvent(wxEVT_KEY_DOWN); wxTranslateKeyEvent(keyEvent, win, (Widget) 0, event); - return win->GetEventHandler()->ProcessEvent( keyEvent ); + return win->HandleWindowEvent( keyEvent ); } return false; @@ -328,7 +338,7 @@ bool CheckForKeyUp(XEvent* event) wxKeyEvent keyEvent(wxEVT_KEY_UP); wxTranslateKeyEvent(keyEvent, win, (Widget) 0, event); - return win->GetEventHandler()->ProcessEvent( keyEvent ); + return win->HandleWindowEvent( keyEvent ); } return false; @@ -338,7 +348,7 @@ bool CheckForKeyUp(XEvent* event) // executes one main loop iteration (declared in include/wx/motif/private.h) // ---------------------------------------------------------------------------- -bool wxDoEventLoopIteration( wxEventLoop& evtLoop ) +bool wxDoEventLoopIteration( wxGUIEventLoop& evtLoop ) { bool moreRequested, pendingEvents;