Force disable xrandr if it is unavailable (#4578)

This commit is contained in:
Alexandru Ionut Tripon
2025-12-26 12:10:39 +02:00
committed by GitHub

View File

@@ -91,6 +91,7 @@
#include <QActionGroup>
#include <QMainWindow>
#include <QScreen>
#include <QStandardPaths>
#include <QWindow>
#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) {