[jdk18] RFR: 8279227: Access Bridge: Wrong frame position and hit test result on HiDPI display [v2]

Sergey Bylokhov serb at openjdk.java.net
Sat Dec 25 00:03:19 UTC 2021


On Fri, 24 Dec 2021 12:00:52 GMT, Aleksandr Veselov <duke at openjdk.java.net> wrote:

>> Perform scaling while converting sizes and coordinates to provide correct positions of accessible elements on HiDPI screen and make hit-test work properly. It uses FontRenderContext to receive display scale without API changes.
>
> Aleksandr Veselov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix missing import

src/jdk.accessibility/windows/classes/com/sun/java/accessibility/internal/AccessBridge.java line 1617:

> 1615:                                     r.width = (int) Math.ceil(r.width * at.getScaleX());
> 1616:                                     r.height = (int) Math.ceil(r.height * at.getScaleY());
> 1617:                                 }

This logic will not work on the multiscreen configs when the monitors have different DPI, the logic should be similar to the SunGraphicsEnvironment.toDeviceSpace().
and probably the round logic should use Region.clipRound as well.

src/jdk.accessibility/windows/classes/com/sun/java/accessibility/internal/AccessBridge.java line 1768:

> 1766:             FontMetrics fm = acomp.getFontMetrics(acomp.getFont());
> 1767:             if (fm != null) {
> 1768:                 return fm.getFontRenderContext().getTransform();

I am not sure do we really update the FRC for the component when the DPI is changed?

-------------

PR: https://git.openjdk.java.net/jdk18/pull/72



More information about the client-libs-dev mailing list