Bug 440235

Summary: CSD windows have huge black outline when compositing is disabled on X11
Product: [Plasma] kwin Reporter: Topi <ritalat>
Component: compositingAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED DOWNSTREAM    
Severity: normal CC: nate, r2b2x3+kdebug, Wi11iam_1
Priority: NOR Keywords: regression
Version First Reported In: master   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
URL: https://gitlab.gnome.org/GNOME/gtk/-/issues/5183
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Firefox with title bar disabled

Description Topi 2021-07-24 20:58:15 UTC
Created attachment 140308 [details]
Firefox with title bar disabled

SUMMARY
CSD windows such as Firefox with the title bar disabled have a huge black outline where the shadows used to be after disabling compositing

STEPS TO REPRODUCE
1. Open Firefox with the title bar disabled
2. Disable compositing manually or launch an application that uses SDL2

OBSERVED RESULT
The Firefox window shadows turn opaque

EXPECTED RESULT
The window shadows are removed

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: 5.22.3
KDE Frameworks Version: 5.84
Qt Version: 5.15.2
Comment 1 Nate Graham 2021-08-04 23:33:12 UTC
Can reproduce.
Comment 2 Vlad Zahorodnii 2021-08-05 13:52:14 UTC
X11 doesn't support translucency natively, only with some help from a compositing window manager.

Please report this issue to Firefox developers. Ideally, Firefox should stop rendering client-side drop shadows and draw some border instead.
Comment 3 Nate Graham 2021-08-05 14:09:09 UTC
I can reproduce the bug with Gedit too. It doesn't seem to be limited to just Firefox.
Comment 4 Vlad Zahorodnii 2021-08-05 14:10:10 UTC
It might be also an issue in breeze gtk theme.
Comment 5 William 2021-08-07 03:28:46 UTC
on X11 it is already possible to circumvent this bug with some special settings:

first one has to enforce the titlebar on firefox via a Kwin WindowRule (do not enable the standard titlebar in firefox settings)
second u have to use breeze window-decoration style and make a custom rule to "unforce" border and titlebar again. this way the shadow is drawn by kwin and the window still looks just as before with proper gtk CSD!

a proper solution to this would be to automatically load in a gtk-css style (similar to the window-decorations overwrite that already syncs min/max/close buttons) that just disables ALL CSD shadows and margins and then add something to kwin that enforces the draw of shadows. 

if the shadows come from kwin even on uncomposited desktop firefox and all other gtk CSD apps would look normal, without shadow. 

i dont know however how far this is possible (in kwin). on my end for firefox and the couple other gtk csd apps that i use i have the workaround in place and a custom gtk-css style that removes all shadows+markins in my ~/.config/gtk-3.0/gtk.css so that any gtk theme wont have these ugly client side shadows.
Comment 6 William 2021-08-07 03:34:59 UTC
another plus to my proposed solution (and the workaround) is that CSD apps would always (no matter the gtk-theme) have the correct shadow set by the window decoration theme, (that is if this is possible to implement for other windwo decos than breeze)
Comment 7 Nate Graham 2022-09-08 15:06:48 UTC
Can reproduce with current git master, still. It happens when using the Adwaita theme too so I think this is on KWin.
Comment 8 Vlad Zahorodnii 2022-09-12 09:46:05 UTC
> It happens when using the Adwaita theme too so I think this is on KWin.

It's not. GTK is responsible for reacting to disabling compositing and adding `solid-csd` class. I don't see how we can fix this in kwin.
Comment 9 Nate Graham 2022-09-12 19:03:51 UTC
The Breeze GTK theme sets those CSS classes already, and it's not setting them to be giant black squares, as far as I can tell. See https://invent.kde.org/plasma/breeze-gtk/-/blob/master/src/gtk3/widgets/_window_decorations.scss#L46 and the lines below it.
Comment 10 Vlad Zahorodnii 2022-09-15 07:45:25 UTC
Hmm, if breeze gtk handles solid-csd and it's reproducible with other themes, I think we need to report this to GTK developers.
Comment 11 Nate Graham 2022-09-15 16:20:31 UTC
OK. I have no idea what to tell them, as I don't have any technical expertise in either GTK or window managers. Any chance you could file the bug report?
Comment 12 Vlad Zahorodnii 2022-09-15 20:31:19 UTC
(In reply to Nate Graham from comment #11)
> OK. I have no idea what to tell them, as I don't have any technical
> expertise in either GTK or window managers. Any chance you could file the
> bug report?

Yes, I was about to do that, but forgot
Comment 13 Nate Graham 2022-09-15 21:02:05 UTC
Thank you very much!