Skip to content

finite_key_valid

The finite_key_valid function checks if a FiniteKey is valid

bool finite_key_valid(FiniteKey key)
TypeDescription
FiniteKey keyThe FiniteKey to check the state of
#include <finite/draw.h>
#include <finite/input.h>
FiniteShell *myShell = finite_shell_init("wayland-0");
if (!myShell) {
FINITE_LOG_FATAL("Unable to init shell");
}
FiniteKeyboard *kbd = finite_input_keyboard_init(myShell->display);
while (wl_display_dispatch(myShell->display) != -1) {
if (!finite_key_valid(FINITE_KEY_A)) {
FINITE_LOG_ERROR("Finite Key A is not valid");
}
if (!finite_key_up(FINITE_KEY_A, kbd)) {
FINITE_LOG("A is down");
}
}

Developers should ALWAYS call finite_gamepad_key_valid to verify a FINITE_GAMEPAD_KEY’s existence in the internal finite_gamepad_key_lookup table. Just because an enum exists does not mean that the evdev code for that input option is present.

As of v0.7.0, the finite controller hasnt been finished. As such theres been no testing for modular controllers. It’s expected that buttons should work as written, however.