Backport recommended by KDE[1]. [1] https://invent.kde.org/qt/qt/qtwayland/-/commit/e4556c59f0c8250da7c16759432b2ac0a5ac9d9f [2] https://mail.kde.org/pipermail/distributions/2025-April/001575.html From e4556c59f0c8250da7c16759432b2ac0a5ac9d9f Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 31 Mar 2025 11:40:12 +0300 Subject: [PATCH] Client: Reset mFrameCallbackTimedOut when showing a window When a window is hidden, the corresponding expose event is sent asynchronously. So, a buffer (and a frame callback) can be attached after the window is hidden. QWaylandWindow::initWindow() handles that case by attaching a nil buffer to the surface, but it skips resetting the frame callback things. If mFrameCallbackTimedOut is not reset, then the window can get stuck in the unexposed state and not show up after the second setVisible(true). This change makes the initWindow() function also reset frame callback data. It fixes some windows not showing up after remapping them. --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -107,4 +107,5 @@ mSurface->attach(nullptr, 0, 0); mSurface->commit(); + resetFrameCallback(); if (window()->type() == Qt::Desktop) @@ -326,4 +327,13 @@ delete std::exchange(mSubSurfaceWindow, nullptr); emit surfaceRoleDestroyed(); + + resetFrameCallback(); + mInFrameRender = false; + mWaitingToApplyConfigure = false; + mExposed = false; +} + +void QWaylandWindow::resetFrameCallback() +{ { QMutexLocker lock(&mFrameSyncMutex); @@ -339,8 +349,5 @@ mFrameCallbackCheckIntervalTimerId = -1; } - mInFrameRender = false; mFrameCallbackTimedOut = false; - mWaitingToApplyConfigure = false; - mExposed = false; } --- a/src/client/qwaylandwindow_p.h +++ b/src/client/qwaylandwindow_p.h @@ -352,4 +352,5 @@ bool shouldCreateSubSurface() const; void resetSurfaceRole(); + void resetFrameCallback(); QPlatformScreen *calculateScreenFromSurfaceEvents() const; void setOpaqueArea(const QRegion &opaqueArea);