mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2024-12-02 08:51:57 +00:00
Fix console on Linux
* Add support for Console-Key independently of KB Layout (with scancode) * add support for TAB key * Add hack so console is empty after opening it (SDL-only)
This commit is contained in:
parent
ab86006668
commit
0be69a3162
1 changed files with 31 additions and 17 deletions
|
@ -269,6 +269,11 @@ static int SDL_KeyToDoom3Key( SDL_Keycode key, bool& isChar )
|
||||||
case SDLK_PAUSE:
|
case SDLK_PAUSE:
|
||||||
return K_PAUSE;
|
return K_PAUSE;
|
||||||
|
|
||||||
|
// DG: add tab key support
|
||||||
|
case SDLK_TAB:
|
||||||
|
return K_TAB;
|
||||||
|
// DG end
|
||||||
|
|
||||||
//case SDLK_APPLICATION:
|
//case SDLK_APPLICATION:
|
||||||
// return K_COMMAND;
|
// return K_COMMAND;
|
||||||
case SDLK_CAPSLOCK:
|
case SDLK_CAPSLOCK:
|
||||||
|
@ -737,26 +742,35 @@ sysEvent_t Sys_GetEvent()
|
||||||
{
|
{
|
||||||
bool isChar;
|
bool isChar;
|
||||||
|
|
||||||
key = SDL_KeyToDoom3Key( ev.key.keysym.sym, isChar );
|
// DG: special case for SDL_SCANCODE_GRAVE - the console key under Esc
|
||||||
|
if( ev.key.keysym.scancode == SDL_SCANCODE_GRAVE )
|
||||||
if( key == 0 )
|
|
||||||
{
|
{
|
||||||
unsigned char c;
|
key = K_GRAVE;
|
||||||
|
c = K_BACKSPACE; // bad hack to get empty console inputline..
|
||||||
|
} // DG end, the original code is in the else case
|
||||||
|
else
|
||||||
|
{
|
||||||
|
key = SDL_KeyToDoom3Key( ev.key.keysym.sym, isChar );
|
||||||
|
|
||||||
// check if its an unmapped console key
|
if( key == 0 )
|
||||||
if( ev.key.keysym.unicode == ( c = Sys_GetConsoleKey( false ) ) )
|
|
||||||
{
|
{
|
||||||
key = c;
|
unsigned char c;
|
||||||
}
|
|
||||||
else if( ev.key.keysym.unicode == ( c = Sys_GetConsoleKey( true ) ) )
|
// check if its an unmapped console key
|
||||||
{
|
if( ev.key.keysym.unicode == ( c = Sys_GetConsoleKey( false ) ) )
|
||||||
key = c;
|
{
|
||||||
}
|
key = c;
|
||||||
else
|
}
|
||||||
{
|
else if( ev.key.keysym.unicode == ( c = Sys_GetConsoleKey( true ) ) )
|
||||||
if( ev.type == SDL_KEYDOWN )
|
{
|
||||||
common->Warning( "unmapped SDL key %d (0x%x)", ev.key.keysym.sym, ev.key.keysym.unicode );
|
key = c;
|
||||||
return res_none;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( ev.type == SDL_KEYDOWN )
|
||||||
|
common->Warning( "unmapped SDL key %d (0x%x)", ev.key.keysym.sym, ev.key.keysym.unicode );
|
||||||
|
return res_none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue