Bug 453977 - X11: window rule setting "No titlebar and frame" has no effect on GTK applications
Summary: X11: window rule setting "No titlebar and frame" has no effect on GTK applica...
Status: RESOLVED NOT A BUG
Alias: None
Product: kwin
Classification: Plasma
Component: rules (show other bugs)
Version: git master
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-18 11:08 UTC by Oded Arbel
Modified: 2022-05-24 15:09 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oded Arbel 2022-05-18 11:08:50 UTC
SUMMARY
Setting a window rule that includes the "Appearance & Fixes" clause "No titlebar and frame" has no effect on the targeted window's "No Border" feature (as can be see under the windows operation menu' "More Actions" sub menu), for GTK applications.

I have tested the issue with various GTK and GNOME applications as well as with Google Chrome.

This is running Neon Jammy unstable, but I've had the same behavior with previous builds.

STEPS TO REPRODUCE
1. Start a GTK application
2. Create a new window rule by detecting the new application's window properties. select class or anything else that applies.
3. Add "No titlebar and frame" clause and set to "Force" and choose either "yes" or "no" for the setting.
4. Add "Titlebar color scheme" (for control) clause and set to "Force" and choose any value for the setting.
5. Click "Apply".
6. Change "No titlebar and frame" setting to the other value, and "Titlebar color scheme" to a different value (that is distinguishable) and click "Apply".

OBSERVED RESULT
The color scheme (and any other setting I tested) does change and take effect immediately, but the window border status does not change from the application's default - if it does not allow the window manager to draw borders, then setting "No titlebar and frame" to "No" does not do anything, and it it does allow the WM to draw borders, then setting "Yes" does not do anything.

EXPECTED RESULT
Setting "No titlebar and frame" to "Force" and "No" should force kwin to draw window borders regardless of the application internal settings, while setting "Force" and "Yes" should force kwin to not draw window borders.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: 5.24.80
KDE Frameworks Version: 5.95.0
Qt Version: 5.15.3

ADDITIONAL INFORMATION
I'm a bit confused about the window rules feature called "No titlebar and frame" while the kwin window's operation menu has a feature called "No border", but they seem to me to be the same thing with different text. That being said, with KDE applications I've tested, setting a rule with "No titlebar and frame" to "yes" indeed sets the "No border" checkbox in the kwin windows operation menu, while with GTK apps it does not.

Using the "No border" feature, on the kwin windows operation menu, manually with GTK apps *does* work as expected - if the application requested "No border", it can be turned off to get the kwin window borders while if the application did not request that, turning it on removes the kwin window borders.
Comment 1 Vlad Zahorodnii 2022-05-24 07:05:57 UTC
"No border" == "remove server-side decorations" on X11. On Wayland, it implies "remove server-side decoration and client-side decoration," but this also requires some support from the client (many apps still refuse to honor decoration hint provided by the wayland compositor). Unlike Wayland, on X11, kwin can't force any decoration mode, it must obey by client preferences.

So, it's already sort of fixed on wayland, but some apps can misbehave and they need to be fixed.
Comment 2 Oded Arbel 2022-05-24 15:09:24 UTC
Vlad, I'm quite confused by your response:

1. This issue is about X11 and not Wayland. I'm not sure of the behavior on Wayland, but I don't think it applies to this issue if the behavior there is as different from X11 as you describe. If you mean to say "Kwin team will not fix this issue on X11 because that platform is deprecated and the team is focusing on Wayland", that is one thing - but I would expect the resolution to be "WONTFIX" and not "NOT A BUG".

2. You said "... on X11, kwin can't force any decoration mode" - which is seems incorrect to me - as kwin rules successfully force the decoration mode for Qt apps, KDE apps, WxWidget apps, Libre Office, Thunderbird and Firefox (surprisingly? IIRC the last two are using GTK).

But after investigating the issue a bit more, I think I understand it a bit more and it all probably starts from my misunderstanding of the idea of setting the rule "No titlebar and frame" to "No" and how it interoperates with GNOME client-side decorations and the gtk3-nocsd hack:
- It is now my belief that "No titlebar and frame" means that kwin will hide the decorations for windows that assume server-side decoration. Setting it to "No" does not mean "force server-side decoration" (though I think that would have been useful).
- GNOME apps request to disable server-side decorations, which kwin will always honor.
- gtk3-nocsd disables the request to disable server-side decorations, causing kwin to draw titlebar and frame.
- My main problem is actually Google Chrome apps that use "open as a window", which use CSD, aren't affected by gtk3-nocsd and I can't get kwin to draw reasonable borders around them (making their title bar unreadable due to the bad interaction between Google Chrome CSD colors and the Breeze theme).

I'm still not sure why kwin refuses to hide the server side decoration when setting "No titlebar and frame" to "Force" "yes", for a GNOME apps loaded with gtk3-nocsd - it sounds like a bug to me, and possibly, relevant to this issue - but I'm actually not that interested in that problem.