<AWT Dev> RFR: 8257414: Drag n Drop target area is wrong on high DPI systems

Olga Mikhaltsova omikhaltcova at openjdk.java.net
Tue Dec 29 21:00:08 UTC 2020

Please, review this small fix for drag-n-drop on Linux with HiDPI turned on!

This bug is due to the following reason: while scaling Java recalculates resolution (W x H) according to sun.java2d.uiScale (W/SCALE x H/SCALE) and works inside these new coordinates but at the same time the events, that come from the system, continue reporting positions in the old coordinates (W x H).

The idea of the suggested fix is in division of coordinates on the scale when they come from the system to Java and multiplying them on the scale when they go back from Java to the system. It is similar to processing events from mouse and buttons. 

Testing is quite complicated because for reproducing this bug the following conditions should be met:
1.	HiDPI is turned on
2.	sun.java2d.uiScale.enabled = true and sun.java2d.uiScale != 100%
3.	the source of drag-n-drop is not java application

The step-by-step guide how to reproduce this bug is added to https://bugs.openjdk.java.net/browse/JDK-8257414.


Commit messages:
 - 8257414: Drag n Drop target area is wrong on high DPI systems

Changes: https://git.openjdk.java.net/jdk/pull/1907/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1907&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8257414
  Stats: 5 lines in 2 files changed: 0 ins; 0 del; 5 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1907.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1907/head:pull/1907

PR: https://git.openjdk.java.net/jdk/pull/1907

More information about the awt-dev mailing list