Fix "mark keys up when focus is lost" code, fixes #68

It didn't build on SDL1.2 (I though we tested that?!) and didn't work
with SDL2 either.

Now it builds and actually works with both SDL1.2 and 2.0
This commit is contained in:
Daniel Gibson 2015-04-14 00:51:38 +02:00
parent 9265dc8cbe
commit 0b9ac6cb99

View file

@ -415,10 +415,21 @@ IN_Update(void)
break;
#if !SDL_VERSION_ATLEAST(2, 0, 0)
case SDL_WINDOWEVENT_FOCUS_LOST:
Key_MarkAllUp();
#if SDL_VERSION_ATLEAST(2, 0, 0)
case SDL_WINDOWEVENT:
if(event.window.event == SDL_WINDOWEVENT_FOCUS_LOST)
{
Key_MarkAllUp();
}
#else // SDL1.2
case SDL_ACTIVEEVENT:
if(event.active.gain == 0 && (event.active.state & SDL_APPINPUTFOCUS))
{
Key_MarkAllUp();
}
#endif
break;
}
}