XIQUERYPOINTER(3)
π XIQueryPointer π
okay bestie, welcome to XIQueryPointer(3) β yes that's the manual name, that's the whole vibe, we're in section 3 of the X Input extension and we're about to find out where a device's pointer actually is π¦
β¨ NAME β¨
XIQueryPointer β get device pointer coordinates. that's it. that's the girl. she tells you where the pointer is pointing π―
πΈ SYNOPSIS πΈ
#include <X11/extensions/XInput2.h>
Bool XIQueryPointer( Display *display,
int deviceid,
Window win,
Window *root_return,
Window *child_return,
double *root_x_return,
double *root_y_return,
double *win_x_return,
double *win_y_return,
XIButtonState *buttons_return,
XIModifierState *modifiers_return,
XIGroupState *group_return);
and now the cast of characters, because every single one of these matters π
buttons_returnβ hands you back the current button state. she's reporting, not asking π«Άchild_returnβ hands you back the child window the pointer is chillin' in, if there even is one πdeviceidβ the device you're interrogating. pick one, bestie β¨displayβ the connection to the X server. your line to the mothership πgroup_returnβ hands you back the current group state πmodifiers_returnβ hands you back the current state of the modifier keys πroot_returnβ hands you back the root window the pointer is in πΈroot_x_return,root_y_returnβ return the pointer coordinates relative to the root window's origin πwinβ the window in question. specify her βwin_x_return,win_y_returnβ return the pointer coordinates relative to the specified window π¦
π DESCRIPTION π
so the XIQueryPointer function returns the root window that the device's pointer is logically on, plus the pointer coordinates relative to the root window's origin. iconic behaviour, no notes π
now here's the plot twist. if XIQueryPointer returns False, that means the pointer is not on the same screen as the specified window, and XIQueryPointer returns None to child_return and zero to win_x_return and win_y_return. not me getting rejected by a screen boundary π
but if XIQueryPointer returns True? slay. then the pointer coordinates returned to win_x_return and win_y_return are relative to the origin of the specified window. and in this case, XIQueryPointer returns the child that contains the pointer β if any β or else None to child_return β¨
XIQueryPointer returns the current logical state of the buttons in buttons_return. the keyboard paired with the master pointer is selected to obtain the data for modifiers_return and group_return. yes, the keyboard is doing the work for the pointer's paperwork, it's giving teamwork fr fr π«Ά
π¨ okay listen up because this part is important: themaskfield inbuttons_returnis dynamically allocated and must be freed by the caller. that's you. you're the caller. free it. don't leak it, bestie, memory leaks are not the aesthetic π
and for the lore: XIQueryPointer is identical to XQueryPointer but specifies the device explicitly. same girl, but she knows exactly which device she's talking about π
also heads up β XIQueryPointer can generate a BadDevice and a BadWindow error. drama is possible π
π DIAGNOSTICS π
BadDeviceβ an invalid device was specified. either the device does not exist, or it's just not a pointer device. wrong girl, wrong job πBadWindowβ a value for aWindowargument does not name a defined window. that window? doesn't exist. never did. ghosted π
π¦ SEE ALSO π¦
and that's the whole page, bestie!! πβ¨π
this lil masterpiece is from 05/18/2026, filed under XIQUERYPOINTER(3) β go query some pointers, free that mask, and stay iconic ππ
πΈ
π¦ 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