DecorationShadow uses QMargins for padding

This commit is contained in:
Martin Gräßlin 2014-11-11 15:18:35 +01:00
parent faa78e187e
commit 1afc355759
2 changed files with 9 additions and 20 deletions

View file

@ -348,10 +348,7 @@ void Decoration::init()
// create a dummy shadow for the configuration interface
if (m_padding) {
KDecoration2::DecorationShadow *s = new KDecoration2::DecorationShadow(this);
s->setPaddingLeft(m_padding->left());
s->setPaddingTop(m_padding->top());
s->setPaddingRight(m_padding->right());
s->setPaddingBottom(m_padding->bottom());
s->setPadding(*m_padding);
s->setTopLeft(QSize(m_padding->left(), m_padding->top()));
s->setTopRight(QSize(m_padding->right(), m_padding->top()));
s->setBottomLeft(QSize(m_padding->left(), m_padding->bottom()));
@ -406,10 +403,7 @@ void Decoration::paint(QPainter *painter, const QRegion &repaintRegion)
r = r.adjusted(m_padding->left(), m_padding->top(), -m_padding->right(), -m_padding->bottom());
KDecoration2::DecorationShadow *s = new KDecoration2::DecorationShadow(this);
s->setShadow(m_buffer);
s->setPaddingLeft(m_padding->left());
s->setPaddingTop(m_padding->top());
s->setPaddingRight(m_padding->right());
s->setPaddingBottom(m_padding->bottom());
s->setPadding(*m_padding);
s->setTopLeft(QSize(m_padding->left(), m_padding->top()));
s->setTopRight(QSize(m_padding->right(), m_padding->top()));
s->setBottomLeft(QSize(m_padding->left(), m_padding->bottom()));

View file

@ -165,10 +165,7 @@ bool Shadow::init(KDecoration2::Decoration *decoration)
disconnect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::bottomLeftChanged, m_topLevel, &Toplevel::getShadow);
disconnect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::leftChanged, m_topLevel, &Toplevel::getShadow);
disconnect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::shadowChanged, m_topLevel, &Toplevel::getShadow);
disconnect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::paddingLeftChanged, m_topLevel, &Toplevel::getShadow);
disconnect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::paddingTopChanged, m_topLevel, &Toplevel::getShadow);
disconnect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::paddingRightChanged, m_topLevel, &Toplevel::getShadow);
disconnect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::paddingBottomChanged, m_topLevel, &Toplevel::getShadow);
disconnect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::paddingChanged, m_topLevel, &Toplevel::getShadow);
}
m_decorationShadow = decoration->shadow();
if (!m_decorationShadow) {
@ -184,15 +181,13 @@ bool Shadow::init(KDecoration2::Decoration *decoration)
connect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::bottomLeftChanged, m_topLevel, &Toplevel::getShadow);
connect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::leftChanged, m_topLevel, &Toplevel::getShadow);
connect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::shadowChanged, m_topLevel, &Toplevel::getShadow);
connect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::paddingLeftChanged, m_topLevel, &Toplevel::getShadow);
connect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::paddingTopChanged, m_topLevel, &Toplevel::getShadow);
connect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::paddingRightChanged, m_topLevel, &Toplevel::getShadow);
connect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::paddingBottomChanged, m_topLevel, &Toplevel::getShadow);
connect(m_decorationShadow.data(), &KDecoration2::DecorationShadow::paddingChanged, m_topLevel, &Toplevel::getShadow);
m_topOffset = m_decorationShadow->paddingTop();
m_rightOffset = m_decorationShadow->paddingRight();
m_bottomOffset = m_decorationShadow->paddingBottom();
m_leftOffset = m_decorationShadow->paddingLeft();
const QMargins &p = m_decorationShadow->padding();
m_topOffset = p.top();
m_rightOffset = p.right();
m_bottomOffset = p.bottom();
m_leftOffset = p.left();
updateShadowRegion();
if (!prepareBackend()) {
return false;