SDL_SetX11EventHook(3)

πŸ’… SDL_SetX11EventHook πŸ’…

okay bestie, welcome to the SDL_SetX11EventHook(3) page, part of the SDL3 functions lineup 🌸 this one is your backstage pass into the X11 event stream, so let's get into it


✨ NAME ✨

SDL_SetX11EventHook β€” set a callback for every X11 event πŸ¦‹

like, every every. no skips. no cap.


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_system.h>

void SDL_SetX11EventHook(SDL_X11EventHook callback, void *userdata);

πŸ’– DESCRIPTION πŸ’–

so here's the tea β˜• the callback you hand over? it may modify the event. yes, you heard me, it's editable, main character energy fr fr.

then it has to return one of two things:

  • return true β†’ the event should continue to be processed πŸ’š
  • return false β†’ prevent further processing πŸ›‘ like, we're done here, no more.

that's the whole vibe check, and it's giving power ngl πŸ‘‘


🫢 FUNCTION PARAMETERS 🫢

  • callback β€” the SDL_X11EventHook function to call πŸ’«
  • userdata β€” a pointer to pass to every iteration of callback πŸ“ yes, every single one, it rides along each time

πŸ”₯ THREAD SAFETY πŸ”₯

⚠️ bestie, listen. This function should only be called on the main thread. do not try to be cute and call it from a worker thread, that is not the moment 😭 periodt.

🌈 AVAILABILITY 🌈

This function is available since SDL 3.2.0 ⭐ so if you're on something older, sorry babe, you're gonna have to upgrade πŸ™ˆ


and that's the page!! πŸŽ€ written with love for the Simple Directmedia Layer, rocking SDL 3.4.18, dated all the way back to SDL_SetX11EventHook(3) times β€” bye bestie, go hook those events πŸ’œβœ¨

πŸ“¦ where this page comes from