From 4ddb4a23d5f453cf890c9f1b1aa5429150991db3 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Thu, 26 Jun 2025 17:00:07 +0200 Subject: [PATCH] scene: Skip visibility check for the Item itself in framePainted Fixes offscreen rendering and window thumbnails for hidden windows not udpating. Co-authored-by: Vlad Zahorodnii --- src/scene/item.cpp | 9 +++++---- src/scene/item.h | 2 +- src/scene/rootitem.cpp | 9 --------- src/scene/rootitem.h | 2 -- 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/scene/item.cpp b/src/scene/item.cpp index 2637a131dbd..eb2b6b46977 100644 --- a/src/scene/item.cpp +++ b/src/scene/item.cpp @@ -648,12 +648,13 @@ void Item::removeEffect() void Item::framePainted(Output *output, OutputFrame *frame, std::chrono::milliseconds timestamp) { - if (!isVisible() || workspace()->outputAt(mapToScene(boundingRect()).center()) != output) { - return; - } + // The visibility of the item itself is not checked here to be able to paint hidden items for + // things like screncasts or thumbnails handleFramePainted(output, frame, timestamp); for (const auto child : std::as_const(m_childItems)) { - child->framePainted(output, frame, timestamp); + if (child->explicitVisible() && workspace()->outputAt(child->mapToScene(child->boundingRect()).center()) == output) { + child->framePainted(output, frame, timestamp); + } } } diff --git a/src/scene/item.h b/src/scene/item.h index acb29994328..d42b32abf7b 100644 --- a/src/scene/item.h +++ b/src/scene/item.h @@ -144,7 +144,7 @@ public: void addEffect(); void removeEffect(); - virtual void framePainted(Output *output, OutputFrame *frame, std::chrono::milliseconds timestamp); + void framePainted(Output *output, OutputFrame *frame, std::chrono::milliseconds timestamp); bool isAncestorOf(const Item *item) const; diff --git a/src/scene/rootitem.cpp b/src/scene/rootitem.cpp index fe0cecc76e3..466a25ce828 100644 --- a/src/scene/rootitem.cpp +++ b/src/scene/rootitem.cpp @@ -14,13 +14,4 @@ RootItem::RootItem(Scene *scene) setScene(scene); } -void RootItem::framePainted(Output *output, OutputFrame *frame, std::chrono::milliseconds timestamp) -{ - handleFramePainted(output, frame, timestamp); - const auto children = childItems(); - for (const auto child : children) { - child->framePainted(output, frame, timestamp); - } -} - } // namespace KWin diff --git a/src/scene/rootitem.h b/src/scene/rootitem.h index 45fa1359c84..43b3cdb90e9 100644 --- a/src/scene/rootitem.h +++ b/src/scene/rootitem.h @@ -20,8 +20,6 @@ class KWIN_EXPORT RootItem : public Item public: explicit RootItem(Scene *scene); - - void framePainted(Output *output, OutputFrame *frame, std::chrono::milliseconds timestamp) override; }; } // namespace KWin -- GitLab