Menu

#184 Console not usable after ALT-Enter in Win32

open
5
2010-02-15
2005-03-05
No

After pressing ALt-Enter for full screen, the Enter key
seems to hang, which makes the console unusable (it
doesn't come up).
SDL bug?

Discussion

  • Max Feingold

    Max Feingold - 2010-02-15

    I think this is an SDL bug. I can't reproduce the precise behavior you mention on Win7 - for me the ALT key gets stuck.

    And I think we know at this point that the ALT key getting stuck (at least on Windows) is an SDL bug. Sometime when http://www.braingames.getput.com/mog/ is up, I'll go look for my original bug report and see if there's anything further we can do.

     
  • Max Feingold

    Max Feingold - 2010-02-15
    • assigned_to: nobody --> mfeingol
     
  • Max Feingold

    Max Feingold - 2010-02-15

    When openmsx is full screen and alt+enter is pressed, SDL detects that the ALT key has been released, but can't enqueue the event because its event queue is still inactive. This is because transitioning from full screen to windowed mode deactivates the event queue while the video subsystem is being destroyed, then recreates it.

    This appears to be timing dependent. On my system, the ALT released event is processed when going full screen, but dropped when returning to windowed mode. By introducing breakpoints, I can cause the ALT released event to be dropped when going full screen as well. I've even seen cases where from SDL's perspective, the ALT key is simply stuck. Again, all timing related.

    I'm not sure what to suggest here... A possible workaround might be to simulate ALT release presses when switching to full screen mode and back. It should be possible to detect that openmsx or SDL itself is out of sync with the OS in these cases (e.g. by calling GetKeyState directly on Win32) and take the appropriate corrective action.

    The bottom line is that detecting key states based on window events is a bad idea on Windows because input queues are tied to windows and windows can be created and destroyed, leaving timing windows. Of course, that's precisely what SDL does when going full screen.

    I have to conclude that full screen will likely never work 100% reliably with SDL 1.2 on Windows. Other systems may vary.

     
  • Max Feingold

    Max Feingold - 2010-02-15
    • priority: 2 --> 5