Proper way to render window decorations on wayland for non-gtk apps

Hi all.

Recently I stumbled upon a problem with non-gtk apps under Gnome/Wayland rendering ugly window decorations:

I found issue in mutter about XDG-Decoration support.

I have read all discussion there, and while i haven’t understood all technical details, general idea is that mutter is not right place to add Server Side Decorations.

This comment https://gitlab.gnome.org/GNOME/mutter/-/issues/217#note_749634 says:

Xwayland app decorations are not drawn by mutter the compositor. The are drawn by the X11 window-manager which happens to a. also be named mutter and b. run in the same process (typically gnome-shell).

My questions is:

  • If there are proper place to add Server Side Decorations, where it is?
  • In the world with no Server Side Decorations, is it possible to write “decorator”, which does nothing but wraps application window in Gnome decorations? If the answer is yes, where can I start? assuming zero GTK knowledge.

When researching this bug i found this: Wayland metabug · Issue #306 · rust-windowing/winit · GitHub

The decorations are ugly / not native
Well, that’s how wayland works. Clients are supposed to draw their own decorations.

This is half true, am I correct? Wayland can support Server Side Decorations and Client Side Decorations?

My understanding is that winit could use libdecor to draw client-side decoration that would look “native” under Wayland.

Here is someone suggesting - right way to draw rounded corners is at compositor level, but, probably winit also could do this (and shadows) using libdecor?

For floating windows, the toolkit must draw the rounded corners. In gnome-shell, the corner rounding is done automatically in the compositor along the edges of the panel, but you’ll see it most often with maximized windows.

You can see this if you try to drag a window along the top bar in gnome shell. Or if you try out GTK applications on a different compositor, the rounded corners go away when the window is maximized. If sctk wanted to do this, it could just copy what GTK does.

It is entirely true that wayland expects windows to draw their own decorations

Whilst it’s true the xdg-decoration extension exists it is an extension - wayland implementations don’t have to provide it (as you noticed mutter doesn’t). Even if they do it doesn’t actually mean they support “SSD” - It simply allows a client to request them. A compositor is explictly allowed to refuse leaving the client to draw anyway.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.