[FIX] Improve Wayland support

This commit is contained in:
Gravita 2023-12-20 02:13:39 +07:00
parent 6c0500f528
commit 31489a2b24
3 changed files with 12 additions and 4 deletions

View file

@ -171,6 +171,14 @@ public void start(boolean pipeOutput) throws IOException, InterruptedException {
LogHelper.debug("Commandline: %s", Arrays.toString(processArgs.toArray())); LogHelper.debug("Commandline: %s", Arrays.toString(processArgs.toArray()));
ProcessBuilder processBuilder = new ProcessBuilder(processArgs); ProcessBuilder processBuilder = new ProcessBuilder(processArgs);
EnvHelper.addEnv(processBuilder); EnvHelper.addEnv(processBuilder);
if(JVMHelper.OS_TYPE == JVMHelper.OS.LINUX){
var env = processBuilder.environment();
// https://github.com/Admicos/minecraft-wayland/issues/55
env.put("__GL_THREADED_OPTIMIZATIONS", "0");
if(params.lwjglGlfwWayland) {
env.remove("DISPLAY"); // No X11
}
}
processBuilder.environment().put("JAVA_HOME", javaVersion.jvmDir.toAbsolutePath().toString()); processBuilder.environment().put("JAVA_HOME", javaVersion.jvmDir.toAbsolutePath().toString());
processBuilder.environment().putAll(systemEnv); processBuilder.environment().putAll(systemEnv);
processBuilder.directory(workDir.toFile()); processBuilder.directory(workDir.toFile());

View file

@ -466,7 +466,7 @@ public enum ClassLoaderConfig {
} }
public enum CompatibilityFlags { public enum CompatibilityFlags {
LEGACY_NATIVES_DIR, CLASS_CONTROL_API, ENABLE_HACKS LEGACY_NATIVES_DIR, CLASS_CONTROL_API, ENABLE_HACKS, WAYLAND_USE_CUSTOM_GLFW
} }
public static class Version implements Comparable<Version> { public static class Version implements Comparable<Version> {

View file

@ -176,9 +176,9 @@ private static void realMain(String[] args) throws Throwable {
if(profile.hasFlag(ClientProfile.CompatibilityFlags.CLASS_CONTROL_API)) { if(profile.hasFlag(ClientProfile.CompatibilityFlags.CLASS_CONTROL_API)) {
ClientService.classLoaderControl = classLoaderControl; ClientService.classLoaderControl = classLoaderControl;
} }
if(params.lwjglGlfwWayland) { if(params.lwjglGlfwWayland && profile.hasFlag(ClientProfile.CompatibilityFlags.WAYLAND_USE_CUSTOM_GLFW)) {
String glfwPath = ClientService.findLibrary("glfw_wayland"); String glfwName = ClientService.findLibrary("glfw_wayland");
System.setProperty("org.lwjgl.glfw.libname", glfwPath); System.setProperty("org.lwjgl.glfw.libname", glfwName);
} }
AuthService.projectName = Launcher.getConfig().projectName; AuthService.projectName = Launcher.getConfig().projectName;
AuthService.username = params.playerProfile.username; AuthService.username = params.playerProfile.username;