XtAppAddInput(3)
π XtAppAddInput β bestie edition π
okay so this is a page from the XT FUNCTIONS corner of the manual, and it's literally about XtAppAddInput(3) β yes, the whole family. sit down, grab a strawberry π, we're registering input sources.
β¨ NAME β¨
XtAppAddInput, XtRemoveInput β register and remove an input source π
πΈ SYNTAX πΈ
like, the actual shape of it:
#include <X11/Intrinsic.h>
XtInputId XtAppAddInput(XtAppContext app_context, int source, XtPointer
condition, XtInputCallbackProc proc, XtPointer client_data);
void XtRemoveInput(XtInputId id);
π¦ ARGUMENTS π¦
here's the tea on every single one of them, no skips:
app_contextβ the application context that identifies the application. like, which app are we even talking about bestie πclient_dataβ the argument that's gonna get passed to the procedure you specified, but only when input is actually available. it's the lil gift you hand over πconditionβ the mask that says read, write, or exception condition, or honestly some operating-system dependent condition. very "depends on the vibe of your OS" of itidβ the ID you got back from the matchingXtAppAddInputcall. yes, the one that call returnedprocβ the procedure that gets called when input is available. your main character callback πsourceβ the source file descriptor on a UNIX-based system, or some other operating-system dependent device specification. loosely interpreted, okurrr
π DESCRIPTION π
so XtAppAddInput registers a brand new source of events with the Intrinsics read routine. it's usually file input, but it can also be file output. and note β "file" should be loosely interpreted to mean any sink or source of data. any. sink. or. source. periodt.
XtAppAddInput also specifies the conditions under which the source can generate events. and when input is pending on this source, the callback procedure gets called. that's it, that's the whole loop π
the legal values for the condition argument are operating-system dependent. on a UNIX-based system, the condition is some union of XtInputReadMask, XtInputWriteMask, and XtInputExceptMask. that's the trio, that's the girl group π
and XtRemoveInput? it causes the Intrinsics read routine to stop watching for input from the input source. she said "I'm done here" and left the group chat π
β SEE ALSO β
go read these next, they're all connected, iykyk:
XtAppAddTimeOut(3)XtAppAddSignal(3)- X Toolkit Intrinsics - C Language Interface
- Xlib - C Language Interface
π BUGS π
okay so in ANSI C you have to cast the condition to an XtPointer. like, it's not optional, bestie, it will not compile. here's exactly how:
XtAppAddInput(app_context,
source,
(XtPointer) (XtInputReadMask | XtInputWriteMask),
proc,
client_data);
not me forgetting the cast and losing my entire mind π don't be like me. cast it. (XtPointer). say it with me.
that's the whole page, bestie β go forth and register your input sources πβ¨π¦
this little manual page comes to you from X Version 11, specifically libXt 1.3.1, and it's filed under XtAppAddInput(3) in the XT FUNCTIONS section. mwah, love u, bye π«Άπ
π¦ where this page comes from
- alpine 3.22: libxt-doc 1.3.1-r0 Β· MIT
- alpine 3.23: libxt-doc 1.3.1-r0 Β· MIT
- alpine 3.24: libxt-doc 1.3.1-r0 Β· MIT
- arch rolling: libxt 1.3.1-1 Β· MIT AND HPND-sell-variant AND SMLNJ AND MIT-open-group AND X11
- fedora 43: libXt-devel 1.3.1-3.fc43 Β· MIT AND HPND-sell-variant AND SMLNJ AND MIT-open-group AND X11
- fedora 43: libXt-devel 1.3.1-3.fc43 Β· MIT AND HPND-sell-variant AND SMLNJ AND MIT-open-group AND X11
- fedora 44: libXt-devel 1.3.1-4.fc44 Β· MIT AND HPND-sell-variant AND SMLNJ AND MIT-open-group AND X11
- fedora 44: libXt-devel 1.3.1-4.fc44 Β· MIT AND HPND-sell-variant AND SMLNJ AND MIT-open-group AND X11
- opensuse-leap 16.0: libXt-devel 1.3.1-160000.3.2 Β· MIT
- opensuse-leap 16.0: libXt-devel 1.3.1-160000.3.2 Β· MIT
- opensuse-leap 16.0: libXt-devel 1.3.1-160000.3.2 Β· MIT
- opensuse-leap 16.0: libXt-devel 1.3.1-160000.3.2 Β· MIT
- Copyright 1993 X Consortium
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms