osu-framework icon indicating copy to clipboard operation
osu-framework copied to clipboard

KeyBindingHandler<T> does not handle conflicting keys appropriately

Open luaneko opened this issue 6 years ago • 2 comments

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.

luaneko avatar Jan 25 '19 12:01 luaneko

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.

peppy avatar Jan 26 '19 02:01 peppy

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?

ekrctb avatar Nov 12 '20 08:11 ekrctb