Native wayland support
Sometimes when I start an X11 app on my computer, xwayland stops working. While we are thinking about how to solve this issue, why don't we think about how to port Minetest (and Irrlicht) to Wayland?
GDB Debug Log:
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/toys-webserver/minetest/bin/minetest
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff5232640 (LWP 10108)]
[Thread 0x7ffff5232640 (LWP 10108) exited]
[New Thread 0x7ffff49f1640 (LWP 10109)]
[New Thread 0x7ffff49f1640 (LWP 10110)]
[Thread 0x7ffff49f1640 (LWP 10109) exited]
[New Thread 0x7fffdffff640 (LWP 10111)]
[New Thread 0x7fffdfdfe640 (LWP 10112)]
^C
Thread 1 "minetest" received signal SIGINT, Interrupt.
0x00007ffff719edab in __libc_connect (fd=10, addr=..., len=20) at ../sysdeps/unix/sysv/linux/connect.c:26
26 ../sysdeps/unix/sysv/linux/connect.c: 沒有此一檔案或目錄.
(gdb) bt
#0 0x00007ffff719edab in __libc_connect (fd=10, addr=..., len=20) at ../sysdeps/unix/sysv/linux/connect.c:26
#1 0x00007ffff7058f5f in xcb_connect_to_display_with_auth_info () from /lib/x86_64-linux-gnu/libxcb.so.1
#2 0x00007ffff7dc709a in _XConnectXCB () from /lib/x86_64-linux-gnu/libX11.so.6
#3 0x00007ffff7db6df9 in XOpenDisplay () from /lib/x86_64-linux-gnu/libX11.so.6
#4 0x0000555555c3aa71 in irr::CIrrDeviceLinux::createWindow() ()
#5 0x0000555555c42bed in irr::CIrrDeviceLinux::CIrrDeviceLinux(irr::SIrrlichtCreationParameters const&) ()
#6 0x0000555555c37e28 in createDeviceEx ()
#7 0x00005555557847cd in RenderingEngine::RenderingEngine(irr::IEventReceiver*) ()
#8 0x00005555556b88b8 in ClientLauncher::init_engine() ()
#9 0x00005555556bd287 in ClientLauncher::run(GameStartData&, Settings const&) ()
#10 0x0000555555693b3d in main ()
(gdb) quit
Not sure if it's that relevant, but there's already a native wayland port of Irrlicht for Salfish. It's probably the full featured Irrlicht though and also contains a few sailfish-specific changes.
@MatthewScholefield This build of Irrlicht allows building against SDL2, and that supports Wayland. It's not yet at a place where it has bug/feature parity with the current X11 code though.
Currently it is behind this CMake flag you can set when compiling yourself (below "Uncomment this line to compile with the SDL device"): https://github.com/minetest/irrlicht/blob/13d28fd2f28e0dcee98fd30f53f76bf04460214a/include/IrrCompileConfig.h#L48
I've had some fun tracking down Wayland-specific bugs in SDL as well: https://github.com/minetest/irrlicht/pull/123, https://github.com/minetest/minetest/pull/12636. I'm really glad with how it's improved so far.
Closing in favor of SDL2, which we're in the process of switching to.
Closing in favor of SDL2, which we're in the process of switching to.
So will Minetest have full support to Wayland after such changes? Would X11 still be the recommended one?