summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@qt.io>2018-09-07 13:48:34 +0200
committerGatis Paeglis <gatis.paeglis@qt.io>2018-10-14 13:41:16 +0000
commit3af4b59e8b59c7b658c925e1f644d31b89e39896 (patch)
treeaf8b0d3822974f5be259c92719db46553fed89de /src/corelib
parentf5204067a02bd0c13500ea6e66bb9211701f96db (diff)
glib dispatcher: rework userEventSourcePrepare() event source
This is a better solution for fbb485d4f6985643b27da3cc6c5b5f960c32e74d. The existing solution was working fine, but it was exposing logic that is internal to QWindowSystemInterface and platform plugin interaction. Some platform plugins do event filtering at native event level - those that support QAbstractEventDispatcher::filterNativeEvent(). Other plugins rely on QWindowSystemInterface to do the filtering. Dispatchers should not care about this. The new logic rely on the fact that QWindowSystemInterfacePrivate::handleWindowSystemEvent calls QAbstractEventDispatcher::wakeUp(). The same way postEventSourcePrepare() rely on QCoreApplication::postEvent() to call QAbstractEventDispatcher::wakeUp(). Event sources run in the order they are attached, postEventSourcePrepare runs before userEventSourcePrepare(). We rely on that order to pass wakeUpCalled value. Change-Id: I0327f4f2398fd863fb2421b8033bb1df8d65f5af Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib.cpp4
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib_p.h1
2 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp
index 4c780a9294..45c6e29e4b 100644
--- a/src/corelib/kernel/qeventdispatcher_glib.cpp
+++ b/src/corelib/kernel/qeventdispatcher_glib.cpp
@@ -260,8 +260,8 @@ static gboolean postEventSourcePrepare(GSource *s, gint *timeout)
*timeout = canWait ? -1 : 0;
GPostEventSource *source = reinterpret_cast<GPostEventSource *>(s);
- return (!canWait
- || (source->serialNumber.load() != source->lastSerialNumber));
+ source->d->wakeUpCalled = source->serialNumber.load() != source->lastSerialNumber;
+ return !canWait || source->d->wakeUpCalled;
}
static gboolean postEventSourceCheck(GSource *source)
diff --git a/src/corelib/kernel/qeventdispatcher_glib_p.h b/src/corelib/kernel/qeventdispatcher_glib_p.h
index 799f23b14a..88ff316ee5 100644
--- a/src/corelib/kernel/qeventdispatcher_glib_p.h
+++ b/src/corelib/kernel/qeventdispatcher_glib_p.h
@@ -108,6 +108,7 @@ public:
GSocketNotifierSource *socketNotifierSource;
GTimerSource *timerSource;
GIdleTimerSource *idleTimerSource;
+ bool wakeUpCalled = true;
void runTimersOnceWithNormalPriority();
};