---
name: "SDL_KeyboardEvent"
section: "3"
platform: "linux"
package: "libsdl1.2-dev"
version: "1.2.15+dfsg2-8"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_KeyboardEvent"
---

# SDL\_KeyboardEvent(3)

Keyboard event structure

## NAME

SDL\_KeyboardEvent - Keyboard event structure

## STRUCTURE DEFINITION

```
typedef struct{
  Uint8 type;
  Uint8 state;
  SDL_keysym keysym;
} SDL_KeyboardEvent;
```

## STRUCTURE DATA

- **type**

  **SDL\_KEYDOWN** or **SDL\_KEYUP**

- **state**

  **SDL\_PRESSED** or **SDL\_RELEASED**

- **keysym**

  Contains key press information

## DESCRIPTION

**SDL\_KeyboardEvent** is a member of the **SDL\_Event** union and is used when an event of type **SDL\_KEYDOWN** or **SDL\_KEYUP** is reported.

The **type** and **state** actually report the same information, they just use different values to do it! A keyboard event occurs when a key is released (**type**=**SDK\_KEYUP** or **state**=**SDL\_RELEASED**) and when a key is pressed (**type**=**SDL\_KEYDOWN** or **state**=**SDL\_PRESSED**). The information on what key was pressed or released is in the **keysym** structure.

**Note:**

**Repeating SDL\_KEYDOWN events will occur if key repeat is enabled (see SDL\_EnableKeyRepeat**).

## SEE ALSO

**SDL\_Event**, **SDL\_keysym**, **SDL\_EnableKeyRepeat**, **SDL\_EnableUNICODE**
