[quake3-commits] r1942 - in trunk/code: client sdl
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sun Apr 17 18:09:05 EDT 2011
Author: thilo
Date: 2011-04-17 18:09:05 -0400 (Sun, 17 Apr 2011)
New Revision: 1942
Modified:
trunk/code/client/cl_keys.c
trunk/code/sdl/sdl_input.c
Log:
Consider key states before startup, patch by Zack Middleton (#4950)
Modified: trunk/code/client/cl_keys.c
===================================================================
--- trunk/code/client/cl_keys.c 2011-04-13 23:42:55 UTC (rev 1941)
+++ trunk/code/client/cl_keys.c 2011-04-17 22:09:05 UTC (rev 1942)
@@ -1175,7 +1175,7 @@
{
keys[key].down = qtrue;
keys[key].repeats++;
- if( keys[key].repeats == 1 )
+ if( keys[key].repeats == 1 && key != K_SCROLLOCK && key != K_KP_NUMLOCK && key != K_CAPSLOCK )
anykeydown++;
if( keys[K_ALT].down && key == K_ENTER )
@@ -1268,7 +1268,9 @@
{
keys[key].repeats = 0;
keys[key].down = qfalse;
- anykeydown--;
+ if (key != K_SCROLLOCK && key != K_KP_NUMLOCK && key != K_CAPSLOCK)
+ anykeydown--;
+
if (anykeydown < 0) {
anykeydown = 0;
}
@@ -1353,6 +1355,9 @@
anykeydown = 0;
for ( i=0 ; i < MAX_KEYS ; i++ ) {
+ if (i == K_SCROLLOCK || i == K_KP_NUMLOCK || i == K_CAPSLOCK)
+ continue;
+
if ( keys[i].down ) {
CL_KeyEvent( i, qfalse, 0 );
Modified: trunk/code/sdl/sdl_input.c
===================================================================
--- trunk/code/sdl/sdl_input.c 2011-04-13 23:42:55 UTC (rev 1941)
+++ trunk/code/sdl/sdl_input.c 2011-04-17 22:09:05 UTC (rev 1942)
@@ -982,6 +982,20 @@
/*
===============
+IN_InitKeyLockStates
+===============
+*/
+void IN_InitKeyLockStates( void )
+{
+ unsigned char *keystate = SDL_GetKeyState(NULL);
+
+ keys[K_SCROLLOCK].down = keystate[SDLK_SCROLLOCK];
+ keys[K_KP_NUMLOCK].down = keystate[SDLK_NUMLOCK];
+ keys[K_CAPSLOCK].down = keystate[SDLK_CAPSLOCK];
+}
+
+/*
+===============
IN_Init
===============
*/
@@ -1030,6 +1044,8 @@
Cvar_SetValue( "com_unfocused", !( appState & SDL_APPINPUTFOCUS ) );
Cvar_SetValue( "com_minimized", !( appState & SDL_APPACTIVE ) );
+ IN_InitKeyLockStates( );
+
IN_InitJoystick( );
Com_DPrintf( "------------------------------------\n" );
}
More information about the quake3-commits
mailing list