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