fixing issues related to the displays pref #3264

This commit is contained in:
Ben Fry
2015-06-08 20:50:07 -04:00
parent 1414ea9adc
commit 70dc95047f
5 changed files with 61 additions and 31 deletions
+11 -5
View File
@@ -9655,8 +9655,10 @@ public class PApplet implements PConstants {
void frameMoved(int x, int y) {
System.err.println(EXTERNAL_MOVE + " " + x + " " + y);
System.err.flush(); // doesn't seem to help or hurt
if (!fullScreen) {
System.err.println(EXTERNAL_MOVE + " " + x + " " + y);
System.err.flush(); // doesn't seem to help or hurt
}
}
@@ -9818,7 +9820,7 @@ public class PApplet implements PConstants {
int stopColor = 0xff808080;
boolean hideStop = false;
int displayIndex = -1; // use default
int displayNum = -1; // use default
// boolean fullScreen = false;
boolean present = false;
// boolean spanDisplays = false;
@@ -9838,8 +9840,8 @@ public class PApplet implements PConstants {
editorLocation = parseInt(split(value, ','));
} else if (param.equals(ARGS_DISPLAY)) {
displayIndex = parseInt(value, -1);
if (displayIndex == -1) {
displayNum = parseInt(value, -1);
if (displayNum == -1) {
System.err.println("Could not parse " + value + " for " + ARGS_DISPLAY);
}
@@ -9926,6 +9928,10 @@ public class PApplet implements PConstants {
}
}
// Set the suggested display that's coming from the command line
// (and most likely, from the PDE's preference setting).
sketch.display = displayNum;
// Call the settings() method which will give us our size() call
// try {
sketch.handleSettings();
@@ -398,6 +398,7 @@ public class PSurfaceAWT extends PSurfaceNone {
GraphicsEnvironment.getLocalGraphicsEnvironment();
int displayNum = sketch.sketchDisplay();
// System.out.println("display from sketch is " + displayNum);
if (displayNum > 0) { // if -1, use the default device
GraphicsDevice[] devices = environment.getScreenDevices();
if (displayNum <= devices.length) {
@@ -694,6 +695,7 @@ public class PSurfaceAWT extends PSurfaceNone {
int contentW = Math.max(sketchWidth, MIN_WINDOW_WIDTH);
int contentH = Math.max(sketchHeight, MIN_WINDOW_HEIGHT);
// Ignore previous sketch placement when dealing with full screen
if (sketch.sketchFullScreen()) {
location = null;
}