summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2025-06-13 09:20:18 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2025-06-13 09:20:18 +0900
commit9735ca1c135526e713a529640ed1ee2d1cdf48ca (patch)
treece350664886864d1305feff104385cd66885f2b2 /src
parent5e8114b6f0ce10965a69cab4a61ce369cbb21d21 (diff)
downloadtqt-9735ca1c135526e713a529640ed1ee2d1cdf48ca.tar.gz
tqt-9735ca1c135526e713a529640ed1ee2d1cdf48ca.zip
Improve X11 'ProcessEvents()' with some code from the equivalent glib version
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'src')
-rw-r--r--src/kernel/tqeventloop_x11.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/kernel/tqeventloop_x11.cpp b/src/kernel/tqeventloop_x11.cpp
index b64b22287..8a2edf804 100644
--- a/src/kernel/tqeventloop_x11.cpp
+++ b/src/kernel/tqeventloop_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 tqapplication.cpp
- return ( qGlobalPostedEventsCount() || XPending( TQPaintDevice::x11AppDisplay() ) );
+ return ( qGlobalPostedEventsCount() || ( (tqt_is_gui_used && TQApplication::isGuiThread()) ? XPending( TQPaintDevice::x11AppDisplay() ) : 0));
}
void TQEventLoop::appStartingUp()