An Outside Developer's Perspective

Hello, I don’t know if this is the right place to write about this, since this category seems to be mostly about GTK. But I wanted to say a few things about some issues I’d like to discuss as a developer.

I generally like how GNOME does things and the philosophy behind them but…

I am a game developer, I switched from Windows a while ago. And switching from Win32 programming to the mess of Wayland, dbus, all the different ways different DEs implement Wayland protocols have been making me think to not release a native Linux version.

First of all, programming for Wayland is already a chore on its own. Everything is callback based for some reason. This inversion of control idea was one of the worst choices of Win32 (e.g. if you don’t render in WM_PAINT you can’t display anything while your window is being resized) and Wayland just copied it for literally everything.

(No, you can’t use the wire protocol directly since EGL requires wl_surface and wl_display. Also, the object oriented nature of the system is another pain point.)
(No, using EGL’s GBM backend won’t solve this issue since it breaks on laptops with separate discrete and integrated gpus)

And on top of that, you have no idea what protocols the target environment supports. The best you can do is make assumptions and if one obscure compositor doesn’t support it you fail.

But when one of the compositors (sometimes the only one) that doesn’t comply with the other DEs is, the not so obscure GNOME, you can’t take that path.

One of these is the server-side decorations.

The solutions mentioned by the GNOME people go along as:

  • Just use libdecor.
  • Use something like SDL, why do you write it yourself?

As far as I understand, one of the reasons GNOME people dislike SSDs is that Wayland has to stay frame-perfect and SSDs somehow prevent that. I tried to use libdecor and SDL (which uses libdecor internally), and you know what? It made this problem literally worse.
Libdecor is incredibly laggy when resizing, and if it’s the only way to do decorations, it literally forces every app that uses it to have this problem. It introduces the very problem not implementing SSDs was supposed to avoid.

See:

And this only happens on GNOME. Also, I don’t want to depend on another library just to display a titlebar.

That is the reason I currently target Xwayland. Yes, Xlib is bad too but at least

  • You have an implementation that 99.99% of users use (X.org).
  • You have a title bar.
  • You don’t have this laggy resize thing. It is still not perfect (KDE’s Xwayland seems to do this better than GNOME) but at least you can see the application responding when you are resizing.

Another issue is that when fractional scale is enabled, GNOME makes Xwayland apps render at 2x of the logical resolution and scale them down (even if only one monitor is present). Which makes games blurry even if you render them at your monitor’s native resolution since upscaling of the game or downscaling of the compositor can sometimes use bilinear interpolation which is lossy.
This also creates performance problems and drains the battery faster.

See:

One option would be to set Xwayland DPI to the specified fractional scale * 96 when only one monitor is present, and do the integer scale conversion when you have multiple monitors. This would help a lot with battery draining too since, you know, laptops have one display.

These were the pain points I wanted to talk about as a developer. I’d like to help improving mutter too, but I was a bit scared of working hard on a merge request just to get immediately rejected. So I wanted to have a discussion about it first.

Thanks.

1 Like