forked from fte/fteqw
1
0
Fork 0

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)
{
case IEV_KEYDOWN:
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:' ');
//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))
@ -1059,7 +1066,7 @@ void IN_JoystickAxisEvent(unsigned int devid, int axis, float value)
void IN_KeyEvent(unsigned int devid, int down, int keycode, int unicode)
{
struct eventlist_s *ev = in_newevent();
if (!ev)
if (!ev)
return;
ev->type = down?IEV_KEYDOWN:IEV_KEYRELEASE;
ev->devid = devid;

View File

@ -2652,14 +2652,7 @@ ClearAllStates
*/
static void ClearAllStates (void)
{
int i;
// 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);
}
IN_KeyEvent(0, false, -1, 0); //-1 means to clear all keys.
Key_ClearStates ();
INS_ClearStates ();
}