From 20051f805f3ac02eec8cd14331e25b0b42d4233c Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 11 Feb 2024 18:12:08 -0800 Subject: [PATCH] Removed SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 Replaced with SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4, defaulting to SDL_TRUE --- docs/README-migration.md | 1 + include/SDL3/SDL_hints.h | 6 +++--- src/video/windows/SDL_windowsevents.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/README-migration.md b/docs/README-migration.md index 60762a395..d840418c4 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -720,6 +720,7 @@ The following hints have been removed: * SDL_HINT_VIDEO_X11_XINERAMA - Xinerama no longer supported by the X11 backend * SDL_HINT_VIDEO_X11_XVIDMODE - Xvidmode no longer supported by the X11 backend * SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING - SDL now properly handles the 0x406D1388 Exception if no debugger intercepts it, preventing its propagation. +* SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 - replaced with SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4, defaulting to SDL_TRUE * SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING * Renamed hints SDL_HINT_VIDEODRIVER and SDL_HINT_AUDIODRIVER to SDL_HINT_VIDEO_DRIVER and SDL_HINT_AUDIO_DRIVER diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 6058e47a0..c2be6743e 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -2392,12 +2392,12 @@ extern "C" { * A variable controlling whether SDL generates window-close events for Alt+F4 on Windows. * * The variable can be set to the following values: - * "0" - SDL will generate a window-close event when it sees Alt+F4. (default) - * "1" - SDL will only do normal key handling for Alt+F4. + * "0" - SDL will only do normal key handling for Alt+F4. (default) + * "1" - SDL will generate a window-close event when it sees Alt+F4. * * This hint can be set anytime. */ -#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4" +#define SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4 "SDL_WINDOWS_CLOSE_ON_ALT_F4" /** * A variable controlling whether SDL uses the D3D9Ex API introduced in Windows Vista, instead of normal D3D9. diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index 7ad60e748..35d0ddb11 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -402,7 +402,7 @@ static void WIN_UpdateFocus(SDL_Window *window, SDL_bool expect_focus) static SDL_bool ShouldGenerateWindowCloseOnAltF4(void) { - return !SDL_GetHintBoolean(SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4, SDL_FALSE); + return SDL_GetHintBoolean(SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4, SDL_TRUE); } #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)