Bug 428095 - Menu sometimes has black border
Summary: Menu sometimes has black border
Alias: None
Product: Breeze
Classification: Plasma
Component: QStyle (show other bugs)
Version: unspecified
Platform: Other Linux
: VHI normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL: https://bugreports.qt.io/browse/QTBUG...
Keywords: regression
: 429031 430263 430567 (view as bug list)
Depends on:
Reported: 2020-10-22 09:54 UTC by popov895
Modified: 2021-04-14 19:30 UTC (History)
12 users (show)

See Also:
Latest Commit:
Version Fixed In:

Context menu (22.80 KB, image/png)
2020-10-22 09:54 UTC, popov895
Drop menu (10.98 KB, image/png)
2020-10-22 09:55 UTC, popov895
Drop menu with light theme (8.72 KB, image/png)
2020-10-24 07:02 UTC, popov895
Drag Menu With KWin Console (56.28 KB, image/png)
2020-10-27 05:38 UTC, Andreas H

Note You need to log in before you can comment on or make changes to this bug.
Description popov895 2020-10-22 09:54:19 UTC

The menu, that appears when a file(s) is dropped into the Dolphin, has no borders.


Linux/KDE Plasma: KDE neon 5.20 User Edition / X11
KDE Plasma Version: 5.20.1
KDE Frameworks Version: 5.75.0
Qt Version: 5.15.0
Comment 1 popov895 2020-10-22 09:54:59 UTC
Created attachment 132629 [details]
Context menu
Comment 2 popov895 2020-10-22 09:55:16 UTC
Created attachment 132630 [details]
Drop menu
Comment 3 Patrick Silva 2020-10-22 18:47:32 UTC
I noriced this bug on Arch Linux and neon unstable after the fix for bug 399680.
Comment 4 popov895 2020-10-24 07:02:57 UTC
Created attachment 132678 [details]
Drop menu with light theme
Comment 5 Nate Graham 2020-10-24 19:55:27 UTC
Can confirm. It does seem to be fallout from the fix for Bug 399680.

Andreas, would yo mind having a look?
Comment 6 Andreas H 2020-10-27 05:36:52 UTC
Hey all! Thanks for bringing this up. I've been looking into this for a bit but I'm having a hard time tracking down the root cause. 

It appears that some transparent menus in X11 (like the drop menu) are totally missing an alpha channel! See my attachment with the KWin debug console.

I think my fix moved the glitch into the border; though it isn't the reason those windows are lacking transparency. 

These windows seem fine in Wayland, except for the "More Actions" KWin menu. 

I think this could be an issue in Breeze, or Qt. If anyone has any ideas I'm all ears
Comment 7 Andreas H 2020-10-27 05:38:33 UTC
Created attachment 132782 [details]
Drag Menu With KWin Console
Comment 8 Andreas H 2020-11-06 08:28:56 UTC
Hey all!

I've spent some more time tracking this down. It appears breeze popups shown with widget->popup() (i.e. asynchronously) exhibit this problem. Popups shown with widget->exec() (i.e. synchronously) do not. 

Furthermore, if the popup has the translucency flag set before popup() is called then the problem goes away.

It appears (in X11) that after a certain moment, Qt will ignore the translucency. With exec() the moment is before polish(), and in popup() the moment is after polish(). 

I dug around the Qt bug tracker and found this. I believe this is the root cause of the issue, and after this is fixed the issue should fix itself :D 

Comment 9 Nate Graham 2020-11-06 14:52:32 UTC
Thanks Andreas!

Is there anything we can do to work around it on our side? Qt being what it is, there's probably not much chance of a fix unless one of us actually goes and fixes it in the Qt code. Would you be interested in having a go at that?
Comment 10 Andreas H 2020-11-08 22:38:06 UTC
No worries Nate!

I'm afraid there's no workaround that I could see, at least from the Plasma side.  I plan to dive into the Qt code soon to either fix it or find a workaround, but that will probably take some time, considering how massive it is.
Comment 11 popov895 2020-11-10 23:41:08 UTC
Can we remove these borders? It seems to me that menus looks better without borders.
Comment 12 Nate Graham 2020-11-13 15:14:49 UTC
*** Bug 429031 has been marked as a duplicate of this bug. ***
Comment 13 Nate Graham 2020-12-11 15:38:11 UTC
*** Bug 430263 has been marked as a duplicate of this bug. ***
Comment 14 Nate Graham 2020-12-19 16:42:21 UTC
*** Bug 430567 has been marked as a duplicate of this bug. ***
Comment 15 Nate Graham 2020-12-19 16:42:41 UTC
Dupes piling up, marking as VHI.
Comment 16 David Redondo 2021-01-15 08:13:53 UTC
I made a Qt patch and when I observed the same as as Andreas that popup() and exec() are different. Unfortunately this is not something we can easily workaround in breeze (aside from a really horrible hack I tried)

Comment 17 Nate Graham 2021-01-15 16:19:40 UTC

Git commit 20602d44341fd11de5a8221aa739ad35f1fcc988 by Nate Graham, on behalf of David Redondo.
Committed on 15/01/2021 at 16:18.
Pushed by ngraham into branch 'master'.

Restore correct menu border color

cac4b544dbbadc5bcd57ae37ac333383bf44c2ab introduced drawing separators
of transparent QMenus with WindowText color with 0.25 opacity. While the change
in drawMenuItemControl uses the correct condition, drawPanelMenuPrimitive
checked whether the widget had an alpha channel. This is wrong because we set
Qt::WA_TranslucentBackground always on all menus. The very low opacity made it
look like the section headers, separators and highlight were drawing outside of
the menu.

M  +2    -2    kstyle/breezestyle.cpp

Comment 18 David Redondo 2021-01-18 11:11:48 UTC
This was actually not fixed by that commit as it was a different bug, just in the same locations
Comment 19 Patrick Silva 2021-04-14 02:07:21 UTC
is this bug really fixed? Or is it a (not fixed according to URL) Qt bug?
It's stiil happening on X11 session of neon unstable.

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.21.80
KDE Frameworks Version: 5.82.0
Qt Version: 5.15.2
Graphics Platform: X11
Comment 20 David Redondo 2021-04-14 06:39:27 UTC
>is this bug really fixed? Or is it a (not fixed according to URL) Qt bug?
It's stiil happening on X11 session of neon unstable.

Note that patch only made it to 5.15 after 5.15.2, but maybe when distributions start using or 5.15 branch it will be better.

If you can see it not everywhere but only in one specific location it could be that it forces creating the platform window to early and we can look at that.
Comment 21 Patrick Silva 2021-04-14 19:30:20 UTC
Thanks David.
On neon unstable hamburger menu of System Settings and drop menu of Dolphin
are affected. But I can't reproduce on Arch Linux running KDE Qt.