engine: platform: linux: move evdev_keydebug cvar to static allocation

This commit is contained in:
Alibek Omarov 2023-05-21 02:09:44 +03:00
parent 9e0d389d9e
commit bd52a9ec2d

View File

@ -37,7 +37,7 @@ struct evdev_s
qboolean shift; qboolean shift;
} evdev; } evdev;
static convar_t *evdev_keydebug; static CVAR_DEFINE_AUTO( evdev_keydebug, "0", 0, "print key events to console" );
static int KeycodeFromEvdev(int keycode, int value) static int KeycodeFromEvdev(int keycode, int value)
{ {
@ -360,7 +360,7 @@ void IN_EvdevFrame ( void )
{ {
int key = KeycodeFromEvdev( ev.code, ev.value ); int key = KeycodeFromEvdev( ev.code, ev.value );
if( CVAR_TO_BOOL( evdev_keydebug )) if( evdev_keydebug.value )
Con_Printf( "key %d %d %d\n", ev.code, key, ev.value ); Con_Printf( "key %d %d %d\n", ev.code, key, ev.value );
Key_Event( key , ev.value ); Key_Event( key , ev.value );
@ -457,7 +457,7 @@ void Evdev_Shutdown( void )
Cmd_RemoveCommand( "evdev_open" ); Cmd_RemoveCommand( "evdev_open" );
Cmd_RemoveCommand( "evdev_close" ); Cmd_RemoveCommand( "evdev_close" );
Cmd_RemoveCommand( "evdev_autodetect" ); Cmd_RemoveCommand( "evdev_autodetect" );
evdev_keydebug = Cvar_Get( "evdev_keydebug", "0", 0, "print key events to console" ); Cvar_RegisterVariable( &evdev_keydebug );
for( i = 0; i < evdev.devices; i++ ) for( i = 0; i < evdev.devices; i++ )
{ {