diff options
author | Elvis Lee <kwangwoong.lee@lge.com> | 2021-03-17 16:31:10 +0900 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2021-04-13 06:44:18 +0000 |
commit | 654a54755138c520c3a41210d8078196e9a2c1bf (patch) | |
tree | ff0a8c1c25efc9903a13f4d5a77b457a94f4daf9 /src/client/qwaylandintegration.cpp | |
parent | befa2e11a87876cd3da8336370ae8f7f2fed004c (diff) |
Connect flushRequest after forceRoundTrip
If flushRequest is connected with aboutToBlock, the flushRequest
may consumes all events so that processEvents might be blocked in forceRoundTrip.
Change-Id: I12b2c506e8442bf0e75f6ab6e418d3e1eea6d68c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/client/qwaylandintegration.cpp')
-rw-r--r-- | src/client/qwaylandintegration.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp index 09de7dddd..41e6c50f8 100644 --- a/src/client/qwaylandintegration.cpp +++ b/src/client/qwaylandintegration.cpp @@ -208,17 +208,20 @@ void QWaylandIntegration::initializePlatform() void QWaylandIntegration::initialize() { - QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher; - QObject::connect(dispatcher, SIGNAL(aboutToBlock()), mDisplay.data(), SLOT(flushRequests())); - QObject::connect(dispatcher, SIGNAL(awake()), mDisplay.data(), SLOT(flushRequests())); - 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())); - // Call after eventDispatcher is fully connected, for QWaylandDisplay::forceRoundTrip() + // Call this after eventDispatcher is connected with QSocketNotifier for QWaylandDisplay::forceRoundTrip() initializePlatform(); + // But the aboutToBlock() and awake() should be connected after initializePlatform(). + // Otherwise the connected flushRequests() may consumes up all events before processEvents starts to wait, + // so that processEvents(QEventLoop::WaitForMoreEvents) may be blocked in the forceRoundTrip(). + QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher; + QObject::connect(dispatcher, SIGNAL(aboutToBlock()), mDisplay.data(), SLOT(flushRequests())); + QObject::connect(dispatcher, SIGNAL(awake()), mDisplay.data(), SLOT(flushRequests())); + // Qt does not support running with no screens mDisplay->ensureScreen(); } |