From f57c08f13c9fadebea866ff40a27ebdc6c613bd3 Mon Sep 17 00:00:00 2001 From: Akseli Lahtinen Date: Fri, 20 Jan 2023 15:16:38 +0000 Subject: [PATCH] kdecoration: Fix outline gap with fractional scale There was some old code lying around from when there was only one outline which was on top of titlebar. This removes all that, which fixes the bug. BUG: 461358 FIXED-IN: 5.27 (cherry picked from commit dc404b0c00930d72487ad2fe5745677b8eec3d1f) --- kdecoration/breezedecoration.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/kdecoration/breezedecoration.cpp b/kdecoration/breezedecoration.cpp index f1574983..cc5bb75d 100644 --- a/kdecoration/breezedecoration.cpp +++ b/kdecoration/breezedecoration.cpp @@ -571,11 +571,8 @@ void Decoration::paint(QPainter *painter, const QRect &repaintRegion) void Decoration::paintTitleBar(QPainter *painter, const QRect &repaintRegion) { const auto c = client().toStrongRef(); - // Check if the window is maximized and if so, remove the extra gap that makes room for outlines, - // since they're not even drawn when window is maximized - const int outlineGap = isMaximized() ? 0 : 1; - const QRect frontRect(QPoint(0, 1), QSize(size().width(), borderTop())); - const QRect backRect(QPoint(0, outlineGap), QSize(size().width(), borderTop() - outlineGap)); + const QRect frontRect(QPoint(0, 0), QSize(size().width(), borderTop())); + const QRect backRect(QPoint(0, 0), QSize(size().width(), borderTop())); QBrush frontBrush; QBrush backBrush(this->titleBarColor()); @@ -827,8 +824,7 @@ QSharedPointer Decoration::createShadowObject(co const qreal outlineWidth = 1.001; const qreal penOffset = outlineWidth / 2; - // Titlebar already has an outline, so move the top of the outline on the same level to avoid 2px width on top outline. - QRectF outlineRect = innerRect + QMarginsF(penOffset, -penOffset, penOffset, penOffset); + QRectF outlineRect = innerRect + QMarginsF(penOffset, penOffset, penOffset, penOffset); qreal cornerSize = m_scaledCornerRadius * 2; QRectF cornerRect(outlineRect.x(), outlineRect.y(), cornerSize, cornerSize); QPainterPath outlinePath;