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

Kevin Rushforth kcr at openjdk.org
Fri Nov 4 17:53:53 UTC 2022


On Wed, 2 Nov 2022 19:54:00 GMT, Johan Vos <jvos at openjdk.org> wrote:

>> modules/javafx.swing/src/main/java/javafx/embed/swing/JFXPanel.java line 400:
>> 
>>> 398:             float py = screen.getPlatformY();
>>> 399:             newx = sx + (wx - px) * awtScaleX / pScaleX;
>>> 400:             newy = sy + (wy - py) * awtScaleY / pScaleY;
>> 
>> `px` and `py` are already (scaled) "FX" coordinates, so I'm not sure AWT scale should be applied to that. I might be missing something here.
>
> Without this correction, there is an offset on Linux (when awtScaleX = 1 and pScaleX =2  for example, versus 1.5 for both on Windows).
> TBH, I think the relations between the different scale factors should be written out clearly somewhere, as I think there are a number of places where we face platform-specific differences.

Yeah, I agree this should be more clearly documented. I've tested it on macOS and Windows and it works fine, so I expect that this is correct as you have it.

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

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


More information about the openjfx-dev mailing list