RFR: 8346281: [Windows] RenderScale doesn't update to HiDPI changes
Jose Pereda
jpereda at openjdk.org
Mon Dec 23 10:56:11 UTC 2024
This PR adds the missing native implementation for Windows `GlassWindow::HandleDPIEvent`, to notify the (Java) window when there is a DPI change event, which can happen when the user changes the resolution of the screen (via Settings -> System -> Display -> scale), while the JavaFX application is running.
When such `WM_DPICHANGED` event happens, `GlassWindow::HandleDPIEvent` notifies the (Java) window, which changes its platform scale via `Window::notifyScaleChanged`, and `GlassScreen::HandleDisplayChange();` is needed too, to update the platform scale of the screen where the window is at as well.
There are no tests added to this PR, since these would require manual intervention to change the display. In any case, the test case added to the [issue](https://bugs.openjdk.org/browse/JDK-8346281) runs fine now when the app runs on a given screen and the user changes its resolution.
There is a follow-up issue after this PR, that might require a more complex fix, for the case where the user changes the resolution of a different screen that is placed before the one that has the application (as location coordinates of the latter depend on the former), because there is no `WM_DPICHANGED` event in this case.
-------------
Commit messages:
- Notify window and screen when dpi changes
Changes: https://git.openjdk.org/jfx/pull/1668/files
Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1668&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8346281
Stats: 17 lines in 1 file changed: 17 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jfx/pull/1668.diff
Fetch: git fetch https://git.openjdk.org/jfx.git pull/1668/head:pull/1668
PR: https://git.openjdk.org/jfx/pull/1668
More information about the openjfx-dev
mailing list