---
name: "SDL_Event"
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_Event/3type"
---

# SDL\_Event(3type)

The structure for all events in SDL.

## NAME

SDL\_Event - The structure for all events in SDL.

## HEADER FILE

Defined in SDL3/SDL\_events.h

## SYNOPSIS

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

**typedef union SDL\_Event** **{**     **Uint32 type;                            /\*\*\< Event type, shared with all events, Uint32 to cover user events which are not in the SDL\_EventType enumeration \*/**     **SDL\_CommonEvent common;                 /\*\*\< Common event data \*/**     **SDL\_DisplayEvent display;               /\*\*\< Display event data \*/**     **SDL\_WindowEvent window;                 /\*\*\< Window event data \*/**     **SDL\_KeyboardDeviceEvent kdevice;        /\*\*\< Keyboard device change event data \*/**     **SDL\_KeyboardEvent key;                  /\*\*\< Keyboard event data \*/**     **SDL\_TextEditingEvent edit;              /\*\*\< Text editing event data \*/**     **SDL\_TextEditingCandidatesEvent edit\_candidates; /\*\*\< Text editing candidates event data \*/**     **SDL\_TextInputEvent text;                /\*\*\< Text input event data \*/**     **SDL\_MouseDeviceEvent mdevice;           /\*\*\< Mouse device change event data \*/**     **SDL\_MouseMotionEvent motion;            /\*\*\< Mouse motion event data \*/**     **SDL\_MouseButtonEvent button;            /\*\*\< Mouse button event data \*/**     **SDL\_MouseWheelEvent wheel;              /\*\*\< Mouse wheel event data \*/**     **SDL\_JoyDeviceEvent jdevice;             /\*\*\< Joystick device change event data \*/**     **SDL\_JoyAxisEvent jaxis;                 /\*\*\< Joystick axis event data \*/**     **SDL\_JoyBallEvent jball;                 /\*\*\< Joystick ball event data \*/**     **SDL\_JoyHatEvent jhat;                   /\*\*\< Joystick hat event data \*/**     **SDL\_JoyButtonEvent jbutton;             /\*\*\< Joystick button event data \*/**     **SDL\_JoyBatteryEvent jbattery;           /\*\*\< Joystick battery event data \*/**     **SDL\_GamepadDeviceEvent gdevice;         /\*\*\< Gamepad device event data \*/**     **SDL\_GamepadAxisEvent gaxis;             /\*\*\< Gamepad axis event data \*/**     **SDL\_GamepadButtonEvent gbutton;         /\*\*\< Gamepad button event data \*/**     **SDL\_GamepadTouchpadEvent gtouchpad;     /\*\*\< Gamepad touchpad event data \*/**     **SDL\_GamepadSensorEvent gsensor;         /\*\*\< Gamepad sensor event data \*/**     **SDL\_AudioDeviceEvent adevice;           /\*\*\< Audio device event data \*/**     **SDL\_CameraDeviceEvent cdevice;          /\*\*\< Camera device event data \*/**     **SDL\_SensorEvent sensor;                 /\*\*\< Sensor event data \*/**     **SDL\_QuitEvent quit;                     /\*\*\< Quit request event data \*/**     **SDL\_UserEvent user;                     /\*\*\< Custom event data \*/**     **SDL\_TouchFingerEvent tfinger;           /\*\*\< Touch finger event data \*/**     **SDL\_PenProximityEvent pproximity;       /\*\*\< Pen proximity event data \*/**     **SDL\_PenTouchEvent ptouch;               /\*\*\< Pen tip touching event data \*/**     **SDL\_PenMotionEvent pmotion;             /\*\*\< Pen motion event data \*/**     **SDL\_PenButtonEvent pbutton;             /\*\*\< Pen button event data \*/**     **SDL\_PenAxisEvent paxis;                 /\*\*\< Pen axis event data \*/**     **SDL\_RenderEvent render;                 /\*\*\< Render event data \*/**     **SDL\_DropEvent drop;                     /\*\*\< Drag and drop event data \*/**     **SDL\_ClipboardEvent clipboard;           /\*\*\< Clipboard event data \*/**     **/\* This is necessary for ABI compatibility between Visual C++ and GCC.**        **Visual C++ will respect the push pack pragma and use 52 bytes (size of**        **SDL\_TextEditingEvent, the largest structure for 32-bit and 64-bit**        **architectures) for this union, and GCC will use the alignment of the**        **largest datatype within the union, which is 8 bytes on 64-bit**        **architectures.**        **So... we'll add padding to force the size to be the same for both.**        **On architectures where pointers are 16 bytes, this needs rounding up to**        **the next multiple of 16, 64, and on architectures where pointers are**        **even larger the size of SDL\_UserEvent will dominate as being 3 pointers.**     **\*/**     **Uint8 padding\[128\];** **} SDL\_Event;**

## DESCRIPTION

The  **SDL\_Event**\
  structure is the core of all event handling in SDL.  **SDL\_Event**\
  is a union of all event structures used in SDL.

## AVAILABILITY

This struct is available since SDL 3.2.0.
