Possible bug in SDL_SetRelativeMouseMode

Hey all,

Here’s (maybe) a small bug I found while working with
SDL_SetRelativeMouseMode. An example gif can be seen here:

https://dl.dropboxusercontent.com/u/65227065/SDLBUG/sdlbug.gif

What happens is I click, the game switches to the game state, and the mouse
is set to relative mode. I move the mouse a bit, and then I press escape
which causes the game to go back to the level state. In that process the
relative mode is set to false. I then don’t move the mouse and click my
mouse button. As you can see, only a mousebuttonup event is reported. This
works consistently.

I’m quite sure it’s not a mistake in my code since the event loop only
consists of:

while(SDL_PollEvent(&e)) {
if (e.type == SDL_MOUSEBUTTONDOWN) {
NNB_INFO << "SDL_MOUSEBUTTONDOWN " << e.type;
} else if (e.type == SDL_MOUSEBUTTONUP) {
NNB_INFO << "SDL_MOUSEBUTTONUP " << e.type;
} else if (e.type == SDL_MOUSEMOTION) {
NNB_INFO << "SDL_MOUSEMOTION " << e.type;
}

    event(e); // Gamestate specific event code is called here
}

So if SDL_MOUSEBUTTONDOWN is not printed it must have been missed by SDL.
When I click the mouse a second time it is also not doing intensive
calculations, just polling for SDL_Events. I can try to whip up a little
test program but that will take some time.

Is there anyone with hands-on SDL experience that can take a look at this
for me? Or am I just missing the small letters in the documentation (“use
of SDL_SetRelatvieMouseMode makes the the prevents the next mousebuttondown
event” or something)?

Regards,

Bob Rubbens