From: Keith Packard Date: Tue, 17 Jun 2014 04:58:13 +0000 (-0700) Subject: altosuilib: Move menu bars into the Mac OS X top bar X-Git-Tag: 1.4.9.1~32^2~28 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=ed38b1b596062b2232fa78a3181f6eaf5818b651;hp=e612693e33ef3b0e22db0656792992fa6e961ff2 altosuilib: Move menu bars into the Mac OS X top bar Setting these properties causes the top menu bar to get placed into the Mac OS X window system menu bar Signed-off-by: Keith Packard --- diff --git a/altosuilib/AltosUIFrame.java b/altosuilib/AltosUIFrame.java index 6e62c762..2de1fb1c 100644 --- a/altosuilib/AltosUIFrame.java +++ b/altosuilib/AltosUIFrame.java @@ -157,11 +157,28 @@ public class AltosUIFrame extends JFrame implements AltosUIListener, AltosPositi } } + static boolean global_settings_done; + + public String getName() { + return "Altus Metrum"; + } + void init() { AltosUIPreferences.register_ui_listener(this); AltosUIPreferences.register_position_listener(this); position = AltosUIPreferences.position(); addWindowListener(new AltosUIFrameListener()); + + /* Try to make menus live in the menu bar like regular Mac apps */ + if (!global_settings_done) { + try { + global_settings_done = true; + System.setProperty("com.apple.mrj.application.apple.menu.about.name", getName()); + System.setProperty("com.apple.macos.useScreenMenuBar", "true"); + System.setProperty( "apple.laf.useScreenMenuBar", "true" ); // for older versions of Java + } catch (Exception e) { + } + } set_icon(); }