xcb\_get\_property(3) XCB Requests xcb\_get\_property(3)

# [NAME](#NAME)

xcb\_get\_property - Gets a window property

# [SYNOPSIS](#SYNOPSIS)

**#include &lt;xcb/xproto.h&gt;**

## [Request function](#Request_function)

xcb\_get\_property\_cookie\_t **xcb\_get\_property**(xcb\_connection\_t \**conn*, uint8\_t *\_delete*, xcb\_window\_t *window*, xcb\_atom\_t *property*, xcb\_atom\_t *type*, uint32\_t *long\_offset*, uint32\_t *long\_length*);

## [Reply datastructure](#Reply_datastructure)

```
typedef struct xcb_get_property_reply_t {


    uint8_t    response_type;


    uint8_t    format;


    uint16_t   sequence;


    uint32_t   length;


    xcb_atom_t type;


    uint32_t   bytes_after;


    uint32_t   value_len;


    uint8_t    pad0[12];
} xcb_get_property_reply_t;
```

## [Reply function](#Reply_function)

xcb\_get\_property\_reply\_t \***xcb\_get\_property\_reply**(xcb\_connection\_t \**conn*, xcb\_get\_property\_cookie\_t *cookie*, xcb\_generic\_error\_t \*\**e*);

## [Reply accessors](#Reply_accessors)

void \***xcb\_get\_property\_value**(const xcb\_get\_property\_request\_t \**reply*);

int **xcb\_get\_property\_value\_length**(const xcb\_get\_property\_reply\_t \**reply*);

xcb\_generic\_iterator\_t **xcb\_get\_property\_value\_end**(const xcb\_get\_property\_reply\_t \**reply*);

# [REQUEST ARGUMENTS](#REQUEST_ARGUMENTS)

[*conn*](#conn)

The XCB connection to X11.

*\_delete*

Whether the property should actually be deleted. For deleting a property, the specified *type* has to match the actual property type.

[*window*](#window)

The window whose property you want to get.

[*property*](#property)

The property you want to get (an atom).

[*type*](#type)

The type of the property you want to get (an atom).

[*long\_offset*](#long_offset)

Specifies the offset (in 32-bit multiples) in the specified property where the data is to be retrieved.

[*long\_length*](#long_length)

Specifies how many 32-bit multiples of data should be retrieved (e.g. if you set *long\_length* to 4, you will receive 16 bytes of data).

# [REPLY FIELDS](#REPLY_FIELDS)

[*response\_type*](#response_type)

The type of this reply, in this case *XCB\_GET\_PROPERTY*. This field is also present in the *xcb\_generic\_reply\_t* and can be used to tell replies apart from each other.

[*sequence*](#sequence)

The sequence number of the last request processed by the X11 server.

[*length*](#length)

The length of the reply, in words (a word is 4 bytes).

[*format*](#format)

Specifies whether the data should be viewed as a list of 8-bit, 16-bit, or 32-bit quantities. Possible values are 8, 16, and 32. This information allows the X server to correctly perform byte-swap operations as necessary.

[*type*](#type~2)

The actual type of the property (an atom).

[*bytes\_after*](#bytes_after)

The number of bytes remaining to be read in the property if a partial read was performed.

[*value\_len*](#value_len)

The length of value. You should use the corresponding accessor instead of this field.

# [DESCRIPTION](#DESCRIPTION)

Gets the specified *property* from the specified *window*. Properties are for example the window title (*WM\_NAME*) or its minimum size (*WM\_NORMAL\_HINTS*). Protocols such as EWMH also use properties - for example EWMH defines the window title, encoded as UTF-8 string, in the *\_NET\_WM\_NAME* property.

TODO: talk about *type*

TODO: talk about *delete*

TODO: talk about the offset/length thing. what's a valid use case?

# [RETURN VALUE](#RETURN_VALUE)

Returns an *xcb\_get\_property\_cookie\_t*. Errors have to be handled when calling the reply function *xcb\_get\_property\_reply*.

If you want to handle errors in the event loop instead, use *xcb\_get\_property\_unchecked*. See [**xcb-requests(3)**](/man/os/libxcb/xcb-requests.3) for details.

# [ERRORS](#ERRORS)

[*xcb\_atom\_error\_t*](#xcb_atom_error_t)

*property* or *type* do not refer to a valid atom.

[*xcb\_value\_error\_t*](#xcb_value_error_t)

The specified *long\_offset* is beyond the actual property length (e.g. the property has a length of 3 bytes and you are setting *long\_offset* to 1, resulting in a byte offset of 4).

[*xcb\_window\_error\_t*](#xcb_window_error_t)

The specified *window* does not exist.

# [EXAMPLE](#EXAMPLE)

```
/*


 * Prints the WM_NAME property of the window.


 *


 */
void my_example(xcb_connection_t *c, xcb_window_t window) {


    xcb_get_property_cookie_t cookie;


    xcb_get_property_reply_t *reply;


    /* These atoms are predefined in the X11 protocol. */


    xcb_atom_t property = XCB_ATOM_WM_NAME;


    xcb_atom_t type = XCB_ATOM_STRING;


    // TODO: a reasonable long_length for WM_NAME?


    cookie = xcb_get_property(c, 0, window, property, type, 0, 0);


    if ((reply = xcb_get_property_reply(c, cookie, NULL))) {


        int len = xcb_get_property_value_length(reply);


        if (len == 0) {


            printf("TODO\n");


            free(reply);


            return;


        }


        printf("WM_NAME is %.*s\n", len,


               (char*)xcb_get_property_value(reply));


    }


    free(reply);
}
```

# [SEE ALSO](#SEE_ALSO)

[**xcb-requests**(3)](/man/os/libxcb/xcb-requests.3), [**xcb-examples**(3)](/man/os/libxcb/xcb-examples.3), [**xcb\_intern\_atom**(3)](/man/os/libxcb/xcb_intern_atom.3), [**xprop**(1)](/man/os/libxcb/xprop.1)

# [AUTHOR](#AUTHOR)

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

libxcb 1.17.0 X Version 11

---

Document: xcb_get_property_value_length(3) from libxcb 1.17.0-r18 (Chainguard OS)
Source: https://gitlab.freedesktop.org/xorg/lib/libxcb.git
