Blame SOURCES/0029-Connect-flushRequest-after-forceRoundTrip.patch

869fe3
From 725c5de6bdd528d1fa03f1de5ec91585eb110d83 Mon Sep 17 00:00:00 2001
9fb289
From: Elvis Lee <kwangwoong.lee@lge.com>
9fb289
Date: Wed, 17 Mar 2021 16:31:10 +0900
869fe3
Subject: [PATCH 29/40] Connect flushRequest after forceRoundTrip
9fb289
9fb289
If flushRequest is connected with aboutToBlock, the flushRequest
9fb289
may consumes all events so that processEvents might be blocked in forceRoundTrip.
9fb289
9fb289
Change-Id: I12b2c506e8442bf0e75f6ab6e418d3e1eea6d68c
9fb289
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
9fb289
(cherry picked from commit 654a54755138c520c3a41210d8078196e9a2c1bf)
9fb289
---
9fb289
 src/client/qwaylandintegration.cpp | 11 +++++++----
9fb289
 1 file changed, 7 insertions(+), 4 deletions(-)
9fb289
9fb289
diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp
9fb289
index f5632982..3a6fa651 100644
9fb289
--- a/src/client/qwaylandintegration.cpp
9fb289
+++ b/src/client/qwaylandintegration.cpp
9fb289
@@ -192,10 +192,6 @@ QAbstractEventDispatcher *QWaylandIntegration::createEventDispatcher() const
9fb289
 
9fb289
 void QWaylandIntegration::initialize()
9fb289
 {
9fb289
-    QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher;
9fb289
-    QObject::connect(dispatcher, SIGNAL(aboutToBlock()), mDisplay.data(), SLOT(flushRequests()));
9fb289
-    QObject::connect(dispatcher, SIGNAL(awake()), mDisplay.data(), SLOT(flushRequests()));
9fb289
-
9fb289
     int fd = wl_display_get_fd(mDisplay->wl_display());
9fb289
     QSocketNotifier *sn = new QSocketNotifier(fd, QSocketNotifier::Read, mDisplay.data());
9fb289
     QObject::connect(sn, SIGNAL(activated(QSocketDescriptor)), mDisplay.data(), SLOT(flushRequests()));
9fb289
@@ -203,6 +199,13 @@ void QWaylandIntegration::initialize()
9fb289
     // Call after eventDispatcher is fully connected, for QWaylandDisplay::forceRoundTrip()
9fb289
     mDisplay->initialize();
9fb289
 
9fb289
+    // But the aboutToBlock() and awake() should be connected after initializePlatform().
9fb289
+    // Otherwise the connected flushRequests() may consumes up all events before processEvents starts to wait,
9fb289
+    // so that processEvents(QEventLoop::WaitForMoreEvents) may be blocked in the forceRoundTrip().
9fb289
+    QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher;
9fb289
+    QObject::connect(dispatcher, SIGNAL(aboutToBlock()), mDisplay.data(), SLOT(flushRequests()));
9fb289
+    QObject::connect(dispatcher, SIGNAL(awake()), mDisplay.data(), SLOT(flushRequests()));
9fb289
+
9fb289
     // Qt does not support running with no screens
9fb289
     mDisplay->ensureScreen();
9fb289
 }
9fb289
-- 
9fb289
2.35.1
9fb289