#56 Repeat key feature



I am having some problems with the GNOME repeat key feature. I would like to make a program that disable this feature just for a window, instead of asking the user to disable manually (:-p) the feature in the System -> Preferences -> Keyboard, affecting the whole system (which is even worst).

This problems appear when I try to make - with freeglut and opengl - something (a character, a car, ...) move smoothly and with final velocity proportional to the time that the user hold the key. When the character reach some predefined velocity the aceleration is turned off and the velocity is maintened until the user releases the foward key. When this happens we have a smooth deceleration.

I know that the Xlib have the function XAutoRepeatOff(Display * ptr) and XAutoRepeatOn(Display * ptr), and is easy to make the AutoRepeat disabled just for a single window, and not for the whole system. Is just turn ON this feature every time that we receive a FocusOut event, and turn off every time that we receive a FocusIn event. Freeglut uses Xlib?? If yes, this feature would be (I believe) a great improvement with a minimum effort.

A big thanks!


  • xlib example with autorepeat on-off with focus out-in

  • Sven Panne
    Sven Panne

    freelut has 2 API entries to handle the key repeat behaviour: glutSetKeyRepeat, which sets the key repeat globally for all freeglut windows (original GLUT did this for *all* windows, IIRC), but this function is effectively deprecated. glutIgnoreKeyRepeat sets the key repeat behaviour per window, and this is the recommended function.

    If either of these API entries has a bug, a separate report should be opened.

  • Sven Panne
    Sven Panne

    • status: open --> closed