Get correct decoration margins region

Size we use to calculate margins region already contains size including
margins. This resulted into bigger region and not properly damaging
region we need to update.

Pick-to: 5.15 6.0 6.1
Change-Id: Id1b7f4cd2a7b894b82db09c5af2b2d1f1f43fa2a
Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
Jan Grulich 2021-02-11 15:12:32 +01:00
parent 37f04028ca
commit 4d666cd62e

View File

@ -108,11 +108,11 @@ void QWaylandAbstractDecoration::setWaylandWindow(QWaylandWindow *window)
static QRegion marginsRegion(const QSize &size, const QMargins &margins)
{
QRegion r;
const int widthWithMargins = margins.left() + size.width() + margins.right();
r += QRect(0, 0, widthWithMargins, margins.top()); // top
r += QRect(0, size.height()+margins.top(), widthWithMargins, margins.bottom()); //bottom
r += QRect(0, 0, size.width(), margins.top()); // top
r += QRect(0, size.height()-margins.bottom(), size.width(), margins.bottom()); //bottom
r += QRect(0, margins.top(), margins.left(), size.height()); //left
r += QRect(size.width()+margins.left(), margins.top(), margins.right(), size.height()); // right
r += QRect(size.width()-margins.left(), margins.top(), margins.right(), size.height()-margins.top()); // right
return r;
}