We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 882

Summary: Spurious SDL_ACTIVEEVENT on ALT+key
Product: SDL Reporter: R.Lamprecht
Component: eventsAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: critical    
Priority: P2    
Version: 1.2.14   
Hardware: Other   
OS: Windows (All)   
Attachments: toggle mouse tracking on input grab changes

Description R.Lamprecht 2009-11-12 06:53:44 UTC
When Alt + any key is pressed on Windows the regular SDL_KeyboardEvent is succeeded by a spurious SDL_ACTIVEEVENT with gain 0!

This bug is Windows only. 

I narrowed the introduction to this bug to the svn commit of revision 4990!

This spurious event will likely be the cause of bug #865, too.

This bug is very critical as it causes misbehaviour of apps like Enigma.
Comment 1 R.Lamprecht 2009-11-12 06:59:03 UTC
Revision 4990 is the fix of bug #634
Comment 2 Sam Lantinga 2009-11-16 21:00:59 UTC
This is fixed in subversion with revision 5262.
You can get the fix here:
http://www.libsdl.org/tmp/SDL-1.2.zip
Comment 3 R.Lamprecht 2009-11-26 07:10:42 UTC
Created attachment 449 [details]
toggle mouse tracking on input grab changes

The analysis of the spurious SDL_ACTIVEEVENT resulted in WM_MOUSELEAVE generated on TranslateMessage() being the source of trouble. Even though they do no longer show up with reversion of patch r4990, they just could cause trouble because mouse tracking is switched on when it should not be switched on.

In windommon/SDL_sysevents.c line 372++ the mouse tracking is switched on just if it is not fullscreen (in fact bug #882 and #865 did not occur in fullscreen mode). But it is switched on even if the mouse is grabbed! Why? I made an experiment and switched off mouse tracking whenever the mouse is grabbed - and of course the spurious SDL_ACTIVEEVENT are gone.

It may be necessary to toggle the mouse tracking on fullscreen switches, too.

A final fix should clean up the the different mouse track changes in a single function.