---
name: "SDL_KeyboardEvent"
section: "3type"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_KeyboardEvent/3type"
---

# SDL\_KeyboardEvent(3type)

Keyboard button event structure (event.key.\*)

## NAME

SDL\_KeyboardEvent - Keyboard button event structure (event.key.\*)

## HEADER FILE

Defined in SDL3/SDL\_events.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**typedef struct SDL\_KeyboardEvent** **{**     **SDL\_EventType type;     /\*\*\< SDL\_EVENT\_KEY\_DOWN or SDL\_EVENT\_KEY\_UP \*/**     **Uint32 reserved;**     **Uint64 timestamp;       /\*\*\< In nanoseconds, populated using SDL\_GetTicksNS() \*/**     **SDL\_WindowID windowID;  /\*\*\< The window with keyboard focus, if any \*/**     **SDL\_KeyboardID which;   /\*\*\< The keyboard instance id, or 0 if unknown or virtual \*/**     **SDL\_Scancode scancode;  /\*\*\< SDL physical key code \*/**     **SDL\_Keycode key;        /\*\*\< SDL virtual key code \*/**     **SDL\_Keymod mod;         /\*\*\< current key modifiers \*/**     **Uint16 raw;             /\*\*\< The platform dependent scancode for this event \*/**     **bool down;              /\*\*\< true if the key is pressed \*/**     **bool repeat;            /\*\*\< true if this is a key repeat \*/** **} SDL\_KeyboardEvent;**

## DESCRIPTION

The **key** is the base  **SDL\_Keycode**\
  generated by pressing the **scancode** using the current keyboard layout, applying any options specified in  **SDL\_HINT\_KEYCODE\_OPTIONS** . You can get the  **SDL\_Keycode**\
  corresponding to the event scancode and modifiers directly from the keyboard layout, bypassing

**SDL\_HINT\_KEYCODE\_OPTIONS** , by calling

**SDL\_GetKeyFromScancode** ().

## AVAILABILITY

This struct is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_GetKeyFromScancode**(3)](/SDL_GetKeyFromScancode/3.md), **•**(3), [**SDL\_HINT\_KEYCODE\_OPTIONS**(3)](/SDL_HINT_KEYCODE_OPTIONS/3.md)
