I’m having problems stealing focus for my game in Linux. Basically,
I’m creating the game window as hidden, do some background
initialization and then show it once it’s done:
SDL_Window *Window = Viewport->GetSDL2Window();
const Uint32 WindowFlags = SDL_GetWindowFlags(Window);
if (WindowFlags & SDL_WINDOW_HIDDEN)
static const Uint32 DesiredFlags = SDL_WINDOW_INPUT_GRABBED
if ((WindowFlags & DesiredFlags) != DesiredFlags)
The thing is - nothing happens. Mouse remains where it was, keyboard
focus remains where it was. Running an iteration of the event pump
reveals that SDL_WINDOWEVENT_FOCUS_GAINED is not generated.
Not immediately, that it is. It is generated several dozen frames
later on and grabbing input in reaction to that event works just fine.
Any idea why this delay occurs and how I can force stealing the focus