From e0c2fbbcde0fc6303527911f65bd0abb77e30bd7 Mon Sep 17 00:00:00 2001 From: Blake Batson Date: Wed, 24 Dec 2025 22:43:31 -0500 Subject: [PATCH] Force disable xrandr if it is unavailable lwjgl2 optionally requires the xrandr command line utility on linux, but does not check if the executable actually exists before trying to use it. We can force it to fall back to the xf86videomode implementation by checking for the executable ourselves, and force disabling xrandr with this boolean [1] if it does not exist. Link: https://github.com/LWJGL/lwjgl/blob/2df01dd762e20ca0871edb75daf670ccacc89b60/src/java/org/lwjgl/opengl/LinuxDisplay.java#L214 [1] Signed-off-by: Blake Batson --- launcher/minecraft/MinecraftInstance.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/launcher/minecraft/MinecraftInstance.cpp b/launcher/minecraft/MinecraftInstance.cpp index da57e9354..cdf670b0f 100644 --- a/launcher/minecraft/MinecraftInstance.cpp +++ b/launcher/minecraft/MinecraftInstance.cpp @@ -91,6 +91,7 @@ #include #include #include +#include #include #ifdef Q_OS_LINUX @@ -588,6 +589,16 @@ QStringList MinecraftInstance::javaArguments() "minecraft.exe.heapdump"); #endif + // LWJGL2 reads `LWJGL_DISABLE_XRANDR` to force disable xrandr usage and fall back to xf86videomode. + // It *SHOULD* check for the executable to exist before trying to use it for queries but it doesnt, + // so WE can and force disable xrandr if it is not available. +#ifdef Q_OS_LINUX + // LWJGL2 is "org.lwjgl" LWJGL3 is "org.lwjgl3" + if (m_components->getComponent("org.lwjgl") != nullptr && QStandardPaths::findExecutable("xrandr").isEmpty()) { + args << QString("-DLWJGL_DISABLE_XRANDR=true"); + } +#endif + int min = settings()->get("MinMemAlloc").toInt(); int max = settings()->get("MaxMemAlloc").toInt(); if (min < max) {