Bug 389361 - Non-Gnome GTK3 apps started with GDK_BACKEND=wayland have no decorations
Summary: Non-Gnome GTK3 apps started with GDK_BACKEND=wayland have no decorations
Status: RESOLVED NOT A BUG
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.11.95
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 389393 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-01-24 07:02 UTC by Kyle Devir
Modified: 2018-04-27 11:17 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Mentioned GTK3 applications shown without decorations (322.44 KB, image/png)
2018-01-24 07:02 UTC, Kyle Devir
Details
Mentioned GTK3 applications shown with decorations in Weston (313.48 KB, image/png)
2018-01-24 08:09 UTC, Kyle Devir
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle Devir 2018-01-24 07:02:56 UTC
Created attachment 110086 [details]
Mentioned GTK3 applications shown without decorations

Unlike the official Gnome GTK3 applications that have decorations when started with GDK_BACKEND=wayland, most, if not all, other GTK3 applications do not have decorations at all. Examples include Libreoffice (using the GTK3 VCL backend), DarkTable, RawTherapee, MyPaint, and so on.

On Weston, these applications all have decorations as expected.
Comment 1 Kyle Devir 2018-01-24 08:09:23 UTC
Created attachment 110088 [details]
Mentioned GTK3 applications shown with decorations in Weston

The applications have decorations in Weston.
Comment 2 Martin Flöser 2018-01-24 16:27:31 UTC
The application explicitly requests to have no decoration.

This is from WAYLAND_DEBUG output for libreoffice:

[306590.176]  -> wl_compositor@4.create_surface(new id wl_surface@33)
[306590.216]  -> org_kde_kwin_server_decoration_manager@15.create(new id org_kde_kwin_server_decoration@34, wl_surface@33)
[306590.227]  -> org_kde_kwin_server_decoration@34.request_mode(1)

The 1 means: "Client-side decoration: The decoration is part of the surface and the client."

If the application uses that it's the responsibility of the application to provide the decoration.
Comment 3 Kyle Devir 2018-01-24 22:25:42 UTC
So... where to now? Is there a way to force CSD borders somehow, because Weston provides them.

Maybe I should open another bug, but worded differently, to reflect that they're specifically lacking KWin decorations, but should have them like other windows?

If the applications request no decorations, how does Weston and Mutter give them their CSD decorations? What sort of logic is going on here?

Do the official Gnome GTK3 apps that have CSD decorations also request no decorations?
Comment 4 Martin Flöser 2018-01-25 05:26:14 UTC
You need to report to GTK. Client side decoration means the application draws it. GTK gained support for our protocol to decide whether to use client or server side decoration. Weston does not support this, so there GTK draws client side decorations.

I don't understand why it is not working. But it's a bug in GTK.
Comment 5 Martin Flöser 2018-01-25 05:26:37 UTC
*** Bug 389393 has been marked as a duplicate of this bug. ***
Comment 6 Kyle Devir 2018-01-25 05:47:19 UTC
Martin,

Gnome, in the latest GTK+3 release, they added support for detecting if KWin was running as the compositor and allowing CSD apps to prefer SSD decorations instead.

This was the bug report, which has been fixed:

https://bugzilla.gnome.org/show_bug.cgi?id=781909

This was their implementation:

https://github.com/GNOME/gtk/commit/1b279e3d4ac33ebd9a3925d1a388c28bd96232d5

Somehow, for some reason, the server-side decoration detection isn't working on KWin's side.
Comment 7 Kyle Devir 2018-01-25 05:50:20 UTC
I'll create a bug on the GTK side, and see what they can do about it.
Comment 8 Kyle Devir 2018-01-25 06:06:26 UTC
I've created a bug report here:

https://bugzilla.gnome.org/show_bug.cgi?id=792889
Comment 9 Kyle Devir 2018-01-25 10:35:41 UTC
It turns out that the function for checking whether GTK3 surfaces should use CSD or not was returning "false" for preferring SSD instead of "true". Seems like it was likely never tested after the original patch was submitted, lol.
Comment 10 Kyle Devir 2018-01-25 10:36:25 UTC
I've added a patch on the GTK side that should fix that issue. A simple typo can do a lot...
Comment 11 Kyle Devir 2018-01-25 10:38:31 UTC
Here is the patch to apply to GTK3 to fix the issue:

https://bug792889.bugzilla-attachments.gnome.org/attachment.cgi?id=367417
Comment 12 Martin Flöser 2018-01-25 15:50:52 UTC
Thanks for having a look into it.
Comment 13 Kyle Devir 2018-01-26 09:36:40 UTC
Turns out it wasn't much of a fix ~ it broke the CSD decorations in Weston.

I looked at the code a bit more, and saw that it never bothers to request server-side decorations. The code really seems to have not been tested well, or at all. How fun... :/
Comment 14 Martin Flöser 2018-01-26 16:23:39 UTC
At least it was not tested with KWin. It probably was tested with sway which doesn't do any decorations.