xcb_query_pointer(3)

πŸ“¦
version 1.17.0 Β· 4 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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 the same_screen field in the reply, iykyk). πŸ‘€

πŸ‘‘ REPLY FIELDS πŸ‘‘

  • response_type β€” the type of this reply, in this case XCB_QUERY_POINTER. this field is also present in the xcb_generic_reply_t and 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 β€” if same_screen is False, then the pointer is not on the same screen as the argument window, child is None, and win_x and win_y are zero. if same_screen is True, then win_x and win_y are the pointer coordinates relative to the argument window's origin, and child is 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, if same_screen is true. if same_screen is false, XCB_NONE is returned. 🧚
  • root_x β€” the pointer X position, relative to root. πŸ“
  • root_y β€” the pointer Y position, relative to root. πŸ“
  • win_x β€” the pointer X coordinate, relative to child, if same_screen is true. zero otherwise. ✨
  • win_y β€” the pointer Y coordinate, relative to child, if same_screen is 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 πŸ‘‘