mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-22 14:50:31 +03:00
improvements for effects area and painting
This commit is contained in:
parent
3c5c59e149
commit
91a9e7c0c5
@ -222,28 +222,28 @@ QRegion Effects::subtrackedMaskFromWindow(QRegion initialRegion, QQuickView *win
|
||||
QRect windowMask;
|
||||
//! we need to subtrack the mask areas that overlap with underlying window
|
||||
switch (m_view->location()) {
|
||||
case Plasma::Types::TopEdge:
|
||||
windowMask.setTopLeft(QPoint(start - m_view->x(), m_mask.y() + m_mask.height() - m_editShadow));
|
||||
windowMask.setSize(QSize(length, m_editShadow));
|
||||
break;
|
||||
case Plasma::Types::TopEdge:
|
||||
windowMask.setTopLeft(QPoint(start - m_view->x(), m_mask.y() + m_mask.height() - m_editShadow));
|
||||
windowMask.setSize(QSize(length, m_editShadow));
|
||||
break;
|
||||
|
||||
case Plasma::Types::LeftEdge:
|
||||
windowMask.setTopLeft(QPoint(m_mask.right() + 1 - m_editShadow, start - m_view->y()));
|
||||
windowMask.setSize(QSize(m_editShadow, length));
|
||||
break;
|
||||
case Plasma::Types::LeftEdge:
|
||||
windowMask.setTopLeft(QPoint(m_mask.right() + 1 - m_editShadow, start - m_view->y()));
|
||||
windowMask.setSize(QSize(m_editShadow, length));
|
||||
break;
|
||||
|
||||
case Plasma::Types::RightEdge:
|
||||
windowMask.setTopLeft(QPoint(m_mask.x(), start - m_view->y()));
|
||||
windowMask.setSize(QSize(m_editShadow, length));
|
||||
break;
|
||||
case Plasma::Types::RightEdge:
|
||||
windowMask.setTopLeft(QPoint(m_mask.x(), start - m_view->y()));
|
||||
windowMask.setSize(QSize(m_editShadow, length));
|
||||
break;
|
||||
|
||||
case Plasma::Types::BottomEdge:
|
||||
windowMask.setTopLeft(QPoint(start - m_view->x(), m_mask.y()));
|
||||
windowMask.setSize(QSize(length, m_editShadow));
|
||||
break;
|
||||
case Plasma::Types::BottomEdge:
|
||||
windowMask.setTopLeft(QPoint(start - m_view->x(), m_mask.y()));
|
||||
windowMask.setSize(QSize(length, m_editShadow));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
subtractedMask = subtractedMask.subtracted(windowMask);
|
||||
@ -387,53 +387,40 @@ void Effects::updateEffects()
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_view->behaveAsPlasmaPanel()) {
|
||||
if (m_drawEffects && !m_rect.isNull() && !m_rect.isEmpty()) {
|
||||
//! this is used when compositing is disabled and provides
|
||||
//! the correct way for the mask to be painted in order for
|
||||
//! rounded corners to be shown correctly
|
||||
if (!m_background) {
|
||||
m_background = new Plasma::FrameSvg(this);
|
||||
}
|
||||
|
||||
if (m_background->imagePath() != "widgets/panel-background") {
|
||||
m_background->setImagePath(QStringLiteral("widgets/panel-background"));
|
||||
}
|
||||
|
||||
m_background->setEnabledBorders(m_enabledBorders);
|
||||
m_background->resizeFrame(m_rect.size());
|
||||
QRegion fixedMask = m_background->mask();
|
||||
fixedMask.translate(m_rect.x(), m_rect.y());
|
||||
|
||||
//! fix1, for KF5.32 that return empty QRegion's for the mask
|
||||
if (fixedMask.isEmpty()) {
|
||||
fixedMask = QRegion(m_rect);
|
||||
}
|
||||
|
||||
KWindowEffects::enableBlurBehind(m_view->winId(), true, fixedMask);
|
||||
|
||||
bool drawBackgroundEffect = m_theme.backgroundContrastEnabled() && (m_backgroundOpacity == 100);
|
||||
//based on Breeze Dark theme behavior the enableBackgroundContrast even though it does accept
|
||||
//a QRegion it uses only the first rect. The bug was that for Breeze Dark there was a line
|
||||
//at the dock bottom that was distinguishing it from other themes
|
||||
KWindowEffects::enableBackgroundContrast(m_view->winId(), drawBackgroundEffect,
|
||||
m_theme.backgroundContrast(),
|
||||
m_theme.backgroundIntensity(),
|
||||
m_theme.backgroundSaturation(),
|
||||
fixedMask.boundingRect());
|
||||
} else {
|
||||
KWindowEffects::enableBlurBehind(m_view->winId(), false);
|
||||
KWindowEffects::enableBackgroundContrast(m_view->winId(), false);
|
||||
if (m_drawEffects && !m_rect.isNull() && !m_rect.isEmpty()) {
|
||||
//! this is used when compositing is disabled and provides
|
||||
//! the correct way for the mask to be painted in order for
|
||||
//! rounded corners to be shown correctly
|
||||
if (!m_background) {
|
||||
m_background = new Plasma::FrameSvg(this);
|
||||
}
|
||||
} else if (m_view->behaveAsPlasmaPanel() && m_drawEffects) {
|
||||
KWindowEffects::enableBlurBehind(m_view->winId(), true);
|
||||
|
||||
if (m_background->imagePath() != "widgets/panel-background") {
|
||||
m_background->setImagePath(QStringLiteral("widgets/panel-background"));
|
||||
}
|
||||
|
||||
m_background->setEnabledBorders(m_enabledBorders);
|
||||
m_background->resizeFrame(m_rect.size());
|
||||
QRegion fixedMask = m_background->mask();
|
||||
fixedMask.translate(m_rect.x(), m_rect.y());
|
||||
|
||||
//! fix1, for KF5.32 that return empty QRegion's for the mask
|
||||
if (fixedMask.isEmpty()) {
|
||||
fixedMask = QRegion(m_rect);
|
||||
}
|
||||
|
||||
KWindowEffects::enableBlurBehind(m_view->winId(), true, fixedMask);
|
||||
|
||||
bool drawBackgroundEffect = m_theme.backgroundContrastEnabled() && (m_backgroundOpacity == 100);
|
||||
|
||||
KWindowEffects::enableBackgroundContrast(m_view->winId(), drawBackgroundEffect,
|
||||
m_theme.backgroundContrast(),
|
||||
m_theme.backgroundIntensity(),
|
||||
m_theme.backgroundSaturation());
|
||||
//based on Breeze Dark theme behavior the enableBackgroundContrast even though it does accept
|
||||
//a QRegion it uses only the first rect. The bug was that for Breeze Dark there was a line
|
||||
//at the dock bottom that was distinguishing it from other themes
|
||||
KWindowEffects::enableBackgroundContrast(m_view->winId(),
|
||||
drawBackgroundEffect,
|
||||
m_theme.backgroundContrast(),
|
||||
m_theme.backgroundIntensity(),
|
||||
m_theme.backgroundSaturation(),
|
||||
fixedMask);
|
||||
} else {
|
||||
KWindowEffects::enableBlurBehind(m_view->winId(), false);
|
||||
KWindowEffects::enableBackgroundContrast(m_view->winId(), false);
|
||||
@ -455,24 +442,24 @@ void Effects::updateEnabledBorders()
|
||||
Plasma::FrameSvg::EnabledBorders borders = Plasma::FrameSvg::AllBorders;
|
||||
|
||||
switch (m_view->location()) {
|
||||
case Plasma::Types::TopEdge:
|
||||
borders &= ~Plasma::FrameSvg::TopBorder;
|
||||
break;
|
||||
case Plasma::Types::TopEdge:
|
||||
borders &= ~Plasma::FrameSvg::TopBorder;
|
||||
break;
|
||||
|
||||
case Plasma::Types::LeftEdge:
|
||||
borders &= ~Plasma::FrameSvg::LeftBorder;
|
||||
break;
|
||||
case Plasma::Types::LeftEdge:
|
||||
borders &= ~Plasma::FrameSvg::LeftBorder;
|
||||
break;
|
||||
|
||||
case Plasma::Types::RightEdge:
|
||||
borders &= ~Plasma::FrameSvg::RightBorder;
|
||||
break;
|
||||
case Plasma::Types::RightEdge:
|
||||
borders &= ~Plasma::FrameSvg::RightBorder;
|
||||
break;
|
||||
|
||||
case Plasma::Types::BottomEdge:
|
||||
borders &= ~Plasma::FrameSvg::BottomBorder;
|
||||
break;
|
||||
case Plasma::Types::BottomEdge:
|
||||
borders &= ~Plasma::FrameSvg::BottomBorder;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ((m_view->location() == Plasma::Types::LeftEdge || m_view->location() == Plasma::Types::RightEdge)) {
|
||||
|
@ -91,17 +91,12 @@ void XWindowInterface::setViewStruts(QWindow &view, const QRect &rect
|
||||
const QRect currentScreen {screen->geometry()};
|
||||
const QRect wholeScreen {{0, 0}, screen->virtualSize()};
|
||||
|
||||
//! WORKAROUND in order to fix KWin faulty behavior concerning struts
|
||||
//! under !compositing mode. Under !compositing mode, kwin removes 1px.
|
||||
//! from the struts
|
||||
const int strutsGap = KWindowSystem::compositingActive ? 1 : 2;
|
||||
|
||||
switch (location) {
|
||||
case Plasma::Types::TopEdge: {
|
||||
const int topOffset {screen->geometry().top()};
|
||||
strut.top_width = rect.height() + topOffset;
|
||||
strut.top_start = rect.x();
|
||||
strut.top_end = rect.x() + rect.width() - strutsGap;
|
||||
strut.top_end = rect.x() + rect.width() - 1;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -109,7 +104,7 @@ void XWindowInterface::setViewStruts(QWindow &view, const QRect &rect
|
||||
const int bottomOffset {wholeScreen.bottom() - currentScreen.bottom()};
|
||||
strut.bottom_width = rect.height() + bottomOffset;
|
||||
strut.bottom_start = rect.x();
|
||||
strut.bottom_end = rect.x() + rect.width() - strutsGap;
|
||||
strut.bottom_end = rect.x() + rect.width() - 1;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -117,7 +112,7 @@ void XWindowInterface::setViewStruts(QWindow &view, const QRect &rect
|
||||
const int leftOffset = {screen->geometry().left()};
|
||||
strut.left_width = rect.width() + leftOffset;
|
||||
strut.left_start = rect.y();
|
||||
strut.left_end = rect.y() + rect.height() - strutsGap;
|
||||
strut.left_end = rect.y() + rect.height() - 1;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -125,7 +120,7 @@ void XWindowInterface::setViewStruts(QWindow &view, const QRect &rect
|
||||
const int rightOffset = {wholeScreen.right() - currentScreen.right()};
|
||||
strut.right_width = rect.width() + rightOffset;
|
||||
strut.right_start = rect.y();
|
||||
strut.right_end = rect.y() + rect.height() - strutsGap;
|
||||
strut.right_end = rect.y() + rect.height() - 1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -515,6 +515,9 @@ Item{
|
||||
return "transparent";
|
||||
}
|
||||
|
||||
borderWidth: 1
|
||||
borderColor: backgroundColor
|
||||
|
||||
roundness: {
|
||||
if (themeExtended) {
|
||||
switch(plasmoid.location) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user