Skip to content

Commit a868f47

Browse files
committed
to span displays, use the fullScreen() method
1 parent ddd7f2c commit a868f47

1 file changed

Lines changed: 21 additions & 17 deletions

File tree

core/src/processing/core/PApplet.java

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -687,9 +687,10 @@ public class PApplet implements PConstants {
687687
*/
688688
static public final String ARGS_LOCATION = "--location";
689689

690+
/** Used by the PDE to suggest a display (set in prefs, passed on Run) */
690691
static public final String ARGS_DISPLAY = "--display";
691692

692-
static public final String ARGS_SPAN_DISPLAYS = "--span";
693+
// static public final String ARGS_SPAN_DISPLAYS = "--span";
693694

694695
static public final String ARGS_WINDOW_COLOR = "--window-color";
695696

@@ -814,6 +815,7 @@ public void init() {
814815
boolean fullScreen;
815816
// boolean spanDisplays;
816817
int display; // set to SPAN when using all displays
818+
GraphicsDevice[] displayDevices;
817819

818820
String outputPath;
819821
OutputStream outputStream;
@@ -848,16 +850,18 @@ void handleSettings() {
848850
// until we resolve https://github.com/processing/processing/issues/3296
849851
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
850852
GraphicsDevice device = ge.getDefaultScreenDevice();
851-
GraphicsDevice[] devices = ge.getScreenDevices();
853+
displayDevices = ge.getScreenDevices();
852854

853855
// Default or unparsed will be -1, spanning will be 0, actual displays will
854856
// be numbered from 1 because it's too weird to say "display 0" in prefs.
855-
if (display > 0 && display <= devices.length) {
856-
device = devices[display-1];
857+
if (display > 0 && display <= displayDevices.length) {
858+
device = displayDevices[display-1];
859+
}
860+
if (display != SPAN) {
861+
DisplayMode displayMode = device.getDisplayMode();
862+
displayWidth = displayMode.getWidth();
863+
displayHeight = displayMode.getHeight();
857864
}
858-
DisplayMode displayMode = device.getDisplayMode();
859-
displayWidth = displayMode.getWidth();
860-
displayHeight = displayMode.getHeight();
861865

862866
// Here's where size(), fullScreen(), smooth(N) and noSmooth() might
863867
// be called, conjuring up the demons of various rendering configurations.
@@ -9602,7 +9606,7 @@ static protected void runSketchEDT(final String[] args,
96029606
int displayIndex = -1; // use default
96039607
// boolean fullScreen = false;
96049608
boolean present = false;
9605-
boolean spanDisplays = false;
9609+
// boolean spanDisplays = false;
96069610

96079611
String param = null, value = null;
96089612
String folder = calcSketchPath();
@@ -9651,8 +9655,8 @@ static protected void runSketchEDT(final String[] args,
96519655
if (args[argIndex].equals(ARGS_PRESENT)) {
96529656
present = true;
96539657

9654-
} else if (args[argIndex].equals(ARGS_SPAN_DISPLAYS)) {
9655-
spanDisplays = true;
9658+
// } else if (args[argIndex].equals(ARGS_SPAN_DISPLAYS)) {
9659+
// spanDisplays = true;
96569660

96579661
} else if (args[argIndex].equals(ARGS_HIDE_STOP)) {
96589662
hideStop = true;
@@ -9713,13 +9717,13 @@ static protected void runSketchEDT(final String[] args,
97139717
// A handful of things that need to be set before init/start.
97149718
sketch.sketchPath = folder;
97159719

9716-
// sketch.spanDisplays = spanDisplays;
9717-
// If spanning screens, that means we're also full screen.
9718-
// fullScreen |= spanDisplays;
9719-
if (spanDisplays) {
9720-
displayIndex = SPAN;
9721-
// fullScreen = true;
9722-
}
9720+
//// sketch.spanDisplays = spanDisplays;
9721+
// // If spanning screens, that means we're also full screen.
9722+
//// fullScreen |= spanDisplays;
9723+
// if (spanDisplays) {
9724+
// displayIndex = SPAN;
9725+
//// fullScreen = true;
9726+
// }
97239727

97249728
// // If the applet doesn't call for full screen, but the command line does,
97259729
// // enable it. Conversely, if the command line does not, don't disable it.

0 commit comments

Comments
 (0)