SDL and sane fullscreen alt-tab behavior on linux

2020-04-22 – With SDL2, by default using full screen windows the behavior of alt-tab and alt-ctrl-left and alt-ctrl-right is quite insane. Whenever the window loses focus it minimizes. This puts it at the bottom of the window stack. This means that when you alt-tab again to get back to your window, instead you get a different window. And so you have to keep alt-tabbing through all your windows until you finally get to the window you just alt-tabbed away from and which is now sitting idiotically at the bottom of the stack of windows.

There’s a way around this.


Then run your program. Now you have sane window behavior. You can also put this inside your program to make the default be sane:

      setenv("SDL_VIDEO_MINIMIZE_ON_FOCUS", "0", 0);

The zero at the very end means that if the user has already set this to something else (e.g. 0 in case your user happens to be insane, and likes insanity), you won’t override it. But nobody will get insanity by default.

~ by scaryreasoner on April 22, 2020.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: