<AWT Dev> [9] Review request for 8176097 Window set location to a display with different DPI does not properly work
Sergey Bylokhov
sergey.bylokhov at oracle.com
Thu Mar 2 19:13:55 UTC 2017
Hi, Alex.
Looks like after the fix the fields in sysX/Y and sysW/sysH will have incompatible values, the location will use the one screen to scale and the size will use another, Is it possible to store the location+size based on same screen?
>
> Hello,
>
> Could you review the fix:
> bug: https://bugs.openjdk.java.net/browse/JDK-8176097
> webrev: http://cr.openjdk.java.net/~alexsch/8176097/webrev.00
>
> 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.
>
> Thanks,
> Alexandr.
>
More information about the awt-dev
mailing list