SDL_SetRelativeMouseMode - Crazy beeping


In the menus I use the mouse as normal. When a game starts I call SDL_SetRelativeMouseMode to keep the mouse in the window.

Some players are reporting a massive lag in fps and crazy beeping coming from their PC at this point.

Any ideas?


1 Like

You only need to execute SDL_SetRelativeMouseMode once, at the startup of the program/game, and not every frame. As long as the mode isn’t changed again, the mode will stay as it is.

I don’t know if the continuously call of SDL_SetRelativeMouseMode will cause the lag etc, but it might be worth checking it out.

1 Like

I only call SDL_SetRelativeMouseMode once when I transition into game play.

Yesterday I added a command line option to disable this call and it fixed the problem for those players. So there’s definitely something wrong with this call.

Here’s the thread where the problem is explained:

1 Like

Googling suggests this is a bug in an Xinput driver, fwiw.

(the beeping is, if I recall correctly, a Windows thing that means “the input queue for the mouse is full and not being emptied fast enough,” which tends to mean some kernel-level driver is hanging for whatever reason.)

SDL_SetRelativeMouseMode on Windows calls RegisterRawInputDevices() to get mouse input outside of the usual Windows mouse events. I don’t know why it would cause this specific bug, but I could see it tickling parts of the system that might.


Thanks for the info. Do you know a way I could detect this so the game can counter it? It’s simple enough to do by not ‘grabbing’ the mouse.