---
name: "al_clear_keyboard_state"
section: "3alleg5"
platform: "linux"
package: "allegro5-doc"
version: "2:5.2.10.1+dfsg-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/al_clear_keyboard_state/3alleg5"
---

# al\_clear\_keyboard\_state(3alleg5)

Allegro 5 API

## NAME

al\_clear\_keyboard\_state - Allegro 5 API

## SYNOPSIS

-

  ```
  #include <allegro5/allegro.h>
  void al_clear_keyboard_state(ALLEGRO_DISPLAY *display)
  ```

## DESCRIPTION

Clear the state of the keyboard, emitting ALLEGRO\_EVENT\_KEY\_UP(3alleg5) for each currently pressed key. The given display is regarded as the one which had the keyboard focus when the event occurred. In case display is NULL no event is emitted. For most keyboard drivers Allegro maintains its own state of the keyboard, which might get out of sync with the real one. This function is intended to remedy such situation by resetting Allegro’s keyboard state to a known default (no key pressed). This is particularly useful in response to ALLEGRO\_EVENT\_DISPLAY\_SWITCH\_OUT(3alleg5) events.

## SEE ALSO

al\_get\_keyboard\_state(3alleg5), ALLEGRO\_KEYBOARD\_STATE(3alleg5)

## SINCE

5\.2.3

*\[Unstable API\]:* This is a new feature and the exact semantics are still being decided upon.
