WayFix icon indicating copy to clipboard operation
WayFix copied to clipboard

wayfix crashes on x11

Open PumpkinXD opened this issue 1 year ago • 1 comments

logs:https://mclo.gs/n87xqJ7

I belive https://github.com/not-coded/WayFix/blob/986f739b650e0d062860fc24e977999404ef2ff4/src/main/java/net/notcoded/wayfix/WayFix.java#L38 is related According to glfw's docs, glfwPlatformSupported(int platform) function returns whether the library was compiled with support for the specified platform. (When GLFW is bundled with both X11 and Wayland support, glfwPlatformSupported(GLFW_PLATFORM_WAYLAND) still returns true on systems that only have X11. )

PumpkinXD avatar Nov 22 '25 09:11 PumpkinXD

maybe we can also check System.getenv("XDG_SESSION_TYPE").lowercase()'s value to get around this(would be good for putting the mod into a modpack)

like

- return GLFW.glfwPlatformSupported(GLFW.GLFW_PLATFORM_WAYLAND); 
+ return (GLFW.glfwPlatformSupported(GLFW.GLFW_PLATFORM_WAYLAND) &&
+ Objects.requireNonNullElse(System.getenv("XDG_SESSION_TYPE"),"").toLowerCase().startsWith("wayland")); 

PumpkinXD avatar Nov 22 '25 09:11 PumpkinXD