From 558ddd3d914b46e24ed25823e209349ec2f0d8a6 Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Fri, 28 Feb 2020 17:51:06 +0100 Subject: [PATCH] Don't restore sketch if last.sketch.location is out of display `if ((screen.width != screenW) || (screen.height != screenH))` was making sure to reset every preference in case the display geometry changed. Unfortunately, on Windows 10, `Toolkit.getDefaultToolkit().getScreenSize()` reports only the primary monitor either if external display is connected or not. Fixes #9781 --- app/src/processing/app/Base.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 734277594..29580d2c9 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -621,7 +621,12 @@ public class Base { .get("last.sketch" + index + ".location"); if (locationStr == null) return defaultEditorLocation(); - return PApplet.parseInt(PApplet.split(locationStr, ',')); + + int location[] = PApplet.parseInt(PApplet.split(locationStr, ',')); + if (location[0] > screen.width || location[1] > screen.height) + return defaultEditorLocation(); + + return location; } protected void storeRecentSketches(SketchController sketch) {