SDL_RemoveEventWatch(3)

πŸ’– SDL_RemoveEventWatch β€” the manual page, but make it cute πŸ’–

ok so bestie, welcome to the SDL3 FUNCTIONS corner of the docs, where today's main character is SDL_RemoveEventWatch(3). yeah, that whole (3) thing just means it lives in the library section, iykyk. πŸŽ€


✨ NAME ✨

SDL_RemoveEventWatch β€” the lil cleanup queen that removes an event watch callback you added earlier with SDL_AddEventWatch(). yes bestie, you have to undo the thing you did. balance. harmony. closure. πŸ¦‹


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_events.h>

void SDL_RemoveEventWatch(SDL_EventFilter filter, void *userdata);

not a single return value in sight, she just does her job and leaves. void energy fr fr. πŸ’…


πŸ‘‘ DESCRIPTION πŸ‘‘

okay so here's the tea: this function takes the same input as SDL_AddEventWatch() β€” literally the same two things β€” and uses them to identify and delete the corresponding callback. it's a matching game. you gave the watch a lil identity card when you added it, and now you hand over the same ID card so she can find it and yeet it. πŸ”₯

no cap, that's the whole vibe. same args in, callback out. 🫢


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • filter β€” the function you originally passed to SDL_AddEventWatch(). yes, originally. the exact same one. don't be out here inventing new ones, she will not find your callback and that's on you bestie. 😭
  • userdata β€” the pointer you originally passed to SDL_AddEventWatch(). again: originally. same pointer, same energy, or it's a no-match. ⭐

🌈 THREAD SAFETY 🌈

it is safe to call this function from any thread. any. thread. she's unbothered, she's multithreaded, she's iconic. πŸ’œ


⭐ AVAILABILITY ⭐

this function is available since SDL 3.2.0. if you're on something older, sorry babe, she doesn't exist yet. πŸ™ˆ


πŸ’œ SEE ALSO πŸ’œ

  • SDL_AddEventWatch(3) β€” the other half of this duo, the one that actually adds the watch. go read her too, they're a package deal. πŸ“

mwah and that's the page!! brought to you by the lovely humans at Simple Directmedia Layer, running SDL 3.4.18. go forth and remove your event watches responsibly, bestie. no leaks, only slay. πŸ’…βœ¨πŸ§š

πŸ“¦ where this page comes from