glutSetKeyRepeat
Prev | GLUT | Next

## Name

glutSetKeyRepeat — sets the key repeat mode

## C Specification

`int `glutSetKeyRepeat`` | `(` | `int `repeatMode`);`

## Python Specification

``glutSetKeyRepeat`` | `(` | ``repeatMode`) → `None``

## Parameters

`repeatMode`

  Mode for setting key repeat to.

  `GLUT_KEY_REPEAT_OFF`
    Disable key repeat for the window system on a global basis if possible.
  `GLUT_KEY_REPEAT_ON`
    Enable key repeat for the window system on a global basis if possible.
  `GLUT_KEY_REPEAT_DEFAULT`
    Reset the key repeat mode for the window system to its default state if possible.

## Description

`glutSetKeyRepeat` sets the key repeat mode for the window system on a global basis if possible. If supported by the window system, the key repeat can either be enabled, disabled, or set to the window system's default key repeat state.

## Glut Implementation Notes For X11

X11 sends KeyPress events repeatedly when the window system's global auto repeat is enabled. `glutIgnoreKeyRepeat` can prevent these auto repeated keystrokes from being reported as keyboard or special callbacks, but there is still some minimal overhead by the X server to continually stream KeyPress events to the GLUT application. The `glutSetKeyRepeat` routine can be used to actually disable the global sending of auto repeated KeyPress events. Note that `glutSetKeyRepeat` affects the global window system auto repeat state so other applications will not auto repeat if you disable auto repeat globally through `glutSetKeyRepeat`.

GLUT applications using the X11 GLUT implemenation should disable key repeat with `glutSetKeyRepeat` to disable key repeats most efficiently.

GLUT applications that change the key repeat state with `glutSetKeyRepeat` are responsible for explicitly restoring the default key repeat state on exit.

## Glut Implementation Notes For Win32

The Win32 implementation of `glutSetKeyRepeat` does nothing. The `glutIgnoreKeyRepeat` routine can be used in the Win32 GLUT implementation to ignore repeated keys on a per-window basis without changing the global window system key repeat.

## See Also

glutIgnoreKeyRepeat, glutKeyboardFunc, glutSpecialFunc, glutKeyboardUpFunc, glutSpecialUpFunc, glutDeviceGet

Prev | Up | Next
glutSetCursor | Home | glutSetMenu