diff options
-rw-r--r-- | src/client/qwaylandwindow.cpp | 46 | ||||
-rw-r--r-- | src/client/qwaylandwindow_p.h | 1 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandsurface.cpp | 3 | ||||
-rw-r--r-- | src/compositor/extensions/qwaylandwlshell.cpp | 3 | ||||
-rw-r--r-- | src/imports/compositor/WaylandCursorItem.qml | 2 | ||||
-rw-r--r-- | tests/auto/client/client/tst_client.cpp | 3 | ||||
-rw-r--r-- | tests/auto/client/inputcontext/tst_inputcontext.cpp | 3 | ||||
-rw-r--r-- | tests/auto/client/shared/corecompositor.cpp | 1 | ||||
-rw-r--r-- | tests/auto/client/shared/mockcompositor.h | 3 | ||||
-rw-r--r-- | tests/auto/compositor/compositor/tst_compositor.cpp | 7 |
10 files changed, 27 insertions, 45 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index ae26ba049..8d34afd1f 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -1105,25 +1105,6 @@ QVariant QWaylandWindow::property(const QString &name, const QVariant &defaultVa void QWaylandWindow::timerEvent(QTimerEvent *event) { - if (event->timerId() == mFallbackUpdateTimerId) { - killTimer(mFallbackUpdateTimerId); - mFallbackUpdateTimerId = -1; - qCDebug(lcWaylandBackingstore) << "mFallbackUpdateTimer timed out"; - - if (!isExposed()) { - qCDebug(lcWaylandBackingstore) << "Fallback update timer: Window not exposed," - << "not delivering update request."; - return; - } - - if (mWaitingForUpdate && hasPendingUpdateRequest() && !mWaitingForFrameCallback) { - qCWarning(lcWaylandBackingstore) << "Delivering update request through fallback timer," - << "may not be in sync with display"; - deliverUpdateRequest(); - } - } - - if (mFrameCallbackTimerId.testAndSetOrdered(event->timerId(), -1)) { killTimer(event->timerId()); qCDebug(lcWaylandBackingstore) << "Didn't receive frame callback in time, window should now be inexposed"; @@ -1135,6 +1116,7 @@ void QWaylandWindow::timerEvent(QTimerEvent *event) void QWaylandWindow::requestUpdate() { + qCDebug(lcWaylandBackingstore) << "requestUpdate"; Q_ASSERT(hasPendingUpdateRequest()); // should be set by QPA // If we have a frame callback all is good and will be taken care of there @@ -1142,20 +1124,17 @@ void QWaylandWindow::requestUpdate() return; // If we've already called deliverUpdateRequest(), but haven't seen any attach+commit/swap yet - if (mWaitingForUpdate) { - // Ideally, we should just have returned here, but we're not guaranteed that the client - // will actually update, so start this timer to deliver another request update after a while - // *IF* the client doesn't update. - int fallbackTimeout = 100; - mFallbackUpdateTimerId = startTimer(fallbackTimeout); - return; - } + // This is a somewhat redundant behavior and might indicate a bug in the calling code, so log + // here so we can get this information when debugging update/frame callback issues. + // Continue as nothing happened, though. + if (mWaitingForUpdate) + qCDebug(lcWaylandBackingstore) << "requestUpdate called twice without committing anything"; // Some applications (such as Qt Quick) depend on updates being delivered asynchronously, // so use invokeMethod to delay the delivery a bit. QMetaObject::invokeMethod(this, [this] { // Things might have changed in the meantime - if (hasPendingUpdateRequest() && !mWaitingForUpdate && !mWaitingForFrameCallback) + if (hasPendingUpdateRequest() && !mWaitingForFrameCallback) deliverUpdateRequest(); }, Qt::QueuedConnection); } @@ -1165,6 +1144,7 @@ void QWaylandWindow::requestUpdate() // Can be called from the render thread (without locking anything) so make sure to not make races in this method. void QWaylandWindow::handleUpdate() { + qCDebug(lcWaylandBackingstore) << "handleUpdate" << QThread::currentThread(); // TODO: Should sync subsurfaces avoid requesting frame callbacks? QReadLocker lock(&mSurfaceLock); if (!isInitialized()) @@ -1175,15 +1155,6 @@ void QWaylandWindow::handleUpdate() mFrameCallback = nullptr; } - if (mFallbackUpdateTimerId != -1) { - // Ideally, we would stop the fallback timer here, but since we're on another thread, - // it's not allowed. Instead we set mFallbackUpdateTimer to -1 here, so we'll just - // ignore it if it times out before it's cleaned up by the invokeMethod call. - int id = mFallbackUpdateTimerId; - mFallbackUpdateTimerId = -1; - QMetaObject::invokeMethod(this, [this, id] { killTimer(id); }, Qt::QueuedConnection); - } - mFrameCallback = frame(); wl_callback_add_listener(mFrameCallback, &QWaylandWindow::callbackListener, this); mWaitingForFrameCallback = true; @@ -1203,6 +1174,7 @@ void QWaylandWindow::handleUpdate() void QWaylandWindow::deliverUpdateRequest() { + qCDebug(lcWaylandBackingstore) << "deliverUpdateRequest"; mWaitingForUpdate = true; QPlatformWindow::deliverUpdateRequest(); } diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h index b03d92e56..e4a1124e7 100644 --- a/src/client/qwaylandwindow_p.h +++ b/src/client/qwaylandwindow_p.h @@ -232,7 +232,6 @@ protected: // True when we have called deliverRequestUpdate, but the client has not yet attached a new buffer bool mWaitingForUpdate = false; - int mFallbackUpdateTimerId = -1; // Started when waiting for app to commit QMutex mResizeLock; bool mWaitingToApplyConfigure = false; diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp index a82c93f7b..8c866351f 100644 --- a/src/compositor/compositor_api/qwaylandsurface.cpp +++ b/src/compositor/compositor_api/qwaylandsurface.cpp @@ -391,7 +391,8 @@ QWaylandSurface::QWaylandSurface(QWaylandSurfacePrivate &dptr) QWaylandSurface::~QWaylandSurface() { Q_D(QWaylandSurface); - QWaylandCompositorPrivate::get(d->compositor)->unregisterSurface(this); + if (d->compositor) + QWaylandCompositorPrivate::get(d->compositor)->unregisterSurface(this); d->notifyViewsAboutDestruction(); } diff --git a/src/compositor/extensions/qwaylandwlshell.cpp b/src/compositor/extensions/qwaylandwlshell.cpp index 66aeb64ba..924234887 100644 --- a/src/compositor/extensions/qwaylandwlshell.cpp +++ b/src/compositor/extensions/qwaylandwlshell.cpp @@ -466,7 +466,8 @@ QWaylandWlShellSurface::QWaylandWlShellSurface(QWaylandWlShell *shell, QWaylandS QWaylandWlShellSurface::~QWaylandWlShellSurface() { Q_D(QWaylandWlShellSurface); - QWaylandWlShellPrivate::get(d->m_shell)->unregisterShellSurface(this); + if (d->m_shell) + QWaylandWlShellPrivate::get(d->m_shell)->unregisterShellSurface(this); } /*! diff --git a/src/imports/compositor/WaylandCursorItem.qml b/src/imports/compositor/WaylandCursorItem.qml index 1fa099676..e50c82d56 100644 --- a/src/imports/compositor/WaylandCursorItem.qml +++ b/src/imports/compositor/WaylandCursorItem.qml @@ -73,7 +73,7 @@ WaylandQuickItem { x: cursorItem.hotspotX + offset.x y: cursorItem.hotspotY + offset.y z: -1 - surface: cursorItem.seat.drag.icon + surface: cursorItem.seat ? cursorItem.seat.drag.icon : null Connections { target: dragIcon.surface diff --git a/tests/auto/client/client/tst_client.cpp b/tests/auto/client/client/tst_client.cpp index 83b9e6ce0..e7729ce8b 100644 --- a/tests/auto/client/client/tst_client.cpp +++ b/tests/auto/client/client/tst_client.cpp @@ -507,7 +507,8 @@ void tst_WaylandClient::longWindowTitleWithUtf16Characters() int main(int argc, char **argv) { - setenv("XDG_RUNTIME_DIR", ".", 1); + QTemporaryDir tmpRuntimeDir; + setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1); setenv("QT_QPA_PLATFORM", "wayland", 1); // force QGuiApplication to use wayland plugin MockCompositor compositor; diff --git a/tests/auto/client/inputcontext/tst_inputcontext.cpp b/tests/auto/client/inputcontext/tst_inputcontext.cpp index b1a5a7f17..3e6de4a08 100644 --- a/tests/auto/client/inputcontext/tst_inputcontext.cpp +++ b/tests/auto/client/inputcontext/tst_inputcontext.cpp @@ -173,7 +173,8 @@ void tst_inputcontext::inputContextReconfigurationWhenTogglingTextInputExtension int main(int argc, char *argv[]) { - qputenv("XDG_RUNTIME_DIR", "."); + QTemporaryDir tmpRuntimeDir; + qputenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit()); qputenv("QT_QPA_PLATFORM", "wayland"); tst_inputcontext tc; diff --git a/tests/auto/client/shared/corecompositor.cpp b/tests/auto/client/shared/corecompositor.cpp index 7edb1c2d4..5c6c83baa 100644 --- a/tests/auto/client/shared/corecompositor.cpp +++ b/tests/auto/client/shared/corecompositor.cpp @@ -43,6 +43,7 @@ CoreCompositor::CoreCompositor() } }) { + qputenv("WAYLAND_DISPLAY", m_socketName); m_timer.start(); Q_ASSERT(isClean()); } diff --git a/tests/auto/client/shared/mockcompositor.h b/tests/auto/client/shared/mockcompositor.h index 05bf32c8d..f5264ccf6 100644 --- a/tests/auto/client/shared/mockcompositor.h +++ b/tests/auto/client/shared/mockcompositor.h @@ -77,7 +77,8 @@ public: #define QCOMPOSITOR_TEST_MAIN(test) \ int main(int argc, char **argv) \ { \ - setenv("XDG_RUNTIME_DIR", ".", 1); \ + QTemporaryDir tmpRuntimeDir; \ + setenv("XDG_RUNTIME_DIR", tmpRuntimeDir.path().toLocal8Bit(), 1); \ setenv("XDG_CURRENT_DESKTOP", "qtwaylandtests", 1); \ setenv("QT_QPA_PLATFORM", "wayland", 1); \ test tc; \ diff --git a/tests/auto/compositor/compositor/tst_compositor.cpp b/tests/auto/compositor/compositor/tst_compositor.cpp index c425f2ba1..c286aae70 100644 --- a/tests/auto/compositor/compositor/tst_compositor.cpp +++ b/tests/auto/compositor/compositor/tst_compositor.cpp @@ -110,10 +110,15 @@ private slots: void viewportDestinationNoSurfaceError(); void viewportSourceNoSurfaceError(); void viewportHiDpi(); + +private: + QTemporaryDir m_tmpRuntimeDir; }; void tst_WaylandCompositor::init() { - qputenv("XDG_RUNTIME_DIR", "."); + // We need to set a test specific runtime dir so we don't conflict with other tests' + // compositors by accident. + qputenv("XDG_RUNTIME_DIR", m_tmpRuntimeDir.path().toLocal8Bit()); } void tst_WaylandCompositor::singleClient() |