Function x11rb::protocol::xproto::configure_window

source ·
pub fn configure_window<'c, 'input, Conn>(
    conn: &'c Conn,
    window: Window,
    value_list: &'input ConfigureWindowAux,
) -> Result<VoidCookie<'c, Conn>, ConnectionError>
where Conn: RequestConnection + ?Sized,
Expand description

Configures window attributes.

Configures a window’s size, position, border width and stacking order.

§Fields

  • window - The window to configure.
  • value_mask - Bitmask of attributes to change.
  • value_list - New values, corresponding to the attributes in value_mask. The order has to correspond to the order of possible value_mask bits. See the example.

§Errors

  • Match - You specified a Sibling without also specifying StackMode or the window is not actually a Sibling.
  • Window - The specified window does not exist. TODO: any other reason?
  • Value - TODO: reasons?

§See

  • MapNotify: event
  • Expose: event

§Example

/*
 * Configures the given window to the left upper corner
 * with a size of 1024x768 pixels.
 *
 */
void my_example(xcb_connection_t *c, xcb_window_t window) {
    uint16_t mask = 0;

    mask |= XCB_CONFIG_WINDOW_X;
    mask |= XCB_CONFIG_WINDOW_Y;
    mask |= XCB_CONFIG_WINDOW_WIDTH;
    mask |= XCB_CONFIG_WINDOW_HEIGHT;

    const uint32_t values[] = {
        0,    /* x */
        0,    /* y */
        1024, /* width */
        768   /* height */
    };

    xcb_configure_window(c, window, mask, values);
    xcb_flush(c);
}