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:

On Dec 7, 2020, at 10:33 AM, Kevin Rushforth <k...@openjdk.java.net> wrote:

On Wed, 2 Dec 2020 20:00:55 GMT, Kevin Rushforth <k...@openjdk.org> wrote:

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](https://bugs.openjdk.java.net/browse/JDK-8123430) and 
[JDK-8093743](https://bugs.openjdk.java.net/browse/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.

This pull request has now been integrated.

Changeset: e7dbdfcb
Author:    Kevin Rushforth <k...@openjdk.org>
URL:       https://git.openjdk.java.net/jfx/commit/e7dbdfcb
Stats:     109 lines in 4 files changed: 94 ins; 0 del; 15 mod

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

Reviewed-by: jvos, aghaisas

-------------

PR: https://git.openjdk.java.net/jfx/pull/361


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

Reply via email to