From e117caa3eb27d113bed4ab8a1e57ddc120b5b51f Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 4 Feb 2021 18:27:17 +0200 Subject: [PATCH] x11: Fix damage region updates We cannot use addDamage() in getDamageReply() because the former sets back the m_isDamaged flag. --- toplevel.cpp | 21 ++++++++------------- toplevel.h | 1 + 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/toplevel.cpp b/toplevel.cpp index 821830c572..b85b6e6899 100644 --- a/toplevel.cpp +++ b/toplevel.cpp @@ -403,7 +403,7 @@ void Toplevel::getDamageRegionReply() reply->extents.width, reply->extents.height); free(reply); - addDamage(region); + addDamage_helper(region); } void Toplevel::addDamageFull() @@ -412,17 +412,7 @@ void Toplevel::addDamageFull() return; const QRect bufferRect = bufferGeometry(); - const QRect frameRect = frameGeometry(); - - const int offsetX = bufferRect.x() - frameRect.x(); - const int offsetY = bufferRect.y() - frameRect.y(); - - const QRect damagedRect(0, 0, bufferRect.width(), bufferRect.height()); - - damage_region = damagedRect; - addRepaint(damagedRect.translated(offsetX, offsetY)); - - emit damaged(this, damage_region); + addDamage_helper(QRect(0, 0, bufferRect.width(), bufferRect.height())); } void Toplevel::resetDamage() @@ -738,11 +728,16 @@ void Toplevel::setSurface(KWaylandServer::SurfaceInterface *surface) } void Toplevel::addDamage(const QRegion &damage) +{ + m_isDamaged = true; + addDamage_helper(damage); +} + +void Toplevel::addDamage_helper(const QRegion &damage) { const QRect bufferRect = bufferGeometry(); const QRect frameRect = frameGeometry(); - m_isDamaged = true; damage_region += damage; addRepaint(damage.translated(bufferRect.topLeft() - frameRect.topLeft())); diff --git a/toplevel.h b/toplevel.h index 7712c2aa83..572bef0e7f 100644 --- a/toplevel.h +++ b/toplevel.h @@ -695,6 +695,7 @@ protected: void discardWindowPixmap(); void addDamageFull(); virtual void addDamage(const QRegion &damage); + void addDamage_helper(const QRegion &damage); Xcb::Property fetchWmClientLeader() const; void readWmClientLeader(Xcb::Property &p); void getWmClientLeader();