* Fix bug that prevented key up events getting to cgame/ui when not in game

* Use Key_[GS]etCatcher everywhere to set keycatcher
* Clear all key states when the catcher changes
This commit is contained in:
Tim Angus 2007-10-02 14:14:45 +00:00
parent 26641226a4
commit 5692e30fa9
9 changed files with 79 additions and 71 deletions

View file

@ -662,27 +662,6 @@ static void Key_GetBindingBuf( int keynum, char *buf, int buflen ) {
}
}
/*
====================
Key_GetCatcher
====================
*/
int Key_GetCatcher( void ) {
return cls.keyCatchers;
}
/*
====================
Ket_SetCatcher
====================
*/
void Key_SetCatcher( int catcher ) {
// prevent console from being closed
catcher |= cls.keyCatchers & KEYCATCH_CONSOLE;
cls.keyCatchers = catcher;
}
/*
====================
CLUI_GetCDKey
@ -932,7 +911,8 @@ intptr_t CL_UISystemCalls( intptr_t *args ) {
return Key_GetCatcher();
case UI_KEY_SETCATCHER:
Key_SetCatcher( args[1] );
// Don't allow the ui module to close the console
Key_SetCatcher( args[1] | ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) );
return 0;
case UI_GETCLIPBOARDDATA:
@ -1124,7 +1104,7 @@ CL_ShutdownUI
====================
*/
void CL_ShutdownUI( void ) {
cls.keyCatchers &= ~KEYCATCH_UI;
Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_UI );
cls.uiStarted = qfalse;
if ( !uivm ) {
return;