Skip to content

Commit

Permalink
Fix Left/Right arrow keys also being read as mouse keys (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
D1firehail authored Apr 7, 2024
1 parent 6e8a60e commit 91c5729
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion WFInfo/Settings/ApplicationSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,20 @@ public Point MainWindowLocation
[JsonIgnore]
public Key? ActivationKeyKey => Enum.TryParse<Key>(ActivationKey, out var res) ? res : (Key?)null;
[JsonIgnore]
public MouseButton? ActivationMouseButton => Enum.TryParse<MouseButton>(ActivationKey, out var res) ? res : (MouseButton?)null;
public MouseButton? ActivationMouseButton
{
get
{
var result = Enum.TryParse<MouseButton>(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;
Expand Down

0 comments on commit 91c5729

Please sign in to comment.