SDL_DisableScreenSaver(3)

πŸ’– SDL_DisableScreenSaver(3) πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we talk about the thing that keeps your screen awake. yes, that thing. no cap, it's more useful than it sounds.


✨ NAME ✨

SDL_DisableScreenSaver β€” stop the screen from getting blanked out by a screensaver, fr fr.


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_video.h>

bool SDL_DisableScreenSaver(void);

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the tea: if you disable the screensaver, it gets automatically re-enabled when SDL quits. like, SDL handles the cleanup for you, you don't have to remember. iconic behaviour honestly.

lowkey important detail: the screensaver is disabled by default already. but that vibe can be changed by SDL_HINT_VIDEO_ALLOW_SCREENSAVER. so if you're out here wondering why your screen never sleeps, that hint is your main character.


πŸ‘‘ RETURN VALUE πŸ‘‘

Returns true on success or false on failure. if it's giving failure, call SDL_GetError() for more info. that's your group chat for error deets, always check it.


🧚 THREAD SAFETY 🧚

This function should only be called on the main thread. do not try to be clever and call it from a worker thread, bestie, it's not that girl.

⭐ AVAILABILITY ⭐

This function is available since SDL 3.2.0. so if you're on something older... no. upgrade. periodt.


🌈 SEE ALSO 🌈


and that's the whole page, bestie πŸ’… this little corner of the Simple Directmedia Layer docs is living in version SDL 3.4.18 β€” go keep those screens lit, ily, mwah 🫢

πŸ“¦ where this page comes from