capture method
- InputSource source
Points the waiting action at source, and stops waiting.
Replaces rather than adds, which is the decision worth defending: a player rebinding a control is nearly always moving it off something they cannot use, and an "as well" that left the old key working would leave them exactly where they started. What that costs is the ability to have two keys for one action, which the defaults already provide and which a player who wants it can rebuild with reset.
Returns whether it took the source, so a caller can go on treating the event as its own if not.
Implementation
bool capture(InputSource source) {
final action = _waiting;
if (action == null) return false;
// A source bound to something else is taken from it. Two actions on one key
// is a table where the last writer wins silently, and a player who cannot
// see which one won is a player who thinks the rebinding failed.
bindings
..unbind(source)
..clearAction(action)
..bind(source, action);
_waiting = null;
return true;
}