Unset suspended state of windows that are marked for offscreen rendering

Otherwise some clients will not render anything even though we are
sending frame callbacks.
BUG:487702
FIXED-IN:6.1
This commit is contained in:
David Redondo 2024-05-29 10:55:45 +02:00
parent 64ddeff3bd
commit cefcdf7db5
3 changed files with 14 additions and 4 deletions

View file

@ -50,6 +50,7 @@ WindowItem::WindowItem(Window *window, Item *parent)
connect(window, &Window::hiddenByShowDesktopChanged, this, &WindowItem::updateVisibility);
connect(window, &Window::activitiesChanged, this, &WindowItem::updateVisibility);
connect(window, &Window::desktopsChanged, this, &WindowItem::updateVisibility);
connect(window, &Window::offscreenRenderingChanged, this, &WindowItem::updateVisibility);
connect(workspace(), &Workspace::currentActivityChanged, this, &WindowItem::updateVisibility);
connect(workspace(), &Workspace::currentDesktopChanged, this, &WindowItem::updateVisibility);
updateVisibility();
@ -187,7 +188,7 @@ void WindowItem::updateVisibility()
setVisible(visible);
if (m_window->readyForPainting()) {
m_window->setSuspended(!visible);
m_window->setSuspended(!visible && !m_window->isOffscreenRendering());
}
}

View file

@ -4261,10 +4261,11 @@ bool Window::isLockScreenOverlay() const
void Window::refOffscreenRendering()
{
if (m_offscreenRenderCount == 0) {
m_offscreenFramecallbackTimer.start(1'000'000 / output()->refreshRate());
}
m_offscreenRenderCount++;
if (m_offscreenRenderCount == 1) {
m_offscreenFramecallbackTimer.start(1'000'000 / output()->refreshRate());
Q_EMIT offscreenRenderingChanged();
}
}
void Window::unrefOffscreenRendering()
@ -4273,9 +4274,15 @@ void Window::unrefOffscreenRendering()
m_offscreenRenderCount--;
if (m_offscreenRenderCount == 0) {
m_offscreenFramecallbackTimer.stop();
Q_EMIT offscreenRenderingChanged();
}
}
bool Window::isOffscreenRendering() const
{
return m_offscreenRenderCount > 0;
}
void Window::maybeSendFrameCallback()
{
if (m_surface && !m_windowItem->isVisible()) {

View file

@ -1322,6 +1322,7 @@ public:
void refOffscreenRendering();
void unrefOffscreenRendering();
bool isOffscreenRendering() const;
qreal preferredBufferScale() const;
void setPreferredBufferScale(qreal scale);
@ -1447,6 +1448,7 @@ Q_SIGNALS:
void readyForPaintingChanged();
void maximizeGeometryRestoreChanged();
void fullscreenGeometryRestoreChanged();
void offscreenRenderingChanged();
protected:
Window();