summaryrefslogtreecommitdiffstats
path: root/src/kernel/qeventloop_x11.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-12-06 16:48:15 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-12-06 16:48:15 -0600
commit3f5dc49edf41359f18e7c94c28a345a9600eb44f (patch)
tree9377a62fd7701d20da0f08cc391035d8d072e8bf /src/kernel/qeventloop_x11.cpp
parent6955a7ebe3c3a0ae2af416fc57ca1f3e9af0ecc3 (diff)
downloadtqt3-3f5dc49edf41359f18e7c94c28a345a9600eb44f.tar.gz
tqt3-3f5dc49edf41359f18e7c94c28a345a9600eb44f.zip
Automated update from Qt3
Diffstat (limited to 'src/kernel/qeventloop_x11.cpp')
-rw-r--r--src/kernel/qeventloop_x11.cpp98
1 files changed, 50 insertions, 48 deletions
diff --git a/src/kernel/qeventloop_x11.cpp b/src/kernel/qeventloop_x11.cpp
index 565427106..a2d8590f6 100644
--- a/src/kernel/qeventloop_x11.cpp
+++ b/src/kernel/qeventloop_x11.cpp
@@ -146,55 +146,57 @@ bool TQEventLoop::processEvents( ProcessEventsFlags flags )
if ( tqt_is_gui_used ) {
TQApplication::sendPostedEvents();
- // Two loops so that posted events accumulate
- while ( XPending( TQPaintDevice::x11AppDisplay() ) ) {
- // also flushes output buffer
- while ( XPending( TQPaintDevice::x11AppDisplay() ) ) {
- if ( d->shortcut ) {
- return FALSE;
- }
-
- XNextEvent( TQPaintDevice::x11AppDisplay(), &event );
-
- if ( flags & ExcludeUserInput ) {
- switch ( event.type ) {
- case ButtonPress:
- case ButtonRelease:
- case MotionNotify:
- case XKeyPress:
- case XKeyRelease:
- case EnterNotify:
- case LeaveNotify:
- continue;
-
- case ClientMessage:
- {
- // from qapplication_x11.cpp
- extern Atom tqt_wm_protocols;
- extern Atom tqt_wm_take_focus;
- extern Atom qt_qt_scrolldone;
-
- // only keep the wm_take_focus and
- // qt_qt_scrolldone protocols, discard all
- // other client messages
- if ( event.xclient.format != 32 )
- continue;
-
- if ( event.xclient.message_type == tqt_wm_protocols ||
- (Atom) event.xclient.data.l[0] == tqt_wm_take_focus )
- break;
- if ( event.xclient.message_type == qt_qt_scrolldone )
- break;
+ if (TQApplication::isGuiThread()) {
+ // Two loops so that posted events accumulate
+ while ( XPending( TQPaintDevice::x11AppDisplay() ) ) {
+ // also flushes output buffer
+ while ( XPending( TQPaintDevice::x11AppDisplay() ) ) {
+ if ( d->shortcut ) {
+ return FALSE;
+ }
+
+ XNextEvent( TQPaintDevice::x11AppDisplay(), &event );
+
+ if ( flags & ExcludeUserInput ) {
+ switch ( event.type ) {
+ case ButtonPress:
+ case ButtonRelease:
+ case MotionNotify:
+ case XKeyPress:
+ case XKeyRelease:
+ case EnterNotify:
+ case LeaveNotify:
+ continue;
+
+ case ClientMessage:
+ {
+ // from qapplication_x11.cpp
+ extern Atom tqt_wm_protocols;
+ extern Atom tqt_wm_take_focus;
+ extern Atom qt_qt_scrolldone;
+
+ // only keep the wm_take_focus and
+ // qt_qt_scrolldone protocols, discard all
+ // other client messages
+ if ( event.xclient.format != 32 )
+ continue;
+
+ if ( event.xclient.message_type == tqt_wm_protocols ||
+ (Atom) event.xclient.data.l[0] == tqt_wm_take_focus )
+ break;
+ if ( event.xclient.message_type == qt_qt_scrolldone )
+ break;
+ }
+
+ default: break;
+ }
+ }
+
+ nevents++;
+ if ( tqApp->x11ProcessEvent( &event ) == 1 )
+ return TRUE;
}
-
- default: break;
- }
}
-
- nevents++;
- if ( tqApp->x11ProcessEvent( &event ) == 1 )
- return TRUE;
- }
}
}
@@ -261,7 +263,7 @@ bool TQEventLoop::processEvents( ProcessEventsFlags flags )
FD_ZERO( &d->sn_vec[2].select_fds );
}
- if ( tqt_is_gui_used ) {
+ if ( tqt_is_gui_used && TQApplication::isGuiThread() ) {
// select for events on the event socket - only on X11
FD_SET( d->xfd, &d->sn_vec[0].select_fds );
highest = TQMAX( highest, d->xfd );