Fixed binds without modifiers not matching while a modifier is held - #6597
Open
dekrom wants to merge 1 commit into
Open
Fixed binds without modifiers not matching while a modifier is held#6597dekrom wants to merge 1 commit into
dekrom wants to merge 1 commit into
Conversation
Collaborator
|
im not a big fan of the idea that introducing a new keybind can affect the behavior of an existing keybind, i think a better solution would be to add a toggle into the keybind setting controlling whether to strictly match modifiers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change
Description
Since 56a7703 ("Fixed modifier keybinds triggering non modifier varients", #6586), a keybind
that has no modifiers only matches when no modifier at all is held:
That breaks two ordinary cases:
1. Binds on a bare modifier key never trigger.
KeyboardHandlerMixindeliberately sets amodifier key's own bit on its press event (the workaround for glfw/glfw#1630), so pressing
Left Alt arrives as
key=342, modifiers=MOD_ALT. A module bound to plain Left Alt thereforenever matches on press. Mine (Free Look on Left Alt) went dead after updating, and only
toggling from the module list still worked. Release does match, but that path only fires for
toggleOnBindRelease.2. Any bind dies while a modifier is held for an unrelated reason. Sneaking holds Shift,
sprinting holds Ctrl. Press a plain bind during either and it no longer matches.
The underlying issue is that #6586 treats a held modifier as disqualifying, when what it
actually wanted is for
Ctrl + Gnot to also trigger a module bound to plainG. That is aquestion of precedence between binds, not of what the bind itself matches, so this moves it to
where the binds are dispatched:
Keybind#matchesgoes back to ignoring modifiers for a bind that has none.Modules#onActionfirst checks whether any module's bind with modifiers matches the event;if one does, binds without modifiers are skipped for that event.
Ctrl + Gstill fires only the chorded bind,Galone still fires the plain one, and plainbinds work again while sneaking, sprinting, or when the bound key is itself a modifier.
Related issues
Regression from #6586 (56a7703).
How Has This Been Tested?
Built and run on 26.2 (production, Fabric) with Free Look bound to plain Left Alt:
Modules#onAction: the press arrives asvalue=342 mods=4and now matches, where before itdid not.
Gand another toCtrl + G:Ctrl + Gtoggles only the chordedmodule,
Galone toggles only the plain one.Checklist: