#include "wx/app.h"
#include "wx/evtloop.h"
#include "wx/tooltip.h"
-
+#if wxUSE_THREADS
+#include "wx/thread.h"
+#endif
+#include "wx/timer.h"
#include "wx/x11/private.h"
#include "X11/Xlib.h"
// ctor
wxEventLoopImpl() { SetExitCode(0); m_keepGoing = FALSE; }
- // process an XEvent
- void ProcessEvent(XEvent* event);
+ // process an XEvent, return TRUE if it was processed
+ bool ProcessEvent(XEvent* event);
// generate an idle message, return TRUE if more idle time requested
bool SendIdleEvent();
public:
// preprocess an event, return TRUE if processed (i.e. no further
// dispatching required)
- bool PreProcessMessage(XEvent* event);
+ bool PreProcessEvent(XEvent* event);
// the exit code of the event loop
int m_exitcode;
// wxEventLoopImpl message processing
// ----------------------------------------------------------------------------
-void wxEventLoopImpl::ProcessEvent(XEvent *event)
+bool wxEventLoopImpl::ProcessEvent(XEvent *event)
{
// give us the chance to preprocess the message first
- if ( !PreProcessEvent(event) )
- {
- // if it wasn't done, dispatch it to the corresponding window
- if (wxTheApp)
- wxTheApp->ProcessXEvent((WXEvent*) event);
- }
+ if ( PreProcessEvent(event) )
+ return TRUE;
+
+ // if it wasn't done, dispatch it to the corresponding window
+ if (wxTheApp)
+ return wxTheApp->ProcessXEvent((WXEvent*) event);
+
+ return FALSE;
}
bool wxEventLoopImpl::PreProcessEvent(XEvent *event)
m_impl->m_keepGoing = TRUE;
while ( m_impl->m_keepGoing )
{
-#if wxUSE_THREADS
- wxMutexGuiLeaveOrEnter();
+#if 0 // wxUSE_THREADS
+ wxMutexGuiLeaveOrEnter();
#endif // wxUSE_THREADS
// generate and process idle events for as long as we don't have
// anything else to do
while ( ! Pending() )
{
+#if wxUSE_TIMER
+ wxTimer::NotifyTimers(); // TODO: is this the correct place for it?
+#endif
if (!m_impl->SendIdleEvent())
{
-#if wxUSE_THREADS
+#if 0 // wxUSE_THREADS
// leave the main loop to give other threads a chance to
// perform their GUI work
wxMutexGuiLeave();
bool wxEventLoop::Pending() const
{
- XFlush(wxGetDisplay());
- return (XPending(wxGetDisplay()) > 0);
+ XFlush((Display*) wxGetDisplay());
+ return (XPending((Display*) wxGetDisplay()) > 0);
}
bool wxEventLoop::Dispatch()
// TODO allowing for threads, as per e.g. wxMSW
- XNextEvent(wxGetDisplay(), & event);
- m_impl->ProcessEvent(& event);
+ XNextEvent((Display*) wxGetDisplay(), & event);
+ (void) m_impl->ProcessEvent(& event);
return TRUE;
}