Exemplo n.º 1
0
xcb_record_query_version_reply_t *
xcb_record_query_version_reply (xcb_connection_t                   *c  /**< */,
                                xcb_record_query_version_cookie_t   cookie  /**< */,
                                xcb_generic_error_t               **e  /**< */)
{
    return (xcb_record_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}
Exemplo n.º 2
0
Arquivo: shape.c Projeto: csulmone/X11
xcb_shape_query_extents_reply_t *
xcb_shape_query_extents_reply (xcb_connection_t                  *c  /**< */,
                               xcb_shape_query_extents_cookie_t   cookie  /**< */,
                               xcb_generic_error_t              **e  /**< */)
{
    return (xcb_shape_query_extents_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}
Exemplo n.º 3
0
xcb_record_enable_context_reply_t *
xcb_record_enable_context_reply (xcb_connection_t                    *c  /**< */,
                                 xcb_record_enable_context_cookie_t   cookie  /**< */,
                                 xcb_generic_error_t                **e  /**< */)
{
    return (xcb_record_enable_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}
Exemplo n.º 4
0
xcb_sync_query_counter_reply_t *
xcb_sync_query_counter_reply (xcb_connection_t                 *c  /**< */,
                              xcb_sync_query_counter_cookie_t   cookie  /**< */,
                              xcb_generic_error_t             **e  /**< */)
{
    return (xcb_sync_query_counter_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}
Exemplo n.º 5
0
xcb_dpms_info_reply_t *
xcb_dpms_info_reply (xcb_connection_t        *c  /**< */,
                     xcb_dpms_info_cookie_t   cookie  /**< */,
                     xcb_generic_error_t    **e  /**< */)
{
    return (xcb_dpms_info_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}
Exemplo n.º 6
0
xcb_xinerama_query_screens_reply_t *
xcb_xinerama_query_screens_reply (xcb_connection_t                     *c  /**< */,
                                  xcb_xinerama_query_screens_cookie_t   cookie  /**< */,
                                  xcb_generic_error_t                 **e  /**< */)
{
    return (xcb_xinerama_query_screens_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}
Exemplo n.º 7
0
Arquivo: res.c Projeto: 3AN03A/libxcb
xcb_res_query_client_pixmap_bytes_reply_t *
xcb_res_query_client_pixmap_bytes_reply (xcb_connection_t                            *c  /**< */,
                                         xcb_res_query_client_pixmap_bytes_cookie_t   cookie  /**< */,
                                         xcb_generic_error_t                        **e  /**< */)
{
    return (xcb_res_query_client_pixmap_bytes_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}
Exemplo n.º 8
0
Arquivo: shape.c Projeto: csulmone/X11
xcb_shape_input_selected_reply_t *
xcb_shape_input_selected_reply (xcb_connection_t                   *c  /**< */,
                                xcb_shape_input_selected_cookie_t   cookie  /**< */,
                                xcb_generic_error_t               **e  /**< */)
{
    return (xcb_shape_input_selected_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}
Exemplo n.º 9
0
xcb_xc_misc_get_xid_list_reply_t *
xcb_xc_misc_get_xid_list_reply (xcb_connection_t                   *c  /**< */,
                                xcb_xc_misc_get_xid_list_cookie_t   cookie  /**< */,
                                xcb_generic_error_t               **e  /**< */)
{
    return (xcb_xc_misc_get_xid_list_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}
Exemplo n.º 10
0
Arquivo: xtest.c Projeto: csulmone/X11
xcb_test_compare_cursor_reply_t *
xcb_test_compare_cursor_reply (xcb_connection_t                  *c  /**< */,
                               xcb_test_compare_cursor_cookie_t   cookie  /**< */,
                               xcb_generic_error_t              **e  /**< */)
{
    return (xcb_test_compare_cursor_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}
Exemplo n.º 11
0
static PyObject *
xpybCookie_reply(xpybCookie *self, PyObject *args)
{
    xcb_generic_error_t *error;
    xcb_generic_reply_t *data;
    PyObject *shim, *reply;
    int is_void;
    void *buf;
    Py_ssize_t len;

    xpybRequest_get_attributes(self->request, &is_void, NULL, NULL);

    /* Check arguments and connection. */
    if (is_void) {
        PyErr_SetString(xpybExcept_base, "Request has no reply.");
        return NULL;
    }
    if (xpybConn_invalid(self->conn))
        return NULL;

    /* Make XCB call */
    data = xcb_wait_for_reply(self->conn->conn, self->cookie.sequence, &error);
    if (xpybError_set(self->conn, error))
        return NULL;
    if (data == NULL) {
        PyErr_SetString(PyExc_IOError, "I/O error on X server connection.");
        return NULL;
    }

    /* Create a shim protocol object */
    shim = PyBuffer_New(32 + data->length * 4);
    if (shim == NULL)
        goto err1;
    if (PyObject_AsWriteBuffer(shim, &buf, &len) < 0)
        goto err2;
    memcpy(buf, data, len);
    free(data);

    /* Call the reply type object to get a new xcb.Reply instance */
    reply = PyObject_CallFunctionObjArgs((PyObject *)self->reply_type, shim, NULL);
    Py_DECREF(shim);
    return reply;

err2:
    Py_DECREF(shim);
err1:
    free(data);
    return NULL;
}
Exemplo n.º 12
0
xcb_shape_query_version_cookie_t
xcb_shape_query_version (xcb_connection_t *c)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_shape_id,
        .opcode = XCB_SHAPE_QUERY_VERSION,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_shape_query_version_cookie_t xcb_ret;
    xcb_shape_query_version_request_t xcb_out;


    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_shape_query_version_cookie_t
xcb_shape_query_version_unchecked (xcb_connection_t *c)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_shape_id,
        .opcode = XCB_SHAPE_QUERY_VERSION,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_shape_query_version_cookie_t xcb_ret;
    xcb_shape_query_version_request_t xcb_out;


    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_shape_query_version_reply_t *
xcb_shape_query_version_reply (xcb_connection_t                  *c,
                               xcb_shape_query_version_cookie_t   cookie  /**< */,
                               xcb_generic_error_t              **e)
{
    return (xcb_shape_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}

int
xcb_shape_rectangles_sizeof (const void  *_buffer,
                             uint32_t     rectangles_len)
{
    char *xcb_tmp = (char *)_buffer;
    unsigned int xcb_buffer_len = 0;
    unsigned int xcb_block_len = 0;
    unsigned int xcb_pad = 0;
    unsigned int xcb_align_to = 0;


    xcb_block_len += sizeof(xcb_shape_rectangles_request_t);
    xcb_tmp += xcb_block_len;
    xcb_buffer_len += xcb_block_len;
    xcb_block_len = 0;
    /* rectangles */
    xcb_block_len += rectangles_len * sizeof(xcb_rectangle_t);
    xcb_tmp += xcb_block_len;
    xcb_align_to = ALIGNOF(xcb_rectangle_t);
    /* insert padding */
    xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    xcb_buffer_len += xcb_block_len + xcb_pad;
    if (0 != xcb_pad) {
        xcb_tmp += xcb_pad;
        xcb_pad = 0;
    }
    xcb_block_len = 0;

    return xcb_buffer_len;
}

xcb_void_cookie_t
xcb_shape_rectangles_checked (xcb_connection_t      *c,
                              xcb_shape_op_t         operation,
                              xcb_shape_kind_t       destination_kind,
                              uint8_t                ordering,
                              xcb_window_t           destination_window,
                              int16_t                x_offset,
                              int16_t                y_offset,
                              uint32_t               rectangles_len,
                              const xcb_rectangle_t *rectangles)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 4,
        .ext = &xcb_shape_id,
        .opcode = XCB_SHAPE_RECTANGLES,
        .isvoid = 1
    };

    struct iovec xcb_parts[6];
    xcb_void_cookie_t xcb_ret;
    xcb_shape_rectangles_request_t xcb_out;

    xcb_out.operation = operation;
    xcb_out.destination_kind = destination_kind;
    xcb_out.ordering = ordering;
    xcb_out.pad0 = 0;
    xcb_out.destination_window = destination_window;
    xcb_out.x_offset = x_offset;
    xcb_out.y_offset = y_offset;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    /* xcb_rectangle_t rectangles */
    xcb_parts[4].iov_base = (char *) rectangles;
    xcb_parts[4].iov_len = rectangles_len * sizeof(xcb_rectangle_t);
    xcb_parts[5].iov_base = 0;
    xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_shape_rectangles (xcb_connection_t      *c,
                      xcb_shape_op_t         operation,
                      xcb_shape_kind_t       destination_kind,
                      uint8_t                ordering,
                      xcb_window_t           destination_window,
                      int16_t                x_offset,
                      int16_t                y_offset,
                      uint32_t               rectangles_len,
                      const xcb_rectangle_t *rectangles)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 4,
        .ext = &xcb_shape_id,
        .opcode = XCB_SHAPE_RECTANGLES,
        .isvoid = 1
    };

    struct iovec xcb_parts[6];
    xcb_void_cookie_t xcb_ret;
    xcb_shape_rectangles_request_t xcb_out;

    xcb_out.operation = operation;
    xcb_out.destination_kind = destination_kind;
    xcb_out.ordering = ordering;
    xcb_out.pad0 = 0;
    xcb_out.destination_window = destination_window;
    xcb_out.x_offset = x_offset;
    xcb_out.y_offset = y_offset;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    /* xcb_rectangle_t rectangles */
    xcb_parts[4].iov_base = (char *) rectangles;
    xcb_parts[4].iov_len = rectangles_len * sizeof(xcb_rectangle_t);
    xcb_parts[5].iov_base = 0;
    xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_rectangle_t *
xcb_shape_rectangles_rectangles (const xcb_shape_rectangles_request_t *R)
{
    return (xcb_rectangle_t *) (R + 1);
}

int
xcb_shape_rectangles_rectangles_length (const xcb_shape_rectangles_request_t *R)
{
    return (((R->length * 4) - sizeof(xcb_shape_rectangles_request_t))/sizeof(xcb_rectangle_t));
}

xcb_rectangle_iterator_t
xcb_shape_rectangles_rectangles_iterator (const xcb_shape_rectangles_request_t *R)
{
    xcb_rectangle_iterator_t i;
    i.data = (xcb_rectangle_t *) (R + 1);
    i.rem = (((R->length * 4) - sizeof(xcb_shape_rectangles_request_t))/sizeof(xcb_rectangle_t));
    i.index = (char *) i.data - (char *) R;
    return i;
}

xcb_void_cookie_t
xcb_shape_mask_checked (xcb_connection_t *c,
                        xcb_shape_op_t    operation,
                        xcb_shape_kind_t  destination_kind,
                        xcb_window_t      destination_window,
                        int16_t           x_offset,
                        int16_t           y_offset,
                        xcb_pixmap_t      source_bitmap)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_shape_id,
        .opcode = XCB_SHAPE_MASK,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_shape_mask_request_t xcb_out;

    xcb_out.operation = operation;
    xcb_out.destination_kind = destination_kind;
    memset(xcb_out.pad0, 0, 2);
    xcb_out.destination_window = destination_window;
    xcb_out.x_offset = x_offset;
    xcb_out.y_offset = y_offset;
    xcb_out.source_bitmap = source_bitmap;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_shape_mask (xcb_connection_t *c,
                xcb_shape_op_t    operation,
                xcb_shape_kind_t  destination_kind,
                xcb_window_t      destination_window,
                int16_t           x_offset,
                int16_t           y_offset,
                xcb_pixmap_t      source_bitmap)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_shape_id,
        .opcode = XCB_SHAPE_MASK,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_shape_mask_request_t xcb_out;

    xcb_out.operation = operation;
    xcb_out.destination_kind = destination_kind;
    memset(xcb_out.pad0, 0, 2);
    xcb_out.destination_window = destination_window;
    xcb_out.x_offset = x_offset;
    xcb_out.y_offset = y_offset;
    xcb_out.source_bitmap = source_bitmap;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_shape_combine_checked (xcb_connection_t *c,
                           xcb_shape_op_t    operation,
                           xcb_shape_kind_t  destination_kind,
                           xcb_shape_kind_t  source_kind,
                           xcb_window_t      destination_window,
                           int16_t           x_offset,
                           int16_t           y_offset,
                           xcb_window_t      source_window)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_shape_id,
        .opcode = XCB_SHAPE_COMBINE,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_shape_combine_request_t xcb_out;

    xcb_out.operation = operation;
    xcb_out.destination_kind = destination_kind;
    xcb_out.source_kind = source_kind;
    xcb_out.pad0 = 0;
    xcb_out.destination_window = destination_window;
    xcb_out.x_offset = x_offset;
    xcb_out.y_offset = y_offset;
    xcb_out.source_window = source_window;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_shape_combine (xcb_connection_t *c,
                   xcb_shape_op_t    operation,
                   xcb_shape_kind_t  destination_kind,
                   xcb_shape_kind_t  source_kind,
                   xcb_window_t      destination_window,
                   int16_t           x_offset,
                   int16_t           y_offset,
                   xcb_window_t      source_window)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_shape_id,
        .opcode = XCB_SHAPE_COMBINE,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_shape_combine_request_t xcb_out;

    xcb_out.operation = operation;
    xcb_out.destination_kind = destination_kind;
    xcb_out.source_kind = source_kind;
    xcb_out.pad0 = 0;
    xcb_out.destination_window = destination_window;
    xcb_out.x_offset = x_offset;
    xcb_out.y_offset = y_offset;
    xcb_out.source_window = source_window;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_shape_offset_checked (xcb_connection_t *c,
                          xcb_shape_kind_t  destination_kind,
                          xcb_window_t      destination_window,
                          int16_t           x_offset,
                          int16_t           y_offset)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_shape_id,
        .opcode = XCB_SHAPE_OFFSET,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_shape_offset_request_t xcb_out;

    xcb_out.destination_kind = destination_kind;
    memset(xcb_out.pad0, 0, 3);
    xcb_out.destination_window = destination_window;
    xcb_out.x_offset = x_offset;
    xcb_out.y_offset = y_offset;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_shape_offset (xcb_connection_t *c,
                  xcb_shape_kind_t  destination_kind,
                  xcb_window_t      destination_window,
                  int16_t           x_offset,
                  int16_t           y_offset)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_shape_id,
        .opcode = XCB_SHAPE_OFFSET,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_shape_offset_request_t xcb_out;

    xcb_out.destination_kind = destination_kind;
    memset(xcb_out.pad0, 0, 3);
    xcb_out.destination_window = destination_window;
    xcb_out.x_offset = x_offset;
    xcb_out.y_offset = y_offset;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_shape_query_extents_cookie_t
xcb_shape_query_extents (xcb_connection_t *c,
                         xcb_window_t      destination_window)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_shape_id,
        .opcode = XCB_SHAPE_QUERY_EXTENTS,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_shape_query_extents_cookie_t xcb_ret;
    xcb_shape_query_extents_request_t xcb_out;

    xcb_out.destination_window = destination_window;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_shape_query_extents_cookie_t
xcb_shape_query_extents_unchecked (xcb_connection_t *c,
                                   xcb_window_t      destination_window)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_shape_id,
        .opcode = XCB_SHAPE_QUERY_EXTENTS,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_shape_query_extents_cookie_t xcb_ret;
    xcb_shape_query_extents_request_t xcb_out;

    xcb_out.destination_window = destination_window;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_shape_query_extents_reply_t *
xcb_shape_query_extents_reply (xcb_connection_t                  *c,
                               xcb_shape_query_extents_cookie_t   cookie  /**< */,
                               xcb_generic_error_t              **e)
{
    return (xcb_shape_query_extents_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}

xcb_void_cookie_t
xcb_shape_select_input_checked (xcb_connection_t *c,
                                xcb_window_t      destination_window,
                                uint8_t           enable)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_shape_id,
        .opcode = XCB_SHAPE_SELECT_INPUT,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_shape_select_input_request_t xcb_out;

    xcb_out.destination_window = destination_window;
    xcb_out.enable = enable;
    memset(xcb_out.pad0, 0, 3);

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_shape_select_input (xcb_connection_t *c,
                        xcb_window_t      destination_window,
                        uint8_t           enable)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_shape_id,
        .opcode = XCB_SHAPE_SELECT_INPUT,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_shape_select_input_request_t xcb_out;

    xcb_out.destination_window = destination_window;
    xcb_out.enable = enable;
    memset(xcb_out.pad0, 0, 3);

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_shape_input_selected_cookie_t
xcb_shape_input_selected (xcb_connection_t *c,
                          xcb_window_t      destination_window)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_shape_id,
        .opcode = XCB_SHAPE_INPUT_SELECTED,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_shape_input_selected_cookie_t xcb_ret;
    xcb_shape_input_selected_request_t xcb_out;

    xcb_out.destination_window = destination_window;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_shape_input_selected_cookie_t
xcb_shape_input_selected_unchecked (xcb_connection_t *c,
                                    xcb_window_t      destination_window)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_shape_id,
        .opcode = XCB_SHAPE_INPUT_SELECTED,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_shape_input_selected_cookie_t xcb_ret;
    xcb_shape_input_selected_request_t xcb_out;

    xcb_out.destination_window = destination_window;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_shape_input_selected_reply_t *
xcb_shape_input_selected_reply (xcb_connection_t                   *c,
                                xcb_shape_input_selected_cookie_t   cookie  /**< */,
                                xcb_generic_error_t               **e)
{
    return (xcb_shape_input_selected_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}

int
xcb_shape_get_rectangles_sizeof (const void  *_buffer)
{
    char *xcb_tmp = (char *)_buffer;
    const xcb_shape_get_rectangles_reply_t *_aux = (xcb_shape_get_rectangles_reply_t *)_buffer;
    unsigned int xcb_buffer_len = 0;
    unsigned int xcb_block_len = 0;
    unsigned int xcb_pad = 0;
    unsigned int xcb_align_to = 0;


    xcb_block_len += sizeof(xcb_shape_get_rectangles_reply_t);
    xcb_tmp += xcb_block_len;
    xcb_buffer_len += xcb_block_len;
    xcb_block_len = 0;
    /* rectangles */
    xcb_block_len += _aux->rectangles_len * sizeof(xcb_rectangle_t);
    xcb_tmp += xcb_block_len;
    xcb_align_to = ALIGNOF(xcb_rectangle_t);
    /* insert padding */
    xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    xcb_buffer_len += xcb_block_len + xcb_pad;
    if (0 != xcb_pad) {
        xcb_tmp += xcb_pad;
        xcb_pad = 0;
    }
    xcb_block_len = 0;

    return xcb_buffer_len;
}

xcb_shape_get_rectangles_cookie_t
xcb_shape_get_rectangles (xcb_connection_t *c,
                          xcb_window_t      window,
                          xcb_shape_kind_t  source_kind)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_shape_id,
        .opcode = XCB_SHAPE_GET_RECTANGLES,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_shape_get_rectangles_cookie_t xcb_ret;
    xcb_shape_get_rectangles_request_t xcb_out;

    xcb_out.window = window;
    xcb_out.source_kind = source_kind;
    memset(xcb_out.pad0, 0, 3);

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_shape_get_rectangles_cookie_t
xcb_shape_get_rectangles_unchecked (xcb_connection_t *c,
                                    xcb_window_t      window,
                                    xcb_shape_kind_t  source_kind)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_shape_id,
        .opcode = XCB_SHAPE_GET_RECTANGLES,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_shape_get_rectangles_cookie_t xcb_ret;
    xcb_shape_get_rectangles_request_t xcb_out;

    xcb_out.window = window;
    xcb_out.source_kind = source_kind;
    memset(xcb_out.pad0, 0, 3);

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_rectangle_t *
xcb_shape_get_rectangles_rectangles (const xcb_shape_get_rectangles_reply_t *R)
{
    return (xcb_rectangle_t *) (R + 1);
}

int
xcb_shape_get_rectangles_rectangles_length (const xcb_shape_get_rectangles_reply_t *R)
{
    return R->rectangles_len;
}

xcb_rectangle_iterator_t
xcb_shape_get_rectangles_rectangles_iterator (const xcb_shape_get_rectangles_reply_t *R)
{
    xcb_rectangle_iterator_t i;
    i.data = (xcb_rectangle_t *) (R + 1);
    i.rem = R->rectangles_len;
    i.index = (char *) i.data - (char *) R;
    return i;
}

xcb_shape_get_rectangles_reply_t *
xcb_shape_get_rectangles_reply (xcb_connection_t                   *c,
                                xcb_shape_get_rectangles_cookie_t   cookie  /**< */,
                                xcb_generic_error_t               **e)
{
    return (xcb_shape_get_rectangles_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}
Exemplo n.º 13
0
xcb_composite_query_version_cookie_t
xcb_composite_query_version (xcb_connection_t *c,
                             uint32_t          client_major_version,
                             uint32_t          client_minor_version)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_composite_id,
        .opcode = XCB_COMPOSITE_QUERY_VERSION,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_composite_query_version_cookie_t xcb_ret;
    xcb_composite_query_version_request_t xcb_out;

    xcb_out.client_major_version = client_major_version;
    xcb_out.client_minor_version = client_minor_version;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_composite_query_version_cookie_t
xcb_composite_query_version_unchecked (xcb_connection_t *c,
                                       uint32_t          client_major_version,
                                       uint32_t          client_minor_version)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_composite_id,
        .opcode = XCB_COMPOSITE_QUERY_VERSION,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_composite_query_version_cookie_t xcb_ret;
    xcb_composite_query_version_request_t xcb_out;

    xcb_out.client_major_version = client_major_version;
    xcb_out.client_minor_version = client_minor_version;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_composite_query_version_reply_t *
xcb_composite_query_version_reply (xcb_connection_t                      *c,
                                   xcb_composite_query_version_cookie_t   cookie  /**< */,
                                   xcb_generic_error_t                  **e)
{
    return (xcb_composite_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}

xcb_void_cookie_t
xcb_composite_redirect_window_checked (xcb_connection_t *c,
                                       xcb_window_t      window,
                                       uint8_t           update)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_composite_id,
        .opcode = XCB_COMPOSITE_REDIRECT_WINDOW,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_composite_redirect_window_request_t xcb_out;

    xcb_out.window = window;
    xcb_out.update = update;
    memset(xcb_out.pad0, 0, 3);

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_composite_redirect_window (xcb_connection_t *c,
                               xcb_window_t      window,
                               uint8_t           update)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_composite_id,
        .opcode = XCB_COMPOSITE_REDIRECT_WINDOW,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_composite_redirect_window_request_t xcb_out;

    xcb_out.window = window;
    xcb_out.update = update;
    memset(xcb_out.pad0, 0, 3);

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_composite_redirect_subwindows_checked (xcb_connection_t *c,
                                           xcb_window_t      window,
                                           uint8_t           update)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_composite_id,
        .opcode = XCB_COMPOSITE_REDIRECT_SUBWINDOWS,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_composite_redirect_subwindows_request_t xcb_out;

    xcb_out.window = window;
    xcb_out.update = update;
    memset(xcb_out.pad0, 0, 3);

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_composite_redirect_subwindows (xcb_connection_t *c,
                                   xcb_window_t      window,
                                   uint8_t           update)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_composite_id,
        .opcode = XCB_COMPOSITE_REDIRECT_SUBWINDOWS,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_composite_redirect_subwindows_request_t xcb_out;

    xcb_out.window = window;
    xcb_out.update = update;
    memset(xcb_out.pad0, 0, 3);

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_composite_unredirect_window_checked (xcb_connection_t *c,
                                         xcb_window_t      window,
                                         uint8_t           update)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_composite_id,
        .opcode = XCB_COMPOSITE_UNREDIRECT_WINDOW,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_composite_unredirect_window_request_t xcb_out;

    xcb_out.window = window;
    xcb_out.update = update;
    memset(xcb_out.pad0, 0, 3);

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_composite_unredirect_window (xcb_connection_t *c,
                                 xcb_window_t      window,
                                 uint8_t           update)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_composite_id,
        .opcode = XCB_COMPOSITE_UNREDIRECT_WINDOW,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_composite_unredirect_window_request_t xcb_out;

    xcb_out.window = window;
    xcb_out.update = update;
    memset(xcb_out.pad0, 0, 3);

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_composite_unredirect_subwindows_checked (xcb_connection_t *c,
                                             xcb_window_t      window,
                                             uint8_t           update)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_composite_id,
        .opcode = XCB_COMPOSITE_UNREDIRECT_SUBWINDOWS,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_composite_unredirect_subwindows_request_t xcb_out;

    xcb_out.window = window;
    xcb_out.update = update;
    memset(xcb_out.pad0, 0, 3);

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_composite_unredirect_subwindows (xcb_connection_t *c,
                                     xcb_window_t      window,
                                     uint8_t           update)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_composite_id,
        .opcode = XCB_COMPOSITE_UNREDIRECT_SUBWINDOWS,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_composite_unredirect_subwindows_request_t xcb_out;

    xcb_out.window = window;
    xcb_out.update = update;
    memset(xcb_out.pad0, 0, 3);

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_composite_create_region_from_border_clip_checked (xcb_connection_t    *c,
                                                      xcb_xfixes_region_t  region,
                                                      xcb_window_t         window)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_composite_id,
        .opcode = XCB_COMPOSITE_CREATE_REGION_FROM_BORDER_CLIP,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_composite_create_region_from_border_clip_request_t xcb_out;

    xcb_out.region = region;
    xcb_out.window = window;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_composite_create_region_from_border_clip (xcb_connection_t    *c,
                                              xcb_xfixes_region_t  region,
                                              xcb_window_t         window)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_composite_id,
        .opcode = XCB_COMPOSITE_CREATE_REGION_FROM_BORDER_CLIP,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_composite_create_region_from_border_clip_request_t xcb_out;

    xcb_out.region = region;
    xcb_out.window = window;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_composite_name_window_pixmap_checked (xcb_connection_t *c,
                                          xcb_window_t      window,
                                          xcb_pixmap_t      pixmap)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_composite_id,
        .opcode = XCB_COMPOSITE_NAME_WINDOW_PIXMAP,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_composite_name_window_pixmap_request_t xcb_out;

    xcb_out.window = window;
    xcb_out.pixmap = pixmap;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_composite_name_window_pixmap (xcb_connection_t *c,
                                  xcb_window_t      window,
                                  xcb_pixmap_t      pixmap)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_composite_id,
        .opcode = XCB_COMPOSITE_NAME_WINDOW_PIXMAP,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_composite_name_window_pixmap_request_t xcb_out;

    xcb_out.window = window;
    xcb_out.pixmap = pixmap;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_composite_get_overlay_window_cookie_t
xcb_composite_get_overlay_window (xcb_connection_t *c,
                                  xcb_window_t      window)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_composite_id,
        .opcode = XCB_COMPOSITE_GET_OVERLAY_WINDOW,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_composite_get_overlay_window_cookie_t xcb_ret;
    xcb_composite_get_overlay_window_request_t xcb_out;

    xcb_out.window = window;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_composite_get_overlay_window_cookie_t
xcb_composite_get_overlay_window_unchecked (xcb_connection_t *c,
                                            xcb_window_t      window)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_composite_id,
        .opcode = XCB_COMPOSITE_GET_OVERLAY_WINDOW,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_composite_get_overlay_window_cookie_t xcb_ret;
    xcb_composite_get_overlay_window_request_t xcb_out;

    xcb_out.window = window;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_composite_get_overlay_window_reply_t *
xcb_composite_get_overlay_window_reply (xcb_connection_t                           *c,
                                        xcb_composite_get_overlay_window_cookie_t   cookie  /**< */,
                                        xcb_generic_error_t                       **e)
{
    return (xcb_composite_get_overlay_window_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}

xcb_void_cookie_t
xcb_composite_release_overlay_window_checked (xcb_connection_t *c,
                                              xcb_window_t      window)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_composite_id,
        .opcode = XCB_COMPOSITE_RELEASE_OVERLAY_WINDOW,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_composite_release_overlay_window_request_t xcb_out;

    xcb_out.window = window;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_composite_release_overlay_window (xcb_connection_t *c,
                                      xcb_window_t      window)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_composite_id,
        .opcode = XCB_COMPOSITE_RELEASE_OVERLAY_WINDOW,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_composite_release_overlay_window_request_t xcb_out;

    xcb_out.window = window;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}
Exemplo n.º 14
0
xcb_dpms_get_version_cookie_t
xcb_dpms_get_version (xcb_connection_t *c,
                      uint16_t          client_major_version,
                      uint16_t          client_minor_version)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_dpms_id,
        .opcode = XCB_DPMS_GET_VERSION,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_dpms_get_version_cookie_t xcb_ret;
    xcb_dpms_get_version_request_t xcb_out;

    xcb_out.client_major_version = client_major_version;
    xcb_out.client_minor_version = client_minor_version;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_dpms_get_version_cookie_t
xcb_dpms_get_version_unchecked (xcb_connection_t *c,
                                uint16_t          client_major_version,
                                uint16_t          client_minor_version)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_dpms_id,
        .opcode = XCB_DPMS_GET_VERSION,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_dpms_get_version_cookie_t xcb_ret;
    xcb_dpms_get_version_request_t xcb_out;

    xcb_out.client_major_version = client_major_version;
    xcb_out.client_minor_version = client_minor_version;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_dpms_get_version_reply_t *
xcb_dpms_get_version_reply (xcb_connection_t               *c,
                            xcb_dpms_get_version_cookie_t   cookie  /**< */,
                            xcb_generic_error_t           **e)
{
    return (xcb_dpms_get_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}

xcb_dpms_capable_cookie_t
xcb_dpms_capable (xcb_connection_t *c)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_dpms_id,
        .opcode = XCB_DPMS_CAPABLE,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_dpms_capable_cookie_t xcb_ret;
    xcb_dpms_capable_request_t xcb_out;


    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_dpms_capable_cookie_t
xcb_dpms_capable_unchecked (xcb_connection_t *c)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_dpms_id,
        .opcode = XCB_DPMS_CAPABLE,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_dpms_capable_cookie_t xcb_ret;
    xcb_dpms_capable_request_t xcb_out;


    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_dpms_capable_reply_t *
xcb_dpms_capable_reply (xcb_connection_t           *c,
                        xcb_dpms_capable_cookie_t   cookie  /**< */,
                        xcb_generic_error_t       **e)
{
    return (xcb_dpms_capable_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}

xcb_dpms_get_timeouts_cookie_t
xcb_dpms_get_timeouts (xcb_connection_t *c)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_dpms_id,
        .opcode = XCB_DPMS_GET_TIMEOUTS,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_dpms_get_timeouts_cookie_t xcb_ret;
    xcb_dpms_get_timeouts_request_t xcb_out;


    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_dpms_get_timeouts_cookie_t
xcb_dpms_get_timeouts_unchecked (xcb_connection_t *c)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_dpms_id,
        .opcode = XCB_DPMS_GET_TIMEOUTS,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_dpms_get_timeouts_cookie_t xcb_ret;
    xcb_dpms_get_timeouts_request_t xcb_out;


    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_dpms_get_timeouts_reply_t *
xcb_dpms_get_timeouts_reply (xcb_connection_t                *c,
                             xcb_dpms_get_timeouts_cookie_t   cookie  /**< */,
                             xcb_generic_error_t            **e)
{
    return (xcb_dpms_get_timeouts_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}

xcb_void_cookie_t
xcb_dpms_set_timeouts_checked (xcb_connection_t *c,
                               uint16_t          standby_timeout,
                               uint16_t          suspend_timeout,
                               uint16_t          off_timeout)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_dpms_id,
        .opcode = XCB_DPMS_SET_TIMEOUTS,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_dpms_set_timeouts_request_t xcb_out;

    xcb_out.standby_timeout = standby_timeout;
    xcb_out.suspend_timeout = suspend_timeout;
    xcb_out.off_timeout = off_timeout;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_dpms_set_timeouts (xcb_connection_t *c,
                       uint16_t          standby_timeout,
                       uint16_t          suspend_timeout,
                       uint16_t          off_timeout)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_dpms_id,
        .opcode = XCB_DPMS_SET_TIMEOUTS,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_dpms_set_timeouts_request_t xcb_out;

    xcb_out.standby_timeout = standby_timeout;
    xcb_out.suspend_timeout = suspend_timeout;
    xcb_out.off_timeout = off_timeout;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_dpms_enable_checked (xcb_connection_t *c)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_dpms_id,
        .opcode = XCB_DPMS_ENABLE,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_dpms_enable_request_t xcb_out;


    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_dpms_enable (xcb_connection_t *c)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_dpms_id,
        .opcode = XCB_DPMS_ENABLE,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_dpms_enable_request_t xcb_out;


    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_dpms_disable_checked (xcb_connection_t *c)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_dpms_id,
        .opcode = XCB_DPMS_DISABLE,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_dpms_disable_request_t xcb_out;


    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_dpms_disable (xcb_connection_t *c)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_dpms_id,
        .opcode = XCB_DPMS_DISABLE,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_dpms_disable_request_t xcb_out;


    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_dpms_force_level_checked (xcb_connection_t *c,
                              uint16_t          power_level)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_dpms_id,
        .opcode = XCB_DPMS_FORCE_LEVEL,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_dpms_force_level_request_t xcb_out;

    xcb_out.power_level = power_level;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_dpms_force_level (xcb_connection_t *c,
                      uint16_t          power_level)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_dpms_id,
        .opcode = XCB_DPMS_FORCE_LEVEL,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_dpms_force_level_request_t xcb_out;

    xcb_out.power_level = power_level;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_dpms_info_cookie_t
xcb_dpms_info (xcb_connection_t *c)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_dpms_id,
        .opcode = XCB_DPMS_INFO,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_dpms_info_cookie_t xcb_ret;
    xcb_dpms_info_request_t xcb_out;


    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_dpms_info_cookie_t
xcb_dpms_info_unchecked (xcb_connection_t *c)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_dpms_id,
        .opcode = XCB_DPMS_INFO,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_dpms_info_cookie_t xcb_ret;
    xcb_dpms_info_request_t xcb_out;


    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_dpms_info_reply_t *
xcb_dpms_info_reply (xcb_connection_t        *c,
                     xcb_dpms_info_cookie_t   cookie  /**< */,
                     xcb_generic_error_t    **e)
{
    return (xcb_dpms_info_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}
Exemplo n.º 15
0
xcb_screensaver_query_version_cookie_t
xcb_screensaver_query_version (xcb_connection_t *c,
                               uint8_t           client_major_version,
                               uint8_t           client_minor_version)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_screensaver_id,
        .opcode = XCB_SCREENSAVER_QUERY_VERSION,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_screensaver_query_version_cookie_t xcb_ret;
    xcb_screensaver_query_version_request_t xcb_out;

    xcb_out.client_major_version = client_major_version;
    xcb_out.client_minor_version = client_minor_version;
    memset(xcb_out.pad0, 0, 2);

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_screensaver_query_version_cookie_t
xcb_screensaver_query_version_unchecked (xcb_connection_t *c,
                                         uint8_t           client_major_version,
                                         uint8_t           client_minor_version)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_screensaver_id,
        .opcode = XCB_SCREENSAVER_QUERY_VERSION,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_screensaver_query_version_cookie_t xcb_ret;
    xcb_screensaver_query_version_request_t xcb_out;

    xcb_out.client_major_version = client_major_version;
    xcb_out.client_minor_version = client_minor_version;
    memset(xcb_out.pad0, 0, 2);

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_screensaver_query_version_reply_t *
xcb_screensaver_query_version_reply (xcb_connection_t                        *c,
                                     xcb_screensaver_query_version_cookie_t   cookie  /**< */,
                                     xcb_generic_error_t                    **e)
{
    return (xcb_screensaver_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}

xcb_screensaver_query_info_cookie_t
xcb_screensaver_query_info (xcb_connection_t *c,
                            xcb_drawable_t    drawable)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_screensaver_id,
        .opcode = XCB_SCREENSAVER_QUERY_INFO,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_screensaver_query_info_cookie_t xcb_ret;
    xcb_screensaver_query_info_request_t xcb_out;

    xcb_out.drawable = drawable;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_screensaver_query_info_cookie_t
xcb_screensaver_query_info_unchecked (xcb_connection_t *c,
                                      xcb_drawable_t    drawable)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_screensaver_id,
        .opcode = XCB_SCREENSAVER_QUERY_INFO,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_screensaver_query_info_cookie_t xcb_ret;
    xcb_screensaver_query_info_request_t xcb_out;

    xcb_out.drawable = drawable;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_screensaver_query_info_reply_t *
xcb_screensaver_query_info_reply (xcb_connection_t                     *c,
                                  xcb_screensaver_query_info_cookie_t   cookie  /**< */,
                                  xcb_generic_error_t                 **e)
{
    return (xcb_screensaver_query_info_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}

xcb_void_cookie_t
xcb_screensaver_select_input_checked (xcb_connection_t *c,
                                      xcb_drawable_t    drawable,
                                      uint32_t          event_mask)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_screensaver_id,
        .opcode = XCB_SCREENSAVER_SELECT_INPUT,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_screensaver_select_input_request_t xcb_out;

    xcb_out.drawable = drawable;
    xcb_out.event_mask = event_mask;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_screensaver_select_input (xcb_connection_t *c,
                              xcb_drawable_t    drawable,
                              uint32_t          event_mask)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_screensaver_id,
        .opcode = XCB_SCREENSAVER_SELECT_INPUT,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_screensaver_select_input_request_t xcb_out;

    xcb_out.drawable = drawable;
    xcb_out.event_mask = event_mask;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

int
xcb_screensaver_set_attributes_value_list_serialize (void                                              **_buffer,
                                                     uint32_t                                            value_mask,
                                                     const xcb_screensaver_set_attributes_value_list_t  *_aux)
{
    char *xcb_out = *_buffer;
    unsigned int xcb_buffer_len = 0;
    unsigned int xcb_align_to = 0;
    unsigned int xcb_padding_offset = 0;

    unsigned int xcb_pad = 0;
    char xcb_pad0[3] = {0, 0, 0};
    struct iovec xcb_parts[16];
    unsigned int xcb_parts_idx = 0;
    unsigned int xcb_block_len = 0;
    unsigned int i;
    char *xcb_tmp;

    if(value_mask & XCB_CW_BACK_PIXMAP) {
        /* xcb_screensaver_set_attributes_value_list_t.background_pixmap */
        xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->background_pixmap;
        xcb_block_len += sizeof(xcb_pixmap_t);
        xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_pixmap_t);
        xcb_parts_idx++;
        xcb_align_to = ALIGNOF(xcb_pixmap_t);
    }
    if(value_mask & XCB_CW_BACK_PIXEL) {
        /* xcb_screensaver_set_attributes_value_list_t.background_pixel */
        xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->background_pixel;
        xcb_block_len += sizeof(uint32_t);
        xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
        xcb_parts_idx++;
        xcb_align_to = ALIGNOF(uint32_t);
    }
    if(value_mask & XCB_CW_BORDER_PIXMAP) {
        /* xcb_screensaver_set_attributes_value_list_t.border_pixmap */
        xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->border_pixmap;
        xcb_block_len += sizeof(xcb_pixmap_t);
        xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_pixmap_t);
        xcb_parts_idx++;
        xcb_align_to = ALIGNOF(xcb_pixmap_t);
    }
    if(value_mask & XCB_CW_BORDER_PIXEL) {
        /* xcb_screensaver_set_attributes_value_list_t.border_pixel */
        xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->border_pixel;
        xcb_block_len += sizeof(uint32_t);
        xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
        xcb_parts_idx++;
        xcb_align_to = ALIGNOF(uint32_t);
    }
    if(value_mask & XCB_CW_BIT_GRAVITY) {
        /* xcb_screensaver_set_attributes_value_list_t.bit_gravity */
        xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->bit_gravity;
        xcb_block_len += sizeof(uint32_t);
        xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
        xcb_parts_idx++;
        xcb_align_to = ALIGNOF(uint32_t);
    }
    if(value_mask & XCB_CW_WIN_GRAVITY) {
        /* xcb_screensaver_set_attributes_value_list_t.win_gravity */
        xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->win_gravity;
        xcb_block_len += sizeof(uint32_t);
        xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
        xcb_parts_idx++;
        xcb_align_to = ALIGNOF(uint32_t);
    }
    if(value_mask & XCB_CW_BACKING_STORE) {
        /* xcb_screensaver_set_attributes_value_list_t.backing_store */
        xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->backing_store;
        xcb_block_len += sizeof(uint32_t);
        xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
        xcb_parts_idx++;
        xcb_align_to = ALIGNOF(uint32_t);
    }
    if(value_mask & XCB_CW_BACKING_PLANES) {
        /* xcb_screensaver_set_attributes_value_list_t.backing_planes */
        xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->backing_planes;
        xcb_block_len += sizeof(uint32_t);
        xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
        xcb_parts_idx++;
        xcb_align_to = ALIGNOF(uint32_t);
    }
    if(value_mask & XCB_CW_BACKING_PIXEL) {
        /* xcb_screensaver_set_attributes_value_list_t.backing_pixel */
        xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->backing_pixel;
        xcb_block_len += sizeof(uint32_t);
        xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
        xcb_parts_idx++;
        xcb_align_to = ALIGNOF(uint32_t);
    }
    if(value_mask & XCB_CW_OVERRIDE_REDIRECT) {
        /* xcb_screensaver_set_attributes_value_list_t.override_redirect */
        xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->override_redirect;
        xcb_block_len += sizeof(xcb_bool32_t);
        xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_bool32_t);
        xcb_parts_idx++;
        xcb_align_to = ALIGNOF(xcb_bool32_t);
    }
    if(value_mask & XCB_CW_SAVE_UNDER) {
        /* xcb_screensaver_set_attributes_value_list_t.save_under */
        xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->save_under;
        xcb_block_len += sizeof(xcb_bool32_t);
        xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_bool32_t);
        xcb_parts_idx++;
        xcb_align_to = ALIGNOF(xcb_bool32_t);
    }
    if(value_mask & XCB_CW_EVENT_MASK) {
        /* xcb_screensaver_set_attributes_value_list_t.event_mask */
        xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->event_mask;
        xcb_block_len += sizeof(uint32_t);
        xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
        xcb_parts_idx++;
        xcb_align_to = ALIGNOF(uint32_t);
    }
    if(value_mask & XCB_CW_DONT_PROPAGATE) {
        /* xcb_screensaver_set_attributes_value_list_t.do_not_propogate_mask */
        xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->do_not_propogate_mask;
        xcb_block_len += sizeof(uint32_t);
        xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
        xcb_parts_idx++;
        xcb_align_to = ALIGNOF(uint32_t);
    }
    if(value_mask & XCB_CW_COLORMAP) {
        /* xcb_screensaver_set_attributes_value_list_t.colormap */
        xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->colormap;
        xcb_block_len += sizeof(xcb_colormap_t);
        xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_colormap_t);
        xcb_parts_idx++;
        xcb_align_to = ALIGNOF(xcb_colormap_t);
    }
    if(value_mask & XCB_CW_CURSOR) {
        /* xcb_screensaver_set_attributes_value_list_t.cursor */
        xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->cursor;
        xcb_block_len += sizeof(xcb_cursor_t);
        xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_cursor_t);
        xcb_parts_idx++;
        xcb_align_to = ALIGNOF(xcb_cursor_t);
    }
    /* insert padding */
    xcb_pad = -(xcb_block_len + xcb_padding_offset) & (xcb_align_to - 1);
    xcb_buffer_len += xcb_block_len + xcb_pad;
    if (0 != xcb_pad) {
        xcb_parts[xcb_parts_idx].iov_base = xcb_pad0;
        xcb_parts[xcb_parts_idx].iov_len = xcb_pad;
        xcb_parts_idx++;
        xcb_pad = 0;
    }
    xcb_block_len = 0;
    xcb_padding_offset = 0;

    if (NULL == xcb_out) {
        /* allocate memory */
        xcb_out = malloc(xcb_buffer_len);
        *_buffer = xcb_out;
    }

    xcb_tmp = xcb_out;
    for(i=0; i<xcb_parts_idx; i++) {
        if (0 != xcb_parts[i].iov_base && 0 != xcb_parts[i].iov_len)
            memcpy(xcb_tmp, xcb_parts[i].iov_base, xcb_parts[i].iov_len);
        if (0 != xcb_parts[i].iov_len)
            xcb_tmp += xcb_parts[i].iov_len;
    }

    return xcb_buffer_len;
}

int
xcb_screensaver_set_attributes_value_list_unpack (const void                                   *_buffer,
                                                  uint32_t                                      value_mask,
                                                  xcb_screensaver_set_attributes_value_list_t  *_aux)
{
    char *xcb_tmp = (char *)_buffer;
    unsigned int xcb_buffer_len = 0;
    unsigned int xcb_block_len = 0;
    unsigned int xcb_pad = 0;
    unsigned int xcb_align_to = 0;
    unsigned int xcb_padding_offset = 0;


    if(value_mask & XCB_CW_BACK_PIXMAP) {
        /* xcb_screensaver_set_attributes_value_list_t.background_pixmap */
        _aux->background_pixmap = *(xcb_pixmap_t *)xcb_tmp;
        xcb_block_len += sizeof(xcb_pixmap_t);
        xcb_tmp += sizeof(xcb_pixmap_t);
        xcb_align_to = ALIGNOF(xcb_pixmap_t);
    }
    if(value_mask & XCB_CW_BACK_PIXEL) {
        /* xcb_screensaver_set_attributes_value_list_t.background_pixel */
        _aux->background_pixel = *(uint32_t *)xcb_tmp;
        xcb_block_len += sizeof(uint32_t);
        xcb_tmp += sizeof(uint32_t);
        xcb_align_to = ALIGNOF(uint32_t);
    }
    if(value_mask & XCB_CW_BORDER_PIXMAP) {
        /* xcb_screensaver_set_attributes_value_list_t.border_pixmap */
        _aux->border_pixmap = *(xcb_pixmap_t *)xcb_tmp;
        xcb_block_len += sizeof(xcb_pixmap_t);
        xcb_tmp += sizeof(xcb_pixmap_t);
        xcb_align_to = ALIGNOF(xcb_pixmap_t);
    }
    if(value_mask & XCB_CW_BORDER_PIXEL) {
        /* xcb_screensaver_set_attributes_value_list_t.border_pixel */
        _aux->border_pixel = *(uint32_t *)xcb_tmp;
        xcb_block_len += sizeof(uint32_t);
        xcb_tmp += sizeof(uint32_t);
        xcb_align_to = ALIGNOF(uint32_t);
    }
    if(value_mask & XCB_CW_BIT_GRAVITY) {
        /* xcb_screensaver_set_attributes_value_list_t.bit_gravity */
        _aux->bit_gravity = *(uint32_t *)xcb_tmp;
        xcb_block_len += sizeof(uint32_t);
        xcb_tmp += sizeof(uint32_t);
        xcb_align_to = ALIGNOF(uint32_t);
    }
    if(value_mask & XCB_CW_WIN_GRAVITY) {
        /* xcb_screensaver_set_attributes_value_list_t.win_gravity */
        _aux->win_gravity = *(uint32_t *)xcb_tmp;
        xcb_block_len += sizeof(uint32_t);
        xcb_tmp += sizeof(uint32_t);
        xcb_align_to = ALIGNOF(uint32_t);
    }
    if(value_mask & XCB_CW_BACKING_STORE) {
        /* xcb_screensaver_set_attributes_value_list_t.backing_store */
        _aux->backing_store = *(uint32_t *)xcb_tmp;
        xcb_block_len += sizeof(uint32_t);
        xcb_tmp += sizeof(uint32_t);
        xcb_align_to = ALIGNOF(uint32_t);
    }
    if(value_mask & XCB_CW_BACKING_PLANES) {
        /* xcb_screensaver_set_attributes_value_list_t.backing_planes */
        _aux->backing_planes = *(uint32_t *)xcb_tmp;
        xcb_block_len += sizeof(uint32_t);
        xcb_tmp += sizeof(uint32_t);
        xcb_align_to = ALIGNOF(uint32_t);
    }
    if(value_mask & XCB_CW_BACKING_PIXEL) {
        /* xcb_screensaver_set_attributes_value_list_t.backing_pixel */
        _aux->backing_pixel = *(uint32_t *)xcb_tmp;
        xcb_block_len += sizeof(uint32_t);
        xcb_tmp += sizeof(uint32_t);
        xcb_align_to = ALIGNOF(uint32_t);
    }
    if(value_mask & XCB_CW_OVERRIDE_REDIRECT) {
        /* xcb_screensaver_set_attributes_value_list_t.override_redirect */
        _aux->override_redirect = *(xcb_bool32_t *)xcb_tmp;
        xcb_block_len += sizeof(xcb_bool32_t);
        xcb_tmp += sizeof(xcb_bool32_t);
        xcb_align_to = ALIGNOF(xcb_bool32_t);
    }
    if(value_mask & XCB_CW_SAVE_UNDER) {
        /* xcb_screensaver_set_attributes_value_list_t.save_under */
        _aux->save_under = *(xcb_bool32_t *)xcb_tmp;
        xcb_block_len += sizeof(xcb_bool32_t);
        xcb_tmp += sizeof(xcb_bool32_t);
        xcb_align_to = ALIGNOF(xcb_bool32_t);
    }
    if(value_mask & XCB_CW_EVENT_MASK) {
        /* xcb_screensaver_set_attributes_value_list_t.event_mask */
        _aux->event_mask = *(uint32_t *)xcb_tmp;
        xcb_block_len += sizeof(uint32_t);
        xcb_tmp += sizeof(uint32_t);
        xcb_align_to = ALIGNOF(uint32_t);
    }
    if(value_mask & XCB_CW_DONT_PROPAGATE) {
        /* xcb_screensaver_set_attributes_value_list_t.do_not_propogate_mask */
        _aux->do_not_propogate_mask = *(uint32_t *)xcb_tmp;
        xcb_block_len += sizeof(uint32_t);
        xcb_tmp += sizeof(uint32_t);
        xcb_align_to = ALIGNOF(uint32_t);
    }
    if(value_mask & XCB_CW_COLORMAP) {
        /* xcb_screensaver_set_attributes_value_list_t.colormap */
        _aux->colormap = *(xcb_colormap_t *)xcb_tmp;
        xcb_block_len += sizeof(xcb_colormap_t);
        xcb_tmp += sizeof(xcb_colormap_t);
        xcb_align_to = ALIGNOF(xcb_colormap_t);
    }
    if(value_mask & XCB_CW_CURSOR) {
        /* xcb_screensaver_set_attributes_value_list_t.cursor */
        _aux->cursor = *(xcb_cursor_t *)xcb_tmp;
        xcb_block_len += sizeof(xcb_cursor_t);
        xcb_tmp += sizeof(xcb_cursor_t);
        xcb_align_to = ALIGNOF(xcb_cursor_t);
    }
    /* insert padding */
    xcb_pad = -(xcb_block_len + xcb_padding_offset) & (xcb_align_to - 1);
    xcb_buffer_len += xcb_block_len + xcb_pad;
    if (0 != xcb_pad) {
        xcb_tmp += xcb_pad;
        xcb_pad = 0;
    }
    xcb_block_len = 0;
    xcb_padding_offset = 0;

    return xcb_buffer_len;
}

int
xcb_screensaver_set_attributes_value_list_sizeof (const void  *_buffer,
                                                  uint32_t     value_mask)
{
    xcb_screensaver_set_attributes_value_list_t _aux;
    return xcb_screensaver_set_attributes_value_list_unpack(_buffer, value_mask, &_aux);
}

int
xcb_screensaver_set_attributes_sizeof (const void  *_buffer)
{
    char *xcb_tmp = (char *)_buffer;
    const xcb_screensaver_set_attributes_request_t *_aux = (xcb_screensaver_set_attributes_request_t *)_buffer;
    unsigned int xcb_buffer_len = 0;
    unsigned int xcb_block_len = 0;
    unsigned int xcb_pad = 0;
    unsigned int xcb_align_to = 0;


    xcb_block_len += sizeof(xcb_screensaver_set_attributes_request_t);
    xcb_tmp += xcb_block_len;
    xcb_buffer_len += xcb_block_len;
    xcb_block_len = 0;
    /* value_list */
    xcb_block_len += xcb_screensaver_set_attributes_value_list_sizeof(xcb_tmp, _aux->value_mask);
    xcb_tmp += xcb_block_len;
    xcb_align_to = ALIGNOF(char);
    /* insert padding */
    xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    xcb_buffer_len += xcb_block_len + xcb_pad;
    if (0 != xcb_pad) {
        xcb_tmp += xcb_pad;
        xcb_pad = 0;
    }
    xcb_block_len = 0;

    return xcb_buffer_len;
}

xcb_void_cookie_t
xcb_screensaver_set_attributes_checked (xcb_connection_t *c,
                                        xcb_drawable_t    drawable,
                                        int16_t           x,
                                        int16_t           y,
                                        uint16_t          width,
                                        uint16_t          height,
                                        uint16_t          border_width,
                                        uint8_t           _class,
                                        uint8_t           depth,
                                        xcb_visualid_t    visual,
                                        uint32_t          value_mask,
                                        const void       *value_list)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 3,
        .ext = &xcb_screensaver_id,
        .opcode = XCB_SCREENSAVER_SET_ATTRIBUTES,
        .isvoid = 1
    };

    struct iovec xcb_parts[5];
    xcb_void_cookie_t xcb_ret;
    xcb_screensaver_set_attributes_request_t xcb_out;

    xcb_out.drawable = drawable;
    xcb_out.x = x;
    xcb_out.y = y;
    xcb_out.width = width;
    xcb_out.height = height;
    xcb_out.border_width = border_width;
    xcb_out._class = _class;
    xcb_out.depth = depth;
    xcb_out.visual = visual;
    xcb_out.value_mask = value_mask;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    /* xcb_screensaver_set_attributes_value_list_t value_list */
    xcb_parts[4].iov_base = (char *) value_list;
    xcb_parts[4].iov_len =
      xcb_screensaver_set_attributes_value_list_sizeof (value_list, value_mask);

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_screensaver_set_attributes (xcb_connection_t *c,
                                xcb_drawable_t    drawable,
                                int16_t           x,
                                int16_t           y,
                                uint16_t          width,
                                uint16_t          height,
                                uint16_t          border_width,
                                uint8_t           _class,
                                uint8_t           depth,
                                xcb_visualid_t    visual,
                                uint32_t          value_mask,
                                const void       *value_list)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 3,
        .ext = &xcb_screensaver_id,
        .opcode = XCB_SCREENSAVER_SET_ATTRIBUTES,
        .isvoid = 1
    };

    struct iovec xcb_parts[5];
    xcb_void_cookie_t xcb_ret;
    xcb_screensaver_set_attributes_request_t xcb_out;

    xcb_out.drawable = drawable;
    xcb_out.x = x;
    xcb_out.y = y;
    xcb_out.width = width;
    xcb_out.height = height;
    xcb_out.border_width = border_width;
    xcb_out._class = _class;
    xcb_out.depth = depth;
    xcb_out.visual = visual;
    xcb_out.value_mask = value_mask;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    /* xcb_screensaver_set_attributes_value_list_t value_list */
    xcb_parts[4].iov_base = (char *) value_list;
    xcb_parts[4].iov_len =
      xcb_screensaver_set_attributes_value_list_sizeof (value_list, value_mask);

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_screensaver_set_attributes_aux_checked (xcb_connection_t                                  *c,
                                            xcb_drawable_t                                     drawable,
                                            int16_t                                            x,
                                            int16_t                                            y,
                                            uint16_t                                           width,
                                            uint16_t                                           height,
                                            uint16_t                                           border_width,
                                            uint8_t                                            _class,
                                            uint8_t                                            depth,
                                            xcb_visualid_t                                     visual,
                                            uint32_t                                           value_mask,
                                            const xcb_screensaver_set_attributes_value_list_t *value_list)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 3,
        .ext = &xcb_screensaver_id,
        .opcode = XCB_SCREENSAVER_SET_ATTRIBUTES,
        .isvoid = 1
    };

    struct iovec xcb_parts[5];
    xcb_void_cookie_t xcb_ret;
    xcb_screensaver_set_attributes_request_t xcb_out;
    void *xcb_aux0 = 0;

    xcb_out.drawable = drawable;
    xcb_out.x = x;
    xcb_out.y = y;
    xcb_out.width = width;
    xcb_out.height = height;
    xcb_out.border_width = border_width;
    xcb_out._class = _class;
    xcb_out.depth = depth;
    xcb_out.visual = visual;
    xcb_out.value_mask = value_mask;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    /* xcb_screensaver_set_attributes_value_list_t value_list */
    xcb_parts[4].iov_len =
      xcb_screensaver_set_attributes_value_list_serialize (&xcb_aux0, value_mask, value_list);
    xcb_parts[4].iov_base = xcb_aux0;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    free(xcb_aux0);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_screensaver_set_attributes_aux (xcb_connection_t                                  *c,
                                    xcb_drawable_t                                     drawable,
                                    int16_t                                            x,
                                    int16_t                                            y,
                                    uint16_t                                           width,
                                    uint16_t                                           height,
                                    uint16_t                                           border_width,
                                    uint8_t                                            _class,
                                    uint8_t                                            depth,
                                    xcb_visualid_t                                     visual,
                                    uint32_t                                           value_mask,
                                    const xcb_screensaver_set_attributes_value_list_t *value_list)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 3,
        .ext = &xcb_screensaver_id,
        .opcode = XCB_SCREENSAVER_SET_ATTRIBUTES,
        .isvoid = 1
    };

    struct iovec xcb_parts[5];
    xcb_void_cookie_t xcb_ret;
    xcb_screensaver_set_attributes_request_t xcb_out;
    void *xcb_aux0 = 0;

    xcb_out.drawable = drawable;
    xcb_out.x = x;
    xcb_out.y = y;
    xcb_out.width = width;
    xcb_out.height = height;
    xcb_out.border_width = border_width;
    xcb_out._class = _class;
    xcb_out.depth = depth;
    xcb_out.visual = visual;
    xcb_out.value_mask = value_mask;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    /* xcb_screensaver_set_attributes_value_list_t value_list */
    xcb_parts[4].iov_len =
      xcb_screensaver_set_attributes_value_list_serialize (&xcb_aux0, value_mask, value_list);
    xcb_parts[4].iov_base = xcb_aux0;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    free(xcb_aux0);
    return xcb_ret;
}

void *
xcb_screensaver_set_attributes_value_list (const xcb_screensaver_set_attributes_request_t *R)
{
    return (void *) (R + 1);
}

xcb_void_cookie_t
xcb_screensaver_unset_attributes_checked (xcb_connection_t *c,
                                          xcb_drawable_t    drawable)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_screensaver_id,
        .opcode = XCB_SCREENSAVER_UNSET_ATTRIBUTES,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_screensaver_unset_attributes_request_t xcb_out;

    xcb_out.drawable = drawable;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_screensaver_unset_attributes (xcb_connection_t *c,
                                  xcb_drawable_t    drawable)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_screensaver_id,
        .opcode = XCB_SCREENSAVER_UNSET_ATTRIBUTES,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_screensaver_unset_attributes_request_t xcb_out;

    xcb_out.drawable = drawable;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_screensaver_suspend_checked (xcb_connection_t *c,
                                 uint8_t           suspend)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_screensaver_id,
        .opcode = XCB_SCREENSAVER_SUSPEND,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_screensaver_suspend_request_t xcb_out;

    xcb_out.suspend = suspend;
    memset(xcb_out.pad0, 0, 3);

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_screensaver_suspend (xcb_connection_t *c,
                         uint8_t           suspend)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_screensaver_id,
        .opcode = XCB_SCREENSAVER_SUSPEND,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_screensaver_suspend_request_t xcb_out;

    xcb_out.suspend = suspend;
    memset(xcb_out.pad0, 0, 3);

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}
Exemplo n.º 16
0
xcb_xinerama_query_version_cookie_t
xcb_xinerama_query_version (xcb_connection_t *c,
                            uint8_t           major,
                            uint8_t           minor)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_xinerama_id,
        .opcode = XCB_XINERAMA_QUERY_VERSION,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_xinerama_query_version_cookie_t xcb_ret;
    xcb_xinerama_query_version_request_t xcb_out;

    xcb_out.major = major;
    xcb_out.minor = minor;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_xinerama_query_version_cookie_t
xcb_xinerama_query_version_unchecked (xcb_connection_t *c,
                                      uint8_t           major,
                                      uint8_t           minor)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_xinerama_id,
        .opcode = XCB_XINERAMA_QUERY_VERSION,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_xinerama_query_version_cookie_t xcb_ret;
    xcb_xinerama_query_version_request_t xcb_out;

    xcb_out.major = major;
    xcb_out.minor = minor;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_xinerama_query_version_reply_t *
xcb_xinerama_query_version_reply (xcb_connection_t                     *c,
                                  xcb_xinerama_query_version_cookie_t   cookie  /**< */,
                                  xcb_generic_error_t                 **e)
{
    return (xcb_xinerama_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}

xcb_xinerama_get_state_cookie_t
xcb_xinerama_get_state (xcb_connection_t *c,
                        xcb_window_t      window)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_xinerama_id,
        .opcode = XCB_XINERAMA_GET_STATE,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_xinerama_get_state_cookie_t xcb_ret;
    xcb_xinerama_get_state_request_t xcb_out;

    xcb_out.window = window;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_xinerama_get_state_cookie_t
xcb_xinerama_get_state_unchecked (xcb_connection_t *c,
                                  xcb_window_t      window)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_xinerama_id,
        .opcode = XCB_XINERAMA_GET_STATE,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_xinerama_get_state_cookie_t xcb_ret;
    xcb_xinerama_get_state_request_t xcb_out;

    xcb_out.window = window;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_xinerama_get_state_reply_t *
xcb_xinerama_get_state_reply (xcb_connection_t                 *c,
                              xcb_xinerama_get_state_cookie_t   cookie  /**< */,
                              xcb_generic_error_t             **e)
{
    return (xcb_xinerama_get_state_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}

xcb_xinerama_get_screen_count_cookie_t
xcb_xinerama_get_screen_count (xcb_connection_t *c,
                               xcb_window_t      window)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_xinerama_id,
        .opcode = XCB_XINERAMA_GET_SCREEN_COUNT,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_xinerama_get_screen_count_cookie_t xcb_ret;
    xcb_xinerama_get_screen_count_request_t xcb_out;

    xcb_out.window = window;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_xinerama_get_screen_count_cookie_t
xcb_xinerama_get_screen_count_unchecked (xcb_connection_t *c,
                                         xcb_window_t      window)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_xinerama_id,
        .opcode = XCB_XINERAMA_GET_SCREEN_COUNT,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_xinerama_get_screen_count_cookie_t xcb_ret;
    xcb_xinerama_get_screen_count_request_t xcb_out;

    xcb_out.window = window;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_xinerama_get_screen_count_reply_t *
xcb_xinerama_get_screen_count_reply (xcb_connection_t                        *c,
                                     xcb_xinerama_get_screen_count_cookie_t   cookie  /**< */,
                                     xcb_generic_error_t                    **e)
{
    return (xcb_xinerama_get_screen_count_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}

xcb_xinerama_get_screen_size_cookie_t
xcb_xinerama_get_screen_size (xcb_connection_t *c,
                              xcb_window_t      window,
                              uint32_t          screen)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_xinerama_id,
        .opcode = XCB_XINERAMA_GET_SCREEN_SIZE,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_xinerama_get_screen_size_cookie_t xcb_ret;
    xcb_xinerama_get_screen_size_request_t xcb_out;

    xcb_out.window = window;
    xcb_out.screen = screen;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_xinerama_get_screen_size_cookie_t
xcb_xinerama_get_screen_size_unchecked (xcb_connection_t *c,
                                        xcb_window_t      window,
                                        uint32_t          screen)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_xinerama_id,
        .opcode = XCB_XINERAMA_GET_SCREEN_SIZE,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_xinerama_get_screen_size_cookie_t xcb_ret;
    xcb_xinerama_get_screen_size_request_t xcb_out;

    xcb_out.window = window;
    xcb_out.screen = screen;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_xinerama_get_screen_size_reply_t *
xcb_xinerama_get_screen_size_reply (xcb_connection_t                       *c,
                                    xcb_xinerama_get_screen_size_cookie_t   cookie  /**< */,
                                    xcb_generic_error_t                   **e)
{
    return (xcb_xinerama_get_screen_size_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}

xcb_xinerama_is_active_cookie_t
xcb_xinerama_is_active (xcb_connection_t *c)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_xinerama_id,
        .opcode = XCB_XINERAMA_IS_ACTIVE,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_xinerama_is_active_cookie_t xcb_ret;
    xcb_xinerama_is_active_request_t xcb_out;


    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_xinerama_is_active_cookie_t
xcb_xinerama_is_active_unchecked (xcb_connection_t *c)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_xinerama_id,
        .opcode = XCB_XINERAMA_IS_ACTIVE,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_xinerama_is_active_cookie_t xcb_ret;
    xcb_xinerama_is_active_request_t xcb_out;


    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_xinerama_is_active_reply_t *
xcb_xinerama_is_active_reply (xcb_connection_t                 *c,
                              xcb_xinerama_is_active_cookie_t   cookie  /**< */,
                              xcb_generic_error_t             **e)
{
    return (xcb_xinerama_is_active_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}

int
xcb_xinerama_query_screens_sizeof (const void  *_buffer)
{
    char *xcb_tmp = (char *)_buffer;
    const xcb_xinerama_query_screens_reply_t *_aux = (xcb_xinerama_query_screens_reply_t *)_buffer;
    unsigned int xcb_buffer_len = 0;
    unsigned int xcb_block_len = 0;
    unsigned int xcb_pad = 0;
    unsigned int xcb_align_to = 0;


    xcb_block_len += sizeof(xcb_xinerama_query_screens_reply_t);
    xcb_tmp += xcb_block_len;
    xcb_buffer_len += xcb_block_len;
    xcb_block_len = 0;
    /* screen_info */
    xcb_block_len += _aux->number * sizeof(xcb_xinerama_screen_info_t);
    xcb_tmp += xcb_block_len;
    xcb_align_to = ALIGNOF(xcb_xinerama_screen_info_t);
    /* insert padding */
    xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    xcb_buffer_len += xcb_block_len + xcb_pad;
    if (0 != xcb_pad) {
        xcb_tmp += xcb_pad;
        xcb_pad = 0;
    }
    xcb_block_len = 0;

    return xcb_buffer_len;
}

xcb_xinerama_query_screens_cookie_t
xcb_xinerama_query_screens (xcb_connection_t *c)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_xinerama_id,
        .opcode = XCB_XINERAMA_QUERY_SCREENS,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_xinerama_query_screens_cookie_t xcb_ret;
    xcb_xinerama_query_screens_request_t xcb_out;


    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_xinerama_query_screens_cookie_t
xcb_xinerama_query_screens_unchecked (xcb_connection_t *c)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_xinerama_id,
        .opcode = XCB_XINERAMA_QUERY_SCREENS,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_xinerama_query_screens_cookie_t xcb_ret;
    xcb_xinerama_query_screens_request_t xcb_out;


    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_xinerama_screen_info_t *
xcb_xinerama_query_screens_screen_info (const xcb_xinerama_query_screens_reply_t *R)
{
    return (xcb_xinerama_screen_info_t *) (R + 1);
}

int
xcb_xinerama_query_screens_screen_info_length (const xcb_xinerama_query_screens_reply_t *R)
{
    return R->number;
}

xcb_xinerama_screen_info_iterator_t
xcb_xinerama_query_screens_screen_info_iterator (const xcb_xinerama_query_screens_reply_t *R)
{
    xcb_xinerama_screen_info_iterator_t i;
    i.data = (xcb_xinerama_screen_info_t *) (R + 1);
    i.rem = R->number;
    i.index = (char *) i.data - (char *) R;
    return i;
}

xcb_xinerama_query_screens_reply_t *
xcb_xinerama_query_screens_reply (xcb_connection_t                     *c,
                                  xcb_xinerama_query_screens_cookie_t   cookie  /**< */,
                                  xcb_generic_error_t                 **e)
{
    return (xcb_xinerama_query_screens_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}
Exemplo n.º 17
0
xcb_present_query_version_cookie_t
xcb_present_query_version (xcb_connection_t *c,
                           uint32_t          major_version,
                           uint32_t          minor_version)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_present_id,
        .opcode = XCB_PRESENT_QUERY_VERSION,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_present_query_version_cookie_t xcb_ret;
    xcb_present_query_version_request_t xcb_out;

    xcb_out.major_version = major_version;
    xcb_out.minor_version = minor_version;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_present_query_version_cookie_t
xcb_present_query_version_unchecked (xcb_connection_t *c,
                                     uint32_t          major_version,
                                     uint32_t          minor_version)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_present_id,
        .opcode = XCB_PRESENT_QUERY_VERSION,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_present_query_version_cookie_t xcb_ret;
    xcb_present_query_version_request_t xcb_out;

    xcb_out.major_version = major_version;
    xcb_out.minor_version = minor_version;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_present_query_version_reply_t *
xcb_present_query_version_reply (xcb_connection_t                    *c,
                                 xcb_present_query_version_cookie_t   cookie  /**< */,
                                 xcb_generic_error_t                **e)
{
    return (xcb_present_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}

int
xcb_present_pixmap_sizeof (const void  *_buffer,
                           uint32_t     notifies_len)
{
    char *xcb_tmp = (char *)_buffer;
    unsigned int xcb_buffer_len = 0;
    unsigned int xcb_block_len = 0;
    unsigned int xcb_pad = 0;
    unsigned int xcb_align_to = 0;


    xcb_block_len += sizeof(xcb_present_pixmap_request_t);
    xcb_tmp += xcb_block_len;
    xcb_buffer_len += xcb_block_len;
    xcb_block_len = 0;
    /* notifies */
    xcb_block_len += notifies_len * sizeof(xcb_present_notify_t);
    xcb_tmp += xcb_block_len;
    xcb_align_to = ALIGNOF(xcb_present_notify_t);
    /* insert padding */
    xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    xcb_buffer_len += xcb_block_len + xcb_pad;
    if (0 != xcb_pad) {
        xcb_tmp += xcb_pad;
        xcb_pad = 0;
    }
    xcb_block_len = 0;

    return xcb_buffer_len;
}

xcb_void_cookie_t
xcb_present_pixmap_checked (xcb_connection_t           *c,
                            xcb_window_t                window,
                            xcb_pixmap_t                pixmap,
                            uint32_t                    serial,
                            xcb_xfixes_region_t         valid,
                            xcb_xfixes_region_t         update,
                            int16_t                     x_off,
                            int16_t                     y_off,
                            xcb_randr_crtc_t            target_crtc,
                            xcb_sync_fence_t            wait_fence,
                            xcb_sync_fence_t            idle_fence,
                            uint32_t                    options,
                            uint64_t                    target_msc,
                            uint64_t                    divisor,
                            uint64_t                    remainder,
                            uint32_t                    notifies_len,
                            const xcb_present_notify_t *notifies)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 4,
        .ext = &xcb_present_id,
        .opcode = XCB_PRESENT_PIXMAP,
        .isvoid = 1
    };

    struct iovec xcb_parts[6];
    xcb_void_cookie_t xcb_ret;
    xcb_present_pixmap_request_t xcb_out;

    xcb_out.window = window;
    xcb_out.pixmap = pixmap;
    xcb_out.serial = serial;
    xcb_out.valid = valid;
    xcb_out.update = update;
    xcb_out.x_off = x_off;
    xcb_out.y_off = y_off;
    xcb_out.target_crtc = target_crtc;
    xcb_out.wait_fence = wait_fence;
    xcb_out.idle_fence = idle_fence;
    xcb_out.options = options;
    memset(xcb_out.pad0, 0, 4);
    xcb_out.target_msc = target_msc;
    xcb_out.divisor = divisor;
    xcb_out.remainder = remainder;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    /* xcb_present_notify_t notifies */
    xcb_parts[4].iov_base = (char *) notifies;
    xcb_parts[4].iov_len = notifies_len * sizeof(xcb_present_notify_t);
    xcb_parts[5].iov_base = 0;
    xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_present_pixmap (xcb_connection_t           *c,
                    xcb_window_t                window,
                    xcb_pixmap_t                pixmap,
                    uint32_t                    serial,
                    xcb_xfixes_region_t         valid,
                    xcb_xfixes_region_t         update,
                    int16_t                     x_off,
                    int16_t                     y_off,
                    xcb_randr_crtc_t            target_crtc,
                    xcb_sync_fence_t            wait_fence,
                    xcb_sync_fence_t            idle_fence,
                    uint32_t                    options,
                    uint64_t                    target_msc,
                    uint64_t                    divisor,
                    uint64_t                    remainder,
                    uint32_t                    notifies_len,
                    const xcb_present_notify_t *notifies)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 4,
        .ext = &xcb_present_id,
        .opcode = XCB_PRESENT_PIXMAP,
        .isvoid = 1
    };

    struct iovec xcb_parts[6];
    xcb_void_cookie_t xcb_ret;
    xcb_present_pixmap_request_t xcb_out;

    xcb_out.window = window;
    xcb_out.pixmap = pixmap;
    xcb_out.serial = serial;
    xcb_out.valid = valid;
    xcb_out.update = update;
    xcb_out.x_off = x_off;
    xcb_out.y_off = y_off;
    xcb_out.target_crtc = target_crtc;
    xcb_out.wait_fence = wait_fence;
    xcb_out.idle_fence = idle_fence;
    xcb_out.options = options;
    memset(xcb_out.pad0, 0, 4);
    xcb_out.target_msc = target_msc;
    xcb_out.divisor = divisor;
    xcb_out.remainder = remainder;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    /* xcb_present_notify_t notifies */
    xcb_parts[4].iov_base = (char *) notifies;
    xcb_parts[4].iov_len = notifies_len * sizeof(xcb_present_notify_t);
    xcb_parts[5].iov_base = 0;
    xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_present_notify_t *
xcb_present_pixmap_notifies (const xcb_present_pixmap_request_t *R)
{
    return (xcb_present_notify_t *) (R + 1);
}

int
xcb_present_pixmap_notifies_length (const xcb_present_pixmap_request_t *R)
{
    return (((R->length * 4) - sizeof(xcb_present_pixmap_request_t))/sizeof(xcb_present_notify_t));
}

xcb_present_notify_iterator_t
xcb_present_pixmap_notifies_iterator (const xcb_present_pixmap_request_t *R)
{
    xcb_present_notify_iterator_t i;
    i.data = (xcb_present_notify_t *) (R + 1);
    i.rem = (((R->length * 4) - sizeof(xcb_present_pixmap_request_t))/sizeof(xcb_present_notify_t));
    i.index = (char *) i.data - (char *) R;
    return i;
}

xcb_void_cookie_t
xcb_present_notify_msc_checked (xcb_connection_t *c,
                                xcb_window_t      window,
                                uint32_t          serial,
                                uint64_t          target_msc,
                                uint64_t          divisor,
                                uint64_t          remainder)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_present_id,
        .opcode = XCB_PRESENT_NOTIFY_MSC,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_present_notify_msc_request_t xcb_out;

    xcb_out.window = window;
    xcb_out.serial = serial;
    memset(xcb_out.pad0, 0, 4);
    xcb_out.target_msc = target_msc;
    xcb_out.divisor = divisor;
    xcb_out.remainder = remainder;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_present_notify_msc (xcb_connection_t *c,
                        xcb_window_t      window,
                        uint32_t          serial,
                        uint64_t          target_msc,
                        uint64_t          divisor,
                        uint64_t          remainder)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_present_id,
        .opcode = XCB_PRESENT_NOTIFY_MSC,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_present_notify_msc_request_t xcb_out;

    xcb_out.window = window;
    xcb_out.serial = serial;
    memset(xcb_out.pad0, 0, 4);
    xcb_out.target_msc = target_msc;
    xcb_out.divisor = divisor;
    xcb_out.remainder = remainder;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

void
xcb_present_event_next (xcb_present_event_iterator_t *i)
{
    --i->rem;
    ++i->data;
    i->index += sizeof(xcb_present_event_t);
}

xcb_generic_iterator_t
xcb_present_event_end (xcb_present_event_iterator_t i)
{
    xcb_generic_iterator_t ret;
    ret.data = i.data + i.rem;
    ret.index = i.index + ((char *) ret.data - (char *) i.data);
    ret.rem = 0;
    return ret;
}

xcb_void_cookie_t
xcb_present_select_input_checked (xcb_connection_t    *c,
                                  xcb_present_event_t  eid,
                                  xcb_window_t         window,
                                  uint32_t             event_mask)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_present_id,
        .opcode = XCB_PRESENT_SELECT_INPUT,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_present_select_input_request_t xcb_out;

    xcb_out.eid = eid;
    xcb_out.window = window;
    xcb_out.event_mask = event_mask;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_void_cookie_t
xcb_present_select_input (xcb_connection_t    *c,
                          xcb_present_event_t  eid,
                          xcb_window_t         window,
                          uint32_t             event_mask)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_present_id,
        .opcode = XCB_PRESENT_SELECT_INPUT,
        .isvoid = 1
    };

    struct iovec xcb_parts[4];
    xcb_void_cookie_t xcb_ret;
    xcb_present_select_input_request_t xcb_out;

    xcb_out.eid = eid;
    xcb_out.window = window;
    xcb_out.event_mask = event_mask;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_present_query_capabilities_cookie_t
xcb_present_query_capabilities (xcb_connection_t *c,
                                uint32_t          target)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_present_id,
        .opcode = XCB_PRESENT_QUERY_CAPABILITIES,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_present_query_capabilities_cookie_t xcb_ret;
    xcb_present_query_capabilities_request_t xcb_out;

    xcb_out.target = target;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_present_query_capabilities_cookie_t
xcb_present_query_capabilities_unchecked (xcb_connection_t *c,
                                          uint32_t          target)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 2,
        .ext = &xcb_present_id,
        .opcode = XCB_PRESENT_QUERY_CAPABILITIES,
        .isvoid = 0
    };

    struct iovec xcb_parts[4];
    xcb_present_query_capabilities_cookie_t xcb_ret;
    xcb_present_query_capabilities_request_t xcb_out;

    xcb_out.target = target;

    xcb_parts[2].iov_base = (char *) &xcb_out;
    xcb_parts[2].iov_len = sizeof(xcb_out);
    xcb_parts[3].iov_base = 0;
    xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;

    xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    return xcb_ret;
}

xcb_present_query_capabilities_reply_t *
xcb_present_query_capabilities_reply (xcb_connection_t                         *c,
                                      xcb_present_query_capabilities_cookie_t   cookie  /**< */,
                                      xcb_generic_error_t                     **e)
{
    return (xcb_present_query_capabilities_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
}

int
xcb_present_redirect_notify_sizeof (const void  *_buffer,
                                    uint32_t     notifies_len)
{
    char *xcb_tmp = (char *)_buffer;
    unsigned int xcb_buffer_len = 0;
    unsigned int xcb_block_len = 0;
    unsigned int xcb_pad = 0;
    unsigned int xcb_align_to = 0;


    xcb_block_len += sizeof(xcb_present_redirect_notify_event_t);
    xcb_tmp += xcb_block_len;
    xcb_buffer_len += xcb_block_len;
    xcb_block_len = 0;
    /* notifies */
    xcb_block_len += notifies_len * sizeof(xcb_present_notify_t);
    xcb_tmp += xcb_block_len;
    xcb_align_to = ALIGNOF(xcb_present_notify_t);
    /* insert padding */
    xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    xcb_buffer_len += xcb_block_len + xcb_pad;
    if (0 != xcb_pad) {
        xcb_tmp += xcb_pad;
        xcb_pad = 0;
    }
    xcb_block_len = 0;

    return xcb_buffer_len;
}

xcb_present_notify_t *
xcb_present_redirect_notify_notifies (const xcb_present_redirect_notify_event_t *R)
{
    return (xcb_present_notify_t *) (R + 1);
}

int
xcb_present_redirect_notify_notifies_length (const xcb_present_redirect_notify_event_t *R)
{
    return (((R->length * 4) - sizeof(xcb_present_redirect_notify_event_t))/sizeof(xcb_present_notify_t));
}

xcb_present_notify_iterator_t
xcb_present_redirect_notify_notifies_iterator (const xcb_present_redirect_notify_event_t *R)
{
    xcb_present_notify_iterator_t i;
    i.data = (xcb_present_notify_t *) (R + 1);
    i.rem = (((R->length * 4) - sizeof(xcb_present_redirect_notify_event_t))/sizeof(xcb_present_notify_t));
    i.index = (char *) i.data - (char *) R;
    return i;
}