From 91c5729855c081c892afe930806de7a8f8824427 Mon Sep 17 00:00:00 2001 From: D1firehail <77355844+D1firehail@users.noreply.github.com> Date: Sun, 7 Apr 2024 03:08:53 +0200 Subject: [PATCH] Fix Left/Right arrow keys also being read as mouse keys (#298) --- WFInfo/Settings/ApplicationSettings.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/WFInfo/Settings/ApplicationSettings.cs b/WFInfo/Settings/ApplicationSettings.cs index 8dfb64c9..c322cd33 100644 --- a/WFInfo/Settings/ApplicationSettings.cs +++ b/WFInfo/Settings/ApplicationSettings.cs @@ -48,7 +48,20 @@ public Point MainWindowLocation [JsonIgnore] public Key? ActivationKeyKey => Enum.TryParse(ActivationKey, out var res) ? res : (Key?)null; [JsonIgnore] - public MouseButton? ActivationMouseButton => Enum.TryParse(ActivationKey, out var res) ? res : (MouseButton?)null; + public MouseButton? ActivationMouseButton + { + get + { + var result = Enum.TryParse(ActivationKey, out var res) ? res : (MouseButton?)null; + if (result is MouseButton.Left || result is MouseButton.Right) + { + // Prevent Key.Left and Key.Right (arrow keys) from being misinterpreted as the mouse buttons. + // Using these mouse buttons as activation key is a bad idea anyway + return null; + } + return result; + } + } public Key DebugModifierKey { get; set; } = Key.LeftShift; public Key SearchItModifierKey { get; set; } = Key.OemTilde; public Key SnapitModifierKey { get; set; } = Key.LeftCtrl;