SDL_X11EventHook(3type)

πŸ’– SDL_X11EventHook πŸ’–

okay bestie, welcome to the SDL_X11EventHook page, straight outta the SDL3 DATATYPES section, iykyk ✨


🌸 NAME 🌸

SDL_X11EventHook β€” it's a callback, and you use it with SDL_SetX11EventHook. that's the whole vibe πŸŽ€


✨ SYNOPSIS ✨

#include <SDL3/SDL_system.h>

typedef bool (SDLCALL *SDL_X11EventHook)(void *userdata, XEvent *xevent);

πŸ¦‹ DESCRIPTION πŸ¦‹

so this callback? it may modify the event, and it should return true if the event should keep being processed, or false to prevent further processing. literally the whole point πŸ’…

and because this is processing an event directly from the X11 event loop, this callback should do the minimum required work and return quickly. like, in-and-out. no yapping, no side quests, no main character monologue. the event loop is waiting on you fr fr 😭


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • userdata β€” the app-defined pointer that got handed to SDL_SetX11EventHook. it's yours, you put it there 🫢
  • xevent β€” a pointer to an Xlib XEvent union to process. yes, the whole union. go off πŸ‘‘

🌈 RETURN VALUE 🌈

returns true to let the event continue on, false to drop it. simple as that, no cap ⭐


πŸ‘‘ THREAD SAFETY πŸ‘‘

this may only be called (by SDL) from the thread handling the X11 event loop. so like, one thread. that one. not your other one πŸ™ˆ


πŸ’œ AVAILABILITY πŸ’œ

this datatype is available since SDL 3.2.0. iconic behavior honestly πŸ¦‹


πŸ’… SEE ALSO πŸ’…


and that's a wrap, bestie! this page came to you from Simple Directmedia Layer, rockin' SDL 3.4.18 πŸ’– go forth and hook those X11 events, you absolute legend πŸŽ€βœ¨

πŸ“¦ where this page comes from