SDL_RaiseWindow(3)

πŸ’– SDL_RaiseWindow πŸ’–

okay bestie, this one lives in the SDL3 FUNCTIONS section of the manual, and it's literally about yelling "notice me!!" at your window manager. let's get into it 🫢


✨ NAME ✨

SDL_RaiseWindow β€” request that a window be raised above other windows and gain the input focus. it's giving "pick me, choose me" energy but for windows, and honestly? valid πŸ’…


✨ SYNOPSIS ✨

#include <SDL3/SDL_video.h>

bool SDL_RaiseWindow(SDL_Window *window);

✨ DESCRIPTION ✨

so you're asking the system to bring this window to the front and hand it the input focus. but here's the tea 🍡 β€” the actual result is subject to desktop window manager policy. your window manager is the main character here, not you. and it's especially gonna say no if raising your window would mean stealing focus from another application. rude? maybe. but that's the rules.

if it does work out and the window gets raised and gains input focus, then two things happen:

  • an SDL_EVENT_WINDOW_FOCUS_GAINED event gets emitted ✨
  • the window will have the SDL_WINDOW_INPUT_FOCUS flag set πŸ”₯

like, the window really said "it's my time to shine." iconic.


✨ FUNCTION PARAMETERS ✨

  • window β€” the window to raise. that's the one you're hyping up πŸŽ€

✨ RETURN VALUE ✨

returns true on success or false on failure. if it flops, call SDL_GetError() for more information β€” she will tell you exactly what went wrong, no cap πŸ’€


✨ THREAD SAFETY ✨

this function should only be called on the main thread. do NOT be out here calling it from some random thread, bestie, that's not the vibe πŸ™ˆ

✨ AVAILABILITY ✨

this function is available since SDL 3.2.0. so if you're on anything older, she doesn't exist yet 😭


and that's the whole page!! brought to you by Simple Directmedia Layer, running SDL 3.4.18 β€” go raise some windows, you absolute queen πŸ‘‘βœ¨πŸ¦‹

πŸ“¦ where this page comes from