1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-31 20:52:13 +01:00

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
This commit is contained in:
Martino Facchin 2020-02-28 17:51:06 +01:00 committed by Cristian Maglie
parent 6f943ea4a8
commit 558ddd3d91

View File

@ -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) {