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

Johan Vos jvos at openjdk.org
Fri Oct 28 07:04:18 UTC 2022


On Thu, 20 Oct 2022 16:06:36 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> Johan Vos has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   address reviewer comments
>>   Fix detection on screen, based on awtScale factors
>
> modules/javafx.swing/src/main/java/javafx/embed/swing/JFXPanel.java line 451:
> 
>> 449:         Dimension2D onScreen = getSwingToFxPixel(getGraphicsConfiguration(), e.getXOnScreen(), e.getYOnScreen());
>> 450:         int fxXOnScreen = (int) onScreen.getWidth();
>> 451:         int fxYOnScreen = (int) onScreen.getHeight();
> 
> question: should it be (int) or Math.round()?
> also, coordinates can be negative - will it work then?

I believe these values should be int in the first place. Otherwise, we have issues in JavaFX where we process them as ints.
About negative coordinates: yes, that works. Is the question about using Dimension2D (width/height) for something that is actually a Point2D? We can use a Point2D here as well, but that class seems to have a bit more overhead than Dimension2D for this goal -- but I'm open to change it to Point2D.

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

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


More information about the openjfx-dev mailing list