Kevin Kofler 83f139
--- src/corelib/kernel/qeventdispatcher_glib.cpp.sav	2014-03-28 15:26:37.000000000 +0100
Kevin Kofler 83f139
+++ src/corelib/kernel/qeventdispatcher_glib.cpp	2014-04-24 09:44:09.358659204 +0200
Kevin Kofler 83f139
@@ -255,22 +255,30 @@ struct GPostEventSource
Kevin Kofler 0da408
     GSource source;
Kevin Kofler 0da408
     QAtomicInt serialNumber;
Kevin Kofler 0da408
     int lastSerialNumber;
Kevin Kofler 0da408
+    QEventLoop::ProcessEventsFlags processEventsFlags;
Kevin Kofler 0da408
     QEventDispatcherGlibPrivate *d;
Kevin Kofler 0da408
 };
Kevin Kofler 0da408
 
Kevin Kofler 0da408
 static gboolean postEventSourcePrepare(GSource *s, gint *timeout)
Kevin Kofler 0da408
 {
Kevin Kofler 0da408
+    GPostEventSource *source = reinterpret_cast<GPostEventSource *>(s);
Kevin Kofler 0da408
     QThreadData *data = QThreadData::current();
Kevin Kofler 0da408
     if (!data)
Kevin Kofler 0da408
         return false;
Kevin Kofler 0da408
 
Kevin Kofler 0da408
+    QEventLoop::ProcessEventsFlags excludeAllFlags
Kevin Kofler 0da408
+        = QEventLoop::ExcludeUserInputEvents
Kevin Kofler 0da408
+        | QEventLoop::ExcludeSocketNotifiers
Kevin Kofler 0da408
+        | QEventLoop::X11ExcludeTimers;
Kevin Kofler 0da408
+    if ((source->processEventsFlags & excludeAllFlags) == excludeAllFlags)
Kevin Kofler 0da408
+        return false;
Kevin Kofler 0da408
+
Kevin Kofler 0da408
     gint dummy;
Kevin Kofler 0da408
     if (!timeout)
Kevin Kofler 0da408
         timeout = &dummy;
Kevin Kofler 0da408
     const bool canWait = data->canWaitLocked();
Kevin Kofler 0da408
     *timeout = canWait ? -1 : 0;
Kevin Kofler 0da408
 
Kevin Kofler 0da408
-    GPostEventSource *source = reinterpret_cast<GPostEventSource *>(s);
Kevin Kofler 0da408
     return (!canWait
Kevin Kofler 0da408
             || (source->serialNumber != source->lastSerialNumber));
Kevin Kofler 0da408
 }
Kevin Kofler 83f139
@@ -284,8 +292,14 @@ static gboolean postEventSourceDispatch(
Kevin Kofler 0da408
 {
Kevin Kofler 0da408
     GPostEventSource *source = reinterpret_cast<GPostEventSource *>(s);
Kevin Kofler 0da408
     source->lastSerialNumber = source->serialNumber;
Kevin Kofler 0da408
-    QCoreApplication::sendPostedEvents();
Kevin Kofler 0da408
-    source->d->runTimersOnceWithNormalPriority();
Kevin Kofler 0da408
+    QEventLoop::ProcessEventsFlags excludeAllFlags
Kevin Kofler 0da408
+        = QEventLoop::ExcludeUserInputEvents
Kevin Kofler 0da408
+        | QEventLoop::ExcludeSocketNotifiers
Kevin Kofler 0da408
+        | QEventLoop::X11ExcludeTimers;
Kevin Kofler 0da408
+    if ((source->processEventsFlags & excludeAllFlags) != excludeAllFlags) {
Kevin Kofler 0da408
+        QCoreApplication::sendPostedEvents();
Kevin Kofler 0da408
+        source->d->runTimersOnceWithNormalPriority();
Kevin Kofler 0da408
+    }
Kevin Kofler 0da408
     return true; // i dunno, george...
Kevin Kofler 0da408
 }
Kevin Kofler 0da408
 
Kevin Kofler 83f139
@@ -329,6 +343,7 @@ QEventDispatcherGlibPrivate::QEventDispa
Kevin Kofler 0da408
     postEventSource = reinterpret_cast<GPostEventSource *>(g_source_new(&postEventSourceFuncs,
Kevin Kofler 0da408
                                                                         sizeof(GPostEventSource)));
Kevin Kofler 0da408
     postEventSource->serialNumber = 1;
Kevin Kofler 0da408
+    postEventSource->processEventsFlags = QEventLoop::AllEvents;
Kevin Kofler 0da408
     postEventSource->d = this;
Kevin Kofler 0da408
     g_source_set_can_recurse(&postEventSource->source, true);
Kevin Kofler 0da408
     g_source_attach(&postEventSource->source, mainContext);
Kevin Kofler 83f139
@@ -423,6 +438,7 @@ bool QEventDispatcherGlib::processEvents
Kevin Kofler 0da408
 
Kevin Kofler 0da408
     // tell postEventSourcePrepare() and timerSource about any new flags
Kevin Kofler 0da408
     QEventLoop::ProcessEventsFlags savedFlags = d->timerSource->processEventsFlags;
Kevin Kofler 0da408
+    d->postEventSource->processEventsFlags = flags;
Kevin Kofler 0da408
     d->timerSource->processEventsFlags = flags;
Kevin Kofler 83f139
     d->socketNotifierSource->processEventsFlags = flags;
Kevin Kofler 0da408
 
Kevin Kofler 83f139
@@ -435,6 +451,7 @@ bool QEventDispatcherGlib::processEvents
Kevin Kofler 0da408
     while (!result && canWait)
Kevin Kofler 0da408
         result = g_main_context_iteration(d->mainContext, canWait);
Kevin Kofler 0da408
 
Kevin Kofler 0da408
+    d->postEventSource->processEventsFlags = savedFlags;
Kevin Kofler 0da408
     d->timerSource->processEventsFlags = savedFlags;
Kevin Kofler 83f139
     d->socketNotifierSource->processEventsFlags = savedFlags;
Kevin Kofler 0da408
 
Kevin Kofler 83f139
--- src/corelib/kernel/qeventdispatcher_unix.cpp.sav	2013-06-07 07:16:52.000000000 +0200
Kevin Kofler 83f139
+++ src/corelib/kernel/qeventdispatcher_unix.cpp	2014-04-24 09:43:06.927589535 +0200
Kevin Kofler 83f139
@@ -905,7 +905,15 @@ bool QEventDispatcherUNIX::processEvents
Kevin Kofler 0da408
 
Kevin Kofler 0da408
     // we are awake, broadcast it
Kevin Kofler 0da408
     emit awake();
Kevin Kofler 0da408
-    QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData);
Kevin Kofler 0da408
+
Kevin Kofler 0da408
+    QEventLoop::ProcessEventsFlags excludeAllFlags
Kevin Kofler 0da408
+        = QEventLoop::ExcludeUserInputEvents
Kevin Kofler 0da408
+        | QEventLoop::ExcludeSocketNotifiers
Kevin Kofler 0da408
+        | QEventLoop::X11ExcludeTimers;
Kevin Kofler 0da408
+    if ((flags & excludeAllFlags) == excludeAllFlags)
Kevin Kofler 0da408
+        return false;
Kevin Kofler 0da408
+    if(( flags & excludeAllFlags ) != excludeAllFlags )
Kevin Kofler 0da408
+        QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData);
Kevin Kofler 0da408
 
Kevin Kofler 0da408
     int nevents = 0;
Kevin Kofler 0da408
     const bool canWait = (d->threadData->canWaitLocked()