Commit 01f0c885 authored by Andreas Haratzis's avatar Andreas Haratzis Committed by Nate Graham

Fix for occasional background glitches behind transparent Menus, especially...

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.
parent eb66c71b
......@@ -3746,13 +3746,20 @@ namespace Breeze
auto background( _helper->frameBackgroundColor( palette ) );
auto outline( _helper->frameOutlineColor( palette ) );
painter->save();
if ( hasAlpha ) {
if ( painter && widget && widget->isWindow() ) {
painter->setCompositionMode( QPainter::CompositionMode_Source );
}
background.setAlphaF(StyleConfigData::menuOpacity() / 100.0);
outline = _helper->alphaColor( palette.color( QPalette::WindowText ), 0.25 );
}
_helper->renderMenuFrame( painter, option->rect, background, outline, hasAlpha );
painter->restore();
return true;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment