Remove QRegion argument in Window::damaged() signal

In most places, it's actually not needed and we actually provide wrong
damage region at the moment anyway. In long term, it would be great to
drop the Window::damaged signal.
This commit is contained in:
Vlad Zahorodnii 2022-12-14 16:25:29 +02:00
parent b095f51035
commit 93f053b514
8 changed files with 16 additions and 17 deletions

View file

@ -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)

View file

@ -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);

View file

@ -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) {

View file

@ -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:

View file

@ -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.

View file

@ -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,

View file

@ -42,7 +42,7 @@ void SurfaceItem::addDamage(const QRegion &region)
m_damage += region;
scheduleRepaint(region);
Q_EMIT m_window->damaged(m_window, region);
Q_EMIT m_window->damaged(m_window);
}
void SurfaceItem::resetDamage()

View file

@ -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.