1
0
Fork 0
forked from fte/fteqw

Fix issue where keypresses were getting sent to QC/etc while the engine is still busy changing video modes.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5369 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2018-12-20 00:57:15 +00:00
parent ddd4b54f0e
commit cc6fff1722
2 changed files with 10 additions and 10 deletions

View file

@ -414,8 +414,15 @@ void IN_Commands(void)
switch(ev->type) switch(ev->type)
{ {
case IEV_KEYDOWN:
case IEV_KEYRELEASE: case IEV_KEYRELEASE:
if (ev->keyboard.scancode == -1)
{
int i;
for (i = 0; i < K_MAX; i++)
Key_Event(ev->devid, i, 0, false);
break;
}
case IEV_KEYDOWN:
//Con_Printf("IEV_KEY%s %i: %i '%c'\n", (ev->type==IEV_KEYDOWN)?"DOWN":"RELEASE", ev->devid, ev->keyboard.scancode, ev->keyboard.unicode?ev->keyboard.unicode:' '); //Con_Printf("IEV_KEY%s %i: %i '%c'\n", (ev->type==IEV_KEYDOWN)?"DOWN":"RELEASE", ev->devid, ev->keyboard.scancode, ev->keyboard.unicode?ev->keyboard.unicode:' ');
//on touchscreens, mouse1 is used as up/down state. we have to emulate actual mouse clicks based upon distance moved, so we can get movement events. //on touchscreens, mouse1 is used as up/down state. we have to emulate actual mouse clicks based upon distance moved, so we can get movement events.
if (ev->keyboard.scancode == K_MOUSE1 && ev->devid < MAXPOINTERS && (ptr[ev->devid].type == M_TOUCH)) if (ev->keyboard.scancode == K_MOUSE1 && ev->devid < MAXPOINTERS && (ptr[ev->devid].type == M_TOUCH))

View file

@ -2652,14 +2652,7 @@ ClearAllStates
*/ */
static void ClearAllStates (void) static void ClearAllStates (void)
{ {
int i; IN_KeyEvent(0, false, -1, 0); //-1 means to clear all keys.
// send an up event for each key, to make sure the server clears them all
for (i=0 ; i<256 ; i++)
{
Key_Event (0, i, 0, false);
}
Key_ClearStates (); Key_ClearStates ();
INS_ClearStates (); INS_ClearStates ();
} }