RFR: 8346281: [Windows] RenderScale doesn't update to HiDPI changes
Andy Goryachev
angorya at openjdk.org
Mon Dec 23 21:10:41 UTC 2024
On Mon, 23 Dec 2024 10:51:39 GMT, Jose Pereda <jpereda at openjdk.org> wrote:
> 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.
Does not seem to work. Here is my scenario:
1. win11 with two monitors, the built-in laptop screen at scale 100%, the external monitor at 225% (located "above" the build-in one).
2. the monkey tester opens up on the external monitor (since it remembers its position between launches)
3. when the user clicks on the menu, the menu pops up in the wrong location (way outside of the main window in fact)
4. change resolution to 200%
5. click on the menu, the menu also appears in the wrong location
6. it's only after I drag the window to the main monitor the menus start appearing at the right location. drag it back to the external monitor, the menu appears at the correct location again.
7. change external scale back to 225%, the menu opens up at the right location.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1668#issuecomment-2560298271
More information about the openjfx-dev
mailing list