XISETFOCUS(3)
π XISETFOCUS π
okay bestie, so you know how the X server has a focus, like who's getting the keyboard events? yeah. this is the Input extension's version of that, but for individual devices. it's giving "every mouse and tablet gets its own main character window" β¨
this page covers two functions: XISetFocus and XIGetFocus, from the XISETFOCUS(3) manual, section 3 of the X Input extension docs π
πΈ NAME πΈ
XISetFocus, XIGetFocus β set or get the device's focus. that's it, that's the whole vibe π
β¨ SYNOPSIS β¨
#include <X11/extensions/XInput2.h>
Status XISetFocus( Display *display,
int deviceid,
Window focus,
Time time);
Status XIGetFocus( Display *display,
Window *focus_return);
π«Ά the arguments, explained with love
displayβ the connection to the X server. your lil line to the server, your group chat with the X server basically πdeviceidβ which device's focus we're querying or changing. like tagging the right person in the message so the right device gets the info πfocusβ the new focus window. the window that's about to be That Girl πfocus_returnβ returns the current focus window. the server hands it back to you, no cap πtimeβ a valid timestamp, orCurrentTime. literally what it says on the tin β°
π DESCRIPTION π
okay so XISetFocus changes the focus of the specified device and its last-focus-change time. obsessed. but β and this is important β it has no effect if the specified time is earlier than the current last-focus-change time, or is later than the current X server time. otherwise, the last-focus-change time gets set to the specified time. and CurrentTime gets replaced by the current X server time (yes there's a stray ) in the original, we don't talk about it π). XISetFocus causes the X server to generate core, XI and XI2 focus events. so many events. iconic π₯
now, if the focus window is None, all keyboard events by this device are discarded until a new focus window is set. like, muted. on do not disturb. π otherwise, if focus is a window, it becomes the device's focus window. and if a generated device event would normally be reported to this window or one of its inferiors, the event is reported as usual. otherwise, the event is reported relative to the focus window. β¨
β οΈ the specified focus window must be viewable at the timeXISetFocusis called, or aBadMatcherror results. so don't come for it with a hidden window, bestie, it will not go well π
if the focus window later becomes not viewable, the focus reverts to the parent (or the closest viewable ancestor). when the focus reverts, the X server generates core, XI and XI2 focus events, but the last-focus-change time is not affected. okay so the events fire but the timestamp stays put. noted π
π attempting to set the focus on a master pointer device or an attached slave device will result in a BadDevice error. do not do this. the server said no and it meant it.
XISetFocus can generate BadDevice, BadMatch, BadValue, and BadWindow errors. four whole error girls. she's versatile π
π¦ DIAGNOSTICS π¦
BadValueβ a value is outside of the permitted range. out of pocket, literally π«BadDeviceβ an invalid device was specified. the device does not exist, or is not appropriate for the type of change. wrong device, wrong vibe, no notes πBadMatchβ the window is not viewable. she's not showing up, so she's not getting focus πBadWindowβ a value for aWindowargument does not name a definedWindow. that window? doesn't exist. ghosted fr fr π»
π SEE ALSO π
nothing listed here bestie, this page stands on its own π β¨
and that's the whole thing!! go forth and set some focus, you've got this π«Άβ¨
this was from the XISETFOCUS(3) manual page, dated 05/18/2026 β stay slay, stay viewable, and always check your timestamps π
π¦ where this page comes from
- fedora 44: libXi-devel 1.8.3-1.fc44 Β· MIT-open-group AND SMLNJ AND MIT
- fedora 44: libXi-devel 1.8.3-1.fc44 Β· MIT-open-group AND SMLNJ AND MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms