---
name: "SDL_ActiveEvent"
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_ActiveEvent"
---

# SDL\_ActiveEvent(3)

Application visibility event structure

## NAME

SDL\_ActiveEvent - Application visibility event structure

## STRUCTURE DEFINITION

```
typedef struct{
  Uint8 type;
  Uint8 gain;
  Uint8 state;
} SDL_ActiveEvent;
```

## STRUCTURE DATA

- **type**

  **SDL\_ACTIVEEVENT.**

- **gain**

  0 if the event is a loss or 1 if it is a gain.

- **state**

  **SDL\_APPMOUSEFOCUS** if mouse focus was gained or lost, **SDL\_APPINPUTFOCUS** if input focus was gained or lost, or **SDL\_APPACTIVE** if the application was iconified (**gain**=0) or restored(**gain**=1).

## DESCRIPTION

**SDL\_ActiveEvent** is a member of the **SDL\_Event** union and is used when an event of type **SDL\_ACTIVEEVENT** is reported.

When the mouse leaves or enters the window area a **SDL\_APPMOUSEFOCUS** type activation event occurs, if the mouse entered the window then **gain** will be 1, otherwise **gain** will be 0. A **SDL\_APPINPUTFOCUS** type activation event occurs when the application loses or gains keyboard focus. This usually occurs when another application is made active. Finally, a **SDL\_APPACTIVE** type event occurs when the application is either minimised/iconified (**gain**=0) or restored.

**Note:**

**This event does not occur when an application window is first created.**

## SEE ALSO

**SDL\_Event**, **SDL\_GetAppState**
