summaryrefslogtreecommitdiffstats
path: root/src/kernel/qapplication.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/qapplication.cpp')
-rw-r--r--src/kernel/qapplication.cpp78
1 files changed, 38 insertions, 40 deletions
diff --git a/src/kernel/qapplication.cpp b/src/kernel/qapplication.cpp
index fbdb9330..8f8dade5 100644
--- a/src/kernel/qapplication.cpp
+++ b/src/kernel/qapplication.cpp
@@ -65,11 +65,11 @@
#endif
#include "qfontdata_p.h"
-#if defined(TQT_THREAD_SUPPORT)
+#ifndef TQT_NO_THREAD
# include "ntqmutex.h"
# include "ntqthread.h"
# include <private/qthreadinstance_p.h>
-#endif // TQT_THREAD_SUPPORT
+#endif // TQT_NO_THREAD
#include <stdlib.h>
@@ -375,7 +375,7 @@ TQStringList *TQApplication::app_libpaths = 0;
bool TQApplication::metaComposeUnicode = FALSE;
int TQApplication::composedUnicode = 0;
-#ifdef TQT_THREAD_SUPPORT
+#ifndef TQT_NO_THREAD
TQMutex *TQApplication::tqt_mutex = 0;
TQMutex *tqt_sharedStringMutex = 0;
TQ_EXPORT TQMutex * tqt_sharedMetaObjectMutex = 0;
@@ -388,13 +388,11 @@ TQ_EXPORT TQt::HANDLE tqt_get_application_thread_id()
{
return tqt_application_thread_id;
}
-#endif // TQT_THREAD_SUPPORT
-
-#ifndef TQT_THREAD_SUPPORT
+#else // !TQT_NO_THREAD
TQEventLoop *TQApplication::eventloop = 0; // application event loop
-#endif
+#endif // TQT_NO_THREAD
-#ifdef TQT_THREAD_SUPPORT
+#ifndef TQT_NO_THREAD
TQEventLoop* TQApplication::currentEventLoop() {
TQThread* thread = TQThread::currentThreadObject();
if (thread) {
@@ -541,7 +539,7 @@ TQClipboard *tqt_clipboard = 0; // global clipboard object
#endif
TQWidgetList * tqt_modal_stack=0; // stack of modal widgets
-#ifdef TQT_THREAD_SUPPORT
+#ifndef TQT_NO_THREAD
// thread wrapper for the main() thread
class TQCoreApplicationThread : public TQThread
{
@@ -603,9 +601,9 @@ static TQPostEventList *globalPostedEvents = 0; // list of posted events
uint qGlobalPostedEventsCount()
{
-#ifdef TQT_THREAD_SUPPORT
+#ifndef TQT_NO_THREAD
TQMutexLocker locker( postevent_mutex );
-#endif // TQT_THREAD_SUPPORT
+#endif // TQT_NO_THREAD
if (!globalPostedEvents) {
return 0;
@@ -1033,7 +1031,7 @@ TQApplication::TQApplication(Display *dpy, int argc, char **argv,
#endif // TQ_WS_X11
-#ifdef TQT_THREAD_SUPPORT
+#ifndef TQT_NO_THREAD
TQThread* TQApplication::guiThread() {
return mainThread();
}
@@ -1067,7 +1065,7 @@ void TQApplication::init_precmdline()
void TQApplication::initialize( int argc, char **argv, bool enable_sm )
{
-#ifdef TQT_THREAD_SUPPORT
+#ifndef TQT_NO_THREAD
tqt_mutex = new TQMutex( TRUE );
tqt_sharedStringMutex = new TQMutex( TRUE );
tqt_sharedMetaObjectMutex = new TQMutex( TRUE );
@@ -1076,7 +1074,7 @@ void TQApplication::initialize( int argc, char **argv, bool enable_sm )
#endif // QT_USE_GLIBMAINLOOP
postevent_mutex = new TQMutex( TRUE );
tqt_application_thread_id = TQThread::currentThread();
-#endif // TQT_THREAD_SUPPORT
+#endif // TQT_NO_THREAD
app_argc = argc;
app_argv = argv;
@@ -1224,12 +1222,12 @@ TQApplication::~TQApplication()
app_libpaths = 0;
#endif
-#ifdef TQT_THREAD_SUPPORT
+#ifndef TQT_NO_THREAD
delete tqt_mutex;
tqt_mutex = 0;
delete postevent_mutex;
postevent_mutex = 0;
-#endif // TQT_THREAD_SUPPORT
+#endif // TQT_NO_THREAD
if( tqApp == this ) {
if ( postedEvents )
@@ -1252,7 +1250,7 @@ TQApplication::~TQApplication()
session_key = 0;
#endif //TQT_NO_SESSIONMANAGER
-#ifdef TQT_THREAD_SUPPORT
+#ifndef TQT_NO_THREAD
delete tqt_sharedMetaObjectMutex;
tqt_sharedMetaObjectMutex = 0;
delete tqt_sharedStringMutex;
@@ -1261,7 +1259,7 @@ TQApplication::~TQApplication()
delete tqt_timerListMutex;
tqt_timerListMutex = 0;
#endif // QT_USE_GLIBMAINLOOP
-#endif // TQT_THREAD_SUPPORT
+#endif // TQT_NO_THREAD
tqt_explicit_app_style = FALSE;
tqt_app_has_font = FALSE;
@@ -2519,9 +2517,9 @@ bool TQApplication::notify( TQObject *receiver, TQEvent *e )
}
if ( e->type() == TQEvent::ChildRemoved && receiver->postedEvents) {
-#ifdef TQT_THREAD_SUPPORT
+#ifndef TQT_NO_THREAD
TQMutexLocker locker( postevent_mutex );
-#endif // TQT_THREAD_SUPPORT
+#endif // TQT_NO_THREAD
if (globalPostedEvents) {
// the TQObject destructor calls TQObject::removeChild, which calls
@@ -2866,7 +2864,7 @@ bool TQApplication::internalNotify( TQObject *receiver, TQEvent * e)
}
if (!handled) {
-#if defined(TQT_THREAD_SUPPORT)
+#ifndef TQT_NO_THREAD
int locklevel = 0;
int llcount;
if (TQApplication::tqt_mutex) {
@@ -2879,7 +2877,7 @@ bool TQApplication::internalNotify( TQObject *receiver, TQEvent * e)
}
#endif
consumed = receiver->event( e );
-#if defined(TQT_THREAD_SUPPORT)
+#ifndef TQT_NO_THREAD
if (TQApplication::tqt_mutex) {
for (llcount=0; llcount<locklevel; llcount++) {
TQApplication::tqt_mutex->lock();
@@ -3031,7 +3029,7 @@ int TQApplication::exec()
*/
void TQApplication::exit( int retcode )
{
-#ifdef TQT_THREAD_SUPPORT
+#ifndef TQT_NO_THREAD
TQThread* thread = tqApp->guiThread();
if (thread) {
if (thread->d) {
@@ -3042,7 +3040,7 @@ void TQApplication::exit( int retcode )
}
#else
tqApp->eventLoop()->exit( retcode );
-#endif // TQT_THREAD_SUPPORT
+#endif // TQT_NO_THREAD
}
/*!
@@ -3367,9 +3365,9 @@ void TQApplication::postEvent( TQObject *receiver, TQEvent *event )
return;
}
-#ifdef TQT_THREAD_SUPPORT
+#ifndef TQT_NO_THREAD
TQMutexLocker locker( postevent_mutex );
-#endif // TQT_THREAD_SUPPORT
+#endif // TQT_NO_THREAD
if ( !globalPostedEvents ) { // create list
globalPostedEvents = new TQPostEventList;
@@ -3463,7 +3461,7 @@ void TQApplication::postEvent( TQObject *receiver, TQEvent *event )
l->append( pe );
globalPostedEvents->append( pe );
-#ifdef TQT_THREAD_SUPPORT
+#ifndef TQT_NO_THREAD
// Wake up the receiver thread event loop
TQThread* thread = receiver->contextThreadObject();
if (thread) {
@@ -3516,7 +3514,7 @@ void TQApplication::sendPostedEvents( TQObject *receiver, int event_type )
sendPostedEvents( 0, TQEvent::ChildInserted );
}
-#ifdef TQT_THREAD_SUPPORT
+#ifndef TQT_NO_THREAD
TQMutexLocker locker( postevent_mutex );
#endif
@@ -3549,7 +3547,7 @@ void TQApplication::sendPostedEvents( TQObject *receiver, int event_type )
&& ( event_type == 0 // we send all types
|| event_type == pe->event->type() ) // we send THAT type
&& ( !pe->receiver->wasDeleted ) // don't send if receiver was deleted
-#ifdef TQT_THREAD_SUPPORT
+#ifndef TQT_NO_THREAD
// only send if active thread is receiver object owning thread
&& ( pe->receiver->contextThreadObject() == TQThread::currentThreadObject() )
#endif
@@ -3579,9 +3577,9 @@ void TQApplication::sendPostedEvents( TQObject *receiver, int event_type )
}
}
-#ifdef TQT_THREAD_SUPPORT
+#ifndef TQT_NO_THREAD
if ( locker.mutex() ) locker.mutex()->unlock();
-#endif // TQT_THREAD_SUPPORT
+#endif // TQT_NO_THREAD
// after all that work, it's time to deliver the event.
if ( e->type() == TQEvent::Paint && r->isWidgetType() ) {
TQWidget * w = (TQWidget*)r;
@@ -3593,9 +3591,9 @@ void TQApplication::sendPostedEvents( TQObject *receiver, int event_type )
sent = TRUE;
TQApplication::sendEvent( r, e );
}
-#ifdef TQT_THREAD_SUPPORT
+#ifndef TQT_NO_THREAD
if ( locker.mutex() ) locker.mutex()->lock();
-#endif // TQT_THREAD_SUPPORT
+#endif // TQT_NO_THREAD
delete e;
// careful when adding anything below this point - the
@@ -3654,9 +3652,9 @@ void TQApplication::removePostedEvents( TQObject *receiver, int event_type )
return;
}
-#ifdef TQT_THREAD_SUPPORT
+#ifndef TQT_NO_THREAD
TQMutexLocker locker( postevent_mutex );
-#endif // TQT_THREAD_SUPPORT
+#endif // TQT_NO_THREAD
// the TQObject destructor calls this function directly. this can
// happen while the event loop is in the middle of posting events,
@@ -3707,9 +3705,9 @@ void TQApplication::removePostedEvent( TQEvent * event )
return;
}
-#ifdef TQT_THREAD_SUPPORT
+#ifndef TQT_NO_THREAD
TQMutexLocker locker( postevent_mutex );
-#endif // TQT_THREAD_SUPPORT
+#endif // TQT_NO_THREAD
if ( !globalPostedEvents ) {
#if defined(QT_DEBUG)
@@ -3804,7 +3802,7 @@ void TQApplication::removePostedEvent( TQEvent * event )
}
}
-#ifdef TQT_THREAD_SUPPORT
+#ifndef TQT_NO_THREAD
static void tqThreadTerminationHandlerRecursive( TQObject* object, TQThread* originThread, TQThread* destinationThread ) {
TQThread* objectThread = object->contextThreadObject();
if (objectThread && (objectThread == originThread)) {
@@ -3845,7 +3843,7 @@ void TQApplication::threadTerminationHandler( TQThread *originThread ) {
tqThreadTerminationHandlerRecursive((*objectit), originThread, destinationThread);
}
}
-#endif // TQT_THREAD_SUPPORT
+#endif // TQT_NO_THREAD
/*!\internal
@@ -4196,7 +4194,7 @@ bool TQApplication::desktopSettingsAware()
\sa lock(), unlock() \link threads.html Thread Support in TQt\endlink
*/
-#if defined(TQT_THREAD_SUPPORT)
+#ifndef TQT_NO_THREAD
void TQApplication::lock()
{
tqt_mutex->lock();