Blame SOURCES/qt-everywhere-opensource-src-4.8.6-QTBUG-34614.patch

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