From 9025d11c54ad4a0aec537d917b22a6f8a68914c9 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 19 Jan 2019 14:30:16 +0000 Subject: [PATCH] Map Ctrl to Cmd for editor copy hotkey. --- .../Widgets/Logic/Editor/MapEditorLogic.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/MapEditorLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/MapEditorLogic.cs index 5dce26be69..fd60faa1f2 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/MapEditorLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/MapEditorLogic.cs @@ -88,6 +88,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic var copypasteButton = widget.GetOrNull("COPYPASTE_BUTTON"); if (copypasteButton != null) { + // HACK: Replace Ctrl with Cmd on macOS + // TODO: Add platform-specific override support to HotkeyManager + // and then port the editor hotkeys to this system. + var copyPasteKey = copypasteButton.Key.GetValue(); + if (Platform.CurrentPlatform == PlatformType.OSX && copyPasteKey.Modifiers.HasModifier(Modifiers.Ctrl)) + { + var modified = new Hotkey(copyPasteKey.Key, copyPasteKey.Modifiers & ~Modifiers.Ctrl | Modifiers.Meta); + copypasteButton.Key = FieldLoader.GetValue("Key", modified.ToString()); + } + copypasteButton.OnClick = () => editorViewport.SetBrush(new EditorCopyPasteBrush(editorViewport, worldRenderer, () => copyFilters)); copypasteButton.IsHighlighted = () => editorViewport.CurrentBrush is EditorCopyPasteBrush; }