-
Notifications
You must be signed in to change notification settings - Fork 463
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
8269374: Menu inoperable after setting stage to second monitor #572
Conversation
👋 Welcome back jpereda! A progress list of the required criteria for merging this PR into |
This seems like a correct fix. I can test it along with a formal review. Even though it is a small change in terms of lines of code, I'd like a second reviewer. /reviewers 2 |
@kevinrushforth |
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.
Looks good.
I tested the fix with different scaling combinations, the issue reported in JBS does not occur with fix. But noticed a similar issue that occurs only if the primary screen is in landscape mode and external monitor is in portrait mode. This behavior is observed both with and without this change. The behavior may be unrelated to fix, in that it can be addressed separately. Steps:
A slight different behavior can be observed with a change in step 6 |
I'd be OK handling this as a follow-on bug. @jperedadnr Can you take at least a quick look and see if you can spot why this case fails? Maybe there is another place where we need to call |
I can reproduce the issues mentioned by @arapte. Even with two landscape screens, if you maximise (or just make it big enough) the app on the 100% monitor, and click the button to move it to the other, the app doesn't move correctly, stays more or less at the middle of the DPI screen (with wrong scale), but menus location and scale are correct: This issues probably require their own follow-up JBS? |
Agreed. Can you file a new bug in JBS? @arapte Unless you have any concerns, can you review / approve this fix now? |
I've filed JDK-8270868, and also investigated the possible root cause of the issue. It turns out there is a reason for the issues @arapte notified, as those happened with a full screen. |
@jperedadnr This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 8 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
/integrate |
Going to push as commit c490ddf.
Your commit was automatically rebased without conflicts. |
@jperedadnr Pushed as commit c490ddf. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
On Windows, with two monitors with different DPI settings, if a JavaFX application changes screens (either by dragging or programmatically) there is a resize event to adjust the view to its new platform scale.
Note that there is already a call to
View::updateLocation
in WinWindow, right afternotifyMoveToAnotherScreen
andnotifyScaleChanged
. But this is done too soon, before the resize event. There are other MOVE events processed too (in a long complex chain of recursive calls toWinWindow::setBounds
).As a consequence, as commented in the issue JDK-8269374, the view x/y coordinates are wrongly set using the old X,Y values (from the previous screen) with the new platform scale (from the new screen).
This PR adds an extra call to View::updateLocation` in WinWindow, forcing the view relocation on Windows after every resize event to fix the issue. With the correct location of the scene, the Menus are now perfectly aligned, and the mouse events are correctly processed. It doesn't have any side effect on other platforms.
There's a very small penalty, as this new relocation will be called whenever there is a resize event on Windows, but it simplifies the overhead of detecting when the change of screens is effectively done (including the chain of move/resize) events.
No tests are provided, since these would require a setup of two monitors with different DPI settings. However, the test case in the JBS issue can be used to validate the fix.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jfx pull/572/head:pull/572
$ git checkout pull/572
Update a local copy of the PR:
$ git checkout pull/572
$ git pull https://git.openjdk.java.net/jfx pull/572/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 572
View PR using the GUI difftool:
$ git pr show -t 572
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jfx/pull/572.diff