mach
mach copied to clipboard
glfw: Wayland Compilation causes `Platform Error` in runtime
im not able to run a simple example of mach-glfw build for wayland target.
error description:
error: PlatformError
Wayland: Focusing a window requires user interaction
not sure this only happen in my system or it's a global issue
Wow, apparently createWindow
returns an error that should be ignored on Wayland:
https://github.com/glfw/glfw/issues/1121
See also https://github.com/bnpr/Malt/issues/173
Seems to be because focusOnShow
window hint defaults to true in GLFW: https://sourcegraph.com/github.com/glfw/[email protected]/-/blob/src/window.c?L270:24
Looks like the error is removed in the latest master
version of GLFW, though. I suspect real fix is just to wait until new GLFW version is released.
Workaround: We should force focusOnShow
to default to false
if Wayland.
I get a different PlatformError
when I try to run a demo:
glfw: error.PlatformError: X11: The DISPLAY environment variable is missing
error: PlatformError
using Sway WM on Arch.
zig build run-example-boids
on wayland worked as expected. upstream issue is also closed so we can close this too
Closing, but please note this doesn't mean Wayland is fully working @alichraghi - the reason that boids example works on your system is most likely because you have XWayland which adds X11 compatibility for Wayland.
https://github.com/hexops/mach/issues/511 describes what we need to do next to get proper Wayland support.