diff options
Diffstat (limited to 'src/kernel/qeventloop_x11.cpp')
| -rw-r--r-- | src/kernel/qeventloop_x11.cpp | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/kernel/qeventloop_x11.cpp b/src/kernel/qeventloop_x11.cpp index 163f8d771..a907a11e1 100644 --- a/src/kernel/qeventloop_x11.cpp +++ b/src/kernel/qeventloop_x11.cpp @@ -207,8 +207,7 @@ bool TQEventLoop::processEvents( ProcessEventsFlags flags ) TQApplication::sendPostedEvents(); const uint exclude_all = ExcludeSocketNotifiers | ExcludeTimers; - if ( nevents > 0 && ( flags & exclude_all ) == exclude_all && - ( flags & WaitForMore ) ) { + if ( nevents > 0 && ( flags & exclude_all ) == exclude_all && ( flags & WaitForMore ) ) { return TRUE; } @@ -221,12 +220,14 @@ bool TQEventLoop::processEvents( ProcessEventsFlags flags ) static timeval zerotm; timeval *tm = 0; if ( ! ( flags & ExcludeTimers ) ) { - tm = qt_wait_timer(); // wait for TQt timers - if ( !canWait ) { - if ( !tm ) - tm = &zerotm; - tm->tv_sec = 0; // no time to wait - tm->tv_usec = 0; + if (TQApplication::isGuiThread()) { + tm = qt_wait_timer(); // wait for TQt timers + if ( !canWait ) { + if ( !tm ) + tm = &zerotm; + tm->tv_sec = 0; // no time to wait + tm->tv_usec = 0; + } } } @@ -391,7 +392,9 @@ bool TQEventLoop::processEvents( ProcessEventsFlags flags ) // activate timers if ( ! ( flags & ExcludeTimers ) ) { - nevents += activateTimers(); + if (TQApplication::isGuiThread()) { + nevents += activateTimers(); + } } // color approx. optimization - only on X11 @@ -403,8 +406,12 @@ bool TQEventLoop::processEvents( ProcessEventsFlags flags ) bool TQEventLoop::hasPendingEvents() const { +#ifdef TQT_THREAD_SUPPORT + TQMutexLocker locker( TQApplication::tqt_mutex ); +#endif // TQT_THREAD_SUPPORT + extern uint qGlobalPostedEventsCount(); // from qapplication.cpp - return ( qGlobalPostedEventsCount() || XPending( TQPaintDevice::x11AppDisplay() ) ); + return ( qGlobalPostedEventsCount() || ( (tqt_is_gui_used && TQApplication::isGuiThread()) ? XPending( TQPaintDevice::x11AppDisplay() ) : 0)); } void TQEventLoop::appStartingUp() |
