RFR: 8346281: [Windows] RenderScale doesn't update to HiDPI changes [v2]

Andy Goryachev angorya at openjdk.org
Fri Nov 7 15:36:39 UTC 2025


On Fri, 7 Nov 2025 00:32:31 GMT, Jose Pereda <jpereda at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/glass/ui/Screen.java line 375:
>> 
>>> 373:     public static void notifySettingsChanged() {
>>> 374:         // Save the old screens in order to dispose them later
>>> 375:         Set<Screen> oldScreens = new HashSet<>();
>> 
>> Does the order matter? I don't think so, but if it does, `LinkedHashSet` would preserve the order.
>
> No, it doesn't matter. 
> 
> The old screens are "disposed" just by setting their native pointer to 0L, so they can't be reused, while the new screens instances are passed to the windows, to keep an updated instance. 
> 
> Note that even if old screen and new screen have the very same information (nothing changed for this particular screen), since `WinWindow::notifyMoving` uses the equality operator (`screen 1 == screen 2`), we need to keep a valid instance in `Window::screen`, and therefore `Screen::dispose` is just a way of invalidating old instances. Then, since they are no longer referenced by any window, they can be gc'ed.

I had exactly the same question, and looked into the implementation.
Is it likely the implementation would change and the order be important in the future?

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1964#discussion_r2504169270


More information about the openjfx-dev mailing list