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

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