Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve edge case when primary key is technically a modifier. #968

Merged
merged 2 commits into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Blish HUD/GameServices/Input/Keyboard/KeyBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ namespace Blish_HUD.Input {
/// Allows for actions to be ran as the result of a provided key combination.
/// </summary>
public class KeyBinding {

private static readonly HashSet<Keys> _acceptedPrimaryModifierKeys = new HashSet<Keys>() { Keys.LeftAlt, Keys.RightAlt, Keys.LeftControl, Keys.RightControl, Keys.LeftShift, Keys.RightShift };

/// <summary>
/// Fires when the keys of the <see cref="KeyBinding"/> are changed.
/// </summary>
Expand Down Expand Up @@ -136,7 +139,7 @@ private void StopFiring() {
}

private void CheckTrigger(ModifierKeys activeModifiers, IEnumerable<Keys> pressedKeys) {
if (activeModifiers == this.ModifierKeys) {
if (activeModifiers == this.ModifierKeys || _acceptedPrimaryModifierKeys.Contains(_primaryKey)) {
if (this.BlockSequenceFromGw2) {
GameService.Input.Keyboard.StageKeyBinding(this);
}
Expand Down
Loading