This is a follow-on to JDK-8251862.
JDK-8251862 fixes a fundamental problem on Windows platforms with more than one screen with different HiDPI scales. A PopupWindow created for a Stage that straddles two screens will be drawn with an incorrect position and scale if the majority of the Stage is on one screen, and the popup is positioned on the other screen.
While doing some additional testing [1][2], we discovered a related problem that happens in some screen configurations. The problem is in the the code that adjusts the position of the popup to keep it on the same screen as the anchor. The code that does this first computes the screen that the anchor is on, and then adjusts the upper-left corner of the popup window to keep the window entirely on that screen. The problem with this approach is that the bounds of each screen is (necessarily) in that screen's coordinate system, using the scale of that screen, which isn't necessarily the same as the scale actually being used for the popup. Since the bounds of the screen are used to determine where to position the rectangle to keep it on that screen, the inaccurate bounds will cause the rectangle to be moved to the wrong location.
A possible fix for this problem is to adjust the bounds of the screen by the ratio of the two screen scales before comparing the coordinates with the screen bounds, but this might be somewhat tricky.
This bug is not platform-specific.
[1] https://git.openjdk.org/jfx/pull/971#issuecomment-1369417821
[2] https://git.openjdk.org/jfx/pull/971#issuecomment-1371547753
While doing some additional testing [1][2], we discovered a related problem that happens in some screen configurations. The problem is in the the code that adjusts the position of the popup to keep it on the same screen as the anchor. The code that does this first computes the screen that the anchor is on, and then adjusts the upper-left corner of the popup window to keep the window entirely on that screen. The problem with this approach is that the bounds of each screen is (necessarily) in that screen's coordinate system, using the scale of that screen, which isn't necessarily the same as the scale actually being used for the popup. Since the bounds of the screen are used to determine where to position the rectangle to keep it on that screen, the inaccurate bounds will cause the rectangle to be moved to the wrong location.
A possible fix for this problem is to adjust the bounds of the screen by the ratio of the two screen scales before comparing the coordinates with the screen bounds, but this might be somewhat tricky.
This bug is not platform-specific.
[1] https://git.openjdk.org/jfx/pull/971#issuecomment-1369417821
[2] https://git.openjdk.org/jfx/pull/971#issuecomment-1371547753
- relates to
-
JDK-8251862 Wrong position of Popup windows at the intersection of 2 screens
- Resolved