blish-hud / Blish-HUD

A Guild Wars 2 overlay with extreme extensibility through compiled modules.
https://blishhud.com
MIT License
311 stars 60 forks source link

Keybinding: should not block or trigger when more modifiers are used than assigned to the keybinding #862

Closed Taschenbuch closed 6 months ago

Taschenbuch commented 1 year ago

Blish core: 1.0.0

expected behavior:

blish hud keybindings only trigger (.Activated) for their keybinding and do not interfer with other keybindings.

actual behavior:

blish hud keybindings are triggered (.Activated) when more modifier keys are pressed than are part of the keybinding. This can cause keybindings to trigger in unwanted situations and it can block other unrelated keybindings from working.

Examples:

(2 cases, one with sending to game and one with not sending to game option enabled. BlockSequenceFromGw2?)

blocking other keybindings:

when a blish hud keybinding like alt + t is assigned in a blish hud module, it will block alt + shift + t, too. e.g. in this case it would prevent arcdps from receiving alt + shift + t. This currently happens with the trading post module (not 100% sure if it used .Activated): https://discord.com/channels/531175899588984842/534492173362528287/1084984576293740634 Probably happening too: When a keybinding for "A" with BlockSequenceFromGw2=true is setup, it will block any key presses that include an "A". e.g. it will block "A" and "CTRL+A" and "ALT+A" and so on.

triggering on wrong keybinding

same issue the other way around: when a hotkey with multiple modifier keys (e.g. arc dps alt + shift + t) is pressed it will also trigger blish keybindings for alt + t. this happens with the gathering tools module https://discord.com/channels/531175899588984842/534492173362528287/1086462037397352458

Solution

discussion starts here https://discord.com/channels/531175899588984842/536970543736291346/1086615020105891841

keybinding triggering on wrong key presses or blocking other keypresses with more modifiers: issue: https://github.com/blish-hud/Blish-HUD/issues/862

Is there a reason why KeyBinding.CheckTrigger() has this check: (this.ModifierKeys & activeModifiers) == this.ModifierKeys

instead of this check: this.ModifierKeys == activeModifiers

that causes the issue that pressing something like "ctrl + shift + T" triggers "ctrl + T" too. didnt test the block case, but pretty sure it causes it too. source: https://github.com/blish-hud/Blish-HUD/blob/8946a418e6f24c7accd63189f6fc825c9eff322a/Blish%20HUD/GameServices/Input/Keyboard/KeyBinding.cs#L139

Tharylia commented 11 months ago

This issue seems to happen more often as of lately. (More users are asking) I got about 3 cases via dm or support server.

ScrambledBrain commented 9 months ago

I can confirm this issue.

My setup:

Issue:

The same 2nd mentioned issue occurs: Other key modifiers are not handled and also trigger: I not only can press ALT+C for "ecksofa.gatheringtools" but also SHIFT+CTRL+ALT+C, CTRL+ALT+C and SHIFT+ALT+C... and the last one also activates arcdps clears.

Workaround:

Using another key binding and key modifier combination, which doesn't trigger other things. I currently use SHIFT+CTRL+C for "ecksofa.gatheringtools".