<AWT Dev>  Review request for 8176097 Window set location to a display with different DPI does not properly work
alexandr.scherbatiy at oracle.com
Thu Mar 2 15:36:08 UTC 2017
Could you review the fix:
Suppose the system has two displays with different DPI. A user can
create a window on the first screen
and set the windows bounds from the second screen.
The windows scales the given bounds from the user space (x, y, w, h)
to the device space (s1 * x, s1 * y, s1 * w, s1 * h),
preserves the location in the device space and updates the windows
size so it has the same size in the screen 2 user space.
(s1 * x, s1 * y, s1 * w, s1 * h) -> (s1 * x, s1 * y, [s1 * w] * s2 /
s1, [s1 * h] * s2 / s1) = (s1 * x, s1 * y, s2 * w, s2 * h)
which is (s1 * x / s2, s1 * y / s2, w, h) in screen 2 user space.
This is necessary for the windows dragging from one display to another.
The fix updates the window size during the size setting if it detects
that the window is located on a different screen with different DPI
so the the second screen scale factor is properly taken into account.
The fix also updates the Robot.createCompatibleImage() method to use
the scale from the screen the the screenshot is taken.
See the issue JDK-8173972 createScreenCapture not working as expected
on multimonitor setup with different DPI scales.
More information about the awt-dev