From 6baeb51b588a9de243c0bb9c67a510e450a3da7b Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Sat, 4 Jan 2020 04:21:23 -0600 Subject: [PATCH] Handle special case of capturing Alt keys Related to issue #1002 --- DS4Windows/DS4Forms/RecordBox.xaml.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/DS4Windows/DS4Forms/RecordBox.xaml.cs b/DS4Windows/DS4Forms/RecordBox.xaml.cs index ac2c07e..29ac8bd 100644 --- a/DS4Windows/DS4Forms/RecordBox.xaml.cs +++ b/DS4Windows/DS4Forms/RecordBox.xaml.cs @@ -278,11 +278,12 @@ namespace DS4WinWPF.DS4Forms { if (recordBoxVM.Recording) { - int value = KeyInterop.VirtualKeyFromKey(e.Key); + Key tempKey = e.SystemKey == Key.None ? e.Key : e.SystemKey; + int value = KeyInterop.VirtualKeyFromKey(tempKey); recordBoxVM.KeysdownMap.TryGetValue(value, out bool isdown); if (!isdown) { - DS4Windows.MacroStep step = new DS4Windows.MacroStep(KeyInterop.VirtualKeyFromKey(e.Key), e.Key.ToString(), + DS4Windows.MacroStep step = new DS4Windows.MacroStep(value, tempKey.ToString(), DS4Windows.MacroStep.StepType.ActDown, DS4Windows.MacroStep.StepOutput.Key); recordBoxVM.AddMacroStep(step); recordBoxVM.KeysdownMap.Add(value, true); @@ -303,11 +304,12 @@ namespace DS4WinWPF.DS4Forms { if (recordBoxVM.Recording) { - int value = KeyInterop.VirtualKeyFromKey(e.Key); + Key tempKey = e.SystemKey == Key.None ? e.Key : e.SystemKey; + int value = KeyInterop.VirtualKeyFromKey(tempKey); recordBoxVM.KeysdownMap.TryGetValue(value, out bool isdown); if (isdown) { - DS4Windows.MacroStep step = new DS4Windows.MacroStep(KeyInterop.VirtualKeyFromKey(e.Key), e.Key.ToString(), + DS4Windows.MacroStep step = new DS4Windows.MacroStep(value, tempKey.ToString(), DS4Windows.MacroStep.StepType.ActUp, DS4Windows.MacroStep.StepOutput.Key); recordBoxVM.AddMacroStep(step); recordBoxVM.KeysdownMap.Remove(value);