XtAddCallback(3)

✨ XtAddCallback β€” the XT FUNCTIONS girlies πŸ’…

ok so bestie, welcome to XtAddCallback(3) and its whole friend group 🫢 these are the functions that let you hook callback procedures onto a widget's callback list β€” and also, crucially, un-hook them when you're done. adding, removing, removing literally everything. the full cycle. it's giving main character energy for real.


🌸 NAME 🌸

XtAddCallback, XtAddCallbacks, XtRemoveCallback, XtRemoveCallbacks, XtRemoveAllCallbacks β€” add and remove callback procedures πŸ’–


✨ SYNTAX ✨

first things first, you gotta pull in the header, no cap:

#include <X11/Intrinsic.h>

then the whole squad, in order:

void XtAddCallback(Widget w, const char *callback_name, XtCallbackProc
       callback, XtPointer client_data);

void XtAddCallbacks(Widget w, const char *callback_name, XtCallbackList
       callbacks);

void XtRemoveCallback(Widget w, const char *callback_name,
       XtCallbackProc callback, XtPointer client_data);

void XtRemoveCallbacks(Widget w, const char *callback_name,
       XtCallbackList callbacks);

void XtRemoveAllCallbacks(Widget w, const char *callback_name);

πŸŽ€ ARGUMENTS πŸŽ€

ok so here's who's who in the group chat:

  • callback β€” specifies the callback procedure. that's the function itself, the whole point, the moment πŸ’…
  • callbacks β€” specifies the null-terminated list of callback procedures and corresponding client data. yes bestie, a list, plural, we're doing this in bulk πŸ¦‹
  • callback_name β€” specifies the callback list to which the procedure is to be appended or deleted. like, which list are we talking to.
  • client_data β€” specifies the argument that is to be passed to the specified procedure when it is invoked by XtCallbacks or NULL, or the client data to match on the registered callback procedures. so it's either the lil gift you hand to your callback, or NULL, or the thing you're matching against when you're hunting down a callback to remove πŸ‘€
  • w β€” specifies the widget. the widget!! the star of the show ✨

πŸ’– DESCRIPTION πŸ’–

XtAddCallback adds the specified callback procedure to the specified widget's callback list. boom. added. welcome to the list, bestie 🌈

XtAddCallbacks adds the specified list of callbacks to the specified widget's callback list. plural girlies, we're adding many at once, obsessed πŸ’œ

XtRemoveCallback removes a callback only if both the procedure and the client data match. okay so this one is picky β€” and honestly? valid. it's not gonna remove just anything, it needs both to line up or it's not doing it. periodt πŸ‘‘

XtRemoveCallbacks removes the specified callback procedures from the specified widget's callback list. the batch removal. the cleanup era 🧹

XtRemoveAllCallbacks removes all the callback procedures from the specified widget's callback list. every single one. scorched earth. no survivors. iconic 😭


πŸ”₯ SEE ALSO πŸ”₯

go read these next, iykyk:

  • XtCallCallbacks(3)
  • X Toolkit Intrinsics - C Language Interface
  • Xlib - C Language Interface

and that's the whole page, babe! πŸŽ€ this one's from X Version 11, libXt 1.3.1 β€” shoutout to the XT FUNCTIONS girlies for keeping the callback lists cute since forever. mwah πŸ’‹βœ¨πŸ¦‹

πŸ“¦ where this page comes from