xcb_get_window_attributes(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_get_window_attributes πŸ’–

okay bestie, so this one's from the XCB Requests fam, it lives in libxcb and yeah it's literally the "tell me everything about this window" request. grab a snack, we're going in πŸ“


🌸 NAME 🌸

xcb_get_window_attributes β€” gets window attributes, no cap πŸ’…


✨ SYNOPSIS ✨

first things first, you gotta bring in the header:

#include <xcb/xproto.h>

πŸŽ€ Request function

xcb_get_window_attributes_cookie_t
       xcb_get_window_attributes(xcb_connection_t *conn,
       xcb_window_t window);

πŸ¦‹ Reply datastructure

typedef struct xcb_get_window_attributes_reply_t {
    uint8_t        response_type;
    uint8_t        backing_store;
    uint16_t       sequence;
    uint32_t       length;
    xcb_visualid_t visual;
    uint16_t       _class;
    uint8_t        bit_gravity;
    uint8_t        win_gravity;
    uint32_t       backing_planes;
    uint32_t       backing_pixel;
    uint8_t        save_under;
    uint8_t        map_is_installed;
    uint8_t        map_state;
    uint8_t        override_redirect;
    xcb_colormap_t colormap;
    uint32_t       all_event_masks;
    uint32_t       your_event_mask;
    uint16_t       do_not_propagate_mask;
    uint8_t        pad0[2];
} xcb_get_window_attributes_reply_t;

🧚 Reply function

xcb_get_window_attributes_reply_t
       *xcb_get_window_attributes_reply(xcb_connection_t *conn,
       xcb_get_window_attributes_cookie_t cookie,
       xcb_generic_error_t **e);

πŸ‘‘ REQUEST ARGUMENTS πŸ‘‘

  • conn β€” the XCB connection to X11, your lil hotline to the server πŸ“ž
  • window β€” the window you're snooping on. this is the one we're pulling attributes from.

πŸ”₯ REPLY FIELDS πŸ”₯

okay this is the juicy part, here's every single thing that comes back at you:

  • response_type β€” the type of this reply, and in this case it's XCB_GET_WINDOW_ATTRIBUTES. this field also shows up in xcb_generic_reply_t, so you can use it to tell your replies apart from each other. very "which one of y'all is this" energy πŸ™ˆ
  • sequence β€” the sequence number of the last request the X11 server processed.
  • length β€” how long the reply is, in words (and a word here is 4 bytes, periodt).
  • backing_store β€” one of these values:
    • XCB_BACKING_STORE_NOT_USEFUL β€” TODO: NOT YET DOCUMENTED.
    • XCB_BACKING_STORE_WHEN_MAPPED β€” TODO: NOT YET DOCUMENTED.
    • XCB_BACKING_STORE_ALWAYS β€” TODO: NOT YET DOCUMENTED.
  • visual β€” the visual structure that's associated with window. πŸ‘€
  • _class β€” one of these values:
    • XCB_WINDOW_CLASS_COPY_FROM_PARENT β€” TODO: NOT YET DOCUMENTED.
    • XCB_WINDOW_CLASS_INPUT_OUTPUT β€” TODO: NOT YET DOCUMENTED.
    • XCB_WINDOW_CLASS_INPUT_ONLY β€” TODO: NOT YET DOCUMENTED.
  • bit_gravity β€” one of these values:
    • XCB_GRAVITY_BIT_FORGET β€” TODO: NOT YET DOCUMENTED.
    • XCB_GRAVITY_WIN_UNMAP β€” TODO: NOT YET DOCUMENTED.
    • XCB_GRAVITY_NORTH_WEST β€” TODO: NOT YET DOCUMENTED.
    • XCB_GRAVITY_NORTH β€” TODO: NOT YET DOCUMENTED.
    • XCB_GRAVITY_NORTH_EAST β€” TODO: NOT YET DOCUMENTED.
    • XCB_GRAVITY_WEST β€” TODO: NOT YET DOCUMENTED.
    • XCB_GRAVITY_CENTER β€” TODO: NOT YET DOCUMENTED.
    • XCB_GRAVITY_EAST β€” TODO: NOT YET DOCUMENTED.
    • XCB_GRAVITY_SOUTH_WEST β€” TODO: NOT YET DOCUMENTED.
    • XCB_GRAVITY_SOUTH β€” TODO: NOT YET DOCUMENTED.
    • XCB_GRAVITY_SOUTH_EAST β€” TODO: NOT YET DOCUMENTED.
    • XCB_GRAVITY_STATIC β€” TODO: NOT YET DOCUMENTED.
  • win_gravity β€” one of these values (yes it's the same set, they really said "copy paste slay"):
    • XCB_GRAVITY_BIT_FORGET β€” TODO: NOT YET DOCUMENTED.
    • XCB_GRAVITY_WIN_UNMAP β€” TODO: NOT YET DOCUMENTED.
    • XCB_GRAVITY_NORTH_WEST β€” TODO: NOT YET DOCUMENTED.
    • XCB_GRAVITY_NORTH β€” TODO: NOT YET DOCUMENTED.
    • XCB_GRAVITY_NORTH_EAST β€” TODO: NOT YET DOCUMENTED.
    • XCB_GRAVITY_WEST β€” TODO: NOT YET DOCUMENTED.
    • XCB_GRAVITY_CENTER β€” TODO: NOT YET DOCUMENTED.
    • XCB_GRAVITY_EAST β€” TODO: NOT YET DOCUMENTED.
    • XCB_GRAVITY_SOUTH_WEST β€” TODO: NOT YET DOCUMENTED.
    • XCB_GRAVITY_SOUTH β€” TODO: NOT YET DOCUMENTED.
    • XCB_GRAVITY_SOUTH_EAST β€” TODO: NOT YET DOCUMENTED.
    • XCB_GRAVITY_STATIC β€” TODO: NOT YET DOCUMENTED.
  • backing_planes β€” planes that should be preserved if possible. like, best effort babe 🫢
  • backing_pixel β€” the value to use when restoring planes.
  • save_under β€” boolean: should the bits underneath be saved? yes/no, iconic behaviour.
  • map_is_installed β€” TODO: NOT YET DOCUMENTED.
  • map_state β€” one of these values:
    • XCB_MAP_STATE_UNMAPPED β€” TODO: NOT YET DOCUMENTED.
    • XCB_MAP_STATE_UNVIEWABLE β€” TODO: NOT YET DOCUMENTED.
    • XCB_MAP_STATE_VIEWABLE β€” TODO: NOT YET DOCUMENTED.
  • override_redirect β€” window managers should ignore this window if override_redirect is 1. like genuinely ignore it, it's giving main character who doesn't want to be managed πŸ’…
  • colormap β€” the color map to be associated with window.
  • all_event_masks β€” the set of events all people have interest in.
  • your_event_mask β€” my event mask. (yes, the manpage really said that, and honestly? relatable.)
  • do_not_propagate_mask β€” the set of events that should not propagate.

🌈 DESCRIPTION 🌈

Gets the current attributes for the specified window. that's it, that's the whole vibe. ask and the server shall provide ✨


⭐ RETURN VALUE ⭐

Returns an xcb_get_window_attributes_cookie_t. you handle errors when you call the reply function xcb_get_window_attributes_reply.

If you'd rather handle errors in the event loop instead, use xcb_get_window_attributes_unchecked. see xcb-requests(3) for the deets 🧚


πŸ’€ ERRORS πŸ’€

  • xcb_drawable_error_t β€” TODO: reasons?
  • xcb_window_error_t β€” the specified window does not exist. she's not here, bestie 😭

πŸ¦‹ SEE ALSO πŸ¦‹


πŸŽ€ AUTHOR πŸŽ€

Generated from xproto.xml. Contact xcb@lists.freedesktop.org for corrections and improvements.


okay so that's the whole page!! and per the footer: this is X Version 11, shipping with libxcb 1.17.0, and you can find it filed under xcb_get_window_attributes(3) 🫢 go forth and query those windows, you absolute icon πŸ‘‘πŸ’–