I Hate: Programming Wayland Applications

While Wayland is seen as the future of Linux desktops, its development experience is described as a nightmare due to its complex object-oriented protocol and fragmented ecosystem.
A quick introduction:
If you want to program a graphical application for linux, your primary choices are using either X11 or Wayland. According to Wikipedia, X11 had its first release in 1984. X11 follows a client-server-model. I assume it's because the whole computational environment, was very different back then. If you have a central server which is doing all of the heavy lifting, while the user only connects to it via a slim client / dumb terminals / whatever, having the desktop system follow a client-server-model makes sense. In contrast, Wayland (protocol) had its first release in 2008. That's also quite a while ago, in the 2000s the computational environment was probably much closer to what we have today: A PC usually comes with a desktop / graphical interface, and the machine doesn't need to rely on an external server to do most of the computing.
So, over the years there has been a push to switch from X11 to Wayland. And, at least on a surface level, this makes sense to me: Developers probably have learned a lot about the various requirements of desktops, so having a (mostly) clean cut for this new desktop environment seems promising. I have read claims stating that Wayland is inherently more secure than X11. Wayland isn't "outdated", we can design the desktop with performance and modern use-cases in mind.
I am typing this on a desktop machine running sway, which is a Wayland compositor. There definitely have been the common hurdles like desktop recording / sharing not working. But over time, these issues have been resolved - at least for my machine. Some years ago, I tried out both X11 and Wayland (I think back on Arch Linux). And honestly, the sway installation was far easier than the i3/X11 one. This ease of installation, combined with Wayland supposedly being "the future of Linux Desktops", and it supporting X11 applications via XWayland, made me stick to sway, even with its rough edges.
That was the story of me using Wayland. Now comes the developing part - which has been a nightmare.
For libraries to be used by other developers, I'm a big fan of raylib. If you just want to open a window and do some simple rendering with your GPU, raylib is a fantastic library. Incredibly simple. Raylib is really good at covering the "make easy things easy" part.
When developing graphical Windows applications, you have to use Windows.h, do a few rather cryptic function calls to create and get window handles, and then you have your "main loop", where you work through a bunch of window events and respond accordingly. It's fairly more complicated compared to raylib, so I see lots of potential for improvement.
This is the reason why I had high hopes for Wayland. Boy was I wrong. Wayland does not care for the simple use-case at all. Getting any example application to work is so incredibly ridiculous. Wayland is an Object Oriented Protocol. The control flow is horrible. Have fun trying to predict what code executes in what order after your wl_display_roundtrip() & wl_display_dispatch() calls.
You cannot open a window if you just use the core protocol. You are supposed to use XdgShell instead. But if you lookup the extension, you will probably only find an XML-file - because the interface code is generated from it using wayland-scanner. This is sheer insanity. There are so many obstacles you have to get over in order to produce just a blank window, and even if you get past that, the control flow of the application is garbage.
Source: Hacker News










