-
Notifications
You must be signed in to change notification settings - Fork 423
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
Remove KeyBindingContainer.SendRepeats
#4896
Conversation
Blocking temporarily. A couple of oversights I'm working on still. |
Turns out that key repeat (via event flow) wasn't really handled correctly in The existing test coverage seems to be enough to cover this behaviour. |
I've fired off a nitpick commit to correct a slightly strange test step name. In general this diff looks sane to me. One thing I'm not sure of, is that when |
Yeah, it isn't a 1:1 with expectations but I'd rather address that as a follow up, I think. Keep in mind it's working with the last action, not bindings, so in a simple case where On macOS (and windows from my recollection), the last non-modifier is the key to be repeated, but modifiers are not included in the equation. So the true behaviour if we're looking for parity would be for the modifier |
|
||
var pressEvent = new KeyBindingPressEvent<T>(state, action, true); | ||
|
||
return keyRepeatInputQueue.FirstOrDefault(d => triggerKeyBindingEvent(d, pressEvent)) != null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have a few more conditions, as per
osu-framework/osu.Framework/Input/KeyEventManager.cs
Lines 25 to 26 in 05920eb
// Only drawables that can still handle input should handle the repeat | |
var drawables = ButtonDownInputQueue.Intersect(InputQueue).Where(t => t.IsAlive && t.IsPresent); |
But I understand that's a bit complex to get done in this PR, so looks fine as it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw that. But those conditionals also weren't applied to the other path as far as I can see (I guess it's less important because it's an immediate firing?) so I didn't think too much of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other path being what? In both cases it's the non-repeat path, and the expectation is that it doesn't contain !IsAlive
and !IsPresent
items in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that part. I'll add the conditionals in a follow-up PR.
|
||
var pressEvent = new KeyBindingPressEvent<T>(state, action, true); | ||
|
||
return keyRepeatInputQueue.FirstOrDefault(d => triggerKeyBindingEvent(d, pressEvent)) != null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this is just incorrect because the input queues are per-keybinding...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which case would be incorrect? The idea is that the repeat is only sent to the last pressed key binding, where this queue is taken from directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I see. Seems okay on a second think...
Going to need osu!-side fixes for this as well, fwiw. |
Yeah. I did a quick testing pass and nothing was too broken (and the places this intends to fix were fixed), but there's going to be multiple places we need to block repeats. Will look at that today. |
Reasoning mentioned in #4773.
See a pretty shocking oversight in db22119 which went unnoticed until now as tests were focused on the non-event-based repeat handling (which is removed in this PR). Existing tests cover the fail case - revert the commit to confirm.
Breaking Changes
KeyBindingContainer.SendRepeats
no longer existsUse the
KeyBindingPressEvent
provided inOnPressed
delegates to identify (and ignore or handle) repeats instead.