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 2369

Summary: SDL_FlushEvent(SDL_MOUSEMOTION) not removing events added by SDL_WarpMouseInWindow()
Product: SDL Reporter: Yamagi <yamagi>
Component: eventsAssignee: Sam Lantinga <slouken>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: gabomdq
Version: 2.0.1   
Hardware: x86_64   
OS: FreeBSD   

Description Yamagi 2014-01-27 17:31:18 UTC
Hi,
I noticed that I'm unable to flush SDL_MOUSEMOTION events added by SDL_WarpMouseInWindow(). Consider this code:

SDL_WarpMouseInWindow(NULL, xcenter, ycenter);
SDL_PumpEvents();
SDL_FlushEvent(SDL_MOUSEMOTION);

=> The events are still there, read from the queue next time when events are processed. I can reproduce this with SDL 2.0.1 on FreeBSD and Windows.
Comment 1 Gabriel Jacobo 2014-01-27 20:54:22 UTC
I couldn't reproduce this, I traced through SDL_FlushEvent and the SDL_MOUSEMOTION are correctly removed from the queue (Linux/X11 but the verification I made should be valid anyway). 

You may be getting new motion events after calling SDL_FlushEvent because when you call SDL_PollEvent that in turn calls SDL_PumpEvents which can put new SDL_MOUSEMOTION events in the queue.

Anyway, I'm marking as invalid for now but feel free to re open if you have a test case that can reproduce this. You can also verify by logging the value of SDL_EventQ.count before and after SDL_FlushEvent does its work and see what you get.