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

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