mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-13 10:29:35 +01:00
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).
This commit is contained in:
parent
8292989e2d
commit
328296a2c5
@ -59,17 +59,11 @@ public abstract class AbstractMonitor extends JFrame implements ActionListener {
|
||||
pack();
|
||||
|
||||
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
if (PreferencesData.get("last.screen.height") != null) {
|
||||
// if screen size has changed, the window coordinates no longer
|
||||
// make sense, so don't use them unless they're identical
|
||||
int screenW = PreferencesData.getInteger("last.screen.width");
|
||||
int screenH = PreferencesData.getInteger("last.screen.height");
|
||||
if ((screen.width == screenW) && (screen.height == screenH)) {
|
||||
String locationStr = PreferencesData.get("last.serial.location");
|
||||
if (locationStr != null) {
|
||||
int[] location = PApplet.parseInt(PApplet.split(locationStr, ','));
|
||||
setPlacement(location);
|
||||
}
|
||||
String locationStr = PreferencesData.get("last.serial.location");
|
||||
if (locationStr != null) {
|
||||
int[] location = PApplet.parseInt(PApplet.split(locationStr, ','));
|
||||
if (location[0] + location[2] <= screen.width && location[1] + location[3] <= screen.height) {
|
||||
setPlacement(location);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user