SDL_ShowWindowSystemMenu(3)

πŸ’– SDL_ShowWindowSystemMenu(3) πŸ’–

okay bestie, gather round, because we're diving into a page from the SDL3 FUNCTIONS collection and it's lowkey one of the cutest little "let the system do its thing" calls in the whole video subsystem. it's SDL_ShowWindowSystemMenu, and yes, it's giving main character energy. ✨


🌸 NAME 🌸

SDL_ShowWindowSystemMenu β€” pop open the system-level window menu, bestie. that's it. that's the whole vibe. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_video.h>

bool SDL_ShowWindowSystemMenu(SDL_Window *window, int x, int y);

like, look at her. two ints, one window pointer, returns a bool. no cap, she's clean. πŸ¦‹


✨ DESCRIPTION ✨

so here's the tea: this menu is not something SDL draws for you. it's the default window menu provided by the system, and on some platforms it comes with functionality for setting or changing privileged state on the window. we're talking stuff like:

  • moving the window between workspaces or displays 🌈
  • toggling the always-on-top property πŸ‘‘

basically the fancy grown-up window management stuff that the OS keeps behind the curtain, and this function is your little backstage pass. 🎟️

and now the part you need to hear, fr fr: on platforms or desktops where this is unsupported, this function does nothing. not an error, not a crash β€” just nothing. so don't be out here expecting a menu on every single setup, okay? vibe check accordingly. πŸ’€


🫢 FUNCTION PARAMETERS 🫢

  • window β€” the window for which the menu will be displayed. she's the one getting the menu, no questions asked. πŸ’–
  • x β€” the x coordinate of the menu, relative to the origin (top-left) of the client area. so like, measured from inside the client area, not the whole screen, bestie. remember that. πŸ“
  • y β€” the y coordinate of the menu, relative to the origin (top-left) of the client area. same deal, same origin, same energy. πŸ“

⭐ RETURN VALUE ⭐

returns true on success or false on failure. and if you get a false, do not just sit there guessing β€” call SDL_GetError() for more information. she will tell you what went wrong, i promise. πŸ”


🧚 THREAD SAFETY 🧚

this function should only be called on the main thread. main thread only. that's the rule. don't be texting this function from a background thread, it's not gonna answer. πŸ™ˆ


🌸 AVAILABILITY 🌸

this function is available since SDL 3.2.0. so if you're on something older... girl. update. 😭


reminder bestie: the only case where nothing happens by design is an unsupported platform or desktop. that's not a bug, that's just the system saying "not today." πŸ’…

and that's the whole page, mwah. this lil' gem comes to you from Simple Directmedia Layer, living in version SDL 3.4.18 of the docs β€” so go forth, show that system menu, and slay. periodt. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from