boolean consumed = false;
final InputState current = inputStates.getCurrent();
// Keyboard checks
{
final KeyboardState previousKState = inputStates.getPrevious().getKeyboardState();
final KeyboardState currentKState = current.getKeyboardState();
if (!currentKState.getKeysDown().isEmpty()) {
// new presses
final EnumSet<Key> pressed = currentKState.getKeysPressedSince(previousKState);
if (!pressed.isEmpty()) {
for (final Key key : pressed) {
consumed |= fireKeyPressedEvent(key, current);
}
}
// repeats
final EnumSet<Key> repeats = currentKState.getKeysHeldSince(previousKState);
if (!repeats.isEmpty() && _focusedComponent != null) {
for (final Key key : repeats) {
consumed |= fireKeyHeldEvent(key, current);
}
}
}
// key releases
if (!previousKState.getKeysDown().isEmpty()) {
final EnumSet<Key> released = currentKState.getKeysReleasedSince(previousKState);
if (!released.isEmpty()) {
for (final Key key : released) {
consumed |= fireKeyReleasedEvent(key, current);
}
}