SDL_SetWindowAlwaysOnTop(3)

✨ SDL_SetWindowAlwaysOnTop ✨

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where today's main character is SDL_SetWindowAlwaysOnTop(3) πŸ’…


🌸 NAME 🌸

SDL_SetWindowAlwaysOnTop β€” set the window to always be above the others. yes, your window gets VIP velvet rope energy and nobody can sit in front of it πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <SDL3/SDL_video.h>

bool SDL_SetWindowAlwaysOnTop(SDL_Window *window, bool on_top);

πŸ’– DESCRIPTION πŸ’–

so here's the tea: this will add or remove the window's SDL_WINDOW_ALWAYS_ON_TOP flag. that's it, that's the whole job, and it does it flawlessly 🫢

and it's not just a flag flip and dip β€” this will also bring the window to the front and keep the window above the rest. like, it literally walks your window to the front of the line and goes "she stays here, thanks" πŸ‘‘


🌈 FUNCTION PARAMETERS 🌈

  • window β€” the window of which to change the always on top state. yeah, this one's the one getting the glow-up ✨
  • on_top β€” true to set the window always on top, false to disable. so like, true = queen behavior, false = she's coming back down to earth with the rest of us 😭

⭐ RETURN VALUE ⭐

Returns true on success or false on failure β€” and if it's a false girlie, call SDL_GetError() for more information. she will tell you what went wrong, fr fr πŸ™ˆ


🧚 THREAD SAFETY 🧚

This function should only be called on the main thread. no side-quest threads for this one, bestie, it's a one-thread kind of situation πŸ’€

πŸ’œ AVAILABILITY πŸ’œ

This function is available since SDL 3.2.0. so if you're on something older… yeah, you're not getting in the club, sorry πŸŽ€


πŸ“ SEE ALSO πŸ“


Simple Directmedia Layer ✦ SDL 3.4.18 ✦ SDL_SetWindowAlwaysOnTop(3)

and that's the whole page, no cap πŸ’– stay iconic, keep your windows on top (only when you want to), and go read SDL_GetWindowFlags(3) next, mwah πŸŒΈπŸ’…

πŸ“¦ where this page comes from