diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 7340d557e..bb64a33b8 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,6 @@ March 10, 2009 +- Added sdl_nokeyrepeat to disable key repeating in the menus and console + on Linux. - Added support for zip/pk3 files with LZMA and bzip2 compression to ZDoom. - Added more output to zipdir and a -q option to turn it off. - Added -u option to zipdir to only recompress those files in a zip that have diff --git a/src/sdl/i_input.cpp b/src/sdl/i_input.cpp index 249c71fcf..572d381e6 100644 --- a/src/sdl/i_input.cpp +++ b/src/sdl/i_input.cpp @@ -29,6 +29,7 @@ extern int paused; CVAR (Bool, use_mouse, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (Bool, m_noprescale, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (Bool, m_filter, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) +CVAR (Bool, sdl_nokeyrepeat, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) float JoyAxes[6]; //static int JoyActive; @@ -200,6 +201,10 @@ static void InitKeySymMap () static void I_CheckGUICapture () { bool wantCapt; + bool repeat; + int oldrepeat, interval; + + SDL_GetKeyRepeat(&oldrepeat, &interval); if (menuactive == MENU_Off) { @@ -217,15 +222,34 @@ static void I_CheckGUICapture () { FlushDIKState (); memset (DownState, 0, sizeof(DownState)); - SDL_EnableKeyRepeat (SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); + repeat = !sdl_nokeyrepeat; SDL_EnableUNICODE (1); } else { - SDL_EnableKeyRepeat (0, 0); + repeat = false; SDL_EnableUNICODE (0); } } + if (wantCapt) + { + repeat = !sdl_nokeyrepeat; + } + else + { + repeat = false; + } + if (repeat != (oldrepeat != 0)) + { + if (repeat) + { + SDL_EnableKeyRepeat (SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); + } + else + { + SDL_EnableKeyRepeat (0, 0); + } + } } static void CenterMouse ()