[Xcb] Where can I find the implementation of the function xcb_image_text_8

Uli Schlachter psychon at znc.in
Fri Mar 10 17:06:20 UTC 2017


Hi,

On 08.03.2017 22:06, Diego Cortez wrote:
> Where can I find the implementation of the function xcb_image_text_8? And
> also that of xcb_image_text_8_checked. I've looked everyone, but can't seem
> to find it. Shouldn't it be in some file in
> https://cgit.freedesktop.org/xcb/?

When you build cairo, it takes the XML files from xcb-proto which
contain a description of the X11 protocol and translates that into C
code. So you need to actually build libxcb to get the C code.

The generated code for xcb_image_text_8 follows. The only difference to
xcb_image_text_8_checked is that the later uses XCB_REQUEST_CHECKED
instead of 0 as the second argument to xcb_send_request().

xcb_void_cookie_t
xcb_image_text_8 (xcb_connection_t *c,
                  uint8_t           string_len,
                  xcb_drawable_t    drawable,
                  xcb_gcontext_t    gc,
                  int16_t           x,
                  int16_t           y,
                  const char       *string)
{
    static const xcb_protocol_request_t xcb_req = {
        .count = 4,
        .ext = 0,
        .opcode = XCB_IMAGE_TEXT_8,
        .isvoid = 1
    };

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

    xcb_out.string_len = string_len;
    xcb_out.drawable = drawable;
    xcb_out.gc = gc;
    xcb_out.x = x;
    xcb_out.y = y;

    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;
    /* char string */
    xcb_parts[4].iov_base = (char *) string;
    xcb_parts[4].iov_len = string_len * sizeof(char);
    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;
}

Cheers,
Uli

-- 
"In the beginning the Universe was created. This has made a lot of
 people very angry and has been widely regarded as a bad move."


More information about the Xcb mailing list