[SOLVED] Global game controller input detection with a window open?

I’m able to globally detect game controller inputs if I do not have a window open.
But, as soon as I have a window open, I can only detect game controller inputs while the window is focused.

Is there a way to have both?

My current work-around is: spawning two processes, one to listen for inputs and another is the game window. I’m using IPC to read the input events from the other process. This is not great, I’d like to avoid it, if possible

I think SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS - SDL Wiki should help

I have that set as well, verified it’s set with SDL_GetHint, and I still only get controller events while the window is focused.

For more info, I’m using Linux with sdl2 2.0.22-2

Found out the hint string is “SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS”, not “SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS”. It’s working now.

SDL_hints.h has this:

#define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"

I’ve often wondered why the name includes HINT but the string doesn’t, but all the hints follow this pattern.