diff --git a/src/effects.cpp b/src/effects.cpp index 19f12a7ff1..0910b9e485 100644 --- a/src/effects.cpp +++ b/src/effects.cpp @@ -562,13 +562,13 @@ void EffectsHandlerImpl::slotTabRemoved(EffectWindow *w, EffectWindow *leaderOfF Q_EMIT tabRemoved(w, leaderOfFormerGroup); } -void EffectsHandlerImpl::slotWindowDamaged(Window *window, const QRegion &r) +void EffectsHandlerImpl::slotWindowDamaged(Window *window) { if (!window->effectWindow()) { // can happen during tear down of window return; } - Q_EMIT windowDamaged(window->effectWindow(), r); + Q_EMIT windowDamaged(window->effectWindow()); } void EffectsHandlerImpl::slotGeometryShapeChanged(Window *window, const QRectF &old) diff --git a/src/effects.h b/src/effects.h index b0e726701e..674ee2d3a9 100644 --- a/src/effects.h +++ b/src/effects.h @@ -288,7 +288,7 @@ protected Q_SLOTS: void slotClientModalityChanged(); void slotGeometryShapeChanged(KWin::Window *window, const QRectF &old); void slotFrameGeometryChanged(Window *window, const QRectF &oldGeometry); - void slotWindowDamaged(KWin::Window *window, const QRegion &r); + void slotWindowDamaged(KWin::Window *window); void slotOutputAdded(Output *output); void slotOutputRemoved(Output *output); diff --git a/src/effects/thumbnailaside/thumbnailaside.cpp b/src/effects/thumbnailaside/thumbnailaside.cpp index 8c6b137b48..f45b37e1a0 100644 --- a/src/effects/thumbnailaside/thumbnailaside.cpp +++ b/src/effects/thumbnailaside/thumbnailaside.cpp @@ -71,7 +71,7 @@ void ThumbnailAsideEffect::paintWindow(EffectWindow *w, int mask, QRegion region painted |= region; } -void ThumbnailAsideEffect::slotWindowDamaged(EffectWindow *w, const QRegion &) +void ThumbnailAsideEffect::slotWindowDamaged(EffectWindow *w) { for (const Data &d : std::as_const(windows)) { if (d.window == w) { diff --git a/src/effects/thumbnailaside/thumbnailaside.h b/src/effects/thumbnailaside/thumbnailaside.h index d37b670d17..6827002c33 100644 --- a/src/effects/thumbnailaside/thumbnailaside.h +++ b/src/effects/thumbnailaside/thumbnailaside.h @@ -61,7 +61,7 @@ private Q_SLOTS: void toggleCurrentThumbnail(); void slotWindowClosed(KWin::EffectWindow *w); void slotWindowFrameGeometryChanged(KWin::EffectWindow *w, const QRectF &old); - void slotWindowDamaged(KWin::EffectWindow *w, const QRegion &damage); + void slotWindowDamaged(KWin::EffectWindow *w); void repaintAll(); private: diff --git a/src/libkwineffects/kwineffects.h b/src/libkwineffects/kwineffects.h index 5ac6a3d4d3..2437cba2eb 100644 --- a/src/libkwineffects/kwineffects.h +++ b/src/libkwineffects/kwineffects.h @@ -1702,7 +1702,7 @@ Q_SIGNALS: * @param r Always empty. * @since 4.7 */ - void windowDamaged(KWin::EffectWindow *w, const QRegion &r); + void windowDamaged(KWin::EffectWindow *w); /** * Signal emitted when a tabbox is added. * An effect who wants to replace the tabbox with itself should use refTabBox. diff --git a/src/plugins/screencast/screencastmanager.cpp b/src/plugins/screencast/screencastmanager.cpp index c58e106857..6936b32b84 100644 --- a/src/plugins/screencast/screencastmanager.cpp +++ b/src/plugins/screencast/screencastmanager.cpp @@ -72,8 +72,8 @@ private: { connect(Compositor::self()->scene(), &Scene::frameRendered, this, &WindowStream::bufferToStream); - connect(m_window, &Window::damaged, this, &WindowStream::includeDamage); - m_damagedRegion = m_window->visibleGeometry().toAlignedRect(); + connect(m_window, &Window::damaged, this, &WindowStream::markDirty); + markDirty(); m_window->output()->renderLoop()->scheduleRepaint(); } @@ -82,22 +82,21 @@ private: disconnect(Compositor::self()->scene(), &Scene::frameRendered, this, &WindowStream::bufferToStream); } - void includeDamage(Window *window, const QRegion &damage) + void markDirty() { - Q_ASSERT(m_window == window); - m_damagedRegion |= damage; + m_dirty = true; } void bufferToStream() { - if (!m_damagedRegion.isEmpty()) { - recordFrame(m_damagedRegion); - m_damagedRegion = {}; + if (m_dirty) { + recordFrame(QRegion(0, 0, m_window->width(), m_window->height())); + m_dirty = false; } } - QRegion m_damagedRegion; Window *m_window; + bool m_dirty = false; }; void ScreencastManager::streamWindow(KWaylandServer::ScreencastStreamV1Interface *waylandStream, diff --git a/src/surfaceitem.cpp b/src/surfaceitem.cpp index a76878ac09..f3edb1fb2e 100644 --- a/src/surfaceitem.cpp +++ b/src/surfaceitem.cpp @@ -42,7 +42,7 @@ void SurfaceItem::addDamage(const QRegion ®ion) m_damage += region; scheduleRepaint(region); - Q_EMIT m_window->damaged(m_window, region); + Q_EMIT m_window->damaged(m_window); } void SurfaceItem::resetDamage() diff --git a/src/window.h b/src/window.h index 1ba9649575..f978a61833 100644 --- a/src/window.h +++ b/src/window.h @@ -1438,7 +1438,7 @@ Q_SIGNALS: void stackingOrderChanged(); void shadeChanged(); void opacityChanged(KWin::Window *window, qreal oldOpacity); - void damaged(KWin::Window *window, const QRegion &damage); + void damaged(KWin::Window *window); void inputTransformationChanged(); /** * This signal is emitted when the Window's frame geometry changes.