- Added sdl_nokeyrepeat to disable key repeating in the menus and console

on Linux.



SVN r1470 (trunk)
This commit is contained in:
Randy Heit 2009-03-11 00:17:31 +00:00
commit fcdab6a777
2 changed files with 28 additions and 2 deletions

View file

@ -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 ()