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:


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) {
} else if (e.type == SDL_MOUSEBUTTONUP) {
} else if (e.type == SDL_MOUSEMOTION) {

    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)?


Bob Rubbens