SDL 2 scroll/caps/num lock keys send KEYUP event when key is released
This commit is contained in:
parent
18e08125dd
commit
1d95ef210e
3 changed files with 2 additions and 25 deletions
|
@ -438,9 +438,6 @@ Note that this cvar MUST be set as a command line parameter.
|
||||||
ioquake3 clients have different keyboard behaviour compared to the original
|
ioquake3 clients have different keyboard behaviour compared to the original
|
||||||
Quake3 clients.
|
Quake3 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
|
* 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
|
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
|
sometimes the same character again) after the character to send it on
|
||||||
|
|
|
@ -1207,7 +1207,7 @@ void CL_KeyDownEvent( int key, unsigned time )
|
||||||
{
|
{
|
||||||
keys[key].down = qtrue;
|
keys[key].down = qtrue;
|
||||||
keys[key].repeats++;
|
keys[key].repeats++;
|
||||||
if( keys[key].repeats == 1 && key != K_SCROLLOCK && key != K_KP_NUMLOCK && key != K_CAPSLOCK )
|
if( keys[key].repeats == 1 )
|
||||||
anykeydown++;
|
anykeydown++;
|
||||||
|
|
||||||
if( keys[K_ALT].down && key == K_ENTER )
|
if( keys[K_ALT].down && key == K_ENTER )
|
||||||
|
@ -1299,8 +1299,7 @@ void CL_KeyUpEvent( int key, unsigned time )
|
||||||
{
|
{
|
||||||
keys[key].repeats = 0;
|
keys[key].repeats = 0;
|
||||||
keys[key].down = qfalse;
|
keys[key].down = qfalse;
|
||||||
if (key != K_SCROLLOCK && key != K_KP_NUMLOCK && key != K_CAPSLOCK)
|
anykeydown--;
|
||||||
anykeydown--;
|
|
||||||
|
|
||||||
if (anykeydown < 0) {
|
if (anykeydown < 0) {
|
||||||
anykeydown = 0;
|
anykeydown = 0;
|
||||||
|
@ -1385,9 +1384,6 @@ void Key_ClearStates (void)
|
||||||
anykeydown = 0;
|
anykeydown = 0;
|
||||||
|
|
||||||
for ( i=0 ; i < MAX_KEYS ; i++ ) {
|
for ( i=0 ; i < MAX_KEYS ; i++ ) {
|
||||||
if (i == K_SCROLLOCK || i == K_KP_NUMLOCK || i == K_CAPSLOCK)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if ( keys[i].down ) {
|
if ( keys[i].down ) {
|
||||||
CL_KeyEvent( i, qfalse, 0 );
|
CL_KeyEvent( i, qfalse, 0 );
|
||||||
|
|
||||||
|
|
|
@ -908,20 +908,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
|
IN_Init
|
||||||
|
@ -959,8 +945,6 @@ void IN_Init( void *windowData )
|
||||||
Cvar_SetValue( "com_unfocused", !( appState & SDL_WINDOW_INPUT_FOCUS ) );
|
Cvar_SetValue( "com_unfocused", !( appState & SDL_WINDOW_INPUT_FOCUS ) );
|
||||||
Cvar_SetValue( "com_minimized", appState & SDL_WINDOW_MINIMIZED );
|
Cvar_SetValue( "com_minimized", appState & SDL_WINDOW_MINIMIZED );
|
||||||
|
|
||||||
IN_InitKeyLockStates( );
|
|
||||||
|
|
||||||
IN_InitJoystick( );
|
IN_InitJoystick( );
|
||||||
Com_DPrintf( "------------------------------------\n" );
|
Com_DPrintf( "------------------------------------\n" );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue