-
Notifications
You must be signed in to change notification settings - Fork 486
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
8233678: [macos 10.15] System menu bar does not work initially on macOS Catalina #361
8233678: [macos 10.15] System menu bar does not work initially on macOS Catalina #361
Conversation
…efore finalising the PR)
👋 Welcome back kcr! A progress list of the required criteria for merging this PR into |
@kevinrushforth |
I note that this does not seem to be a problem for Swing apps. AWT uses the Java Runtime Support (JRS) framework to initialize the application and menubar. |
Note to testers: |
… and non-taskbar apps)
I tested the patch, and it works for me (MacOS Catalina, 10.15.7) |
Thanks for checking. I'll remove the debug print statements, turn off verbose logging, and send it out for review. I would appreciate a thorough review of the code. Given the way JavaFX initializes the macOS application and sets the system menu bar, this seems like the least intrusive and least risky fix, but it would be nice if we can find a better fix that isn't overly complicated or risky. |
Webrevs
|
For some reason, the GitHub actions test results weren't added by the Skara bot. I filed SKARA-839 to track this. You can click here to see the results of the GitHub action for the most recent commit I pushed. |
modules/javafx.graphics/src/main/java/com/sun/glass/ui/mac/MacApplication.java
Outdated
Show resolved
Hide resolved
I added a few comments. In general, the approach looks ok to me. My comments are about edge cases, for which I'm not sure how we need to handle them. |
modules/javafx.graphics/src/main/java/com/sun/glass/ui/mac/MacApplication.java
Outdated
Show resolved
Hide resolved
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.
I tested the test program provided in the JBS on macOS 10.15.4. This PR fixes the reported issue.
The side effect of brief flash when the application is launched is undesirable, but livable given the important issue this PR fixes.
I spotted a typo in code comments.
modules/javafx.graphics/src/main/java/com/sun/glass/ui/mac/MacApplication.java
Outdated
Show resolved
Hide resolved
@kevinrushforth 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 3 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 |
@kevinrushforth Since your change was applied there have been 3 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit e7dbdfc. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Mailing list message from Bruce Johnson on openjfx-dev: It would be useful, at least to me, to see a brief comment in this email thread about why this approach (which results in the application flashing) is necessary. Why does JavaFX require this approach, or is there an alternative, but more complex approach that could ultimately be used in later releases. I?d just like to be able to look back in the email thread when I (or the users of my software) see the flash to understand why it's there. Bruce |
I don't yet know whether there is an alternative that would allow the menubar to work without deactivating the app, but I filed a follow-up bug to track this: JDK-8257835: Brief flash in terminal window when launching FX app on macOS It seems like it might be possible to fix this, since AWT initialization doesn't run into this. I note that AWT uses an Apple-provided "JavaRuntime Support" (JRS) Framework. We would need to see whether there is something else possible using public macOS APIs. |
Mailing list message from Tom Schindl on openjfx-dev: Hi Kevin, I today saw this tweet by Alex Blewitt [1] in my twitter feed and a Tom [1] https://twitter.com/alblue/status/1350877893979746305 Am 07.12.20 um 16:58 schrieb Bruce Johnson:
|
@tomsontom Thanks for letting me know. He reached to me directly as well, so I'll plan to add the information to the follow-on bug, JDK-8257835. |
BTW there were observations that the setActivationPolicy call needs to be inside the callback as well, at least on 10.15. I've updated the bug on the StackOverflow question, and the Eclipse bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=552063 has a fix about to go in with the suggested change. |
This is a proposed fix for the bug where the Apple system menubar is initially non-responsive on macOS 10.15 and later after a JavaFX application has started up. The end user can workaround this by switching to some other application and then back to the JavaFX app, but there is no known workaround that the application developer can use.
JavaFX is using a non-standard approach to creating the system menus, and seems likely that some change in macOS 10.15 means that this no longer works the same as in previous versions of macOS. We have had problems with application startup on macOS in the past that affected the system menubar: see JDK-8123430 and JDK-8093743.
The solution is to deactivate and then reactivate the application after the app has initially been made active, but before any window is initialized and before the system menu is populated.
I pushed this as two commits: one with the fix and one with some temporary verbose debug print statements. I will remove the print statements prior to the formal review, but wanted to leave them in for now in case someone wanted to test them, and ran into an issue (the debug print statements could help isolate any problems).
I have tested this on macOS 10.14, 10.15, and 11 (Big Sur). It will need additional testing.
The only drawback I see with this approach is that there can be a very brief flash when launching the JavaFX app from a terminal window as the FX application activates, deactivates, and reactivates.
/reviewers 2
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jfx pull/361/head:pull/361
$ git checkout pull/361