XQueryPointer(3)
π XQueryPointer(3) π β get pointer coordinates
okay so this lil icon is from XLIB FUNCTIONS, and itβs literally the βwhere is the pointer rn?β function. bestie, weβre getting coordinates, windows, and modifier/button state all in one go β¨
β¨ SYNTAX β¨
Bool XQueryPointer(Display *display, Window w, Window *root_return,
Window *child_return, int *root_x_return, int *root_y_return, int
*win_x_return, int *win_y_return, unsigned int *mask_return);
π ARGUMENTS π
child_returnβ Returns the child window that the pointer is located in, if any. πdisplayβ Specifies the connection to the X server.mask_returnβ Returns the current state of the modifier keys and pointer buttons.root_returnβ Returns the root window that the pointer is in.root_x_return,root_y_returnβ Return the pointer coordinates relative to the root windowβs origin.wβ Specifies the window.win_x_return,win_y_returnβ Return the pointer coordinates relative to the specified window.
π¦ DESCRIPTION π¦
So XQueryPointer returns the root window the pointer is logically on, plus the pointer coordinates relative to the root windowβs origin. iconic behavior, no cap π
If XQueryPointer returns False, the pointer is not on the same screen as the specified window, and XQueryPointer returns None to child_return and zero to win_x_return and win_y_return. π
If XQueryPointer returns True, the pointer coordinates returned to win_x_return and win_y_return are relative to the origin of the specified window. In this case, XQueryPointer returns the child that contains the pointer, if any, or else None to child_return. slay π
XQueryPointer returns the current logical state of the keyboard buttons and the modifier keys in mask_return. It sets mask_return to the bitwise inclusive OR of one or more of the button or modifier key bitmasks to match the current state of the mouse buttons and the modifier keys. periodt π
XQueryPointer can generate a BadWindow error.
π DIAGNOSTICS π
BadWindowβ A value for aWindowargument does not name a definedWindow.
bestie pls make sure that Window is actually defined, or this error is gonna vibe-check you π
π SEE ALSO π
XGetWindowAttributes(3)XQueryTree(3)Xlib - C Language X Interface
okay bye bestie! this page is signing off from X Version 11, libX11 1.8.14, and yes, the footer also says XQueryPointer(3) β we been knew π
π«Ά
π¦ 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