osu-framework
osu-framework copied to clipboard
KeyBindingHandler<T> does not handle conflicting keys appropriately
looking at the source, KeyBindingHandler<T> always handles bindings with more keys first. however this doesn't help when there are multiple bindings with the exact same keys.
I discovered this while tackling https://github.com/ppy/osu/issues/3885. I added another GlobalAction bound to InputKey.Space for deselecting mods, but ModSelectOverlay would always receive GlobalAction.SkipCutscene (which is also bound to InputKey.Space).
possible fix: make KeyBindingHandler<T> aware of the type of Drawable it's triggering the actions on.
It could just fire both in some order instead? Keep in mind that I think the binding interface would also need to be updated as it avoids duplicates currently.
GlobalActionContainer uses SimultaneousBindingMode.None, which prohibits multiple key bindings to be pressed at once. SimultaneousBindingMode.Unique allows multiple conflicting key bindings.
Then, is there any reason we cannot just use SimultaneousBindingMode.Unique for the GlobalActionContainer?