Add restart on resolution change
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
import pp.mdga.client.view.*;
|
import pp.mdga.client.view.*;
|
||||||
import pp.mdga.message.server.ServerInterpreter;
|
import pp.mdga.message.server.ServerInterpreter;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.prefs.Preferences;
|
import java.util.prefs.Preferences;
|
||||||
@@ -263,7 +264,25 @@ public void updateResolution(int width, int height, float imageFactor) {
|
|||||||
prefs.putInt("height", height);
|
prefs.putInt("height", height);
|
||||||
prefs.putFloat("scale", imageFactor);
|
prefs.putFloat("scale", imageFactor);
|
||||||
|
|
||||||
stop();
|
try {
|
||||||
|
restartApp();
|
||||||
|
} catch (Exception e) {
|
||||||
|
//nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void restartApp() throws IOException {
|
||||||
|
String javaBin = System.getProperty("java.home") + "/bin/java";
|
||||||
|
String classPath = System.getProperty("java.class.path");
|
||||||
|
String className = System.getProperty("sun.java.command");
|
||||||
|
|
||||||
|
ProcessBuilder builder = new ProcessBuilder(
|
||||||
|
javaBin, "-cp", classPath, className
|
||||||
|
);
|
||||||
|
|
||||||
|
builder.start();
|
||||||
|
|
||||||
|
System.exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user