RFR: 8222210: JFXPanel popups open at wrong coordinates when using multiple hidpi monitors [v3]
Johan Vos
jvos at openjdk.org
Wed Nov 2 20:09:45 UTC 2022
On Wed, 2 Nov 2022 19:10:49 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>>> And yes, I did not see Dimension2D - we probably should remove confusion and use Point2D (why does it have more overhead?)
>>
>> Point2D provides much more functionality -- but has 2 fields only. So it should not be an overhead at all, hence I'll switch to Point2D. Thanks for Pointing that out :)
>
> I suspect Math.floor() would be incorrect - we should use Math.round() for coordinates and Math.floor() for sizes (sizes will always be positive, I hope, and the rounded size will be slightly smaller than the original value).
>
> But for coordinates we should use (int)Math.round()
I'll change it to Math.round, although I doubt it doesn't improve anything (but it won't make it worse either).
The reason we need the transformation on those coordinates is to position new windows, *relative* against the location of the root window that we are given by Swing. Hence, if the operation applied to the window location coordinates (in sendMoveEventToFX) is the same as the operation applied to the mouse point (in sendMouseEventToFX), we are good.
A bigger problem imho is that mouseEvents, scrollEvents and menuEvents are dealing with different precisions in the EmbeddedSceneInterface -- but that is a different problem.
-------------
PR: https://git.openjdk.org/jfx/pull/924
More information about the openjfx-dev
mailing list