Use Wayland on Linux
One More Step Before opening this issue
- [x] To follow our Code of Conduct
- [x] I've considered existing issues on GitHub page and didn't find a similar issue
Describe the need of your project
The backend uses X11 on linux, and X11 is being deprecated. Native wayland support could be cool.
Proposed solution
aui.views/src/AUI/Platform/linux/ACustomWindowImpl.cpp - this is hardcoded to X11. In theory, it would be nice to change in runtime from X11 to Wayland.
I am unsure how the GTK include is being used, but is it really needed?
Alternatives you've considered
No response
Additional context
No response
https://github.com/aui-framework/aui/issues/218
Long story short, AUI has experimental support of Wayland, but on develop branch. The GTK module is used to present windows on GNOME as if they were native, because GNOME is the only DE that does not implement server side decoration.
this is hardcoded to X11. In theory, it would be nice to change in runtime from X11 to Wayland.
On develop branch, there will be an abstraction layer that dispatches between X11/Wayland.
You can prioritize Wayland (if it is present) https://github.com/Alex2772/auimusic/blob/master/src/main.cpp .
@diegoiast hi, is your issue resolved?
No. I installed on debian apt install libadwaita-1-dev and rebuilt from scratch. I don't see the app linking to that library, and I still see an x on the window menu - meaning its not a Wayland client yet, but still XWayland (X11 client). Am I missing something?
[aui] ldd cbuild2/bin/aui.example.flight_booker | grep -i adw 21:12:50 ☁ develop ☂ ✭
[aui]
Regarding the implementation - IMHO all that boiler plate should be on the library side, keeping the app code clean from such abstractions (unless the developer requested).
#if AUI_PLATFORM_LINUX
#include <AUI/Platform/linux/APlatformAbstractionOptions.h>
#endif
...
#if AUI_PLATFORM_LINUX
APlatformAbstractionOptions::set({
.initializationOrder = {
APlatformAbstractionOptions::Adwaita1{},
APlatformAbstractionOptions::Gtk4{},
APlatformAbstractionOptions::X11{},
},
});
#endif
This is undocumented behaviour but I will try to explain.
aui does not link to libadwaita nor to libgtk in the same way as to x11. Instead, for compatbility reasons,
APlatformAbstractionOptions::set({
.initializationOrder = {
APlatformAbstractionOptions::Adwaita1{},
APlatformAbstractionOptions::Gtk4{},
APlatformAbstractionOptions::X11{},
},
});
This snippet configures aui in such a way it will try to dlopen adwaita. If library is found, the adwaita PlatformAbstraction will be used. Otherwise, it fallbacks to gtk4, and to x11 as the last option.
So, there's no direct linking used.
Am I missing something?
Can you share console output from an AUI program that enforces Wayland? It should write a reason why it used X11 instead of Wayland backend.
IMHO all that boiler plate should be on the library side, keeping the app code clean from such abstractions (unless the developer requested.
Yes it would be there, but I would like to perform smooth transition to Wayland and not to enforce it by default. If you wish, you can enforce Wayland by this snippet.
OK, I was just blindly running code. That snippet is only in the music demo. I added that code to the button example.
When running with GTK4 abstraction - the top is rounded and looks bad on Plasma6. Also, the button has no text:
Lets run it with Adwaita, now I get a proper wayland client. However, it looks out of place in my desktop. See Firefox's title and the demo app. Still - no text on the button.
Here is the X11 client. Which looks OK, and button has text. But still - a X11 client.
Oh, I see. I've created a separate issue on this point: https://github.com/aui-framework/aui/issues/607