SDL_GetDisplayUsableBounds(3)
π SDL_GetDisplayUsableBounds(3) π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we talk about usable desktop space, not just the whole screen. this one's a certified bop, let's go β¨
πΈ NAME πΈ
SDL_GetDisplayUsableBounds β get the usable desktop area represented by a display, in screen coordinates. yes, the usable one, not the "the whole thing including the bits your OS stole" one π«Ά
π¦ SYNOPSIS π¦
#include <SDL3/SDL_video.h>
bool SDL_GetDisplayUsableBounds(SDL_DisplayID displayID, SDL_Rect *rect);
β¨ DESCRIPTION β¨
so this is literally the same area that SDL_GetDisplayBounds() reports, except we've yeeted out all the portions that the system reserved for itself. subtracted, gone, not yours π
for example β and this is the iconic one β on Apple's macOS, this subtracts the area occupied by the menu bar and the dock. so like, the space that's technically on your screen but is 100% claimed by the OS and will never ever be yours.
and here's the tea: setting a window to be fullscreen generally bypasses these unusable areas, so these numbers are good guidelines for the maximum space available to a non-fullscreen window. iykyk π
lowkey important: these are guidelines for non-fullscreen windows. fullscreen does its own thing and doesn't care about your menu bar.
π FUNCTION PARAMETERS π
displayIDβ the instance ID of the display you want to query. which one? that one. πrectβ theSDL_Rectstructure that gets filled in with the display bounds. you hand it the empty container, it hands you back the numbers. slay.
β RETURN VALUE β
returns true on success or false on failure. if it fails, 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 quests, no background threads, main thread only bestie π
π AVAILABILITY π
this function is available since SDL 3.2.0. vintage? no. iconic? yes. β¨
π SEE ALSO π
and that's the whole vibe check, bestie π₯° go forth and respect the menu bar's territory.
Simple Directmedia Layer Β· SDL 3.4.18 Β· SDL_GetDisplayUsableBounds(3) β mwah, take care of your usable bounds π
π«Ά
π¦ 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