SDL_RestoreWindow(3)

πŸ’– SDL_RestoreWindow β€” bestie, your window is coming BACK πŸ’–

okay so real quick, this is the tea on SDL_RestoreWindow(3) from the SDL3 video fam. it lives in the SDL3 FUNCTIONS section and it is exactly what it sounds like: you're politely asking a minimized or maximized window to go back to its normal lil size and spot on screen. ✨


🌸 NAME 🌸

SDL_RestoreWindow β€” request that the size and position of a minimized or maximized window be restored. that's it, that's the whole vibe. πŸͺŸπŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_video.h>

bool SDL_RestoreWindow(SDL_Window *window);

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the situation, bestie. if the window is in a fullscreen state, this request has no direct effect. it may alter the state the window is returned to when leaving fullscreen. so like, it's doing something, but not the something you asked for. it's giving "I'll think about it" energy. πŸ™ˆ

on some windowing systems this request is asynchronous, and the new window state may not have been applied immediately upon the return of this function. (yes the original says "have have", it's fine, we don't gatekeep typos πŸ’€). so if you need an immediate change, call SDL_SyncWindow() to block until the changes have taken effect. no cap, that's the move.

when the window state changes, an SDL_EVENT_WINDOW_RESTORED event will be emitted. but β€” and this is the important part β€” because this is just a request, the windowing system can deny the state change. you asked nicely, the compositor said no. 😭 it's not personal, it's just how it is.


⭐ FUNCTION PARAMETERS ⭐

  • window β€” the window to restore. that's the one you're hyping back to its normal self. πŸ‘‘

🌈 RETURN VALUE 🌈

returns true on success or false on failure. and if it fails? call SDL_GetError() for more info, because we do NOT do mystery failures in this house. πŸ”βœ¨


πŸ’œ THREAD SAFETY πŸ’œ

this function should only be called on the main thread. main character energy only. everyone else, please stay in your lane. 🚫🧡


🌸 AVAILABILITY 🌸

this function is available since SDL 3.2.0. iconic, historic, we love an origin story. πŸŽ‰


πŸ‘‘ SEE ALSO πŸ‘‘

like, the whole trilogy. go read them. iykyk. πŸ“šπŸ’–


ok but fr fr β€” remember: it's a request, not a demand. fullscreen windows lowkey ignore you, some systems take their sweet time, and the windowing system can straight up say no. sync up with SDL_SyncWindow() if you can't wait. πŸ’…

that's the page, bestie! brought to you by Simple Directmedia Layer, running version SDL 3.4.18 of the SDL 3 era. now go restore a window, you've got this. πŸ«ΆπŸ¦‹πŸ’–

πŸ“¦ where this page comes from