mach icon indicating copy to clipboard operation
mach copied to clipboard

glfw: Wayland Compilation causes `Platform Error` in runtime

Open alichraghi opened this issue 3 years ago • 2 comments

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

alichraghi avatar Dec 24 '21 10:12 alichraghi

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.

emidoots avatar Dec 24 '21 18:12 emidoots

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.

illfygli avatar Jun 05 '22 20:06 illfygli

zig build run-example-boids on wayland worked as expected. upstream issue is also closed so we can close this too

alichraghi avatar Sep 02 '22 12:09 alichraghi

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.

emidoots avatar Sep 02 '22 17:09 emidoots