[iortcw] 197/497: All: scroll/caps/num lock keys send KEYUP event when key is released

Simon McVittie smcv at debian.org
Fri Sep 8 10:36:50 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to annotated tag 1.42d
in repository iortcw.

commit a0bfd100f753ffca1b4eaa4f5fa6699a19127ecf
Author: M4N4T4RMS at gmail.com <M4N4T4RMS at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date:   Fri Aug 29 17:37:25 2014 +0000

    All: scroll/caps/num lock keys send KEYUP event when key is released
---
 MP/README                |  3 ---
 MP/code/client/cl_keys.c |  8 ++------
 MP/code/sdl/sdl_input.c  | 16 ----------------
 SP/README                |  3 ---
 SP/code/client/cl_keys.c |  8 ++------
 SP/code/sdl/sdl_input.c  | 16 ----------------
 6 files changed, 4 insertions(+), 50 deletions(-)

diff --git a/MP/README b/MP/README
index 1fdc08e..c5423e1 100644
--- a/MP/README
+++ b/MP/README
@@ -410,9 +410,6 @@ SDL Keyboard Differences
   iortcw clients have different keyboard behaviour compared to the original
   RTTCW clients.
 
-    * "Caps Lock" and "Num Lock" can not be used as normal binds since they
-      do not send a KEYUP event until the key is pressed again.
-
     * SDL > 1.2.9 does not support disabling dead key recognition. In order to
       send dead key characters (e.g. ~, ', `, and ^), you must key a Space (or
       sometimes the same character again) after the character to send it on
diff --git a/MP/code/client/cl_keys.c b/MP/code/client/cl_keys.c
index d46807a..985b82c 100644
--- a/MP/code/client/cl_keys.c
+++ b/MP/code/client/cl_keys.c
@@ -2193,7 +2193,7 @@ void CL_KeyDownEvent( int key, unsigned time )
 	qboolean bypassMenu = qfalse;       // NERVE - SMF
 	keys[key].down = qtrue;
 	keys[key].repeats++;
-	if( keys[key].repeats == 1 && key != K_SCROLLOCK && key != K_KP_NUMLOCK && key != K_CAPSLOCK )
+	if( keys[key].repeats == 1 )
 		anykeydown++;
 
 	if( keys[K_ALT].down && key == K_ENTER )
@@ -2352,8 +2352,7 @@ void CL_KeyUpEvent( int key, unsigned time )
 {
 	keys[key].repeats = 0;
 	keys[key].down = qfalse;
-	if (key != K_SCROLLOCK && key != K_KP_NUMLOCK && key != K_CAPSLOCK)
-		anykeydown--;
+	anykeydown--;
 
 	if (anykeydown < 0) {
 		anykeydown = 0;
@@ -2430,9 +2429,6 @@ void Key_ClearStates( void ) {
 	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 );
 
diff --git a/MP/code/sdl/sdl_input.c b/MP/code/sdl/sdl_input.c
index 8448990..9e6fd5c 100644
--- a/MP/code/sdl/sdl_input.c
+++ b/MP/code/sdl/sdl_input.c
@@ -910,20 +910,6 @@ void IN_Frame( void )
 
 /*
 ===============
-IN_InitKeyLockStates
-===============
-*/
-void IN_InitKeyLockStates( void )
-{
-	const unsigned char *keystate = SDL_GetKeyboardState(NULL);
-
-	keys[K_SCROLLOCK].down = keystate[SDL_SCANCODE_SCROLLLOCK];
-	keys[K_KP_NUMLOCK].down = keystate[SDL_SCANCODE_NUMLOCKCLEAR];
-	keys[K_CAPSLOCK].down = keystate[SDL_SCANCODE_CAPSLOCK];
-}
-
-/*
-===============
 IN_Init
 ===============
 */
@@ -959,8 +945,6 @@ void IN_Init( void *windowData )
 	Cvar_SetValue( "com_unfocused",	!( appState & SDL_WINDOW_INPUT_FOCUS ) );
 	Cvar_SetValue( "com_minimized", appState & SDL_WINDOW_MINIMIZED );
 
-	IN_InitKeyLockStates( );
-
 	IN_InitJoystick( );
 	Com_DPrintf( "------------------------------------\n" );
 }
diff --git a/SP/README b/SP/README
index 1fdc08e..c5423e1 100644
--- a/SP/README
+++ b/SP/README
@@ -410,9 +410,6 @@ SDL Keyboard Differences
   iortcw clients have different keyboard behaviour compared to the original
   RTTCW clients.
 
-    * "Caps Lock" and "Num Lock" can not be used as normal binds since they
-      do not send a KEYUP event until the key is pressed again.
-
     * SDL > 1.2.9 does not support disabling dead key recognition. In order to
       send dead key characters (e.g. ~, ', `, and ^), you must key a Space (or
       sometimes the same character again) after the character to send it on
diff --git a/SP/code/client/cl_keys.c b/SP/code/client/cl_keys.c
index fbc541e..005809a 100644
--- a/SP/code/client/cl_keys.c
+++ b/SP/code/client/cl_keys.c
@@ -2190,7 +2190,7 @@ void CL_KeyDownEvent( int key, unsigned time )
 	int activeMenu = 0;
 	keys[key].down = qtrue;
 	keys[key].repeats++;
-	if( keys[key].repeats == 1 && key != K_SCROLLOCK && key != K_KP_NUMLOCK && key != K_CAPSLOCK )
+	if( keys[key].repeats == 1 )
 		anykeydown++;
 
 	if( keys[K_ALT].down && key == K_ENTER )
@@ -2338,8 +2338,7 @@ void CL_KeyUpEvent( int key, unsigned time )
 {
 	keys[key].repeats = 0;
 	keys[key].down = qfalse;
-	if (key != K_SCROLLOCK && key != K_KP_NUMLOCK && key != K_CAPSLOCK)
-		anykeydown--;
+	anykeydown--;
 
 	if (anykeydown < 0) {
 		anykeydown = 0;
@@ -2416,9 +2415,6 @@ void Key_ClearStates( void ) {
 	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 );
 		}
diff --git a/SP/code/sdl/sdl_input.c b/SP/code/sdl/sdl_input.c
index 8448990..9e6fd5c 100644
--- a/SP/code/sdl/sdl_input.c
+++ b/SP/code/sdl/sdl_input.c
@@ -910,20 +910,6 @@ void IN_Frame( void )
 
 /*
 ===============
-IN_InitKeyLockStates
-===============
-*/
-void IN_InitKeyLockStates( void )
-{
-	const unsigned char *keystate = SDL_GetKeyboardState(NULL);
-
-	keys[K_SCROLLOCK].down = keystate[SDL_SCANCODE_SCROLLLOCK];
-	keys[K_KP_NUMLOCK].down = keystate[SDL_SCANCODE_NUMLOCKCLEAR];
-	keys[K_CAPSLOCK].down = keystate[SDL_SCANCODE_CAPSLOCK];
-}
-
-/*
-===============
 IN_Init
 ===============
 */
@@ -959,8 +945,6 @@ void IN_Init( void *windowData )
 	Cvar_SetValue( "com_unfocused",	!( appState & SDL_WINDOW_INPUT_FOCUS ) );
 	Cvar_SetValue( "com_minimized", appState & SDL_WINDOW_MINIMIZED );
 
-	IN_InitKeyLockStates( );
-
 	IN_InitJoystick( );
 	Com_DPrintf( "------------------------------------\n" );
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list