finite_key_pressed
The finite_key_pressed returns whether a given FiniteKey is being pressed.
bool finite_key_pressed(FiniteKey key, FiniteKeyboard *board)Parameters
Section titled “Parameters”| Type | Description |
|---|---|
FiniteKey key | The FiniteKey to check the state of |
FiniteKeyboard *board | The FiniteKeyboard to check the state from |
Code Example
Section titled “Code Example”#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_pressed(FINITE_KEY_A, kbd)) { FINITE_LOG("A was pressed"); }}Standard Usage
Section titled “Standard Usage”This function returns whether a key was pushed down then immediately released. For “input held” related events use finite_key_down instead
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.