xcb_query_pointer(3)
π xcb_query_pointer β get pointer coordinates π
okay bestie, welcome to the xcb_query_pointer(3) page from the XCB Requests fam π«Ά this one's all about asking the X server hey where is that cursor rn and it answers, no cap.
β¨ NAME β¨
xcb_query_pointer β get pointer coordinates π¦
πΈ SYNOPSIS πΈ
#include <xcb/xproto.h>
π Request function
xcb_query_pointer_cookie_t xcb_query_pointer(xcb_connection_t *conn,
xcb_window_t window);
π Reply datastructure
typedef struct xcb_query_pointer_reply_t {
uint8_t response_type;
uint8_t same_screen;
uint16_t sequence;
uint32_t length;
xcb_window_t root;
xcb_window_t child;
int16_t root_x;
int16_t root_y;
int16_t win_x;
int16_t win_y;
uint16_t mask;
uint8_t pad0[2];
} xcb_query_pointer_reply_t;
π Reply function
xcb_query_pointer_reply_t
*xcb_query_pointer_reply(xcb_connection_t *conn,
xcb_query_pointer_cookie_t cookie, xcb_generic_error_t **e);
π REQUEST ARGUMENTS π
connβ the XCB connection to X11. your lil hotline to the server, periodt.windowβ a window to check if the pointer is on the same screen as window (peep thesame_screenfield in the reply, iykyk). π
π REPLY FIELDS π
response_typeβ the type of this reply, in this caseXCB_QUERY_POINTER. this field is also present in thexcb_generic_reply_tand can be used to tell replies apart from each other. it's giving name tag at a party πsequenceβ the sequence number of the last request processed by the X11 server. βlengthβ the length of the reply, in words (a word is 4 bytes). lowkey important math.same_screenβ ifsame_screenisFalse, then the pointer is not on the same screen as the argument window,childisNone, andwin_xandwin_yare zero. ifsame_screenisTrue, thenwin_xandwin_yare the pointer coordinates relative to the argument window's origin, andchildis the child containing the pointer, if any. this field is carrying the whole reply ngl πrootβ the root window the pointer is logically on. πchildβ the child window containing the pointer, if any, ifsame_screenis true. ifsame_screenis false,XCB_NONEis returned. π§root_xβ the pointer X position, relative toroot. πroot_yβ the pointer Y position, relative toroot. πwin_xβ the pointer X coordinate, relative tochild, ifsame_screenis true. zero otherwise. β¨win_yβ the pointer Y coordinate, relative tochild, ifsame_screenis true. zero otherwise. β¨maskβ the current logical state of the modifier keys and the buttons. note that the logical state of a device (as seen by means of the protocol) may lag the physical state if device event processing is frozen. so like, don't trust it to be frame-perfect, bestie π
π¦ DESCRIPTION π¦
gets the root window the pointer is logically on and the pointer coordinates relative to the root window's origin. that's it, that's the whole vibe check π«Ά
π₯ RETURN VALUE π₯
returns an xcb_query_pointer_cookie_t. errors have to be handled when calling the reply function xcb_query_pointer_reply.
if you want to handle errors in the event loop instead, use xcb_query_pointer_unchecked. see xcb-requests(3) for details. choose your fighter π
π ERRORS π
xcb_window_error_tβ the specified window does not exist. ghost window fr fr π»
π SEE ALSO π
π AUTHOR π
generated from xproto.xml. contact xcb@lists.freedesktop.org for corrections and improvements. they're literally so responsive, go say hi π«Ά
ok that's the whole page bestie, go forth and find that cursor β¨π±οΈ
mwah π this was X Version 11, libxcb 1.17.0, and xcb_query_pointer(3) β stay iconic, queen π
π¦ where this page comes from
- alpine 3.22: libxcb-doc 1.17.0-r0 Β· MIT
- alpine 3.23: libxcb-doc 1.17.0-r1 Β· MIT
- alpine 3.24: libxcb-doc 1.17.0-r2 Β· MIT
- arch rolling: libxcb 1.17.0-1 Β· X11
- centos-stream 10: libxcb-devel 1.17.0-3.el10 Β· X11
- debian trixie: libxcb-doc 1.17.0-2
- fedora 43: libxcb-devel 1.17.0-6.fc43 Β· X11
- fedora 43: libxcb-devel 1.17.0-6.fc43 Β· X11
- fedora 44: libxcb-devel 1.17.0-7.fc44 Β· X11
- fedora 44: libxcb-devel 1.17.0-7.fc44 Β· X11
- nixpkgs unstable: libxcb 1.17.0
- opensuse-leap 16.0: libxcb-devel-doc 1.17.0-160000.2.2 Β· MIT
- ubuntu questing: libxcb-doc 1.17.0-2build1
- ubuntu resolute: libxcb-doc 1.17.0-2ubuntu1
- ubuntu stonking: libxcb-doc 1.17.0-2ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms