SDL_SetTrayEntryCallback(3)
π SDL_SetTrayEntryCallback β the SDL3 functions girlies know π
okay so bestie, welcome to SDL_SetTrayEntryCallback(3), a page from the SDL3 FUNCTIONS collection. sit down, grab a strawberry π, and let's talk about making your system tray entries actually do something when someone clicks them, because an icon that does nothing is giving NPC energy and we don't do that here.
β¨ NAME β¨
SDL_SetTrayEntryCallback β sets a callback to be invoked when the entry is selected.
like literally. you pick the entry, you hand it a function, and boom π₯ β when someone selects that entry, your callback gets called. it's giving "main character gets a spotlight" energy.
β¨ SYNOPSIS β¨
#include <SDL3/SDL_tray.h>
void SDL_SetTrayEntryCallback(SDL_TrayEntry *entry, SDL_TrayCallback callback, void *userdata);
no cap, that's the whole vibe. three arguments, returns nothing, changes everything π«Ά
β¨ FUNCTION PARAMETERS β¨
entryβ the entry to be updated. this is the tray entry you're blessing with new behaviour, the glow-up recipient β¨callbackβ a callback to be invoked when the entry is selected. this is the function that gets the party started when someone picks that entry πuserdataβ an optional pointer to pass extra data to the callback when it will be invoked. it's optional, so if you don't need to hand your callback any extra lil goodies, that's totally fine, pass what you gotta pass π
β¨ THREAD SAFETY β¨
β οΈ okay important one, bestie: this function should be called on the thread that created the tray.
like. the tray's thread. the one that birthed it. don't be calling this from some random other thread and expect sunshine and rainbows, because that is not the vibe. keep it in the family, okay? π
β¨ AVAILABILITY β¨
this function is available since SDL 3.2.0. so if you're on something older, it's giving "not me being left on read" β you simply don't have it yet π
β¨ SEE ALSO β¨
go read those too, they're iconic in their own right π
and that's the whole page, bestie!! you now know how to give a tray entry a callback and make it feel seen. slay. π β¨
mwah π this was brought to you by the fine folks at Simple Directmedia Layer, from the SDL 3.4.18 era of the manual β go forth and callback responsibly π¦
π¦ 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