XFilterEvent(3)
π XFilterEvent β the manual page, but make it a group chat
It's XFilterEvent(3) from the XLIB FUNCTIONS fam, and honestly it's shorter than my attention span β but every detail matters so let's go π
β¨ NAME β¨
XFilterEvent β filter X events for an input method π¦
That's it. That's the whole name. Input methods get to peek at events before you do, and this is the function that lets them. Periodt.
π SYNTAX π
Bool XFilterEvent(XEvent *event, Window w);
It's giving short-and-sweet. Returns a Bool, so True or False, no in-between, no "it's complicated."
π§ ARGUMENTS π§
eventβ specifies the event to filter. Like, "hey input method, do you want this one? π"wβ specifies the window for which the filter is to be applied. Provided specifically so that layers above Xlib that do event redirection can tell us which window an event got redirected to. Iykyk π
π DESCRIPTION π
Okay so here's the tea. If the w argument is None, XFilterEvent just applies the filter to the window specified inside the XEvent structure itself. Easy. But the w argument exists for a reason: layers above Xlib that handle event redirection need a way to indicate which window an event has been redirected to. Main character energy for real. β¨
Now for the vibe check on the return value:
If XFilterEvent returns True, then some input method has filtered the event, and the client should discard the event. Do not pass go, do not process it, it's been handled. ποΈ
If XFilterEvent returns False, then the client should continue processing the event. Business as usual, bestie. Slay. π₯
And here's the part that's lowkey crucial and highkey easy to forget: if a grab has occurred in the client and XFilterEvent returns True, the client should ungrab the keyboard. The way that this is a whole thing β forget it and you'll be stuck grabbing forever. π Don't do that to yourself.
πΈ SEE ALSO πΈ
XNextEvent(3)β for when you actually, like, want to get events πXlib - C Language X Interfaceβ the big book, the blueprint, the icon π
That's literally it, bestie. Go filter some events and stan input methods. π
Sign-off: this page comes from X Version 11, libX11 1.8.14, dated XFilterEvent(3) β no cap, that's the official source and version info, periodt. π¦
π¦ where this page comes from
- alpine 3.24: libx11-doc 1.8.14-r0 Β· X11
- arch rolling: libx11 1.8.14-1 Β· MIT AND X11
- nixos 26.05: libx11 1.8.14
- nixpkgs unstable: libx11 1.8.14
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms