Add default handler for Alt+Tab while keyboard grab is enabled

By default, we will minimize the window when we receive Alt+Tab with a
full-screen keyboard grabbed window to allow the user to escape the
full-screen application.

Some applications like remote desktop clients may want to handle Alt+Tab
themselves, so provide an opt-out via SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED=0.
This commit is contained in:
Cameron Gutman 2021-01-27 20:41:36 -06:00
parent 9d70711342
commit 79cd8cab08
2 changed files with 30 additions and 0 deletions

View file

@ -1587,6 +1587,19 @@ extern "C" {
*/
#define SDL_HINT_AUDIO_DEVICE_STREAM_NAME "SDL_AUDIO_DEVICE_STREAM_NAME"
/**
* \brief Specify the behavior of Alt+Tab while the keyboard is grabbed.
*
* By default, SDL emulates Alt+Tab functionality while the keyboard is grabbed
* and your window is full-screen. This prevents the user from getting stuck in
* your application if you've enabled keyboard grab.
*
* The variable can be set to the following values:
* "0" - SDL will not handle Alt+Tab. Your application is responsible
for handling Alt+Tab while the keyboard is grabbed.
* "1" - SDL will minimize your window when Alt+Tab is pressed (default)
*/
#define SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED "SDL_ALLOW_ALT_TAB_WHILE_GRABBED"
/**
* \brief Override for SDL_GetPreferredLocales()