by Ciantic · 8mo ago · 0 comments
In Wayland you have multiple ways to render windows, not just the XDG top level window. It works via surfaces, and here is a list I've discovered so far:
- XDG Top Level Window
- Child Window
- Popup Surface
- Layer surface (like task-bars, shell overlays)
- Subsurface (region in another surface)
- IME Panel Surface (surface that follows text cursor)
There probably is others too.It is diffifcult to find high-level toolkits that support all of the above.
https://avaloniaui.net/blog/bringing-wayland-support-to-aval...
If you subtract GNOME from the set then things become a lot more sane. "Compositor-specific extensions" are really "everyone besides GNOME extensions." The system tray extension isn't KDE-specific. Sure, window positions might not be available at all (because they don't make sense for a TWM), or a user might not have a system tray bar (or you might be on GNOME). However, if they did have a system tray it would be the StatusNotifierItem protocol. Ideally, these should be handled like other platform features like accelerometers etc.. That may not be possible, either way a lot of them can safely noop.
> [Article] For Avalonia, this means "Wayland support" isn't one implementation, it's potentially dozens. We're not just writing a Wayland backend; we're writing a GNOME-Wayland backend, a KDE-Wayland backend, a Sway-Wayland backend,
If you're making per-WM backends then you've fundamentally misunderstood how extensions are supposed to work. Other Wayland client libraries do not have a independent backends for KDE, Sway, and GNOME. Maybe quirks would be needed because you're attempting to support an existing UI library - but those should be few and far between.
IIRC Avalonia supports Vulkan as a rendering backend? Wayland protocols are the same line of thinking as Vulkan extensions.
wlroot and smithay are good examples of what extensions are used in the real world.
The whole idea of granular and independent extensions is pretty stupid across GL, Vulkan and Wayland. It makes more sense to have a handful "tiers" or "profiles" which guarantee a specific set of features (eg how all other 3D APIs do it) - e.g. Wayland should have a "desktop profile" instead of dozens of optional extensions needed for desktop scenarios, other profiles could be "mobile" and "kiosk".
What? No, that's not the case. Yes, different Wayland compositors often support different extensions, but everyone has the basics (Wayland core, xdg_shell, and probably a few others). You need one backend, and then you can support extensions to implement more advanced features, but you of course have to be able to continue to work without any extensions present.
Yes, there are some features that might require a different extension on GNOME than it does on KDE (for example), but you don't need a full "backend" to handle those differences.
As someone who has always been skeptical of Wayland, frustrated with its shortcomings, and who has written both a compositor and XEMBED-workalike library for Wayland, it just feels like author is trying to play up the difficulties for PR purposes here.
More likely you have to use a GNOME Extension (as in the plugin, not a wayland extension), or maybe a gnome-specific, possibly undocumented D-bus protocol.
That and studying smithay code.
https://wayland.freedesktop.org/docs/book/ https://wayland-book.com/
But when you try to do so, you see there's very little documentation and help out in the open, and by the commit history, you can see there's been like three dozen people who have ever contributed to the project.
The rate of code change and the obscurity means the knowledge simply does not build up over time.
So it's unclear how to fix an issue you've encountered, or add a feature, and if you've done so, how to get your changes merged.
* Core protocol drawing (lines, rectangles, arcs, the classics)
* XRender for compositing and alpha
* XShm for shared-memory blits
* GLX if you felt like bringing a GPU to a 2D fight
* XVideo for overlay video paths
* Pixmaps vs Windows, because why have one drawable when you can have two subtly different ones
* And of course, indirect rendering over the network if you enjoy latency as a design constraint
What happened is basically this:
- X11 was fairly complex, had a lot of dead-weight code, and a whole bunch of fundamental issues that were building up to warrant an "X12" and breaking the core protocols to get fixed.
- Alongside this, at some point in the relatively distant past, the XFree86 implementation (the most used one at the time, which later begat Xorg) was massively fat and did a huge amount of stuff, including driver-level work - think "PCI in userspace".
- Over the years, more and more of the work moved out of the X server and into e.g. the Linux kernel. Drivers, mode setting, input event handling, higher-level input event handling (libinput). Xorg also got a bit cleaner and modularized, making some of the remaining hard bits available in library form (e.g. xkb).
- With almost everything you need for a windowing system now cleanly factored out and no longer in X, trying out a wholly new windowing system suddenly became a tractable problem. This enabled the original Wayland author to attempt it and submit it for others to appraise.
- A lot of the active X and GUI developer liked what they saw and it managed to catch on.
- A lot of the people involved were in fact not naive, and did not ignore the classic "should you iterate or start over" conundrum. Wayland had a fairly strong backward compat story very early on in the form of Xwayland, which was created almost immediately, and convinced a lot of people.
In the end this is a very classic software engineering story. Would it have been possible to iterate X11 toward what Wayland is now in-place? Maybe. Not sure. Would the end result look a lot like Wayland today? Probably, the Wayland design is still quite good and modern.
It's a lot like Python 2.x vs. 3.x in the end.
X11 was ok for it's time, but fundamentally it's an really outdated design to solve 80s/90s issues over the network in the way you solved it back then.
Why not use a much simpler command buffer model like on 3D APIs, and only for actually asynchronous commands (but not simple synchronous getters)?
PS: is io_uring using sockets for its "shared memory ringbuffers"? If not why? Too much overhead? And if there's notable socket overhead, why is Wayland using sockets (since it has to solve a simar problem as io_uring or 3D APIs).
We have eons better ways to transport graphical buffers around (also, what about sound? That seems reasonable - but now should the display server also be a sound server?), so building it into such a core protocol just doesn't make sense.
- Modern DX and old Direct Draw games often was a clusterfuck in order to keep them running fast in Windows 8 and up.
- XVideo and overlay video for Windows were 100% the same; green glitches on drawing, blue screens on screnshots et all.
- Same issue in Windows with pixmaps.
- RDP was fine there, even Gnome adopted it. But I prefer 9front's transparency, you don't need to get everything from the host to use it, with 9front you can just get the device you want, you can decouple auth from the GUI and a lot more, even the network and audio devices. Much fetter than X11's remote setups, VNC, RDP and whatnot.
It's not particularly complicated, and certainly a lot simpler and cleaner than X11 in almost every way.
The reality of the situation is that there's sort of a hateful half-knowledge mob dynamic around the topic, where people run into a bug, do some online search, run into the existing mob, copy over some of its "arguments" and the whole thing keeps rolling and snowballing.
Sometimes this innocent, like OP discovering that UIs are actually non-trivial and there's different types of windows for different things (like in really any production-grade windowing system). So they share their new-found knowledge in the form of a list. Then the mob comes along and goes "look at this! they have a list of things, and it's probably too long!" and then in the next discussion it's "Did you know that Wayland has a LONG LIST OF THINGS?!" and so on and so forth.
It's like politics, and it's cyclic. One day the narrative will shift again.
The mob will not believe me either, for that matter, but FWIW, I've worked on the Linux desktop for over 20 years, and as the lead developer of KDE Plasma's taskbar and a semi-regular contributor to its window manager, I'm exposed to the complexity of these systems in a way that only relatively few people in the world are. And I'd rather keep the Wayland code than the X11 one, which I wrote a lot of.
Most other Linux projects "just work" without any drama (usually those not originating at Red Hat?). Makes you wonder why Wayland is so special (or maybe it is something special about the Red Hat company culture?).
Sometimes a badly designed system is simply a badly designed system, and the main forces behind Wayland seem to be exceptionally tone deaf and defensive when it comes to feedback both from users and application developers (e.g. there seems to be a general "we know better what's good for you" attitude).
Perhaps https://github.com/X11Libre/xserver can revive the older ecosystem. Almost nobody writes for wayland. About two years ago I tried to switch, then gave up when I realised how many things are missing on wayland. And then I noticed that barely anyone wrote software for wayland. It feels like a corporate advertisement project really. GNOME and KDE push for wayland now.
If you write software using GTK, Qt, or FLTK then you are writing Wayland software.
The majority of Linux desktops are Wayland at this point. Nobody writes software for them?
The Steamdeck uses gamescope which is Wayland. GNOME, COSMIC, Budgie, Niri, and Hyprland are not just Wayland but Wayland only. KDE will be Wayland only soon. Cinnamon is switching to Wayland. XFCE is writing a Wayland compositor.
What percentage of Linux desktop users are not using one of the above? 10 at most?
Why is it so complicated if it's just a common backend? Surely you don't need 1/10th the complexity just to render gnome or kde (never heard of fltk before).
As such it essentially cements the GTK/Qt duopoly. Both are extremely subpar low-quality bloated toolkits that are also responsible for the fact that the Linux desktop is still not a thing in 2026.
1. Comparison with raylib
This is imo comparing apples with oranges. Raylib sits at a much higher level than wayland, and it in fact supports using wayland as a backend.
2. Wayland is littered with callbacks because it's an object oriented protocol
It's more due to wayland being an asynchronous protocol. When you send a request to the compositor, chances are that you wont hear back from it immediately. But it's also likely that the app can do other things while waiting for the response. X11 is also in fact an asynchronous protocol, it's just that XLib creates a synchronous API on top of it (and as a result suffers from unnecessary roundtrip delays). In comparison, the newer XCB library is a lot more faithful in terms of preserving the asynchronous nature of the protocol and is used by, for example, Qt's X11 backend and even XLib itself. Of course that also makes it more difficult to use, not unlike libwayland, but the main takeaway here is that you can build a sync API on top of an async one if you wish and not vice versa.
I think some parts of the author's frustration is misplaced because they see libwayland as a toolkit, and in that case yeah it's pretty painful. But I really don't agree with the conclusion that this somehow makes it a bad foundation to build upon. As an analogy, making raw syscalls to the kernel is also painful, but that's why libraries exist.
(edit for better formatting)
You can write a simple Wayland screenshot app with a few hundred lines of code[0], and a compositor that supports the ext-image-capture source and ext-image-copy-capture extensions implemented. (Or the older wlr-screencopy.)
I have plenty of criticism for Wayland and its ecosystem, but if you're going to criticize, don't spread FUD.
(I don't like being the guy who has to assert his credentials, but: I've implemented all three of those screenshot/screencast protocols in a Wayland compositor, just a month or so ago, and know how they work, and what it takes to talk to them from a client.)
Also I read through the link you posted. There's a lot of truth to many of those frustrations, but a lot of it is based on misunderstandings of what Wayland actually is. Yes, most people should be using a toolkit. No, it's not great that the main choices are GTK and Qt. I think there's absolutely room for a mid-level toolkit that lets you do the basics without requiring all the Wayland boilerplate. smithay-client-toolkit is one such effort, and I think it's a good start, though something even higher-level on top of it would be nice.
I also don't get the callback hate. I much prefer registering callbacks over a ginormous switch statement that has to dispatch every event under the sun. Toolkits use callbacks too; does the author hate all toolkits as well? You actually could talk to a Wayland compositor with a big switch statement if you wanted, though you'd need to modify libwayland-client to return events as you iterate its event queue rather than dispatch things to callbacks. That could be a fun project for someone who wanted to make Wayland event handling just like libX11 event handling. (See: just a fundamental misunderstanding of what Wayland is.)
And comparing raylib to libwayland-client is silly; they're fundamentally different things. And you can use raylib to talk to a Wayland compositor. It's just a bad-faith argument.
If you want to compare libwayland-client to something, you have to compare it to libX11 or libxcb. And while yes, getting a simple window on-screen is indeed simpler with libX11/libxcb, doing anything more complicated than that is on par with what you'd end up doing with libwayland-client.
[0] Not counting the protocol code that wayland-scanner will generate for you, because that's like saying you have to count the lines of code in libX11 to write an X11 screenshot app.
I'm not all that informed regarding Waylands benefits and shortcomings (just being puzzled when "performance" or "overhead" is quoted as reason to move away from X11, remembering that the latter didn't seem unbearable slow 30 years ago and that performance of computers in general and computer graphics in particular increased manifold since then). There are however some who should know, who don't seem all that excited: https://www.kicad.org/blog/2025/06/KiCad-and-Wayland-Support...
Whether you use Wayland or not depends on what DE/Window Manager/Session Manager you are using and not what distro.
Cinnamon, XFCE don't really work with Wayland. Cinnamon just hangs on my system, and I don't believe XFCE even support. I am on Debian 13, so things may have changed on the latest versions.
Making Gnome using X was as simple as disabling Wayland. A one line change in GDM config somewhere and restart the session manager.
> This just feels like the systemd drama restarted. Some will complain and hold on to the past for as long as they can but the rest of the world moves on.
That because a similar things happen fairly regularly in Linux land. It seems every 5 years (or so it seems) There are things that are working perfectly fine, and then someone/some group decided that half of a particular stack needs rewriting/replacing at <large corp> and we go through a rigmarole of bugs, breakage, stability issues.
It isn't people being irrational. It is people not wanting to go through another 5 years of churn on their desktops. If people are happy with something that works fine in their opinion and it is replaced by something else that causes a lot of churn and it isn't substantially better a lot of people are going to be left pissed off about it and thus the drama and resentment.
This also causes issues for other operating systems e.g. BSDs/Solaris forks etc. Their users have to deal with all the Linuxisms.
> Wayland is the better choice today.
The problem is that a lot of stuff still doesn't work properly. I am using a modern AMD card. I get weird hang ups in Chrome/Brave that don't happen in X. Sometimes the windows "stick", other times the whole desktop just locks up. Doesn't happen in X at all. I am a web developer, so this is very annoying.
There is another problem and that is that I don't think Wayland even works on non-Linux *nix like FreeBSD.
The things that Gnome did well with Wayland is things like Different Refresh rates, display scaling etc. That all worked nicely. However the way Gnome works with Games can be a PITA.
When I was using Wayland BTW, I was using it with Gnome 48, GDM on Debian 13. I think they just released Gnome 50. I went to Cinnamon and can't really go back because I updated too many dependencies from back-ports to reinstall Gnome.
You are free to use whatever you feel like, no one stops you.
At the same time, you are not free to request for/expect other people's free work in maintaining stuff forever for you. If you want it to continue to work, feel free to step up and maintain Xorg/your DE of choice, whatever.
Also, both systemd and Wayland are just factually better stuff than their predecessors. Not everything is NIH, there are legitimate technological advances we are better off adapting at one point - see git, not managing the complex process of system boot via hacky bash scripts, or package management (we are not yet ready, but nix is the future, all other package management systems are objectively worse).
It is just sometimes in an easier context to be replaced. Display stack is tightly depended on by all kinds of software and no matter how good an interop it has (xwayland), people will always find problems and blame the new tool. The network effect should not be underestimated.
As I am an Xfce user, I'm happy to wait.
not to mention GTK and Qt, both supporting wayland.
Most software vendors never talked to X directly either. You seem extremely misinformed