SDL_SetWindowModal(3)

✨ SDL_SetWindowModal ✨

okay bestie, welcome to the SDL_SetWindowModal(3) glow-up πŸ’… this one lives in the SDL3 FUNCTIONS corner of the SDL3 manual and it's basically the on/off switch for whether a window gets to be all main character and demand everyone's attention πŸ‘‘


🌸 NAME 🌸

SDL_SetWindowModal β€” toggle the state of the window as modal πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <SDL3/SDL_video.h>

bool SDL_SetWindowModal(SDL_Window *window, bool modal);

πŸ’– DESCRIPTION πŸ’–

so here's the tea, fr fr: to turn modal status on for a window, that window has to currently be the child window of a parent. that's the vibe check. if it's not a child of a parent, then toggling modal status on is gonna fail 😭 no cap.


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • window β€” the window on which to set the modal state. it's the one getting the makeover πŸ’…
  • modal β€” true to toggle modal status on, false to toggle it off. yes queen, it's just a lil boolean doing its thing ✨

πŸ’œ RETURN VALUE πŸ’œ

returns true on success or false on failure 🫢 and if it fails, don't just sit there spiraling β€” call SDL_GetError() for more information, she'll tell you what went wrong πŸ’€


🌈 THREAD SAFETY 🌈

⚠️ this function should only be called on the main thread. literally do not try it anywhere else, bestie, that's not the move πŸ™ˆ

⭐ AVAILABILITY ⭐

this function is available since SDL 3.2.0 β€” a true icon of the 3.2.0 era πŸ‘‘


πŸ”₯ SEE ALSO πŸ”₯

iykyk, go read those next, they're part of the same friend group 🧚


mwah πŸ’‹ that's the whole page! this little love letter to your windows came from the Simple Directmedia Layer girlies, rocking SDL 3.4.18, and it's filed under SDL_SetWindowModal(3) β€” catch you in the next manpage, periodt πŸ’…βœ¨

πŸ“¦ where this page comes from