Opened 7 years ago
Last modified 5 years ago
#16530 new defect
Dual head monitor setup: menus and dialogs are on the wrong screen
Reported by: | anonymous | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core | Version: | latest |
Keywords: | template_report | Cc: | naoliv |
Description
What steps will reproduce the problem?
- Open JOSM, download an area
- Move the JOSM main window to the second screen
- Click a main menu item or open a dialog
What is the expected result?
Menus and dialogs are displayed on the main window screen, except the user moved the dialog to a suitable position before (then remember this position, see bug #13939)
What happens instead?
Menus and dialogs are always shown on the first screen where the JOSM main window was before.
Please provide any additional information below. Attach a screenshot if possible.
see also bug #4925 for an X11 system. I'm on Windows 7.
Attachments (0)
Change History (9)
comment:1 by , 7 years ago
Owner: | changed from | to
---|---|
Status: | new → needinfo |
comment:2 by , 7 years ago
Resolution: | → needinfo |
---|---|
Status: | needinfo → closed |
comment:3 by , 6 years ago
Resolution: | needinfo |
---|---|
Status: | closed → reopened |
Version: | → latest |
Same here. When JOSM moved from the primary display, the newly opening UI elements (even the menu bar) still show up on the primary monitor instead of on that display where JOSM is.
JOSM 14760 OS Name: Microsoft Windows 10 Pro OS Version: 10.0.17763 N/A Build 17763 java version "1.8.0_201" Java(TM) SE Runtime Environment (build 1.8.0_201-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
comment:4 by , 6 years ago
Owner: | changed from | to
---|---|
Status: | reopened → new |
comment:5 by , 6 years ago
Steps to reproduce:
- Get a second monitor, if you currently doesn't have
- Open JOSM. It will open on your primary display.
- Move JOSM entirely to the secondary monitor.
- Try using it. Almost every new UI element will be on your primary.
comment:6 by , 5 years ago
I use two screens with Windows 10, with the added complication that they have different scaling factors (200% on the primary HiDPI laptop screen, 100% on the secondary desktop screen). Under theses circumstances, JOSM dialogs (e.g. the history dialog) are spawned such that parts of the are outside of any screen. And even if the window is resized and dragged to the right position, that position is not remembered (at least not in a correctly).
==========
History...
Similar bugs have been filed multiple times
https://josm.openstreetmap.de/ticket/13939 (has a video showing the problem, still open)
https://josm.openstreetmap.de/ticket/13166 (closed as duplicate)
https://josm.openstreetmap.de/ticket/4925 (still open, for ages)
==========
Looking into the JOSM code...
WindowGeometry.getScreenInfo has a comment saying
/* default: something on screen 1 */
which probably means "primary screen" and would support that the bug still exists.
The Javadoc of WindowGeometry.centerOnScreen says "where main window is", but I don't think that's actually implemented.
It rather looks for a screen intersecting with new Point(0, 0), new Dimension(10, 10), which would be the primary screen.
All this code comes from an 8 year old commit ("better handling of dialogs for multiple screens")
https://github.com/openstreetmap/josm/commit/d72aa28f07ee6fb0d70895dfd9fb25a0176f5f26
==========
Contributing to the problem...
Java's Rectangle.intersect returns a result rectangle with negative dimensions instead of an empty rectangle as documented:
https://stackoverflow.com/questions/23848592/java-awt-rectangle-intersection
Varios unfixed bugs on Java side:
https://bugs.openjdk.java.net/browse/JDK-8229813
https://bugs.openjdk.java.net/browse/JDK-8222210
GraphicsConfiguration.getBounds returning inconsistent results for screens with different scaling, e.g.
(0,0)+(1600,900)
(3200,0)+(1920,1200)
==========
I hope I can come up with a portable fix for this mess...
comment:7 by , 5 years ago
Cc: | added |
---|
comment:8 by , 5 years ago
I'd propose you try an java update first. Something above 11. I'm using JOSM for several years now on different OS (Windows and Linux) and JAVA versions and it works as expected on many systems for dual screen setups.
As JOSM does not calculate the position of menus (but only positions of windows/dialogs/...) as JAVA does this itself, there is little chance the bug is in JOSM code.
comment:9 by , 5 years ago
True, the menus are fine. But the dialogs are not, as described for the mixed-scaling setup. This includes that in certain setups, they open on the first screen while the main program is open on the second one (topic of this bug). Remembering those positions using getLocation/setLocation does not work, I have filed a JDK bug on that problem (tried with many Java versions >=11, including 15 EA):
https://bugs.openjdk.java.net/browse/JDK-8237924
Thanks for your report, however your ticket is incomplete and therefore not helpful in its current form.
Please add all needed information according to this list:
To ensure that all technical relevant information is contained, create new tickets by clicking in JOSMs Main Menu on Help →
Report Bug.
Remember: This is a generic notice so we don't need to write the same stuff again and again. It may only apply in parts to the specific case!