|
|
|
@ -96,6 +96,9 @@ static gboolean qt_gsource_check ( GSource *source )
|
|
|
|
|
static gboolean qt_gsource_dispatch ( GSource *source,
|
|
|
|
|
GSourceFunc callback, gpointer user_data )
|
|
|
|
|
{
|
|
|
|
|
Q_UNUSED(callback);
|
|
|
|
|
Q_UNUSED(user_data);
|
|
|
|
|
|
|
|
|
|
TQtGSource * qtGSource = (TQtGSource*) source;
|
|
|
|
|
return qtGSource->qeventLoop->gsourceDispatch(source);
|
|
|
|
|
}
|
|
|
|
@ -166,7 +169,9 @@ void TQEventLoop::init()
|
|
|
|
|
d->pev_flags = AllEvents | WaitForMore;
|
|
|
|
|
|
|
|
|
|
// initialize the common parts of the event loop
|
|
|
|
|
pipe( d->thread_pipe );
|
|
|
|
|
if (pipe( d->thread_pipe ) < 0) {
|
|
|
|
|
// Error!
|
|
|
|
|
}
|
|
|
|
|
fcntl(d->thread_pipe[0], F_SETFD, FD_CLOEXEC);
|
|
|
|
|
fcntl(d->thread_pipe[1], F_SETFD, FD_CLOEXEC);
|
|
|
|
|
|
|
|
|
@ -341,6 +346,7 @@ bool TQEventLoop::processX11Events()
|
|
|
|
|
|
|
|
|
|
bool TQEventLoop::gsourcePrepare(GSource *gs, int * timeout)
|
|
|
|
|
{
|
|
|
|
|
Q_UNUSED(gs);
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_QT_GLIBMAINLOOP
|
|
|
|
|
printf("inside gsourcePrepare(1)\n");
|
|
|
|
@ -447,6 +453,7 @@ bool TQEventLoop::gsourcePrepare(GSource *gs, int * timeout)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool TQEventLoop::gsourceCheck(GSource *gs) {
|
|
|
|
|
Q_UNUSED(gs);
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_QT_GLIBMAINLOOP
|
|
|
|
|
printf("inside gsourceCheck(1)\n");
|
|
|
|
@ -512,6 +519,7 @@ bool TQEventLoop::gsourceCheck(GSource *gs) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool TQEventLoop::gsourceDispatch(GSource *gs) {
|
|
|
|
|
Q_UNUSED(gs);
|
|
|
|
|
|
|
|
|
|
// relock the GUI mutex before processing any pending events
|
|
|
|
|
#if defined(QT_THREAD_SUPPORT)
|
|
|
|
@ -538,7 +546,9 @@ bool TQEventLoop::gsourceDispatch(GSource *gs) {
|
|
|
|
|
|
|
|
|
|
if ( d->threadPipe_gPollFD.revents) {
|
|
|
|
|
char c;
|
|
|
|
|
::read( d->thread_pipe[0], &c, 1 );
|
|
|
|
|
if (::read( d->thread_pipe[0], &c, 1 ) < 0) {
|
|
|
|
|
// Error!
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( qt_postselect_handler ) {
|
|
|
|
@ -583,6 +593,7 @@ bool TQEventLoop::gsourceDispatch(GSource *gs) {
|
|
|
|
|
printf("inside gsourceDispatch(2) hasPendingEvents=%d\n", hasPendingEvents());
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (hasPendingEvents()) {
|
|
|
|
|
|
|
|
|
|
// color approx. optimization - only on X11
|
|
|
|
@ -596,8 +607,12 @@ bool TQEventLoop::gsourceDispatch(GSource *gs) {
|
|
|
|
|
locker.mutex()->unlock();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
if (d->singletoolkit) {
|
|
|
|
|
return TRUE; // Eat the event
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return FALSE; // Pass the event on to GTK
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TQEventLoop::hasPendingEvents() const
|
|
|
|
@ -616,3 +631,7 @@ void TQEventLoop::appClosingDown()
|
|
|
|
|
{
|
|
|
|
|
d->xfd = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TQEventLoop::setSingleToolkitEventHandling(bool enabled) {
|
|
|
|
|
d->singletoolkit = enabled;
|
|
|
|
|
}
|