Skip to content

Commit cc2433e

Browse files
authored
Merge pull request #79 from PumpkinXD/fix-x11-crash
fix(wayland): combine GLFW backend check with XDG_SESSION_TYPE detection
2 parents 8ca5e2f + 2f90216 commit cc2433e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/main/java/net/notcoded/wayfix/WayFix.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import org.apache.logging.log4j.LogManager;
1111
import org.apache.logging.log4j.Logger;
1212
import org.lwjgl.glfw.GLFW;
13+
import java.util.Objects;
1314

1415
public class WayFix {
1516
public static final Logger LOGGER = LogManager.getLogger(WayFix.class);
@@ -35,7 +36,9 @@ public static boolean isWayland() {
3536

3637
public static boolean supportsWayland() {
3738
try {
38-
return GLFW.glfwPlatformSupported(GLFW.GLFW_PLATFORM_WAYLAND);
39+
return GLFW.glfwPlatformSupported(GLFW.GLFW_PLATFORM_WAYLAND) &&
40+
Objects.requireNonNullElse(System.getenv("XDG_SESSION_TYPE"),
41+
"").toLowerCase().startsWith("wayland");
3942
} catch (NoSuchMethodError ignored) { // <3.3.0
4043
LOGGER.warn("WayFix is disabling itself due to the LWJGL Version being too low.");
4144
LOGGER.warn("Please update to a LWJGL version such as '3.3.1' or higher.");

0 commit comments

Comments
 (0)