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
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms