|
|
@ -79,8 +79,7 @@ static GSourceFuncs qt_gsource_funcs = {
|
|
|
|
|
|
|
|
|
|
|
|
// forward main loop callbacks to QEventLoop methods!
|
|
|
|
// forward main loop callbacks to QEventLoop methods!
|
|
|
|
|
|
|
|
|
|
|
|
static gboolean qt_gsource_prepare ( GSource *source,
|
|
|
|
static gboolean qt_gsource_prepare ( GSource *source, gint *timeout )
|
|
|
|
gint *timeout )
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QtGSource * qtGSource = (QtGSource*) source;
|
|
|
|
QtGSource * qtGSource = (QtGSource*) source;
|
|
|
|
QEventLoop* candidateEventLoop = qtGSource->qeventLoop;
|
|
|
|
QEventLoop* candidateEventLoop = qtGSource->qeventLoop;
|
|
|
@ -110,8 +109,7 @@ static gboolean qt_gsource_check ( GSource *source )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static gboolean qt_gsource_dispatch ( GSource *source,
|
|
|
|
static gboolean qt_gsource_dispatch ( GSource *source, GSourceFunc callback, gpointer user_data )
|
|
|
|
GSourceFunc callback, gpointer user_data )
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Q_UNUSED(callback);
|
|
|
|
Q_UNUSED(callback);
|
|
|
|
Q_UNUSED(user_data);
|
|
|
|
Q_UNUSED(user_data);
|
|
|
@ -215,6 +213,7 @@ void QEventLoop::init()
|
|
|
|
// new main context for thread
|
|
|
|
// new main context for thread
|
|
|
|
d->ctx = g_main_context_new();
|
|
|
|
d->ctx = g_main_context_new();
|
|
|
|
g_main_context_push_thread_default(d->ctx);
|
|
|
|
g_main_context_push_thread_default(d->ctx);
|
|
|
|
|
|
|
|
d->ctx_is_default = true;
|
|
|
|
|
|
|
|
|
|
|
|
// new GSource
|
|
|
|
// new GSource
|
|
|
|
QtGSource * qtGSource = (QtGSource*) g_source_new(&qt_gsource_funcs, sizeof(QtGSource));
|
|
|
|
QtGSource * qtGSource = (QtGSource*) g_source_new(&qt_gsource_funcs, sizeof(QtGSource));
|
|
|
@ -649,4 +648,17 @@ void QEventLoop::appClosingDown()
|
|
|
|
|
|
|
|
|
|
|
|
void QEventLoop::setSingleToolkitEventHandling(bool enabled) {
|
|
|
|
void QEventLoop::setSingleToolkitEventHandling(bool enabled) {
|
|
|
|
d->singletoolkit = 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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|