The fix for [JDK-8233678](https://bugs.openjdk.org/browse/JDK-8233678) added a 
step to the NSApplication initialization to deactivate and then reactivate the 
application. We trigger the deactivation the first time 
applicationDidBecomeActive is called. We then trigger the reactivation the when 
applicationDidResignActive is called after that. The initialization logic in 
MacApplication spins up a nested event loop that waits for the reactivation (a 
second call to applicationDidBecomeActive).

Something in macOS 14 has changed that prevents the initial call to 
applicationDidBecomeActive from being done until the application has finished 
launching (notifyDidFinishLaunching).

So the activation of the NSApplication is waiting for the launching to be 
finished, but the nested event loop we spin up is blocking the completion of 
launching until we get the activation. This is a classic deadlock.

The good news, though, is the deactivation / reactivation of the application no 
longer seems to be needed on macOS 14. The menus work fine without that fix.

The proposed solution is to check the version of macOS and only enable the 
deactivation / reactivation logic on systems prior to macOS 14. This will have 
the additional benefit of avoiding the brief flash when the app is first 
launched (see [JDK-8257835](https://bugs.openjdk.org/browse/JDK-8257835)).

This is a Draft PR with a few debugging statements. Once I get some feedback 
that it works for more than just me, I'll remove the debugging statements and 
then make it "rfr".

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

Commit messages:
 - Remove debug prints
 - Cleanup method name and flag for better clarity
 - 8315657: Application window not activated in macOS 14 Sonoma

Changes: https://git.openjdk.org/jfx/pull/1247/files
 Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1247&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8315657
  Stats: 21 lines in 2 files changed: 9 ins; 0 del; 12 mod
  Patch: https://git.openjdk.org/jfx/pull/1247.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1247/head:pull/1247

PR: https://git.openjdk.org/jfx/pull/1247

Reply via email to