improve config windows calculated geometries

pull/5/head
Michail Vourlakos 6 years ago
parent 89fd411dab
commit 94415e24b4

@ -149,6 +149,21 @@ void Effects::setBackgroundOpacity(int opacity)
emit backgroundOpacityChanged(); emit backgroundOpacityChanged();
} }
int Effects::editShadow() const
{
return m_editShadow;
}
void Effects::setEditShadow(int shadow)
{
if (m_editShadow == shadow) {
return;
}
m_editShadow = shadow;
emit editShadowChanged();
}
int Effects::innerShadow() const int Effects::innerShadow() const
{ {
return m_innerShadow; return m_innerShadow;
@ -188,23 +203,23 @@ QRegion Effects::subtrackedMaskFromWindow(QRegion initialRegion, QQuickView *win
//! we need to subtrack the mask areas that overlap with underlying window //! we need to subtrack the mask areas that overlap with underlying window
switch (m_view->location()) { switch (m_view->location()) {
case Plasma::Types::TopEdge: case Plasma::Types::TopEdge:
windowMask.setTopLeft(QPoint(window->x() - m_view->x(), m_mask.y() - m_innerShadow)); windowMask.setTopLeft(QPoint(window->x() - m_view->x(), m_mask.y() - m_editShadow));
windowMask.setSize(QSize(window->width(), m_innerShadow)); windowMask.setSize(QSize(window->width(), m_editShadow));
break; break;
case Plasma::Types::LeftEdge: case Plasma::Types::LeftEdge:
windowMask.setTopLeft(QPoint(m_mask.right() + 1 - m_innerShadow, window->y() - m_view->y())); windowMask.setTopLeft(QPoint(m_mask.right() + 1 - m_editShadow, window->y() - m_view->y()));
windowMask.setSize(QSize(m_innerShadow, window->height())); windowMask.setSize(QSize(m_editShadow, window->height()));
break; break;
case Plasma::Types::RightEdge: case Plasma::Types::RightEdge:
windowMask.setTopLeft(QPoint(m_mask.x(), window->y() - m_view->y())); windowMask.setTopLeft(QPoint(m_mask.x(), window->y() - m_view->y()));
windowMask.setSize(QSize(m_innerShadow, window->height())); windowMask.setSize(QSize(m_editShadow, window->height()));
break; break;
case Plasma::Types::BottomEdge: case Plasma::Types::BottomEdge:
windowMask.setTopLeft(QPoint(window->x() - m_view->x(), m_mask.y())); windowMask.setTopLeft(QPoint(window->x() - m_view->x(), m_mask.y()));
windowMask.setSize(QSize(window->width(), m_innerShadow)); windowMask.setSize(QSize(window->width(), m_editShadow));
break; break;
default: default:

@ -47,6 +47,7 @@ class Effects: public QObject
//! thickness shadow size when is drawn inside the window from qml //! thickness shadow size when is drawn inside the window from qml
Q_PROPERTY(int backgroundOpacity READ backgroundOpacity WRITE setBackgroundOpacity NOTIFY backgroundOpacityChanged) Q_PROPERTY(int backgroundOpacity READ backgroundOpacity WRITE setBackgroundOpacity NOTIFY backgroundOpacityChanged)
Q_PROPERTY(int editShadow READ editShadow WRITE setEditShadow NOTIFY editShadowChanged)
Q_PROPERTY(int innerShadow READ innerShadow WRITE setInnerShadow NOTIFY innerShadowChanged) Q_PROPERTY(int innerShadow READ innerShadow WRITE setInnerShadow NOTIFY innerShadowChanged)
Q_PROPERTY(QRect mask READ mask WRITE setMask NOTIFY maskChanged) Q_PROPERTY(QRect mask READ mask WRITE setMask NOTIFY maskChanged)
@ -76,6 +77,9 @@ public:
int backgroundOpacity() const; int backgroundOpacity() const;
void setBackgroundOpacity(int opacity); void setBackgroundOpacity(int opacity);
int editShadow() const;
void setEditShadow(int shadow);
int innerShadow() const; int innerShadow() const;
void setInnerShadow(int shadow); void setInnerShadow(int shadow);
@ -98,6 +102,7 @@ signals:
void backgroundOpacityChanged(); void backgroundOpacityChanged();
void drawShadowsChanged(); void drawShadowsChanged();
void drawEffectsChanged(); void drawEffectsChanged();
void editShadowChanged();
void enabledBordersChanged(); void enabledBordersChanged();
void maskChanged(); void maskChanged();
void innerShadowChanged(); void innerShadowChanged();
@ -120,6 +125,7 @@ private:
bool m_settingsMaskSubtracted{false}; bool m_settingsMaskSubtracted{false};
int m_backgroundOpacity{100}; int m_backgroundOpacity{100};
int m_editShadow{0};
int m_innerShadow{0}; int m_innerShadow{0};
QRect m_rect; QRect m_rect;

@ -202,7 +202,8 @@ void PrimaryConfigView::syncGeometry()
resize(size); resize(size);
const auto location = m_latteView->containment()->location(); const auto location = m_latteView->containment()->location();
const auto sGeometry = m_latteView->screenGeometry(); const auto scrGeometry = m_latteView->screenGeometry();
const auto availGeometry = m_availableScreenGeometry;
int clearThickness = m_latteView->editThickness(); int clearThickness = m_latteView->editThickness();
@ -215,22 +216,22 @@ void PrimaryConfigView::syncGeometry()
case Plasma::Types::Horizontal: { case Plasma::Types::Horizontal: {
xPos = (m_complexity == Latte::Types::ExpertSettings) ? xPos = (m_complexity == Latte::Types::ExpertSettings) ?
m_latteView->x() + m_latteView->width() - size.width() : m_latteView->x() + m_latteView->width() - size.width() :
sGeometry.center().x() - size.width() / 2; scrGeometry.center().x() - size.width() / 2;
if (location == Plasma::Types::TopEdge) { if (location == Plasma::Types::TopEdge) {
yPos = sGeometry.y() + clearThickness; yPos = scrGeometry.y() + clearThickness;
} else if (location == Plasma::Types::BottomEdge) { } else if (location == Plasma::Types::BottomEdge) {
yPos = sGeometry.y() + sGeometry.height() - clearThickness - size.height(); yPos = scrGeometry.y() + scrGeometry.height() - clearThickness - size.height();
} }
} }
break; break;
case Plasma::Types::Vertical: { case Plasma::Types::Vertical: {
if (location == Plasma::Types::LeftEdge) { if (location == Plasma::Types::LeftEdge) {
xPos = sGeometry.x() + clearThickness; xPos = scrGeometry.x() + clearThickness;
yPos = m_latteView->geometry().center().y() - size.height() / 2; yPos = m_latteView->geometry().center().y() - size.height() / 2;
} else if (location == Plasma::Types::RightEdge) { } else if (location == Plasma::Types::RightEdge) {
xPos = sGeometry.x() + sGeometry.width() - clearThickness - size.width(); xPos = scrGeometry.x() + scrGeometry.width() - clearThickness - size.width();
yPos = m_latteView->geometry().center().y() - size.height() / 2; yPos = m_latteView->geometry().center().y() - size.height() / 2;
} }
} }

@ -153,7 +153,8 @@ void SecondaryConfigView::syncGeometry()
resize(size); resize(size);
const auto location = m_latteView->containment()->location(); const auto location = m_latteView->containment()->location();
const auto sGeometry = m_latteView->screenGeometry(); const auto scrGeometry = m_latteView->screenGeometry();
const auto availGeometry = m_parent->availableScreenGeometry();
int clearThickness = m_latteView->editThickness(); int clearThickness = m_latteView->editThickness();
@ -166,24 +167,23 @@ void SecondaryConfigView::syncGeometry()
switch (m_latteView->containment()->formFactor()) { switch (m_latteView->containment()->formFactor()) {
case Plasma::Types::Horizontal: { case Plasma::Types::Horizontal: {
xPos = availGeometry.x() + secondaryConfigSpacing;
if (location == Plasma::Types::TopEdge) { if (location == Plasma::Types::TopEdge) {
xPos = m_latteView->x() + secondaryConfigSpacing; yPos = scrGeometry.y() + clearThickness;
yPos = m_latteView->y() + clearThickness;
} else if (location == Plasma::Types::BottomEdge) { } else if (location == Plasma::Types::BottomEdge) {
xPos = m_latteView->x() + secondaryConfigSpacing; yPos = scrGeometry.y() + scrGeometry.height() - clearThickness - size.height();
//xPos = m_latteView->x() + m_latteView->width() - secondaryConfigSpacing - size.width();
yPos = sGeometry.y() + sGeometry.height() - clearThickness - size.height();
} }
} }
break; break;
case Plasma::Types::Vertical: { case Plasma::Types::Vertical: {
yPos = availGeometry.y() + secondaryConfigSpacing;
if (location == Plasma::Types::LeftEdge) { if (location == Plasma::Types::LeftEdge) {
xPos = sGeometry.x() + clearThickness; xPos = scrGeometry.x() + clearThickness;
yPos = m_latteView->y() + secondaryConfigSpacing;
} else if (location == Plasma::Types::RightEdge) { } else if (location == Plasma::Types::RightEdge) {
xPos = sGeometry.x() + sGeometry.width() - clearThickness - size.width(); xPos = scrGeometry.x() + scrGeometry.width() - clearThickness - size.width();
yPos = m_latteView->y() + secondaryConfigSpacing;
} }
} }
break; break;

@ -170,6 +170,13 @@ Item{
value: root.drawShadowsExternal && (!root.inStartup || inForceHiding || inTempHiding) value: root.drawShadowsExternal && (!root.inStartup || inForceHiding || inTempHiding)
} }
Binding{
target: latteView && latteView.effects ? latteView.effects : null
property:"editShadow"
when: latteView && latteView.effects
value: root.editShadow
}
Binding{ Binding{
target: latteView && latteView.effects ? latteView.effects : null target: latteView && latteView.effects ? latteView.effects : null
property:"innerShadow" property:"innerShadow"

Loading…
Cancel
Save