Skip to content

finite_key_down

The finite_key_down returns whether a given FiniteKey is being pushed down.

bool finite_key_down(FiniteKey key, FiniteKeyboard *board)
TypeDescription
FiniteKey keyThe FiniteKey to check the state of
FiniteKeyboard *boardThe FiniteKeyboard to check the state from
#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_down(FINITE_KEY_A, kbd)) {
FINITE_LOG("A is down");
}
}

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