Skip to content

Commit 328296a

Browse files
facchinmcmaglie
authored andcommitted
Only reapply serial monitor last location if it fits the screen
There could be a couple of edge cases in this approach (for example, if someone wants to keep the serial monitor window only half visible). However, it should be at least safe (no serial monitors on the second screen) if the Window Manager acts correctly (by moving all the windows on the second monitor to the primary on detach).
1 parent 8292989 commit 328296a

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

app/src/processing/app/AbstractMonitor.java

+5-11
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,11 @@ public void actionPerformed(ActionEvent event) {
5959
pack();
6060

6161
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
62-
if (PreferencesData.get("last.screen.height") != null) {
63-
// if screen size has changed, the window coordinates no longer
64-
// make sense, so don't use them unless they're identical
65-
int screenW = PreferencesData.getInteger("last.screen.width");
66-
int screenH = PreferencesData.getInteger("last.screen.height");
67-
if ((screen.width == screenW) && (screen.height == screenH)) {
68-
String locationStr = PreferencesData.get("last.serial.location");
69-
if (locationStr != null) {
70-
int[] location = PApplet.parseInt(PApplet.split(locationStr, ','));
71-
setPlacement(location);
72-
}
62+
String locationStr = PreferencesData.get("last.serial.location");
63+
if (locationStr != null) {
64+
int[] location = PApplet.parseInt(PApplet.split(locationStr, ','));
65+
if (location[0] + location[2] <= screen.width && location[1] + location[3] <= screen.height) {
66+
setPlacement(location);
7367
}
7468
}
7569

0 commit comments

Comments
 (0)