SDL 2.0.9
The title bar of a window is the bar that would have the minimize, maximize, and close buttons.
When you click the title bar of an SDL window to regain focus, the window may begin receiving keyboard events as expected but never mouse events (except for one mouse event at the time of the click).
- Call
SDL_SetRelativeMouseMode(SDL_TRUE)
- Alt+tab away from the SDL window
- Click the title bar of the SDL window
- At this point, the window will receive keyboard events as expected, but not mouse events. One mouse event will be received when the title bar is clicked, but no mouse events are received after that, even when the mouse is moved and clicked.
- Alt+tab away from the window
- Either alt+tab back to the window or click the window itself (not the title bar)
- Whenever you receive event
SDL_WINDOWEVENT_FOCUS_LOST
callSDL_SetRelativeMouseMode(SDL_FALSE)
- Whenever you receive event
SDL_WINDOWEVENT_FOCUS_GAINED
callSDL_SetRelativeMouseMode(SDL_TRUE)
With the fix in place, you can click either the window itself or its title bar and the window will begin receiving mouse events as expected.