X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b46b1d59d6f69ad80dcf5955375578a6504d100a..68f64b40bfdffd1fc4967dc422a7d89b42545d82:/src/motif/evtloop.cpp diff --git a/src/motif/evtloop.cpp b/src/motif/evtloop.cpp index a3e4b54dea..f5041784f4 100644 --- a/src/motif/evtloop.cpp +++ b/src/motif/evtloop.cpp @@ -6,7 +6,7 @@ // Created: 01.11.02 // RCS-ID: $Id$ // Copyright: (c) 2002 Mattia Barbon -// License: wxWindows licence +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -20,11 +20,6 @@ // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" -#ifdef __VMS -#define XtParent XTPARENT -#define XtDisplay XTDISPLAY -#endif - #ifndef WX_PRECOMP #include "wx/event.h" #include "wx/app.h" @@ -33,6 +28,7 @@ #endif //WX_PRECOMP #include "wx/evtloop.h" +#include "wx/thread.h" #ifdef __VMS__ #pragma message disable nosimpint @@ -103,13 +99,13 @@ bool wxEventLoopImpl::SendIdleMessage() 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 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); @@ -125,15 +121,14 @@ int wxGUIEventLoop::Run() OnExit(); int exitcode = m_impl->GetExitCode(); - delete m_impl; - m_impl = NULL; + wxDELETE(m_impl); return exitcode; } 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,6 +136,20 @@ void wxGUIEventLoop::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 // ---------------------------------------------------------------------------- @@ -302,7 +311,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 +337,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;