https://bugs.kde.org/show_bug.cgi?id=529098
Bug ID: 529098
Summary: Aurorae v2: decoration shadow is not regenerated after
a window resize, leaving stale border remnants at
rounded corners
Classification: Plasma
Product: kwin
Version First unspecified
Reported In:
Platform: Other
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: aurorae
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Created attachment 198643
--> https://bugs.kde.org/attachment.cgi?id=198643&action=edit
Screenshots and the kwin-support.txt
Version
6.8.3 (also reproducible with current git master)
## Platform
Arch Linux, Plasma 6.8.3, KWin 6.8.3, Qt 6.12.0, Wayland session
## Detailed description
### Summary
With an Aurorae v2 window decoration, the decoration shadow is not regenerated
when a window is resized. `Decoration::onWindowSizeChanged()` resizes the frame
but does not call `updateShadow()`, so KWin keeps drawing a shadow image that
was
generated for an older frame size. Because that shadow image still contains the
outer part of the frame's 1 px border (see root cause below), a straight black
border segment becomes visible through the transparent rounded corner. The
artifact looks like a black "L" sticking out of the rounded corner.
The artifact is also reproducible after maximizing and restoring a window, and
after logging out and back in (the window is restored to its final size after
the decoration/shadow was created).
### Steps to reproduce
1. Use an Aurorae v2 decoration with shadows and rounded corners, for example
MacTahoe-Dark (library=org.kde.kwin.aurorae.v2,
theme=__aurorae__svg__MacTahoe-Dark).
2. Open a window.
3. Resize the window (the artifact also appears after maximizing and restoring
it, and after a logout/login where the window geometry is restored).
4. Look at the top-left / top-right corner.
### Actual result
A straight black border line runs past the rounded corner into the transparent
corner notch. The length of the protruding segment depends on the window size:
the larger the window, the shorter the segment; the smaller the window, the
longer the segment.
### Expected result
No border remnants; the decoration shadow matches the current window geometry.
### Additional observations / workarounds
- Moving the window (without changing its size) does not change the artifact.
- Clicking another window and then clicking back makes the artifact disappear.
A focus change triggers `onWindowActiveChanged() -> updateDecoration() ->
updateShadow()`, which regenerates the shadow at the current frame size.
- Switching the decoration theme away and back also fixes it, because the
decoration and its shadow are recreated at the current size.
- A standalone KSvg render of the same theme (decoration.svg, rendered at
several sizes, and the same FrameSvg object resized from one size to another)
is clean. The theme SVG is therefore not the cause.
### Root cause analysis (current master, v2/decoration.cpp)
`Decoration::onWindowSizeChanged()` updates the frame, title bar, buttons,
caption and blur region, but does not refresh the decoration shadow:
void Decoration::onWindowSizeChanged()
{
updateSize();
updateTitleBar();
positionButtons();
updateCaption();
updateBlur();
}
`Decoration::updateShadow()` caches the generated shadow and only regenerates
it
when the current decoration changes or when the cached shadow size no longer
matches the frame size:
if (m_shadowSvg == m_currentDecoration && m_shadowSvg->frameSize().toSize()
== m_shadow->shadow().size()) {
return;
}
Since `updateShadow()` is not called after a size change, this check is never
evaluated, and the cached shadow keeps the old size.
In addition, `updateShadow()` paints the complete frame artwork (including its
1 px border) into a QImage and then removes the window area with a rectangular
DestinationOut draw:
m_currentDecoration->paintFrame(&painter);
painter.setPen(Qt::NoPen);
painter.setBrush(Qt::black);
painter.setCompositionMode(QPainter::CompositionMode_DestinationOut);
painter.drawRect(innerRect);
The parts of the border stroke that lie on the edges of that rectangle remain
in
the shadow image. When the cached shadow is drawn with stale geometry (the
window size differs from the size the shadow was generated at), those border
remnants become visible through the transparent rounded corner.
### Suggested fix
Regenerate the shadow after the frame size changes. Regenerating on every
resize
step would be expensive, so a debounced single-shot QTimer (for example 100 ms)
started from `updateSize()` or `onWindowSizeChanged()` would be a reasonable
approach. Alternatively, invalidate the cached shadow whenever the frame size
changes.
### System information
- Arch Linux, Plasma 6.8.3, aurorae 6.8.3, KWin 6.8.3, Qt 6.12.0, Wayland.
- GPU: NVIDIA GeForce RTX 5070 Laptop GPU, driver 620.70.06, EGL / OpenGL ES.
- Display scales used: 1.5 (internal panel) and 1.0 (external monitor).
- Full KWin support information: see attachment kwin-support.txt.
--
You are receiving this mail because:
You are watching all bug changes.