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 - SDL_FlushEvent(SDL_MOUSEMOTION) not removing events added by SDL_WarpMouseInWindow()
Summary: SDL_FlushEvent(SDL_MOUSEMOTION) not removing events added by SDL_WarpMouseInW...
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: 2.0.1
Hardware: x86_64 FreeBSD
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-27 17:31 UTC by Yamagi
Modified: 2014-01-27 20:54 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.