summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylandintegration.cpp
diff options
context:
space:
mode:
authorGiulio Camuffo <giulio.camuffo@kdab.com>2020-03-16 10:22:36 +0100
committerRatchanan Srirattanamet <ratchanan@ubports.com>2021-10-18 16:28:52 +0700
commit92a7904d9651348b0c307e84251c8440c6f75b22 (patch)
tree500e5fc24db82f1e470b22061725f0bcc238a306 /src/client/qwaylandintegration.cpp
parentbaa7ef511bf40280448e5f0e721ddd6da3301f3b (diff)
Move the wayland socket polling to a separate event thread
New event threads is introduced which calls poll() on the wayland fd, instead of relying on the event dispatcher by using the QSocketNotifier. This allows to call in the proper order the wl_display_prepare_read(), poll() and wl_display_read_events() functions. One thread is responsible for the default queue; when needed, it emit a signal so that the main thread can dispatch the queue. Another thread is responsible for the dedicated queue for frame callbacks; this thread will dispatch events on the thread itself. QWaylandWindow is updated to, instead of each window's dedicated event queue, use this queue for frame callbacks. Co-authored-by: Ratchanan Srirattanamet <ratchanan@ubports.com> Task-number: QTBUG-66075 Change-Id: Ibb33ad7f4193b866d1b8d7a0405a94d59dcad5eb Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/client/qwaylandintegration.cpp')
-rw-r--r--src/client/qwaylandintegration.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp
index d54dff5ce..5b712cab9 100644
--- a/src/client/qwaylandintegration.cpp
+++ b/src/client/qwaylandintegration.cpp
@@ -208,11 +208,9 @@ void QWaylandIntegration::initializePlatform()
void QWaylandIntegration::initialize()
{
- int fd = wl_display_get_fd(mDisplay->wl_display());
- QSocketNotifier *sn = new QSocketNotifier(fd, QSocketNotifier::Read, mDisplay.data());
- QObject::connect(sn, SIGNAL(activated(QSocketDescriptor)), mDisplay.data(), SLOT(flushRequests()));
+ mDisplay->initEventThread();
- // Call this after eventDispatcher is connected with QSocketNotifier for QWaylandDisplay::forceRoundTrip()
+ // Call this after initializing event thread for QWaylandDisplay::forceRoundTrip()
initializePlatform();
// But the aboutToBlock() and awake() should be connected after initializePlatform().