RFR: 8222210: JFXPanel popups open at wrong coordinates when using multiple hidpi monitors

Johan Vos jvos at openjdk.org
Thu Oct 20 14:44:39 UTC 2022


The root problem is actually broader than stated in the JBS issue. This PR now translates screencoordinates from absolute coordinates into coordinates that take the platformScale into account. 
The whole process is complicated by the fact that throughout our code, we use e.g. `x` and `y` without clearly stating if those are absolute, logical, screen or rendering coordinates. 
I believe the most consistent approach is to have the different entry points (e.g. a Glass Window or a JFXPanel) to deal with platformScale before passing screen coordinates. This is already done in the Glass approach, and this PR does the same in JFXPanel. That means some code is duplicated, but since this is only about 12 lines, and said code lives in 2 different modules, I think it's not worth the hassle of moving that into e.g. the base module.

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

Commit messages:
 - Transform coordinates using platform scale if needed when bridging from

Changes: https://git.openjdk.org/jfx/pull/924/files
 Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=924&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8222210
  Stats: 50 lines in 2 files changed: 45 ins; 0 del; 5 mod
  Patch: https://git.openjdk.org/jfx/pull/924.diff
  Fetch: git fetch https://git.openjdk.org/jfx pull/924/head:pull/924

PR: https://git.openjdk.org/jfx/pull/924


More information about the openjfx-dev mailing list