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

# SDL\_SetModState(3)

Set the current key modifier state for the keyboard.

## NAME

SDL\_SetModState - Set the current key modifier state for the keyboard.

## HEADER FILE

Defined in SDL3/SDL\_keyboard.h

## SYNOPSIS

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

**void SDL\_SetModState(SDL\_Keymod modstate);**

## DESCRIPTION

The inverse of  **SDL\_GetModState** (),

**SDL\_SetModState** () allows you to impose modifier key states on your application. Simply pass your desired modifier states into **modstate** . This value may be a bitwise, OR'd combination of

**SDL\_Keymod**\
  values.

This does not change the keyboard state, only the key modifier flags that SDL reports.

## FUNCTION PARAMETERS

- *modstate*

  the desired  **SDL\_Keymod**\
    for the keyboard.

## THREAD SAFETY

It is safe to call this function from any thread.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_GetModState**(3)](/SDL_GetModState/3.md)
