mirror of
https://github.com/processing/processing4.git
synced 2026-01-29 19:31:16 +01:00
fixing issues related to the displays pref #3264
This commit is contained in:
@@ -153,6 +153,7 @@ public class Runner implements MessageConsumer {
|
||||
public boolean launchVirtualMachine(boolean presenting) {
|
||||
String[] vmParams = getMachineParams();
|
||||
String[] sketchParams = getSketchParams(presenting);
|
||||
// PApplet.printArray(sketchParams);
|
||||
int port = 8000 + (int) (Math.random() * 1000);
|
||||
String portStr = String.valueOf(port);
|
||||
|
||||
@@ -308,7 +309,7 @@ public class Runner implements MessageConsumer {
|
||||
} else {
|
||||
params.add("processing.core.PApplet");
|
||||
|
||||
// get the stored device index (starts at 0)
|
||||
// get the stored device index (starts at 1)
|
||||
int runDisplay = Preferences.getInteger("run.display");
|
||||
|
||||
// If there was a saved location (this guy has been run more than once)
|
||||
@@ -327,17 +328,23 @@ public class Runner implements MessageConsumer {
|
||||
|
||||
// Make sure the display set in Preferences actually exists
|
||||
GraphicsDevice runDevice = editorDevice;
|
||||
if (runDisplay >= 0 && runDisplay < devices.length) {
|
||||
runDevice = devices[runDisplay];
|
||||
if (runDisplay > 0 && runDisplay <= devices.length) {
|
||||
runDevice = devices[runDisplay-1];
|
||||
} else {
|
||||
// If a bad display is selected, use the same display as the editor
|
||||
if (runDisplay > 0) { // don't complain about -1 or 0
|
||||
System.err.println("Display " + runDisplay + " not available.");
|
||||
}
|
||||
runDevice = editorDevice;
|
||||
for (int i = 0; i < devices.length; i++) {
|
||||
if (devices[i] == runDevice) {
|
||||
runDisplay = i;
|
||||
// Wasn't setting the pref to avoid screwing things up with
|
||||
// something temporary. But not setting it makes debugging one's
|
||||
// setup just too damn weird, so changing that behavior.
|
||||
runDisplay = i + 1;
|
||||
System.err.println("Setting 'Run Sketches on Display' preference to display " + runDisplay);
|
||||
Preferences.setInteger("run.display", runDisplay);
|
||||
break;
|
||||
// Don't set the pref, might be a temporary thing. Users can
|
||||
// open/close Preferences to reset the device themselves.
|
||||
// Preferences.setInteger("run.display", runDisplay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user