noctalia-shell icon indicating copy to clipboard operation
noctalia-shell copied to clipboard

[BUG] Stickers are rendering incorrectly on the lock screen

Open lucaphill opened this issue 2 weeks ago • 4 comments

Submission checklist

  • [x] I have searched existing issues and confirmed this is not a duplicate.
  • [x] I reproduced this on the latest release of Noctalia.

Bug description

At random times, when I go to the lock screen, it renders the stickers I've added incorrectly

Steps to reproduce

Lock and unlock your device a few times, eventually, the icons will glitch out.

Expected behavior

It should remain consistent without any changes in size

image

Actual behavior

Sometimes the stickers are too small

image

Logs / error output


Noctalia version

5.6.0.1 - dirty

Compositor

Niri

Distribution

Arch-based

Environment information

AMD rysem 5 3500u
AMD radeon vega 8 graphics

Additional context

No response

lucaphill avatar Nov 21 '26 00:11 lucaphill

I hit this on 5.6.0 too (niri, Arch-based), on the desktop and on the lock screen. I think I found the cause. It only affects non-square images, and whether you see it depends on how fast the async decode finishes, which would explain why it seems random.

What happens

  1. DesktopStickerWidget::doLayout (src/shell/desktop/widgets/desktop_sticker_widget.cpp:98) sizes the sticker as a kDefaultStickerSize (200×200) square until m_image->hasImage() is true. In 5.6 the decode is async, so the first layout pass measures that 200×200 placeholder.
  2. DesktopWidget::layout (src/shell/desktop/desktop_widget.cpp:58-59) records the content size as a high-water mark (m_maxNaturalWidth / m_maxNaturalHeight), and the mark only ever grows.
  3. When the decode lands, setAsyncReadyCallback → requestLayout() re-lays out the sticker at its real aspect ratio. Width or height drops below 200, but the high-water mark stays at 200×200. So contentScaleForBox fits a 200×200 box that doesn't exist anymore, and the sticker draws too small along its short axis.

Example from my setup: a portrait SVG in a 404×1012 box should fill the box. Instead it rendered at about 160×400, because min(404/200, 1012/200) = 2.02, and that scale was applied to an 80×200 natural size.

The lock screen goes through the same DesktopWidgetFactory (lockscreen_widgets_host.cpp:35), so it's the same bug there. When the texture is already cached, the decode is effectively instant and it renders correctly. That matches the "sometimes" in this report.

I checked current main (2951c1a). It still has the same high-water logic and the same 200×200 placeholder. b4b5c16 (file images load only through the async cache) probably makes the bug easier to hit.

Possible fixes

  • Reset the high-water mark when the async image arrives (for example, a protected resetNaturalSizeHighWater() on DesktopWidget, called in the sticker's ready callback before requestLayout()), or
  • Have the sticker skip the high-water mark, the way DesktopAudioVisualizerWidget::layout already does. A sticker's natural size only depends on its aspect ratio, so the "stable font" reason for the high-water mark doesn't apply to it.

Workaround until it's fixed: make the sticker's box square, with each side equal to the longest edge you want. The placeholder pass is square too, so the image comes out the right size.

Scary2oc avatar Nov 21 '26 06:11 Scary2oc

Hey @lucaphill , this should be solved with the referenced commit. Can you please test it and let us know :)?

Ly-sec avatar Nov 21 '26 11:11 Ly-sec

In my current workflow, I can't build from source, so I can't test it :( But I hope it worked

lucaphill avatar Nov 21 '26 15:11 lucaphill

@lucaphill I tested it. This commit fixed it, stickers goes back to previous state like same as before. My cats stickers are not small anymore.

It's been a week and no issue still so I am closing this.

AdityaKr015 avatar Nov 21 '26 16:11 AdityaKr015