From 0394f58101c41cadc4540194ca69977f9e875a27 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 30 Sep 2019 12:28:07 +0300 Subject: [PATCH] Schedule correct damage and repaints region in addDamageFull for csd clients Summary: The damage region is in surface-local coordinates, while the repaints region is in frame-local coordinates, i.e. relative to the top-left corner of the frame geometry. Reviewers: #kwin, romangg Reviewed By: #kwin, romangg Subscribers: romangg, kwin Tags: #kwin Maniphest Tasks: T10867 Differential Revision: https://phabricator.kde.org/D24460 --- toplevel.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/toplevel.cpp b/toplevel.cpp index 735aeba3e9..18000445d6 100644 --- a/toplevel.cpp +++ b/toplevel.cpp @@ -419,10 +419,18 @@ void Toplevel::addDamageFull() if (!compositing()) return; - damage_region = rect(); - repaints_region |= rect(); + const QRect bufferRect = bufferGeometry(); + const QRect frameRect = frameGeometry(); - emit damaged(this, rect()); + const int offsetX = bufferRect.x() - frameRect.x(); + const int offsetY = bufferRect.y() - frameRect.y(); + + const QRect damagedRect = QRect(0, 0, bufferRect.width(), bufferRect.height()); + + damage_region = damagedRect; + repaints_region |= damagedRect.translated(offsetX, offsetY); + + emit damaged(this, damagedRect); } void Toplevel::resetDamage()