XtAddInput(3)

✨ XtAddInput β€” the manual page bestie πŸ’–

okay so real talk, this one's a compatibility situation, it's giving "we keep the old thing around so your ancient code still compiles" energy, and honestly? iconic of libXt. 🫢


πŸ’« NAME πŸ’«

XtAddInput, XtAddTimeOut, XtAddWorkProc β€” the trio that registers input, timeout, and workprocs, no cap ✨


🌸 SYNTAX 🌸

first things first, you gotta bring in the header, literally the doorway:

#include <X11/Intrinsic.h>

then the three besties, one at a time:

XtInputId XtAddInput(int source, XtPointer condition,
       XtInputCallbackProc proc, XtPointer client_data);
XtIntervalId XtAddTimeOut(unsigned long interval, XtTimerCallbackProc
       proc, XtPointer client_data);
XtWorkProcId XtAddWorkProc(XtWorkProc proc, XtPointer client_data);

look at those return types. XtInputId, XtIntervalId, XtWorkProcId. they hand you back an ID and you hold onto it, periodt πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

okay so here's what you're feeding these functions, one by one, don't skip a single one:

  • client_data β€” this is the lil gift you wrap up and pass along; it's the argument that gets handed to the procedure you specified when input becomes available 🎁
  • condition β€” the mask, bestie. it says whether we're talking a read, a write, or an exception condition, or some operating-system-dependent condition πŸ‘€
  • proc β€” the procedure that gets called when input is available. your callback, your moment, your main character entrance πŸ”₯
  • source β€” the source file descriptor if you're on a UNIX-based system, or some other operating-system-dependent device specification if you're not 🌈

πŸ’œ DESCRIPTION πŸ’œ

so here's the tea, and I need you to sit with it:

XtAddInput has been replaced by XtAppAddInput. πŸ’€

XtAddTimeOut has been replaced by XtAppAddTimeOut. πŸ’€

XtAddWorkProc has been replaced by XtAppAddWorkProc. πŸ’€

that's the whole description, fr fr. all three of these are the old way, and the new way lives in XtAppAddInput, XtAppAddTimeOut, and XtAppAddWorkProc. if you're writing new code, go hang with the XtApp girlies. if you're maintaining something ancient, well, you're in the right place and we love you for it 🫢

not me telling you that all three functions here are the superseded versions. no shade, just facts. ✨

πŸ” SEE ALSO πŸ”

go read these next, they're the glow-ups:


πŸ¦‹ sign-off πŸ¦‹

this page came from X Version 11, libXt 1.3.1 β€” that's the version and the date vibe of this lil document, and it was served fresh from the libXt household πŸ‘‘

stay hydrated, read your headers, and remember: XtAddInput is a legacy queen but XtAppAddInput is the one you call. bye bestie!! πŸŒΈπŸ’–βœ¨

πŸ“¦ where this page comes from