#23022 closed defect (fixed)
Regression: Application name on macOS 12 is MainApplication
Reported by: | Owned by: | team | |
---|---|---|---|
Priority: | normal | Milestone: | 23.06 |
Component: | Core | Version: | tested |
Keywords: | template_report | Cc: | taylor.smock |
Description
What steps will reproduce the problem?
java -jar josm-tested.jar
What is the expected result?
Application name in menu bar expected to be "JOSM". Works when run against JAR release 18646.
What happens instead?
Application name in menu bar is "MainApplication" in JAR release 18746.
Please provide any additional information below. Attach a screenshot if possible.
Relative:URL: ^/trunk Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Last:Changed Date: 2023-06-02 17:23:29 +0200 (Fri, 02 Jun 2023) Revision:18746 Build-Date:2023-06-03 01:31:02 URL:https://josm.openstreetmap.de/svn/trunk Identification: JOSM/1.5 (18746 en) Mac OS X 12.6.6 OS Build number: macOS 12.6.6 (21G646) Memory Usage: 504 MB / 8192 MB (314 MB allocated, but free) Java version: 17.0.7+7-LTS, Azul Systems, Inc., OpenJDK 64-Bit Server VM Look and Feel: com.apple.laf.AquaLookAndFeel Screen: Display 1 1728×1117 (scaling 2.00×2.00) Display 3 2560×1440 (scaling 2.00×2.00) Maximum Screen Size: 2560×1440 Best cursor sizes: 16×16→16×16, 32×32→32×32 System property file.encoding: UTF-8 System property sun.jnu.encoding: UTF-8 Locale info: en_US Numbers with default locale: 1234567890 -> 1234567890 Plugins: + apache-commons (36034) + photo_geotagging (36079)
Attachments (1)
Change History (9)
comment:1 by , 23 months ago
Cc: | added |
---|
comment:2 by , 23 months ago
Milestone: | → 23.06 |
---|---|
Summary: | Application name on macOS 12 is MainApplication → Regression: Application name on macOS 12 is MainApplication |
comment:3 by , 23 months ago
I believe symptoms are related to changes in r18704 (fix #22865). The call to set the app name for macOS is in
./src/org/openstreetmap/josm/tools/PlatformHookOsx.java
From an old stack-overflow thread the call to set the app name must be done before any awt classes are loaded. The order in calling
Utils.updateSystemProperty("apple.awt.application.name", "JOSM");
did change some but I cannot tell if any awt classes are being loaded before the new call location.
comment:4 by , 23 months ago
That very well may be the problem. I don't have a Mac to test it on right now though. I'll check it on a Mac at work Monday.
When I was testing the change, I was focused on how the apple.laf.useScreenMenuBar
system environment was affected, and didn't think to check the application name.
comment:5 by , 22 months ago
java -jar josm-tested.jar
Identification: JOSM/1.5 (18746 en) Mac OS X 12.6.6
FML. This might be specific to an OS version. I'm not seeing this with macOS 13.4. I'll go ahead and move apple.awt.application.name
back to preStartupHook
, but I will be unable to verify the fix.
In fact, I'm not seeing any UI calls prior to the afterPrefStartupHook
call but after the preStartupHook
call, so I really don't think moving it back to preStartupHook
will fix things. I'll still do that, but it is really hard to fix stuff (and know its fixed) without being able to reproduce.
@bal_agates: Can you please verify the fix with the josm jar file I'll be attaching in a minute or so? Please only give feedback on the application name in menu bar problem -- there are other changes in the jar for different tickets, like #11487.
-
src/org/openstreetmap/josm/tools/PlatformHookOsx.java
diff --git a/src/org/openstreetmap/josm/tools/PlatformHookOsx.java b/src/org/openstreetmap/josm/tools/PlatformHookOsx.java
a b 59 59 if (TaggingPresetReader.getPresetSources().stream().noneMatch(url -> url.contains("name-suggestion-index"))) { 60 60 Utils.updateSystemProperty("apple.laf.useScreenMenuBar", "true"); 61 61 } 62 } 63 64 @Override 65 public void preStartupHook() { 66 // This may need to be set early, see #23022. The behavior in the ticket was not reproduced on macOS 13.4. 62 67 Utils.updateSystemProperty("apple.awt.application.name", "JOSM"); 63 68 } 64 69
by , 22 months ago
Attachment: | josm-custom.jar added |
---|
Possible fix for MainApplication in menu bar on older macOS versions
comment:6 by , 22 months ago
The josm-custom.jar attached above did show JOSM as App name on my system (macOS 12.6.6). This appears to fix the problem I reported. I too didn't see anything before afterPrefStartupHook that might cause the problem. I noticed this custom version was built against 18767 so maybe there were some other changes, not where we were looking, that affected the behavior?
Have you ever seen any documentation for "apple.awt.application.name". I found some related sources at OpenJDK NSApplicationAWT.m but it was difficult for me to understand.
I think you can close this issue. I will recheck on the next official JOSM release. Thanks for looking at it.
comment:8 by , 22 months ago
Just confirming that it showed up as "Main application" on Mac OS 12.6.7 in version 18746 and that it's now fixed in version 18772, showing up as "JOSM" again. Thanks for the fix!
see #14741.
probably caused by #22865