From eed7066e544fa43644596db07a42aa9dcfa203f2 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Mon, 16 Jan 2023 08:07:46 -0500 Subject: [PATCH] find a workaround for Help menu bug on macOS (fixes #638) --- app/src/processing/app/ui/Editor.java | 14 +++++++++++++- todo.txt | 7 +++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/src/processing/app/ui/Editor.java b/app/src/processing/app/ui/Editor.java index 2fe89cb86..e78925388 100644 --- a/app/src/processing/app/ui/Editor.java +++ b/app/src/processing/app/ui/Editor.java @@ -633,7 +633,19 @@ public abstract class Editor extends JFrame implements RunnerListener { base.populateToolsMenu(toolsMenu); menubar.add(toolsMenu); - menubar.add(buildHelpMenu()); + JMenu helpMenu = buildHelpMenu(); + if (Platform.isMacOS()) { + // There's a bug on macOS since at least 2016 that leaves the + // Help menu disabled after a modal dialog has been shown. + // In 2018, it was closed by Oracle with a claim that it couldn't + // be reproduced: https://bugs.openjdk.org/browse/JDK-8196655 + // The workaround is to add a space to the end of the menu name, + // which disables whatever macOS behavior is causing the problem. + // https://github.com/processing/processing4/issues/638 + helpMenu.setText(helpMenu.getText() + " "); + } + menubar.add(helpMenu); + Toolkit.setMenuMnemonics(menubar); setJMenuBar(menubar); } diff --git a/todo.txt b/todo.txt index 7093e2e33..ce7d4f10a 100755 --- a/todo.txt +++ b/todo.txt @@ -1,5 +1,7 @@ 1290 (4.1.2?) - +X Help Menu disabled on OS X (looks like a JVM bug) +X https://github.com/processing/processing/issues/4353#issuecomment-237715947 +X https://github.com/processing/processing4/issues/617 contributed X “Cannot find a class or type named ‘PApplet’” error @@ -825,9 +827,6 @@ _ https://github.com/processing/processing4/issues/234 _ we're not posting any, can we suppress the "allow notifications" message? _ https://developer.apple.com/documentation/usernotifications _ https://developer.apple.com/documentation/usernotifications/asking_permission_to_use_notifications -_ Help Menu disabled on OS X (looks like a JVM bug) -_ https://github.com/processing/processing/issues/4353#issuecomment-237715947 -_ still broken in 11.0.8 _ Java bug prevents us from setting the dock name of a sketch run from the PDE _ https://github.com/processing/processing/issues/5045 _ client properties