decode keyboard events to InputEvent structs