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 1800

Summary: SDL_EventState() in 1.2 drops events incorrectly.
Product: SDL Reporter: Ryan C. Gordon <icculus>
Component: eventsAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED WONTFIX QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 1.2   
Hardware: x86   
OS: Other   

Description Ryan C. Gordon 2013-04-12 16:57:22 UTC
I think this is a bug, but can someone sanity check this?

SDL_EventState() in 1.2 seems to drop events incorrectly. This does not seem to be the case in SDL 2.0:

   http://hg.libsdl.org/SDL/file/b6b2829cd7ef/src/events/SDL_events.c#l442

In the SDL_ALLEVENTS case, it unconditionally drops all events from the queue, whether we specified SDL_ENABLE or not.

In the normal case (one event type), we drop every event from the queue, but only if enabling events. This should probably use SDL_PeekEvent() to get only the specific event type, and do it in the SDL_IGNORE case.

Am I right about this?

--ryan.
Comment 1 Ryan C. Gordon 2013-04-12 22:43:27 UTC
One more note: in the SDL_ALLEVENTS case, if you did SDL_QUERY, you broke all the event state on line 449. The comments in SDL_events.h don't mention SDL_ALLEVENTS, though, so maybe this is meant to be internal magic only?

--ryan.
Comment 2 Sam Lantinga 2013-04-17 04:50:14 UTC
Yep, those are legit bugs.  Nice catch!
I think we don't need to fix them in SDL 1.2, if you're taking care of it in the wrapper.
Comment 3 Ryan C. Gordon 2013-04-17 10:38:32 UTC
(In reply to comment #2)
> I think we don't need to fix them in SDL 1.2, if you're taking care of it in
> the wrapper.

Yeah, all the research for the wrapper is why I'm finding bugs like this in 1.2.  :)

I'm marking this as WONTFIX, since it clearly isn't hurting anyone in sdl12-classic (and sdl12-compat doesn't have this issue).

--ryan.