From 28d62e69d7c87aaf0b71748b91f236eb48fb844b Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Sat, 3 Sep 2022 19:59:08 +1000 Subject: [PATCH] Enable menu mnemonics (Alt+X) for MainForm on Linux --- src/BizHawk.Client.EmuHawk/MainForm.cs | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index d33500bbe0..81424884ef 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -2382,26 +2382,14 @@ namespace BizHawk.Client.EmuHawk base.WndProc(ref m); } - // sends an alt+mnemonic combination + /// HACK to send an alt+mnemonic combination private void SendAltKeyChar(char c) - { - switch (OSTailoredCode.CurrentOS) - { - case OSTailoredCode.DistinctOS.Linux: - case OSTailoredCode.DistinctOS.macOS: - // no mnemonics for you - break; - case OSTailoredCode.DistinctOS.Windows: - //HACK - var _ = typeof(ToolStrip).InvokeMember( - "ProcessMnemonicInternal", - BindingFlags.NonPublic | BindingFlags.InvokeMethod | BindingFlags.Instance, - null, - MainformMenu, - new object[] { c }); - break; - } - } + => _ = typeof(ToolStrip).InvokeMember( + OSTailoredCode.IsUnixHost ? "ProcessMnemonic" : "ProcessMnemonicInternal", + BindingFlags.NonPublic | BindingFlags.InvokeMethod | BindingFlags.Instance, + null, + MainformMenu, + new object/*?*/[] { c }); public static readonly string ConfigFileFSFilterString = new FilesystemFilter("Config File", new[] { "ini" }).ToString();