mirror of
https://github.com/processing/processing4.git
synced 2026-02-02 21:29:17 +01:00
prevent "run sketches on display" message from showing up on startup
This commit is contained in:
@@ -376,7 +376,9 @@ public class Runner implements MessageConsumer {
|
||||
} else {
|
||||
params.append("processing.core.PApplet");
|
||||
|
||||
// get the stored device index (starts at 1)
|
||||
// Get the stored device index (starts at 1)
|
||||
// By default, set to -1, meaning 'the default display',
|
||||
// which is the same display as the one being used by the Editor.
|
||||
int runDisplay = Preferences.getInteger("run.display");
|
||||
|
||||
// If there was a saved location (this guy has been run more than once)
|
||||
@@ -395,23 +397,26 @@ 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-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) {
|
||||
// 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;
|
||||
if (runDisplay > 0) {
|
||||
if (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) {
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user