Map Ctrl to Cmd for editor copy hotkey.

This commit is contained in:
Paul Chote
2019-01-19 14:30:16 +00:00
parent de851fba2c
commit 9025d11c54

View File

@@ -88,6 +88,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var copypasteButton = widget.GetOrNull<ButtonWidget>("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<HotkeyReference>("Key", modified.ToString());
}
copypasteButton.OnClick = () => editorViewport.SetBrush(new EditorCopyPasteBrush(editorViewport, worldRenderer, () => copyFilters));
copypasteButton.IsHighlighted = () => editorViewport.CurrentBrush is EditorCopyPasteBrush;
}