Automated update from Qt3

pull/1/head
Timothy Pearson 12 years ago
parent 3289e9c0d8
commit e863a01b9b

@ -86,6 +86,10 @@ class TQEventLoopPrivate
public:
TQEventLoopPrivate()
{
#if defined(Q_WS_X11)
xfd = -1;
x_gPollFD.fd = -1;
#endif // Q_WS_X11
reset();
}
@ -106,9 +110,7 @@ public:
#if defined(Q_WS_X11)
int xfd;
GPollFD x_gPollFD;
#endif // Q_WS_X11
int thread_pipe[2];

@ -82,15 +82,32 @@ static GSourceFuncs qt_gsource_funcs = {
static gboolean qt_gsource_prepare ( GSource *source,
gint *timeout )
{
TQtGSource * qtGSource;
qtGSource = (TQtGSource*) source;
return qtGSource->qeventLoop->gsourcePrepare(source, timeout);
TQtGSource * qtGSource = (TQtGSource*) source;
TQEventLoop* candidateEventLoop = qtGSource->qeventLoop;
TQEventLoop* activeThreadEventLoop = TQApplication::eventLoop();
if (candidateEventLoop == activeThreadEventLoop) {
return candidateEventLoop->gsourcePrepare(source, timeout);
}
else {
// Prepare failed
return FALSE;
}
}
static gboolean qt_gsource_check ( GSource *source )
{
TQtGSource * qtGSource = (TQtGSource*) source;
return qtGSource->qeventLoop->gsourceCheck(source);
TQEventLoop* candidateEventLoop = qtGSource->qeventLoop;
TQEventLoop* activeThreadEventLoop = TQApplication::eventLoop();
if (candidateEventLoop == activeThreadEventLoop) {
return candidateEventLoop->gsourceCheck(source);
}
else {
// Check failed
return FALSE;
}
}
static gboolean qt_gsource_dispatch ( GSource *source,
@ -205,25 +222,24 @@ void TQEventLoop::init()
qtGSource->qeventLoop = this;
// init main loop and attach gsource
#ifdef DEBUG_QT_GLIBMAINLOOP
printf("inside init(1)\n");
#endif
g_main_loop_new (d->ctx, 1);
g_source_attach( (GSource*)qtGSource, d->ctx );
d->gSource = (GSource*) qtGSource;
d->gSource = (GSource*)qtGSource;
// poll for X11 events
if ( tqt_is_gui_used && TQApplication::isGuiThread() ) {
d->x_gPollFD.fd = d->xfd;
d->x_gPollFD.events = G_IO_IN | G_IO_HUP;
d->x_gPollFD.events = G_IO_IN | G_IO_HUP | G_IO_ERR;
g_source_add_poll(d->gSource, &d->x_gPollFD);
}
// poll thread-pipe
d->threadPipe_gPollFD.fd = d->thread_pipe[0];
d->threadPipe_gPollFD.events = G_IO_IN | G_IO_HUP;
d->threadPipe_gPollFD.events = G_IO_IN | G_IO_HUP | G_IO_ERR;
g_source_add_poll(d->gSource, &d->threadPipe_gPollFD);
@ -336,12 +352,13 @@ bool TQEventLoop::processX11Events()
}
nevents++;
if ( tqApp->x11ProcessEvent( &event ) == 1 )
if ( tqApp->x11ProcessEvent( &event ) == 1 ) {
return TRUE;
}
}
}
}
}
if ( d->shortcut ) {
return FALSE;
@ -463,14 +480,9 @@ bool TQEventLoop::gsourceCheck(GSource *gs) {
printf("inside gsourceCheck(1)\n");
#endif
// Socketnotifier events?
TQPtrList<TQSockNotGPollFD> *list = &d->sn_list;
//if ( list ) {
TQSockNotGPollFD *sn = list->first();
while ( sn ) {
if ( sn->gPollFD.revents )
@ -500,10 +512,9 @@ bool TQEventLoop::gsourceCheck(GSource *gs) {
return TRUE; // we got more X11 events!
}
// check if we have timers to activate?
// check if we have timers to activate?
timeval * tm =qt_wait_timer();
if (tm && (tm->tv_sec == 0 && tm->tv_usec == 0 )) {
#ifdef DEBUG_QT_GLIBMAINLOOP
printf("inside gsourceCheck(2) qtwaittimer!\n");
@ -513,7 +524,6 @@ bool TQEventLoop::gsourceCheck(GSource *gs) {
}
// nothing to dispatch
#ifdef DEBUG_QT_GLIBMAINLOOP
printf("inside gsourceCheck(2) nothing to dispatch!\n");
#endif
@ -534,7 +544,6 @@ bool TQEventLoop::gsourceDispatch(GSource *gs) {
#endif
int nevents=0;
ProcessEventsFlags flags = d->pev_flags;
#ifdef DEBUG_QT_GLIBMAINLOOP
@ -588,12 +597,10 @@ bool TQEventLoop::gsourceDispatch(GSource *gs) {
//return (nevents > 0);
// now process x11 events!
#ifdef DEBUG_QT_GLIBMAINLOOP
printf("inside gsourceDispatch(2) hasPendingEvents=%d\n", hasPendingEvents());
#endif
if (hasPendingEvents()) {
// color approx. optimization - only on X11
qt_reset_color_avail();
@ -627,6 +634,11 @@ void TQEventLoop::appStartingUp()
{
if ( tqt_is_gui_used ) {
d->xfd = XConnectionNumber( TQPaintDevice::x11AppDisplay() );
if ( (d->x_gPollFD.fd == -1) && TQApplication::isGuiThread() ) {
d->x_gPollFD.fd = d->xfd;
d->x_gPollFD.events = G_IO_IN | G_IO_HUP | G_IO_ERR;
g_source_add_poll(d->gSource, &d->x_gPollFD);
}
}
}

Loading…
Cancel
Save