Focus lost after inactivity

I’m debugging an issue I’m having with two older games that use SDL 1.2. They both have the following bug:

  • They periodically pause the game when the player doesn’t want to pause the game.
  • It happens after a 2-4 second period with no user input.
  • This only happens when they are in fullscreen mode.
  • I’m seeing this on Linux (and I assume it’s the X11 backend – SDL 1.2 only supports X11, doesn’t it?). I don’t have a Windows or Mac computer to test.

I compiled my own SDL and added some debug statements – the games are receiving a focus lost event (SDL_ACTIVEEVENT, specifically SDL_APPINPUTFOCUS) followed immediately by a focus gained event. These games have the convenient feature of pausing when the user switches to a different window. But why are they getting a focus lost event? Is this a bug in the games or in SDL 1.2?

I have seen this in Bit.Trip Runner 2 and Cave Story+.

I can’t reproduce this anymore. There must have been a bug in something else on my system that has since been fixed.