From 33e2cf2d1ceff1515b2d7d2a2c29a48de63181b3 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 22 Apr 2013 21:26:09 -0500 Subject: Automated update from Qt3 --- src/kernel/qapplication.cpp | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) (limited to 'src/kernel/qapplication.cpp') diff --git a/src/kernel/qapplication.cpp b/src/kernel/qapplication.cpp index d39f38e36..64f4dfa4b 100644 --- a/src/kernel/qapplication.cpp +++ b/src/kernel/qapplication.cpp @@ -600,8 +600,9 @@ static TQPostEventList *globalPostedEvents = 0; // list of posted events uint qGlobalPostedEventsCount() { - if (!globalPostedEvents) + if (!globalPostedEvents) { return 0; + } return globalPostedEvents->count(); } @@ -2413,8 +2414,9 @@ void TQApplication::aboutTQt() bool TQApplication::notify( TQObject *receiver, TQEvent *e ) { // no events are delivered after ~TQApplication() has started - if ( is_app_closing ) + if ( is_app_closing ) { return FALSE; + } if ( receiver == 0 ) { // serious error #if defined(QT_CHECK_NULL) @@ -2456,8 +2458,9 @@ bool TQApplication::notify( TQObject *receiver, TQEvent *e ) } bool res = FALSE; - if ( !receiver->isWidgetType() ) + if ( !receiver->isWidgetType() ) { res = internalNotify( receiver, e ); + } else switch ( e->type() ) { #ifndef QT_NO_ACCEL case TQEvent::Accel: @@ -2465,13 +2468,15 @@ bool TQApplication::notify( TQObject *receiver, TQEvent *e ) TQKeyEvent* key = (TQKeyEvent*) e; res = internalNotify( receiver, e ); - if ( !res && !key->isAccepted() ) + if ( !res && !key->isAccepted() ) { res = tqt_dispatchAccelEvent( (TQWidget*)receiver, key ); + } // next lines are for compatibility with TQt <= 3.0.x: old // TQAccel was listening on toplevel widgets - if ( !res && !key->isAccepted() && !((TQWidget*)receiver)->isTopLevel() ) + if ( !res && !key->isAccepted() && !((TQWidget*)receiver)->isTopLevel() ) { res = internalNotify( ((TQWidget*)receiver)->topLevelWidget(), e ); + } } break; #endif //QT_NO_ACCEL @@ -3275,8 +3280,9 @@ void TQApplication::postEvent( TQObject *receiver, TQEvent *event ) qapp_cleanup_events.set( &globalPostedEvents ); } - if ( !receiver->postedEvents ) + if ( !receiver->postedEvents ) { receiver->postedEvents = new TQPostEventList; + } TQPostEventList * l = receiver->postedEvents; // if this is one of the compressible events, do compression @@ -3374,8 +3380,9 @@ void TQApplication::postEvent( TQObject *receiver, TQEvent *event ) } #endif - if (currentEventLoop()) + if (currentEventLoop()) { currentEventLoop()->wakeUp(); + } } @@ -3406,22 +3413,25 @@ void TQApplication::sendPostedEvents( TQObject *receiver, int event_type ) { // Make sure the object hierarchy is stable before processing events // to avoid endless loops - if ( receiver == 0 && event_type == 0 ) + if ( receiver == 0 && event_type == 0 ) { sendPostedEvents( 0, TQEvent::ChildInserted ); - - if ( !globalPostedEvents || ( receiver && !receiver->postedEvents ) ) - return; + } #ifdef QT_THREAD_SUPPORT TQMutexLocker locker( postevent_mutex ); #endif + if ( !globalPostedEvents || ( receiver && !receiver->postedEvents ) ) { + return; + } + bool sent = TRUE; while ( sent ) { sent = FALSE; - if ( !globalPostedEvents || ( receiver && !receiver->postedEvents ) ) + if ( !globalPostedEvents || ( receiver && !receiver->postedEvents ) ) { return; + } // if we have a receiver, use the local list. Otherwise, use the // global list @@ -3438,7 +3448,7 @@ void TQApplication::sendPostedEvents( TQObject *receiver, int event_type ) || receiver == pe->receiver ) // we send to THAT receiver && ( event_type == 0 // we send all types || event_type == pe->event->type() ) // we send THAT type - && ( (!pe->receiver) || (pe->receiver->contextThreadObject() == TQThread::currentThreadObject()) ) ) { // only send if active thread is receiver object owning thread + && ( (!pe->receiver) || ((pe->receiver) && (!pe->receiver->wasDeleted) && (pe->receiver->contextThreadObject() == TQThread::currentThreadObject())) ) ) { // only send if active thread is receiver object owning thread // first, we diddle the event so that we can deliver // it, and that noone will try to touch it later. pe->event->posted = FALSE; @@ -3471,8 +3481,9 @@ void TQApplication::sendPostedEvents( TQObject *receiver, int event_type ) if ( e->type() == TQEvent::Paint && r->isWidgetType() ) { TQWidget * w = (TQWidget*)r; TQPaintEvent * p = (TQPaintEvent*)e; - if ( w->isVisible() ) + if ( w->isVisible() ) { w->repaint( p->reg, p->erase ); + } } else { sent = TRUE; TQApplication::sendEvent( r, e ); @@ -3493,10 +3504,12 @@ void TQApplication::sendPostedEvents( TQObject *receiver, int event_type ) if ( l == globalPostedEvents ) { globalPostedEvents->first(); while( (pe=globalPostedEvents->current()) != 0 ) { - if ( pe->event ) + if ( pe->event ) { globalPostedEvents->next(); - else + } + else { globalPostedEvents->remove(); + } } } } -- cgit v1.2.1