Skip to content

Fix for occasional background glitches behind transparent Menus

Hey all!

This has been bugging me for a good while, especially on Wayland where it always appears on the Kwin useraction menu. Thought I'd take a stab at fixing it!

Honestly I'm not sure how most menus were OK before, but I think it has something to do with the widget/window relationship. Maybe widgets that have a parent window are OK because they clear the buffer before a draw?

before after
before after

======== Original Git Commit message below:

Fix for occasional background glitches behind transparent Menus, especially when hovering over menu elements.

Bug: 399680

Issue: Breeze sets the WA_TranslucentBackground attribute on Menu widgets to achieve transparency. This implies WA_NoSystemBackground, which makes Qt not repaint the background when content changes. This is fine for things like tooltips which don't change content, but for dynamic content (like hovering over menus), Breeze ends up painting over the previous frame.

Fix: We render menu panels with CompositionMode_Source to ensure the previous frame is obliterated. We could reset the buffer by painting transparent pixels first, but that is wasteful.

Notes: I have ensured that overlapping transparent menus still appear OK (they are rendered over each other with the compositor). On Wayland, occasionally colours appear behind the rounded borders. I believe this is a kwin issue because it doesn't occur in X11.

Merge request reports

Loading