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 3528

Summary: SDL_WINDOWEVENT_LEAVE event is repeated continously
Product: SDL Reporter: axel mattauch <axel.mattauch>
Component: eventsAssignee: Sam Lantinga <slouken>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: philipp.wiesemann
Version: 2.0.5   
Hardware: x86_64   
OS: Windows 8   
Attachments: Simple test program to understow the window events in SDL2

Description axel mattauch 2016-12-18 15:46:46 UTC
Created attachment 2654 [details]
Simple test program to understow the window events in SDL2

See simple test program attached 
(derivated from http://wiki.libsdl.org/SDL_WindowEvent?highlight=%28%5CbCategoryStruct%5Cb%29%7C%28CategoryEvents%29 )

After moving the mouse inside the window one single  SDL_WINDOWEVENT_ENTER is issued, but moving then the mouse outside the window lead to repetitive SDL_WINDOWEVENT_LEAVE events, even if the mouse is steady.
Comment 1 Philipp Wiesemann 2016-12-21 19:41:02 UTC
In the attached test program, the return value of SDL_PollEvent() is not checked to see if there is a new event at all. This might lead to processing the same event several times.
Comment 2 axel mattauch 2016-12-22 13:55:10 UTC
The use of the int return value is clearly indicated in the Wiki.
I understood falsely that a NULL event is 'no more event'.
Bug is in my test program.

I apologize for the disturbance.
Comment 3 Sam Lantinga 2016-12-23 01:02:40 UTC
No worries, I'm glad you figured it out.