Release button manually through SDL?

What if a mouse button gets stuck in the wrong state, or if a cat sits on the button.

There should be some conditions where you should be a ble to un-click the button on the OS level.

For instance, when you do something to the window that is reported as an event

Usually we don’t worry about this kind of thing, and there’s not an OS-level solution like that in SDL. But you could set up a timeout for your buttons and keys inside of your program.

Timeouts are as simple as getting the tick at the time the down event starts then checking if the current tick minus the starting tick surpasses your delay limit each frame. If it does then it is time to change your flag for the state of the key.
You could also use SDL_AddTimer for your timeout, but the callback function will run on a different thread which can complicate things.

Sadly there is not a good software solution to shoo the cat away either.

You can try SendInput, but I don’t know how SDL will react to this. Other platforms should have something similar.