SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4(3)

πŸ’… SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4(3) ✨

okay bestie, sit down, we're doing a lil thing from the SDL3 FUNCTIONS manual, and it's genuinely so simple you're gonna slay it πŸ’–


🌸 NAME 🌸

SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4 β€” a variable that controls whether SDL generates window-close events for Alt+F4 on Windows. yes. that's it. that's the whole vibe. πŸͺŸβœ¨


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_hints.h>

#define SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4 "SDL_WINDOWS_CLOSE_ON_ALT_F4"

like, just include the header and the macro is right there, no cap πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so the variable can be set to the following values, and there are literally two of them, we love a low-effort icon:

  • "0" β€” SDL will only do normal key handling for Alt+F4. that's it. no window closing, no drama, just keys being keys πŸ™ˆ
  • "1" β€” SDL will generate a window-close event when it sees Alt+F4. (default) β€” yes bestie, this is the one you get if you say nothing, main character energy fr fr πŸ‘‘

This hint can be set anytime. like, whenever. mid-frame, before init, doesn't matter, it's giving flexible ✨


🌈 AVAILABILITY 🌈

This hint is available since SDL 3.2.0. so if you're on something older... girl. update. 😭


⭐ little reminder: it's a hint, so set it with SDL_SetHint and let SDL do its thing. don't come for me if you forget the quotes on the "0" / "1", iykyk πŸ’€

and that's the whole page, you ate that 🫢 go forth and Alt+F4 responsibly πŸ’–βœ¨

β€” with love from the Simple Directmedia Layer girlies, SDL 3.4.18 edition πŸŽ€πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from