diff --git a/kdecoration/breezedecoration.h b/kdecoration/breezedecoration.h --- a/kdecoration/breezedecoration.h +++ b/kdecoration/breezedecoration.h @@ -150,6 +150,11 @@ //* active state change opacity qreal m_opacity = 0; + qreal m_scalingFactor; + + qreal frameRadius(qreal bias = 0) { + return (Metrics::Frame_FrameRadius + bias) * m_scalingFactor; + } }; bool Decoration::hasBorders() const diff --git a/kdecoration/breezedecoration.cpp b/kdecoration/breezedecoration.cpp --- a/kdecoration/breezedecoration.cpp +++ b/kdecoration/breezedecoration.cpp @@ -371,6 +371,10 @@ void Decoration::reconfigure() { + // this only affects X11 + // on Wayland it's always 1 + m_scalingFactor = qMax(1.0, QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96.0); + m_internalSettings = SettingsProvider::self()->internalSettings( this ); // animation @@ -534,7 +538,7 @@ // clip away the top part if( !hideTitleBar() ) painter->setClipRect(0, borderTop(), size().width(), size().height() - borderTop(), Qt::IntersectClip); - if( s->isAlphaChannelSupported() ) painter->drawRoundedRect(rect(), Metrics::Frame_FrameRadius, Metrics::Frame_FrameRadius); + if( s->isAlphaChannelSupported() ) painter->drawRoundedRect(rect(), frameRadius(), frameRadius()); else painter->drawRect( rect() ); painter->restore(); @@ -592,19 +596,19 @@ } else if( c->isShaded() ) { - painter->drawRoundedRect(titleRect, Metrics::Frame_FrameRadius, Metrics::Frame_FrameRadius); + painter->drawRoundedRect(titleRect, frameRadius(), frameRadius()); } else { painter->setClipRect(titleRect, Qt::IntersectClip); // the rect is made a little bit larger to be able to clip away the rounded corners at the bottom and sides painter->drawRoundedRect(titleRect.adjusted( - isLeftEdge() ? -Metrics::Frame_FrameRadius:0, - isTopEdge() ? -Metrics::Frame_FrameRadius:0, - isRightEdge() ? Metrics::Frame_FrameRadius:0, - Metrics::Frame_FrameRadius), - Metrics::Frame_FrameRadius, Metrics::Frame_FrameRadius); + isLeftEdge() ? -frameRadius():0, + isTopEdge() ? -frameRadius():0, + isRightEdge() ? frameRadius():0, + frameRadius()), + frameRadius(), frameRadius()); } @@ -774,17 +778,16 @@ painter.setCompositionMode(QPainter::CompositionMode_DestinationOut); painter.drawRoundedRect( innerRect, - Metrics::Frame_FrameRadius + 0.5, - Metrics::Frame_FrameRadius + 0.5); - + frameRadius(0.5), + frameRadius(0.5)); // Draw outline. - painter.setPen(withOpacity(g_shadowColor, 0.2 * strength)); + painter.setPen(QPen(withOpacity(g_shadowColor, 0.2 * strength), m_scalingFactor * m_scalingFactor)); painter.setBrush(Qt::NoBrush); painter.setCompositionMode(QPainter::CompositionMode_SourceOver); painter.drawRoundedRect( innerRect, - Metrics::Frame_FrameRadius - 0.5, - Metrics::Frame_FrameRadius - 0.5); + frameRadius(-0.5), + frameRadius(-0.5)); painter.end();