RFR: 8274932: Render scales in EmbeddedWindow are not properly updated [v6]

John Hendrikx jhendrikx at openjdk.org
Thu Jul 27 17:52:53 UTC 2023


On Tue, 11 Jul 2023 07:58:07 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> When the JavaFX scene is set before it is really shown, then the scale factors are not properly propagated to the EmbeddedWindow, resulting in showing wrong scales.
>> Fix is made to update scales to EmbeddedWindow
>
> Prasanta Sadhukhan has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains seven commits:
> 
>  - Merge branch 'master' of https://git.openjdk.org/jfx into JDK-8274932
>  - Merge branch 'master' of https://github.com/openjdk/jfx into JDK-8274932
>  - Fix to get correct scale in secondary monitor
>  - Set stage scale in FX thread
>  - Set stage scale in FX thread
>  - Set stage scale in FX thread
>  - 8274932: Render scales in EmbeddedWindow are not properly updated

This is how I understand this works:

The `JFXPanel` makes use of an `EmbeddedWindow` that  is a subclass of `Window`.  This window listens to its `showing` property, and when it becomes visible will call `updateOutputScales`; this will in turn set the (correct?) render scales.

Now the above fix seems to 2nd guess this logic, and overrides these values with render scales it gets from Swing/AWT (note that it didn't do this before).

So, my questions:

- If JFXPanel never called setRenderScale before, was the JFXPanel completely broken when used on monitors that are not set at 100% scale? Did they update correctly when moved between monitors?  I get the impression that it sort of worked, except for this edge case.

- If it wasn't completely broken, then why is this fix needed?  Shouldn't `Window` already detect that it has become visible (with its `showing` listener) and update the render scales using the `updateOutputScales` method?  In other words, isn't this a bug that perhaps needs to be fixed in `Window`s detection of when it should be updating the output scales?

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

PR Comment: https://git.openjdk.org/jfx/pull/1171#issuecomment-1654113576


More information about the openjfx-dev mailing list