diff options
author | Timothy Pearson <[email protected]> | 2013-02-12 18:15:36 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2013-02-12 18:15:36 -0600 |
commit | 07d10b57b72e366cc793302d8209752927311eec (patch) | |
tree | 8358ee7867ca2dc133cf7c04911927d97c78703b /src/kernel/qeventloop_x11_glib.cpp | |
parent | fe4ae78df6b03fa65b4efa9cf82b30d96da4e69f (diff) | |
download | tqt3-07d10b57b72e366cc793302d8209752927311eec.tar.gz tqt3-07d10b57b72e366cc793302d8209752927311eec.zip |
Automated update from Qt3
Diffstat (limited to 'src/kernel/qeventloop_x11_glib.cpp')
-rw-r--r-- | src/kernel/qeventloop_x11_glib.cpp | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/kernel/qeventloop_x11_glib.cpp b/src/kernel/qeventloop_x11_glib.cpp index 40205f805..7106bf4e6 100644 --- a/src/kernel/qeventloop_x11_glib.cpp +++ b/src/kernel/qeventloop_x11_glib.cpp @@ -79,8 +79,7 @@ static GSourceFuncs qt_gsource_funcs = { // forward main loop callbacks to TQEventLoop methods! -static gboolean qt_gsource_prepare ( GSource *source, - gint *timeout ) +static gboolean qt_gsource_prepare ( GSource *source, gint *timeout ) { TQtGSource * qtGSource = (TQtGSource*) source; TQEventLoop* candidateEventLoop = qtGSource->qeventLoop; @@ -95,7 +94,7 @@ static gboolean qt_gsource_prepare ( GSource *source, } } -static gboolean qt_gsource_check ( GSource *source ) +static gboolean qt_gsource_check ( GSource *source ) { TQtGSource * qtGSource = (TQtGSource*) source; TQEventLoop* candidateEventLoop = qtGSource->qeventLoop; @@ -110,8 +109,7 @@ static gboolean qt_gsource_check ( GSource *source ) } } -static gboolean qt_gsource_dispatch ( GSource *source, - GSourceFunc callback, gpointer user_data ) +static gboolean qt_gsource_dispatch ( GSource *source, GSourceFunc callback, gpointer user_data ) { Q_UNUSED(callback); Q_UNUSED(user_data); @@ -215,6 +213,7 @@ void TQEventLoop::init() // new main context for thread d->ctx = g_main_context_new(); g_main_context_push_thread_default(d->ctx); + d->ctx_is_default = true; // new GSource TQtGSource * qtGSource = (TQtGSource*) g_source_new(&qt_gsource_funcs, sizeof(TQtGSource)); @@ -241,9 +240,9 @@ void TQEventLoop::init() d->threadPipe_gPollFD.fd = d->thread_pipe[0]; d->threadPipe_gPollFD.events = G_IO_IN | G_IO_HUP | G_IO_ERR; - g_source_add_poll(d->gSource, &d->threadPipe_gPollFD); + g_source_add_poll(d->gSource, &d->threadPipe_gPollFD); -#ifdef DEBUG_QT_GLIBMAINLOOP +#ifdef DEBUG_QT_GLIBMAINLOOP printf("inside init(2)\n"); #endif @@ -375,7 +374,7 @@ bool TQEventLoop::processX11Events() } -bool TQEventLoop::gsourcePrepare(GSource *gs, int * timeout) +bool TQEventLoop::gsourcePrepare(GSource *gs, int * timeout) { Q_UNUSED(gs); @@ -428,7 +427,7 @@ bool TQEventLoop::gsourcePrepare(GSource *gs, int * timeout) #ifdef DEBUG_QT_GLIBMAINLOOP printf("inside gsourcePrepare(2) canwait=%d\n", canWait); -#endif +#endif if ( canWait ) { emit aboutToBlock(); @@ -440,7 +439,7 @@ bool TQEventLoop::gsourcePrepare(GSource *gs, int * timeout) (**it)(); } -#ifdef DEBUG_QT_GLIBMAINLOOP +#ifdef DEBUG_QT_GLIBMAINLOOP printf("inside gsourcePrepare(2.1) canwait=%d\n", canWait); #endif @@ -649,4 +648,17 @@ void TQEventLoop::appClosingDown() void TQEventLoop::setSingleToolkitEventHandling(bool enabled) { d->singletoolkit = enabled; + + if (!d->singletoolkit) { + if (d->ctx_is_default) { + d->ctx_is_default = false; + g_main_context_pop_thread_default(d->ctx); + } + } + else { + if (!d->ctx_is_default) { + g_main_context_push_thread_default(d->ctx); + d->ctx_is_default = true; + } + } }
\ No newline at end of file |