-
Notifications
You must be signed in to change notification settings - Fork 484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8346281: [Windows] RenderScale doesn't update to HiDPI changes #1668
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back jpereda! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
/reviewers 2 |
@andy-goryachev-oracle |
@@ -209,6 +209,10 @@ LRESULT CALLBACK GlassWindow::CBTFilter(int nCode, WPARAM wParam, LPARAM lParam) | |||
return ::CallNextHookEx(GlassWindow::sm_hCBTFilter, nCode, wParam, lParam); | |||
} | |||
|
|||
#ifndef USER_DEFAULT_SCREEN_DPI | |||
#define USER_DEFAULT_SCREEN_DPI 96 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this value come from some windows header?
please add the test case to https://bugs.openjdk.org/browse/JDK-8346281 |
Does not seem to work. Here is my scenario:
|
I've added the test case to the JBS issue (sorry about that, I thought I did when I created it). About the test case scenario:
With this PR you should see:
|
Do you have the same issue (unexpected offset for the popup) as well without this PR? |
I think the difference between your scenario and mine is that the monkey tester appears on the external monitor instead of the main one. If I close the monkey tester while it is on the primary laptop screen and restart it, the menu shows up at the right location from the start. Maybe you can change your test app to open one window on each screen? |
The behavior is different. With the MT showing up on the external monitor, the initial location of the menus is correct. Once I change the scale, the menus pop up in two wrong location above and to the left (the change in scale was 2.25 -> 1.5) |
attached an updated SCCE to the ticket. the initial scale value seems to be incorrect in this PR. |
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 viaWindow::notifyScaleChanged
, andGlassScreen::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 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.Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1668/head:pull/1668
$ git checkout pull/1668
Update a local copy of the PR:
$ git checkout pull/1668
$ git pull https://git.openjdk.org/jfx.git pull/1668/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1668
View PR using the GUI difftool:
$ git pr show -t 1668
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1668.diff
Using Webrev
Link to Webrev Comment