GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — 8233678: [macos 10.15] System menu bar does not work initially on macOS Catalina by kevinrushforth · Pull Request #361 · openjdk/jfx

Conversation

@kevinrushforth

@kevinrushforth kevinrushforth commented Dec 2, 2020 •
edited by openjdk Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8233678: [macos 10.15] System menu bar does not work initially on macOS Catalina

Reviewers

  • Johan Vos (@johanvos - Reviewer)
  • Ajit Ghaisas (@aghaisas - Reviewer)

Download

$ git fetch https://git.openjdk.java.net/jfx pull/361/head:pull/361
$ git checkout pull/361

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

tobihagemann reacted with heart emoji
All reactions
  • ❤️ 1 reaction
kevinrushforth added 2 commits December 2, 2020 11:43
@kevinrushforth
8233678: [macos 10.15] System menu bar does not work initially on mac…
8121bb4
…OS Catalina
@kevinrushforth
TEMPORARY: enabled verbose debug print statements (will be reverted b…
666fd86
…efore finalising the PR)
@bridgekeeper

bridgekeeper Bot commented Dec 2, 2020

Copy link
Copy Markdown

👋 Welcome back kcr! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@openjdk

openjdk Bot commented Dec 2, 2020

Copy link
Copy Markdown

@kevinrushforth
The number of required reviews for this PR is now set to 2 (with at least 1 of role reviewers).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kevinrushforth

kevinrushforth commented Dec 2, 2020

Copy link
Copy Markdown
Member Author

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kevinrushforth
kevinrushforth requested review from arapte, johanvos and prrace December 2, 2020 20:05
@kevinrushforth

kevinrushforth commented Dec 2, 2020

Copy link
Copy Markdown
Member Author

Note to testers: JFXPanel applications deadlock with this fix. I need to check whether glass is being started up for a normal Taskbar application, and not being embedded in an FXCanvas or JFXPanel.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kevinrushforth
Fix cases where the app is not a normal app (e.g., JFXPanel, FXCanvas…
0f61cd3
… and non-taskbar apps)
@johanvos

johanvos commented Dec 3, 2020

Copy link
Copy Markdown
Collaborator

I tested the patch, and it works for me (MacOS Catalina, 10.15.7)
I will look into more detail in the code, as I'm slightly worried about not following the Apple conventions. From experience, this often leads to more issues sooner or later.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kevinrushforth

kevinrushforth commented Dec 3, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kevinrushforth
Remove debug print statements and turn off verbose logging
3078e21
@kevinrushforth
kevinrushforth marked this pull request as ready for review December 3, 2020 13:46
@openjdk openjdk Bot added the rfr Ready for review label Dec 3, 2020
@mlbridge

mlbridge Bot commented Dec 3, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Webrevs

  • 02: Full - Incremental (dc31f0b)
  • 01: Full - Incremental (e7de442)
  • 00: Full (3078e21)
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kevinrushforth

kevinrushforth commented Dec 3, 2020

Copy link
Copy Markdown
Member Author

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

johanvos
johanvos reviewed Dec 3, 2020
View reviewed changes
Comment thread modules/javafx.graphics/src/main/java/com/sun/glass/ui/mac/MacApplication.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

johanvos
johanvos reviewed Dec 3, 2020
View reviewed changes
Comment thread modules/javafx.graphics/src/main/native-glass/mac/GlassApplication.m Resolved

Uh oh!

There was an error while loading. Please reload this page.

@johanvos

johanvos commented Dec 3, 2020

Copy link
Copy Markdown
Collaborator

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kevinrushforth
Address review comments
e7de442
johanvos
johanvos approved these changes Dec 3, 2020
View reviewed changes
kevinrushforth
kevinrushforth commented Dec 4, 2020
View reviewed changes
Comment thread modules/javafx.graphics/src/main/java/com/sun/glass/ui/mac/MacApplication.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@kevinrushforth
kevinrushforth requested review from aghaisas and removed request for arapte December 4, 2020 14:16
aghaisas
aghaisas reviewed Dec 7, 2020
View reviewed changes

@aghaisas aghaisas left a comment

Copy link
Copy Markdown
Collaborator

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread modules/javafx.graphics/src/main/java/com/sun/glass/ui/mac/MacApplication.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@kevinrushforth
fix typos in comments
dc31f0b
@kevinrushforth
kevinrushforth requested review from aghaisas and johanvos December 7, 2020 14:23
johanvos
johanvos approved these changes Dec 7, 2020
View reviewed changes
aghaisas
aghaisas approved these changes Dec 7, 2020
View reviewed changes
@openjdk

openjdk Bot commented Dec 7, 2020

Copy link
Copy Markdown

@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:

8233678: [macos 10.15] System menu bar does not work initially on macOS Catalina

Reviewed-by: jvos, aghaisas

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 master branch:

  • ca0d3d0: 8256821: TreeViewSkin/Behavior: misbehavior on switching skin
  • 00a8646: 8247576: Labeled/SkinBase: misbehavior on switching skin
  • c8d9c94: 8254049: Update WebView to public suffix list 2020-04-24

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@openjdk openjdk Bot added the ready Ready to be integrated label Dec 7, 2020
@kevinrushforth

kevinrushforth commented Dec 7, 2020

Copy link
Copy Markdown
Member Author

/integrate

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@openjdk openjdk Bot closed this Dec 7, 2020
@openjdk openjdk Bot added integrated Pull request has been integrated and removed ready Ready to be integrated rfr Ready for review labels Dec 7, 2020
@openjdk

openjdk Bot commented Dec 7, 2020

Copy link
Copy Markdown

@kevinrushforth Since your change was applied there have been 3 commits pushed to the master branch:

  • ca0d3d0: 8256821: TreeViewSkin/Behavior: misbehavior on switching skin
  • 00a8646: 8247576: Labeled/SkinBase: misbehavior on switching skin
  • c8d9c94: 8254049: Update WebView to public suffix list 2020-04-24

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kevinrushforth
kevinrushforth deleted the 8233678-macos-menu-bar branch December 7, 2020 15:35
@mlbridge

mlbridge Bot commented Dec 7, 2020

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kevinrushforth

kevinrushforth commented Dec 7, 2020

Copy link
Copy Markdown
Member Author

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@0x4a616e 0x4a616e mentioned this pull request Dec 11, 2020
MenuBar not working on launch 0x4a616e/NSMenuFX#8
Closed
@mlbridge

mlbridge Bot commented Jan 17, 2021

Copy link
Copy Markdown

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
possible fix without the de/reactivation. So I thought I would bring it
up here as well.

Tom

[1] https://twitter.com/alblue/status/1350877893979746305

Am 07.12.20 um 16:58 schrieb Bruce Johnson:

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kevinrushforth

kevinrushforth commented Jan 21, 2021

Copy link
Copy Markdown
Member Author

@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.

alblue reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@alblue

alblue commented Jan 23, 2021

Copy link
Copy Markdown

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@alblue alblue mentioned this pull request Jan 24, 2021
Fix macOS menu at launch #386
Closed
1 of 3 tasks
@0x4a616e 0x4a616e mentioned this pull request Apr 13, 2021
MenuBar not responsive after application start 0x4a616e/NSMenuFX#15
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@prrace prrace Awaiting requested review from prrace
2 more reviewers
@johanvos johanvos johanvos approved these changes
@aghaisas aghaisas aghaisas approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

integrated Pull request has been integrated

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@kevinrushforth @johanvos @alblue @aghaisas
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.