[aurorae] fix incorrectly disabled blur for maximized windows

when aurorae decorated windows become maximized and back to normal, after a while they all start to disable blur for their decorated maximized windows.

- bug was tracked down to aurorae fault sending empty QRegions for its maximized windows. What probably happens is that because mask FrameSvgItem enabled borders change from AllBorders to NoBorder, mask FrameSvgItem calculations can not catch up
- the new approach is lighter than the previous one and simpler as margins and enabledborders for mask framesvgitem are not changed and in the c++ side no QRegions calculations are needed at all for maximized windows
- in my system with the new code changing from normal window to maximized one feels a bit snapper
This commit is contained in:
Michail Vourlakos 2022-03-15 13:21:46 +00:00
parent ad09d9cc1e
commit f8b1b7f47e
2 changed files with 11 additions and 12 deletions

View file

@ -578,21 +578,20 @@ void Decoration::updateBlur()
QRegion mask;
const QVariant maskProperty = m_item->property("decorationMask");
if (static_cast<QMetaType::Type>(maskProperty.type()) == QMetaType::QRegion) {
mask = maskProperty.value<QRegion>();
if (clientPointer() && clientPointer()->isMaximized()) {
mask = QRect(0, 0, m_item->width(), m_item->height());
} else {
const QVariant maskProperty = m_item->property("decorationMask");
if (static_cast<QMetaType::Type>(maskProperty.type()) == QMetaType::QRegion) {
mask = maskProperty.value<QRegion>();
if (!mask.isNull()) {
QPoint maskOffset(-m_padding->left(), -m_padding->top());
if (clientPointer() && !clientPointer()->isMaximized()) {
if (!mask.isNull()) {
// moving mask by 1,1 because mask size has already been adjusted to be smaller than the frame.
// Since the svg will have antialiasing and the mask not, there will be artifacts at the corners,
// if they go under the svg they're less evident.
maskOffset += QPoint(1, 1);
QPoint maskOffset(-m_padding->left()+1, -m_padding->top()+1);
mask.translate(maskOffset);
}
mask.translate(maskOffset);
}
}

View file

@ -223,9 +223,9 @@ Decoration {
anchors.fill: parent
// This makes the mask slightly smaller than the frame. Since the svg will have antialiasing and the mask not,
// there will be artifacts at the corners, if they go under the svg they're less evident
anchors.margins: decoration.client.maximized ? 0 : 1
anchors.margins: 1
imagePath: backgroundSvg.imagePath
opacity: 0
enabledBorders: decoration.client.maximized ? PlasmaCore.FrameSvg.NoBorder : PlasmaCore.FrameSvg.TopBorder | PlasmaCore.FrameSvg.BottomBorder | PlasmaCore.FrameSvg.LeftBorder | PlasmaCore.FrameSvg.RightBorder
enabledBorders: PlasmaCore.FrameSvg.TopBorder | PlasmaCore.FrameSvg.BottomBorder | PlasmaCore.FrameSvg.LeftBorder | PlasmaCore.FrameSvg.RightBorder
}
}