diff options
Diffstat (limited to 'depends/libxcb/src')
39 files changed, 89730 insertions, 0 deletions
diff --git a/depends/libxcb/src/bigreq.c b/depends/libxcb/src/bigreq.c new file mode 100644 index 0000000..46f66ca --- /dev/null +++ b/depends/libxcb/src/bigreq.c @@ -0,0 +1,75 @@ +/* + * This file generated automatically from bigreq.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "bigreq.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) + +xcb_extension_t xcb_big_requests_id = { "BIG-REQUESTS", 0 }; + +xcb_big_requests_enable_cookie_t +xcb_big_requests_enable (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_big_requests_id, + .opcode = XCB_BIG_REQUESTS_ENABLE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_big_requests_enable_cookie_t xcb_ret; + xcb_big_requests_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_big_requests_enable_cookie_t +xcb_big_requests_enable_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_big_requests_id, + .opcode = XCB_BIG_REQUESTS_ENABLE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_big_requests_enable_cookie_t xcb_ret; + xcb_big_requests_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_big_requests_enable_reply_t * +xcb_big_requests_enable_reply (xcb_connection_t *c, + xcb_big_requests_enable_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_big_requests_enable_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + diff --git a/depends/libxcb/src/composite.c b/depends/libxcb/src/composite.c new file mode 100644 index 0000000..db3efbd --- /dev/null +++ b/depends/libxcb/src/composite.c @@ -0,0 +1,541 @@ +/* + * This file generated automatically from composite.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "composite.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) +#include "xproto.h" +#include "xfixes.h" + +xcb_extension_t xcb_composite_id = { "Composite", 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; +} + diff --git a/depends/libxcb/src/config.h b/depends/libxcb/src/config.h new file mode 100644 index 0000000..eec1c1e --- /dev/null +++ b/depends/libxcb/src/config.h @@ -0,0 +1,209 @@ +/* src/config.h. Generated from config.h.in by configure. */ +/* src/config.h.in. Generated from configure.ac by autoheader. */ + +/* Defined if GCC supports the visibility feature */ +#define GCC_HAS_VISIBILITY /**/ + +/* Has Wraphelp.c needed for XDM AUTH protocols */ +#define HASXDMAUTH 1 + +/* Define if your platform supports abstract sockets */ +#define HAVE_ABSTRACT_SOCKETS 1 + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#define HAVE_DLFCN_H 1 + +/* getaddrinfo() function is available */ +#define HAVE_GETADDRINFO 1 + +/* Define to 1 if you have the <inttypes.h> header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `is_system_labeled' function. */ +/* #undef HAVE_IS_SYSTEM_LABELED */ + +/* launchd support available */ +/* #undef HAVE_LAUNCHD */ + +/* Define to 1 if you have the `ws2_32' library (-lws2_32). */ +/* #undef HAVE_LIBWS2_32 */ + +/* Define to 1 if you have the <minix/config.h> header file. */ +/* #undef HAVE_MINIX_CONFIG_H */ + +/* Define if your platform supports sendmsg */ +#define HAVE_SENDMSG 1 + +/* Have the sockaddr_un.sun_len member. */ +/* #undef HAVE_SOCKADDR_SUN_LEN */ + +/* Define to 1 if you have the <stdint.h> header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the <stdio.h> header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the <strings.h> header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the <sys/types.h> header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the <tsol/label.h> header file. */ +/* #undef HAVE_TSOL_LABEL_H */ + +/* Define to 1 if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the <wchar.h> header file. */ +#define HAVE_WCHAR_H 1 + +/* Define if not provided by <limits.h> */ +/* #undef IOV_MAX */ + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* Name of package */ +#define PACKAGE "libxcb" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "https://gitlab.freedesktop.org/xorg/lib/libxcb/issues" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libxcb" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libxcb 1.15" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libxcb" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "1.15" + +/* Major version of this package */ +#define PACKAGE_VERSION_MAJOR 1 + +/* Minor version of this package */ +#define PACKAGE_VERSION_MINOR 15 + +/* Patch version of this package */ +#define PACKAGE_VERSION_PATCHLEVEL 0 + +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ +#define STDC_HEADERS 1 + +/* poll() function is available */ +#define USE_POLL 1 + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +/* Enable general extensions on macOS. */ +#ifndef _DARWIN_C_SOURCE +# define _DARWIN_C_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +/* Enable X/Open compliant socket functions that do not require linking + with -lxnet on HP-UX 11.11. */ +#ifndef _HPUX_ALT_XOPEN_SOCKET_API +# define _HPUX_ALT_XOPEN_SOCKET_API 1 +#endif +/* Identify the host operating system as Minix. + This macro does not affect the system headers' behavior. + A future release of Autoconf may stop defining this macro. */ +#ifndef _MINIX +/* # undef _MINIX */ +#endif +/* Enable general extensions on NetBSD. + Enable NetBSD compatibility extensions on Minix. */ +#ifndef _NETBSD_SOURCE +# define _NETBSD_SOURCE 1 +#endif +/* Enable OpenBSD compatibility extensions on NetBSD. + Oddly enough, this does nothing on OpenBSD. */ +#ifndef _OPENBSD_SOURCE +# define _OPENBSD_SOURCE 1 +#endif +/* Define to 1 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_SOURCE +/* # undef _POSIX_SOURCE */ +#endif +/* Define to 2 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_1_SOURCE +/* # undef _POSIX_1_SOURCE */ +#endif +/* Enable POSIX-compatible threading on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ +#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +# define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ +# define __STDC_WANT_IEC_60559_BFP_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ +#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ +# define __STDC_WANT_IEC_60559_DFP_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ +#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ +# define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ +#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ +# define __STDC_WANT_IEC_60559_TYPES_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ +#ifndef __STDC_WANT_LIB_EXT2__ +# define __STDC_WANT_LIB_EXT2__ 1 +#endif +/* Enable extensions specified by ISO/IEC 24747:2009. */ +#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ +# define __STDC_WANT_MATH_SPEC_FUNCS__ 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable X/Open extensions. Define to 500 only if necessary + to make mbstate_t available. */ +#ifndef _XOPEN_SOURCE +/* # undef _XOPEN_SOURCE */ +#endif + + +/* Version number of package */ +#define VERSION "1.15" + +/* XCB buffer queue size */ +#define XCB_QUEUE_BUFFER_SIZE 16384 + +/* Defined if needed to expose struct msghdr.msg_control */ +/* #undef _XOPEN_SOURCE */ diff --git a/depends/libxcb/src/damage.c b/depends/libxcb/src/damage.c new file mode 100644 index 0000000..e84a5b9 --- /dev/null +++ b/depends/libxcb/src/damage.c @@ -0,0 +1,333 @@ +/* + * This file generated automatically from damage.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "damage.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) +#include "xproto.h" +#include "xfixes.h" + +xcb_extension_t xcb_damage_id = { "DAMAGE", 0 }; + +void +xcb_damage_damage_next (xcb_damage_damage_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_damage_damage_t); +} + +xcb_generic_iterator_t +xcb_damage_damage_end (xcb_damage_damage_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_damage_query_version_cookie_t +xcb_damage_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_damage_id, + .opcode = XCB_DAMAGE_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_damage_query_version_cookie_t xcb_ret; + xcb_damage_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_damage_query_version_cookie_t +xcb_damage_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_damage_id, + .opcode = XCB_DAMAGE_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_damage_query_version_cookie_t xcb_ret; + xcb_damage_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_damage_query_version_reply_t * +xcb_damage_query_version_reply (xcb_connection_t *c, + xcb_damage_query_version_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_damage_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_damage_create_checked (xcb_connection_t *c, + xcb_damage_damage_t damage, + xcb_drawable_t drawable, + uint8_t level) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_damage_id, + .opcode = XCB_DAMAGE_CREATE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_damage_create_request_t xcb_out; + + xcb_out.damage = damage; + xcb_out.drawable = drawable; + xcb_out.level = level; + 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_damage_create (xcb_connection_t *c, + xcb_damage_damage_t damage, + xcb_drawable_t drawable, + uint8_t level) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_damage_id, + .opcode = XCB_DAMAGE_CREATE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_damage_create_request_t xcb_out; + + xcb_out.damage = damage; + xcb_out.drawable = drawable; + xcb_out.level = level; + 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_damage_destroy_checked (xcb_connection_t *c, + xcb_damage_damage_t damage) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_damage_id, + .opcode = XCB_DAMAGE_DESTROY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_damage_destroy_request_t xcb_out; + + xcb_out.damage = damage; + + 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_damage_destroy (xcb_connection_t *c, + xcb_damage_damage_t damage) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_damage_id, + .opcode = XCB_DAMAGE_DESTROY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_damage_destroy_request_t xcb_out; + + xcb_out.damage = damage; + + 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_damage_subtract_checked (xcb_connection_t *c, + xcb_damage_damage_t damage, + xcb_xfixes_region_t repair, + xcb_xfixes_region_t parts) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_damage_id, + .opcode = XCB_DAMAGE_SUBTRACT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_damage_subtract_request_t xcb_out; + + xcb_out.damage = damage; + xcb_out.repair = repair; + xcb_out.parts = parts; + + 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_damage_subtract (xcb_connection_t *c, + xcb_damage_damage_t damage, + xcb_xfixes_region_t repair, + xcb_xfixes_region_t parts) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_damage_id, + .opcode = XCB_DAMAGE_SUBTRACT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_damage_subtract_request_t xcb_out; + + xcb_out.damage = damage; + xcb_out.repair = repair; + xcb_out.parts = parts; + + 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_damage_add_checked (xcb_connection_t *c, + xcb_drawable_t drawable, + xcb_xfixes_region_t region) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_damage_id, + .opcode = XCB_DAMAGE_ADD, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_damage_add_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.region = region; + + 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_damage_add (xcb_connection_t *c, + xcb_drawable_t drawable, + xcb_xfixes_region_t region) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_damage_id, + .opcode = XCB_DAMAGE_ADD, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_damage_add_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.region = region; + + 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; +} + diff --git a/depends/libxcb/src/dpms.c b/depends/libxcb/src/dpms.c new file mode 100644 index 0000000..e1020d4 --- /dev/null +++ b/depends/libxcb/src/dpms.c @@ -0,0 +1,459 @@ +/* + * This file generated automatically from dpms.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "dpms.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) + +xcb_extension_t xcb_dpms_id = { "DPMS", 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); +} + diff --git a/depends/libxcb/src/dri2.c b/depends/libxcb/src/dri2.c new file mode 100644 index 0000000..a8bcf6a --- /dev/null +++ b/depends/libxcb/src/dri2.c @@ -0,0 +1,1227 @@ +/* + * This file generated automatically from dri2.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "dri2.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) +#include "xproto.h" + +xcb_extension_t xcb_dri2_id = { "DRI2", 0 }; + +void +xcb_dri2_dri2_buffer_next (xcb_dri2_dri2_buffer_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_dri2_dri2_buffer_t); +} + +xcb_generic_iterator_t +xcb_dri2_dri2_buffer_end (xcb_dri2_dri2_buffer_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; +} + +void +xcb_dri2_attach_format_next (xcb_dri2_attach_format_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_dri2_attach_format_t); +} + +xcb_generic_iterator_t +xcb_dri2_attach_format_end (xcb_dri2_attach_format_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_dri2_query_version_cookie_t +xcb_dri2_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_dri2_id, + .opcode = XCB_DRI2_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri2_query_version_cookie_t xcb_ret; + xcb_dri2_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_dri2_query_version_cookie_t +xcb_dri2_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_dri2_id, + .opcode = XCB_DRI2_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri2_query_version_cookie_t xcb_ret; + xcb_dri2_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_dri2_query_version_reply_t * +xcb_dri2_query_version_reply (xcb_connection_t *c, + xcb_dri2_query_version_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_dri2_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_dri2_connect_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_dri2_connect_reply_t *_aux = (xcb_dri2_connect_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_dri2_connect_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* driver_name */ + xcb_block_len += _aux->driver_name_length * sizeof(char); + 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; + /* alignment_pad */ + xcb_block_len += (((_aux->driver_name_length + 3) & (~3)) - _aux->driver_name_length) * sizeof(char); + 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; + /* device_name */ + xcb_block_len += _aux->device_name_length * sizeof(char); + 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_dri2_connect_cookie_t +xcb_dri2_connect (xcb_connection_t *c, + xcb_window_t window, + uint32_t driver_type) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_CONNECT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri2_connect_cookie_t xcb_ret; + xcb_dri2_connect_request_t xcb_out; + + xcb_out.window = window; + xcb_out.driver_type = driver_type; + + 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_dri2_connect_cookie_t +xcb_dri2_connect_unchecked (xcb_connection_t *c, + xcb_window_t window, + uint32_t driver_type) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_CONNECT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri2_connect_cookie_t xcb_ret; + xcb_dri2_connect_request_t xcb_out; + + xcb_out.window = window; + xcb_out.driver_type = driver_type; + + 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; +} + +char * +xcb_dri2_connect_driver_name (const xcb_dri2_connect_reply_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_dri2_connect_driver_name_length (const xcb_dri2_connect_reply_t *R) +{ + return R->driver_name_length; +} + +xcb_generic_iterator_t +xcb_dri2_connect_driver_name_end (const xcb_dri2_connect_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->driver_name_length); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void * +xcb_dri2_connect_alignment_pad (const xcb_dri2_connect_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_dri2_connect_driver_name_end(R); + return (void *) ((char *) prev.data + XCB_TYPE_PAD(char, prev.index) + 0); +} + +int +xcb_dri2_connect_alignment_pad_length (const xcb_dri2_connect_reply_t *R) +{ + return (((R->driver_name_length + 3) & (~3)) - R->driver_name_length); +} + +xcb_generic_iterator_t +xcb_dri2_connect_alignment_pad_end (const xcb_dri2_connect_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_dri2_connect_driver_name_end(R); + i.data = ((char *) ((char*) prev.data + XCB_TYPE_PAD(char, prev.index))) + ((((R->driver_name_length + 3) & (~3)) - R->driver_name_length)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +char * +xcb_dri2_connect_device_name (const xcb_dri2_connect_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_dri2_connect_alignment_pad_end(R); + return (char *) ((char *) prev.data + XCB_TYPE_PAD(char, prev.index) + 0); +} + +int +xcb_dri2_connect_device_name_length (const xcb_dri2_connect_reply_t *R) +{ + return R->device_name_length; +} + +xcb_generic_iterator_t +xcb_dri2_connect_device_name_end (const xcb_dri2_connect_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_dri2_connect_alignment_pad_end(R); + i.data = ((char *) ((char*) prev.data + XCB_TYPE_PAD(char, prev.index))) + (R->device_name_length); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_dri2_connect_reply_t * +xcb_dri2_connect_reply (xcb_connection_t *c, + xcb_dri2_connect_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_dri2_connect_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_dri2_authenticate_cookie_t +xcb_dri2_authenticate (xcb_connection_t *c, + xcb_window_t window, + uint32_t magic) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_AUTHENTICATE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri2_authenticate_cookie_t xcb_ret; + xcb_dri2_authenticate_request_t xcb_out; + + xcb_out.window = window; + xcb_out.magic = magic; + + 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_dri2_authenticate_cookie_t +xcb_dri2_authenticate_unchecked (xcb_connection_t *c, + xcb_window_t window, + uint32_t magic) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_AUTHENTICATE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri2_authenticate_cookie_t xcb_ret; + xcb_dri2_authenticate_request_t xcb_out; + + xcb_out.window = window; + xcb_out.magic = magic; + + 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_dri2_authenticate_reply_t * +xcb_dri2_authenticate_reply (xcb_connection_t *c, + xcb_dri2_authenticate_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_dri2_authenticate_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_dri2_create_drawable_checked (xcb_connection_t *c, + xcb_drawable_t drawable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_CREATE_DRAWABLE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_dri2_create_drawable_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_dri2_create_drawable (xcb_connection_t *c, + xcb_drawable_t drawable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_CREATE_DRAWABLE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_dri2_create_drawable_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_dri2_destroy_drawable_checked (xcb_connection_t *c, + xcb_drawable_t drawable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_DESTROY_DRAWABLE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_dri2_destroy_drawable_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_dri2_destroy_drawable (xcb_connection_t *c, + xcb_drawable_t drawable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_DESTROY_DRAWABLE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_dri2_destroy_drawable_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; +} + +int +xcb_dri2_get_buffers_sizeof (const void *_buffer, + uint32_t attachments_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_dri2_get_buffers_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* attachments */ + xcb_block_len += attachments_len * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_dri2_get_buffers_cookie_t +xcb_dri2_get_buffers (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t count, + uint32_t attachments_len, + const uint32_t *attachments) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_GET_BUFFERS, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_dri2_get_buffers_cookie_t xcb_ret; + xcb_dri2_get_buffers_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.count = count; + + 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; + /* uint32_t attachments */ + xcb_parts[4].iov_base = (char *) attachments; + xcb_parts[4].iov_len = attachments_len * sizeof(uint32_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_dri2_get_buffers_cookie_t +xcb_dri2_get_buffers_unchecked (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t count, + uint32_t attachments_len, + const uint32_t *attachments) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_GET_BUFFERS, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_dri2_get_buffers_cookie_t xcb_ret; + xcb_dri2_get_buffers_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.count = count; + + 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; + /* uint32_t attachments */ + xcb_parts[4].iov_base = (char *) attachments; + xcb_parts[4].iov_len = attachments_len * sizeof(uint32_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_dri2_dri2_buffer_t * +xcb_dri2_get_buffers_buffers (const xcb_dri2_get_buffers_reply_t *R) +{ + return (xcb_dri2_dri2_buffer_t *) (R + 1); +} + +int +xcb_dri2_get_buffers_buffers_length (const xcb_dri2_get_buffers_reply_t *R) +{ + return R->count; +} + +xcb_dri2_dri2_buffer_iterator_t +xcb_dri2_get_buffers_buffers_iterator (const xcb_dri2_get_buffers_reply_t *R) +{ + xcb_dri2_dri2_buffer_iterator_t i; + i.data = (xcb_dri2_dri2_buffer_t *) (R + 1); + i.rem = R->count; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_dri2_get_buffers_reply_t * +xcb_dri2_get_buffers_reply (xcb_connection_t *c, + xcb_dri2_get_buffers_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_dri2_get_buffers_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_dri2_copy_region_cookie_t +xcb_dri2_copy_region (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t region, + uint32_t dest, + uint32_t src) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_COPY_REGION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri2_copy_region_cookie_t xcb_ret; + xcb_dri2_copy_region_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.region = region; + xcb_out.dest = dest; + xcb_out.src = src; + + 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_dri2_copy_region_cookie_t +xcb_dri2_copy_region_unchecked (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t region, + uint32_t dest, + uint32_t src) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_COPY_REGION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri2_copy_region_cookie_t xcb_ret; + xcb_dri2_copy_region_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.region = region; + xcb_out.dest = dest; + xcb_out.src = src; + + 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_dri2_copy_region_reply_t * +xcb_dri2_copy_region_reply (xcb_connection_t *c, + xcb_dri2_copy_region_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_dri2_copy_region_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_dri2_get_buffers_with_format_sizeof (const void *_buffer, + uint32_t attachments_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_dri2_get_buffers_with_format_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* attachments */ + xcb_block_len += attachments_len * sizeof(xcb_dri2_attach_format_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_dri2_attach_format_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_dri2_get_buffers_with_format_cookie_t +xcb_dri2_get_buffers_with_format (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t count, + uint32_t attachments_len, + const xcb_dri2_attach_format_t *attachments) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_GET_BUFFERS_WITH_FORMAT, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_dri2_get_buffers_with_format_cookie_t xcb_ret; + xcb_dri2_get_buffers_with_format_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.count = count; + + 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_dri2_attach_format_t attachments */ + xcb_parts[4].iov_base = (char *) attachments; + xcb_parts[4].iov_len = attachments_len * sizeof(xcb_dri2_attach_format_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_dri2_get_buffers_with_format_cookie_t +xcb_dri2_get_buffers_with_format_unchecked (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t count, + uint32_t attachments_len, + const xcb_dri2_attach_format_t *attachments) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_GET_BUFFERS_WITH_FORMAT, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_dri2_get_buffers_with_format_cookie_t xcb_ret; + xcb_dri2_get_buffers_with_format_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.count = count; + + 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_dri2_attach_format_t attachments */ + xcb_parts[4].iov_base = (char *) attachments; + xcb_parts[4].iov_len = attachments_len * sizeof(xcb_dri2_attach_format_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_dri2_dri2_buffer_t * +xcb_dri2_get_buffers_with_format_buffers (const xcb_dri2_get_buffers_with_format_reply_t *R) +{ + return (xcb_dri2_dri2_buffer_t *) (R + 1); +} + +int +xcb_dri2_get_buffers_with_format_buffers_length (const xcb_dri2_get_buffers_with_format_reply_t *R) +{ + return R->count; +} + +xcb_dri2_dri2_buffer_iterator_t +xcb_dri2_get_buffers_with_format_buffers_iterator (const xcb_dri2_get_buffers_with_format_reply_t *R) +{ + xcb_dri2_dri2_buffer_iterator_t i; + i.data = (xcb_dri2_dri2_buffer_t *) (R + 1); + i.rem = R->count; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_dri2_get_buffers_with_format_reply_t * +xcb_dri2_get_buffers_with_format_reply (xcb_connection_t *c, + xcb_dri2_get_buffers_with_format_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_dri2_get_buffers_with_format_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_dri2_swap_buffers_cookie_t +xcb_dri2_swap_buffers (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t target_msc_hi, + uint32_t target_msc_lo, + uint32_t divisor_hi, + uint32_t divisor_lo, + uint32_t remainder_hi, + uint32_t remainder_lo) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_SWAP_BUFFERS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri2_swap_buffers_cookie_t xcb_ret; + xcb_dri2_swap_buffers_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.target_msc_hi = target_msc_hi; + xcb_out.target_msc_lo = target_msc_lo; + xcb_out.divisor_hi = divisor_hi; + xcb_out.divisor_lo = divisor_lo; + xcb_out.remainder_hi = remainder_hi; + xcb_out.remainder_lo = remainder_lo; + + 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_dri2_swap_buffers_cookie_t +xcb_dri2_swap_buffers_unchecked (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t target_msc_hi, + uint32_t target_msc_lo, + uint32_t divisor_hi, + uint32_t divisor_lo, + uint32_t remainder_hi, + uint32_t remainder_lo) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_SWAP_BUFFERS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri2_swap_buffers_cookie_t xcb_ret; + xcb_dri2_swap_buffers_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.target_msc_hi = target_msc_hi; + xcb_out.target_msc_lo = target_msc_lo; + xcb_out.divisor_hi = divisor_hi; + xcb_out.divisor_lo = divisor_lo; + xcb_out.remainder_hi = remainder_hi; + xcb_out.remainder_lo = remainder_lo; + + 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_dri2_swap_buffers_reply_t * +xcb_dri2_swap_buffers_reply (xcb_connection_t *c, + xcb_dri2_swap_buffers_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_dri2_swap_buffers_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_dri2_get_msc_cookie_t +xcb_dri2_get_msc (xcb_connection_t *c, + xcb_drawable_t drawable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_GET_MSC, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri2_get_msc_cookie_t xcb_ret; + xcb_dri2_get_msc_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_dri2_get_msc_cookie_t +xcb_dri2_get_msc_unchecked (xcb_connection_t *c, + xcb_drawable_t drawable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_GET_MSC, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri2_get_msc_cookie_t xcb_ret; + xcb_dri2_get_msc_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_dri2_get_msc_reply_t * +xcb_dri2_get_msc_reply (xcb_connection_t *c, + xcb_dri2_get_msc_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_dri2_get_msc_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_dri2_wait_msc_cookie_t +xcb_dri2_wait_msc (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t target_msc_hi, + uint32_t target_msc_lo, + uint32_t divisor_hi, + uint32_t divisor_lo, + uint32_t remainder_hi, + uint32_t remainder_lo) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_WAIT_MSC, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri2_wait_msc_cookie_t xcb_ret; + xcb_dri2_wait_msc_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.target_msc_hi = target_msc_hi; + xcb_out.target_msc_lo = target_msc_lo; + xcb_out.divisor_hi = divisor_hi; + xcb_out.divisor_lo = divisor_lo; + xcb_out.remainder_hi = remainder_hi; + xcb_out.remainder_lo = remainder_lo; + + 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_dri2_wait_msc_cookie_t +xcb_dri2_wait_msc_unchecked (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t target_msc_hi, + uint32_t target_msc_lo, + uint32_t divisor_hi, + uint32_t divisor_lo, + uint32_t remainder_hi, + uint32_t remainder_lo) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_WAIT_MSC, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri2_wait_msc_cookie_t xcb_ret; + xcb_dri2_wait_msc_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.target_msc_hi = target_msc_hi; + xcb_out.target_msc_lo = target_msc_lo; + xcb_out.divisor_hi = divisor_hi; + xcb_out.divisor_lo = divisor_lo; + xcb_out.remainder_hi = remainder_hi; + xcb_out.remainder_lo = remainder_lo; + + 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_dri2_wait_msc_reply_t * +xcb_dri2_wait_msc_reply (xcb_connection_t *c, + xcb_dri2_wait_msc_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_dri2_wait_msc_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_dri2_wait_sbc_cookie_t +xcb_dri2_wait_sbc (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t target_sbc_hi, + uint32_t target_sbc_lo) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_WAIT_SBC, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri2_wait_sbc_cookie_t xcb_ret; + xcb_dri2_wait_sbc_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.target_sbc_hi = target_sbc_hi; + xcb_out.target_sbc_lo = target_sbc_lo; + + 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_dri2_wait_sbc_cookie_t +xcb_dri2_wait_sbc_unchecked (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t target_sbc_hi, + uint32_t target_sbc_lo) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_WAIT_SBC, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri2_wait_sbc_cookie_t xcb_ret; + xcb_dri2_wait_sbc_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.target_sbc_hi = target_sbc_hi; + xcb_out.target_sbc_lo = target_sbc_lo; + + 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_dri2_wait_sbc_reply_t * +xcb_dri2_wait_sbc_reply (xcb_connection_t *c, + xcb_dri2_wait_sbc_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_dri2_wait_sbc_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_dri2_swap_interval_checked (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t interval) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_SWAP_INTERVAL, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_dri2_swap_interval_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.interval = interval; + + 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_dri2_swap_interval (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t interval) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_SWAP_INTERVAL, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_dri2_swap_interval_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.interval = interval; + + 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_dri2_get_param_cookie_t +xcb_dri2_get_param (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t param) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_GET_PARAM, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri2_get_param_cookie_t xcb_ret; + xcb_dri2_get_param_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.param = param; + + 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_dri2_get_param_cookie_t +xcb_dri2_get_param_unchecked (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t param) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri2_id, + .opcode = XCB_DRI2_GET_PARAM, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri2_get_param_cookie_t xcb_ret; + xcb_dri2_get_param_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.param = param; + + 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_dri2_get_param_reply_t * +xcb_dri2_get_param_reply (xcb_connection_t *c, + xcb_dri2_get_param_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_dri2_get_param_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + diff --git a/depends/libxcb/src/dri3.c b/depends/libxcb/src/dri3.c new file mode 100644 index 0000000..d423935 --- /dev/null +++ b/depends/libxcb/src/dri3.c @@ -0,0 +1,979 @@ +/* + * This file generated automatically from dri3.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "dri3.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) +#include "xproto.h" + +xcb_extension_t xcb_dri3_id = { "DRI3", 0 }; + +xcb_dri3_query_version_cookie_t +xcb_dri3_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_dri3_id, + .opcode = XCB_DRI3_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri3_query_version_cookie_t xcb_ret; + xcb_dri3_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_dri3_query_version_cookie_t +xcb_dri3_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_dri3_id, + .opcode = XCB_DRI3_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri3_query_version_cookie_t xcb_ret; + xcb_dri3_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_dri3_query_version_reply_t * +xcb_dri3_query_version_reply (xcb_connection_t *c, + xcb_dri3_query_version_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_dri3_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_dri3_open_cookie_t +xcb_dri3_open (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t provider) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri3_id, + .opcode = XCB_DRI3_OPEN, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri3_open_cookie_t xcb_ret; + xcb_dri3_open_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.provider = provider; + + 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_REQUEST_REPLY_FDS, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_dri3_open_cookie_t +xcb_dri3_open_unchecked (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t provider) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri3_id, + .opcode = XCB_DRI3_OPEN, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri3_open_cookie_t xcb_ret; + xcb_dri3_open_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.provider = provider; + + 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_REPLY_FDS, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_dri3_open_reply_t * +xcb_dri3_open_reply (xcb_connection_t *c, + xcb_dri3_open_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_dri3_open_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int * +xcb_dri3_open_reply_fds (xcb_connection_t *c /**< */, + xcb_dri3_open_reply_t *reply) +{ + return xcb_get_reply_fds(c, reply, sizeof(xcb_dri3_open_reply_t) + 4 * reply->length); +} + +xcb_void_cookie_t +xcb_dri3_pixmap_from_buffer_checked (xcb_connection_t *c, + xcb_pixmap_t pixmap, + xcb_drawable_t drawable, + uint32_t size, + uint16_t width, + uint16_t height, + uint16_t stride, + uint8_t depth, + uint8_t bpp, + int32_t pixmap_fd) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri3_id, + .opcode = XCB_DRI3_PIXMAP_FROM_BUFFER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_dri3_pixmap_from_buffer_request_t xcb_out; + int fds[1]; + int fd_index = 0; + + xcb_out.pixmap = pixmap; + xcb_out.drawable = drawable; + xcb_out.size = size; + xcb_out.width = width; + xcb_out.height = height; + xcb_out.stride = stride; + xcb_out.depth = depth; + xcb_out.bpp = bpp; + + 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; + + fds[fd_index++] = pixmap_fd; + xcb_ret.sequence = xcb_send_request_with_fds(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req, 1, fds); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_dri3_pixmap_from_buffer (xcb_connection_t *c, + xcb_pixmap_t pixmap, + xcb_drawable_t drawable, + uint32_t size, + uint16_t width, + uint16_t height, + uint16_t stride, + uint8_t depth, + uint8_t bpp, + int32_t pixmap_fd) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri3_id, + .opcode = XCB_DRI3_PIXMAP_FROM_BUFFER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_dri3_pixmap_from_buffer_request_t xcb_out; + int fds[1]; + int fd_index = 0; + + xcb_out.pixmap = pixmap; + xcb_out.drawable = drawable; + xcb_out.size = size; + xcb_out.width = width; + xcb_out.height = height; + xcb_out.stride = stride; + xcb_out.depth = depth; + xcb_out.bpp = bpp; + + 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; + + fds[fd_index++] = pixmap_fd; + xcb_ret.sequence = xcb_send_request_with_fds(c, 0, xcb_parts + 2, &xcb_req, 1, fds); + return xcb_ret; +} + +xcb_dri3_buffer_from_pixmap_cookie_t +xcb_dri3_buffer_from_pixmap (xcb_connection_t *c, + xcb_pixmap_t pixmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri3_id, + .opcode = XCB_DRI3_BUFFER_FROM_PIXMAP, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri3_buffer_from_pixmap_cookie_t xcb_ret; + xcb_dri3_buffer_from_pixmap_request_t xcb_out; + + 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_REQUEST_REPLY_FDS, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_dri3_buffer_from_pixmap_cookie_t +xcb_dri3_buffer_from_pixmap_unchecked (xcb_connection_t *c, + xcb_pixmap_t pixmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri3_id, + .opcode = XCB_DRI3_BUFFER_FROM_PIXMAP, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri3_buffer_from_pixmap_cookie_t xcb_ret; + xcb_dri3_buffer_from_pixmap_request_t xcb_out; + + 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_REPLY_FDS, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_dri3_buffer_from_pixmap_reply_t * +xcb_dri3_buffer_from_pixmap_reply (xcb_connection_t *c, + xcb_dri3_buffer_from_pixmap_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_dri3_buffer_from_pixmap_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int * +xcb_dri3_buffer_from_pixmap_reply_fds (xcb_connection_t *c /**< */, + xcb_dri3_buffer_from_pixmap_reply_t *reply) +{ + return xcb_get_reply_fds(c, reply, sizeof(xcb_dri3_buffer_from_pixmap_reply_t) + 4 * reply->length); +} + +xcb_void_cookie_t +xcb_dri3_fence_from_fd_checked (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t fence, + uint8_t initially_triggered, + int32_t fence_fd) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri3_id, + .opcode = XCB_DRI3_FENCE_FROM_FD, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_dri3_fence_from_fd_request_t xcb_out; + int fds[1]; + int fd_index = 0; + + xcb_out.drawable = drawable; + xcb_out.fence = fence; + xcb_out.initially_triggered = initially_triggered; + 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; + + fds[fd_index++] = fence_fd; + xcb_ret.sequence = xcb_send_request_with_fds(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req, 1, fds); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_dri3_fence_from_fd (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t fence, + uint8_t initially_triggered, + int32_t fence_fd) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri3_id, + .opcode = XCB_DRI3_FENCE_FROM_FD, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_dri3_fence_from_fd_request_t xcb_out; + int fds[1]; + int fd_index = 0; + + xcb_out.drawable = drawable; + xcb_out.fence = fence; + xcb_out.initially_triggered = initially_triggered; + 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; + + fds[fd_index++] = fence_fd; + xcb_ret.sequence = xcb_send_request_with_fds(c, 0, xcb_parts + 2, &xcb_req, 1, fds); + return xcb_ret; +} + +xcb_dri3_fd_from_fence_cookie_t +xcb_dri3_fd_from_fence (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t fence) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri3_id, + .opcode = XCB_DRI3_FD_FROM_FENCE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri3_fd_from_fence_cookie_t xcb_ret; + xcb_dri3_fd_from_fence_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.fence = fence; + + 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_REQUEST_REPLY_FDS, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_dri3_fd_from_fence_cookie_t +xcb_dri3_fd_from_fence_unchecked (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t fence) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri3_id, + .opcode = XCB_DRI3_FD_FROM_FENCE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri3_fd_from_fence_cookie_t xcb_ret; + xcb_dri3_fd_from_fence_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.fence = fence; + + 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_REPLY_FDS, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_dri3_fd_from_fence_reply_t * +xcb_dri3_fd_from_fence_reply (xcb_connection_t *c, + xcb_dri3_fd_from_fence_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_dri3_fd_from_fence_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int * +xcb_dri3_fd_from_fence_reply_fds (xcb_connection_t *c /**< */, + xcb_dri3_fd_from_fence_reply_t *reply) +{ + return xcb_get_reply_fds(c, reply, sizeof(xcb_dri3_fd_from_fence_reply_t) + 4 * reply->length); +} + +int +xcb_dri3_get_supported_modifiers_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_dri3_get_supported_modifiers_reply_t *_aux = (xcb_dri3_get_supported_modifiers_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_dri3_get_supported_modifiers_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* window_modifiers */ + xcb_block_len += _aux->num_window_modifiers * sizeof(uint64_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint64_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; + /* screen_modifiers */ + xcb_block_len += _aux->num_screen_modifiers * sizeof(uint64_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint64_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_dri3_get_supported_modifiers_cookie_t +xcb_dri3_get_supported_modifiers (xcb_connection_t *c, + uint32_t window, + uint8_t depth, + uint8_t bpp) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri3_id, + .opcode = XCB_DRI3_GET_SUPPORTED_MODIFIERS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri3_get_supported_modifiers_cookie_t xcb_ret; + xcb_dri3_get_supported_modifiers_request_t xcb_out; + + xcb_out.window = window; + xcb_out.depth = depth; + xcb_out.bpp = bpp; + 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_dri3_get_supported_modifiers_cookie_t +xcb_dri3_get_supported_modifiers_unchecked (xcb_connection_t *c, + uint32_t window, + uint8_t depth, + uint8_t bpp) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri3_id, + .opcode = XCB_DRI3_GET_SUPPORTED_MODIFIERS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri3_get_supported_modifiers_cookie_t xcb_ret; + xcb_dri3_get_supported_modifiers_request_t xcb_out; + + xcb_out.window = window; + xcb_out.depth = depth; + xcb_out.bpp = bpp; + 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; +} + +uint64_t * +xcb_dri3_get_supported_modifiers_window_modifiers (const xcb_dri3_get_supported_modifiers_reply_t *R) +{ + return (uint64_t *) (R + 1); +} + +int +xcb_dri3_get_supported_modifiers_window_modifiers_length (const xcb_dri3_get_supported_modifiers_reply_t *R) +{ + return R->num_window_modifiers; +} + +xcb_generic_iterator_t +xcb_dri3_get_supported_modifiers_window_modifiers_end (const xcb_dri3_get_supported_modifiers_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint64_t *) (R + 1)) + (R->num_window_modifiers); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +uint64_t * +xcb_dri3_get_supported_modifiers_screen_modifiers (const xcb_dri3_get_supported_modifiers_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_dri3_get_supported_modifiers_window_modifiers_end(R); + return (uint64_t *) ((char *) prev.data + XCB_TYPE_PAD(uint64_t, prev.index) + 0); +} + +int +xcb_dri3_get_supported_modifiers_screen_modifiers_length (const xcb_dri3_get_supported_modifiers_reply_t *R) +{ + return R->num_screen_modifiers; +} + +xcb_generic_iterator_t +xcb_dri3_get_supported_modifiers_screen_modifiers_end (const xcb_dri3_get_supported_modifiers_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_dri3_get_supported_modifiers_window_modifiers_end(R); + i.data = ((uint64_t *) ((char*) prev.data + XCB_TYPE_PAD(uint64_t, prev.index))) + (R->num_screen_modifiers); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_dri3_get_supported_modifiers_reply_t * +xcb_dri3_get_supported_modifiers_reply (xcb_connection_t *c, + xcb_dri3_get_supported_modifiers_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_dri3_get_supported_modifiers_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_dri3_pixmap_from_buffers_checked (xcb_connection_t *c, + xcb_pixmap_t pixmap, + xcb_window_t window, + uint8_t num_buffers, + uint16_t width, + uint16_t height, + uint32_t stride0, + uint32_t offset0, + uint32_t stride1, + uint32_t offset1, + uint32_t stride2, + uint32_t offset2, + uint32_t stride3, + uint32_t offset3, + uint8_t depth, + uint8_t bpp, + uint64_t modifier, + const int32_t *buffers) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri3_id, + .opcode = XCB_DRI3_PIXMAP_FROM_BUFFERS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_dri3_pixmap_from_buffers_request_t xcb_out; + unsigned int i; + int fds[num_buffers]; + int fd_index = 0; + + xcb_out.pixmap = pixmap; + xcb_out.window = window; + xcb_out.num_buffers = num_buffers; + memset(xcb_out.pad0, 0, 3); + xcb_out.width = width; + xcb_out.height = height; + xcb_out.stride0 = stride0; + xcb_out.offset0 = offset0; + xcb_out.stride1 = stride1; + xcb_out.offset1 = offset1; + xcb_out.stride2 = stride2; + xcb_out.offset2 = offset2; + xcb_out.stride3 = stride3; + xcb_out.offset3 = offset3; + xcb_out.depth = depth; + xcb_out.bpp = bpp; + memset(xcb_out.pad1, 0, 2); + xcb_out.modifier = modifier; + + 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; + + for (i = 0; i < num_buffers; i++) + fds[fd_index++] = buffers[i]; + xcb_ret.sequence = xcb_send_request_with_fds(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req, num_buffers, fds); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_dri3_pixmap_from_buffers (xcb_connection_t *c, + xcb_pixmap_t pixmap, + xcb_window_t window, + uint8_t num_buffers, + uint16_t width, + uint16_t height, + uint32_t stride0, + uint32_t offset0, + uint32_t stride1, + uint32_t offset1, + uint32_t stride2, + uint32_t offset2, + uint32_t stride3, + uint32_t offset3, + uint8_t depth, + uint8_t bpp, + uint64_t modifier, + const int32_t *buffers) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri3_id, + .opcode = XCB_DRI3_PIXMAP_FROM_BUFFERS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_dri3_pixmap_from_buffers_request_t xcb_out; + unsigned int i; + int fds[num_buffers]; + int fd_index = 0; + + xcb_out.pixmap = pixmap; + xcb_out.window = window; + xcb_out.num_buffers = num_buffers; + memset(xcb_out.pad0, 0, 3); + xcb_out.width = width; + xcb_out.height = height; + xcb_out.stride0 = stride0; + xcb_out.offset0 = offset0; + xcb_out.stride1 = stride1; + xcb_out.offset1 = offset1; + xcb_out.stride2 = stride2; + xcb_out.offset2 = offset2; + xcb_out.stride3 = stride3; + xcb_out.offset3 = offset3; + xcb_out.depth = depth; + xcb_out.bpp = bpp; + memset(xcb_out.pad1, 0, 2); + xcb_out.modifier = modifier; + + 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; + + for (i = 0; i < num_buffers; i++) + fds[fd_index++] = buffers[i]; + xcb_ret.sequence = xcb_send_request_with_fds(c, 0, xcb_parts + 2, &xcb_req, num_buffers, fds); + return xcb_ret; +} + +int +xcb_dri3_buffers_from_pixmap_sizeof (const void *_buffer, + int32_t buffers) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_dri3_buffers_from_pixmap_reply_t *_aux = (xcb_dri3_buffers_from_pixmap_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_dri3_buffers_from_pixmap_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* strides */ + xcb_block_len += _aux->nfd * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* offsets */ + xcb_block_len += _aux->nfd * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_dri3_buffers_from_pixmap_cookie_t +xcb_dri3_buffers_from_pixmap (xcb_connection_t *c, + xcb_pixmap_t pixmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri3_id, + .opcode = XCB_DRI3_BUFFERS_FROM_PIXMAP, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri3_buffers_from_pixmap_cookie_t xcb_ret; + xcb_dri3_buffers_from_pixmap_request_t xcb_out; + + 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_REQUEST_REPLY_FDS, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_dri3_buffers_from_pixmap_cookie_t +xcb_dri3_buffers_from_pixmap_unchecked (xcb_connection_t *c, + xcb_pixmap_t pixmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri3_id, + .opcode = XCB_DRI3_BUFFERS_FROM_PIXMAP, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_dri3_buffers_from_pixmap_cookie_t xcb_ret; + xcb_dri3_buffers_from_pixmap_request_t xcb_out; + + 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_REPLY_FDS, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +uint32_t * +xcb_dri3_buffers_from_pixmap_strides (const xcb_dri3_buffers_from_pixmap_reply_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_dri3_buffers_from_pixmap_strides_length (const xcb_dri3_buffers_from_pixmap_reply_t *R) +{ + return R->nfd; +} + +xcb_generic_iterator_t +xcb_dri3_buffers_from_pixmap_strides_end (const xcb_dri3_buffers_from_pixmap_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->nfd); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +uint32_t * +xcb_dri3_buffers_from_pixmap_offsets (const xcb_dri3_buffers_from_pixmap_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_dri3_buffers_from_pixmap_strides_end(R); + return (uint32_t *) ((char *) prev.data + XCB_TYPE_PAD(uint32_t, prev.index) + 0); +} + +int +xcb_dri3_buffers_from_pixmap_offsets_length (const xcb_dri3_buffers_from_pixmap_reply_t *R) +{ + return R->nfd; +} + +xcb_generic_iterator_t +xcb_dri3_buffers_from_pixmap_offsets_end (const xcb_dri3_buffers_from_pixmap_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_dri3_buffers_from_pixmap_strides_end(R); + i.data = ((uint32_t *) ((char*) prev.data + XCB_TYPE_PAD(uint32_t, prev.index))) + (R->nfd); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int32_t * +xcb_dri3_buffers_from_pixmap_buffers (const xcb_dri3_buffers_from_pixmap_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_dri3_buffers_from_pixmap_offsets_end(R); + return (int32_t *) ((char *) prev.data + XCB_TYPE_PAD(int32_t, prev.index) + 0); +} + +int +xcb_dri3_buffers_from_pixmap_buffers_length (const xcb_dri3_buffers_from_pixmap_reply_t *R) +{ + return R->nfd; +} + +xcb_generic_iterator_t +xcb_dri3_buffers_from_pixmap_buffers_end (const xcb_dri3_buffers_from_pixmap_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_dri3_buffers_from_pixmap_offsets_end(R); + i.data = ((int32_t *) ((char*) prev.data + XCB_TYPE_PAD(int32_t, prev.index))) + (R->nfd); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_dri3_buffers_from_pixmap_reply_t * +xcb_dri3_buffers_from_pixmap_reply (xcb_connection_t *c, + xcb_dri3_buffers_from_pixmap_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_dri3_buffers_from_pixmap_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int * +xcb_dri3_buffers_from_pixmap_reply_fds (xcb_connection_t *c /**< */, + xcb_dri3_buffers_from_pixmap_reply_t *reply) +{ + return xcb_get_reply_fds(c, reply, sizeof(xcb_dri3_buffers_from_pixmap_reply_t) + 4 * reply->length); +} + +xcb_void_cookie_t +xcb_dri3_set_drm_device_in_use_checked (xcb_connection_t *c, + xcb_window_t window, + uint32_t drmMajor, + uint32_t drmMinor) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri3_id, + .opcode = XCB_DRI3_SET_DRM_DEVICE_IN_USE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_dri3_set_drm_device_in_use_request_t xcb_out; + + xcb_out.window = window; + xcb_out.drmMajor = drmMajor; + xcb_out.drmMinor = drmMinor; + + 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_dri3_set_drm_device_in_use (xcb_connection_t *c, + xcb_window_t window, + uint32_t drmMajor, + uint32_t drmMinor) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_dri3_id, + .opcode = XCB_DRI3_SET_DRM_DEVICE_IN_USE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_dri3_set_drm_device_in_use_request_t xcb_out; + + xcb_out.window = window; + xcb_out.drmMajor = drmMajor; + xcb_out.drmMinor = drmMinor; + + 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; +} + diff --git a/depends/libxcb/src/ge.c b/depends/libxcb/src/ge.c new file mode 100644 index 0000000..6f370b7 --- /dev/null +++ b/depends/libxcb/src/ge.c @@ -0,0 +1,83 @@ +/* + * This file generated automatically from ge.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "ge.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) + +xcb_extension_t xcb_genericevent_id = { "Generic Event Extension", 0 }; + +xcb_genericevent_query_version_cookie_t +xcb_genericevent_query_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_genericevent_id, + .opcode = XCB_GENERICEVENT_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_genericevent_query_version_cookie_t xcb_ret; + xcb_genericevent_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_genericevent_query_version_cookie_t +xcb_genericevent_query_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_genericevent_id, + .opcode = XCB_GENERICEVENT_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_genericevent_query_version_cookie_t xcb_ret; + xcb_genericevent_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_genericevent_query_version_reply_t * +xcb_genericevent_query_version_reply (xcb_connection_t *c, + xcb_genericevent_query_version_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_genericevent_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + diff --git a/depends/libxcb/src/glx.c b/depends/libxcb/src/glx.c new file mode 100644 index 0000000..ba37e60 --- /dev/null +++ b/depends/libxcb/src/glx.c @@ -0,0 +1,10730 @@ +/* + * This file generated automatically from glx.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "glx.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) +#include "xproto.h" + +xcb_extension_t xcb_glx_id = { "GLX", 0 }; + +void +xcb_glx_pixmap_next (xcb_glx_pixmap_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_glx_pixmap_t); +} + +xcb_generic_iterator_t +xcb_glx_pixmap_end (xcb_glx_pixmap_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; +} + +void +xcb_glx_context_next (xcb_glx_context_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_glx_context_t); +} + +xcb_generic_iterator_t +xcb_glx_context_end (xcb_glx_context_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; +} + +void +xcb_glx_pbuffer_next (xcb_glx_pbuffer_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_glx_pbuffer_t); +} + +xcb_generic_iterator_t +xcb_glx_pbuffer_end (xcb_glx_pbuffer_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; +} + +void +xcb_glx_window_next (xcb_glx_window_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_glx_window_t); +} + +xcb_generic_iterator_t +xcb_glx_window_end (xcb_glx_window_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; +} + +void +xcb_glx_fbconfig_next (xcb_glx_fbconfig_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_glx_fbconfig_t); +} + +xcb_generic_iterator_t +xcb_glx_fbconfig_end (xcb_glx_fbconfig_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; +} + +void +xcb_glx_drawable_next (xcb_glx_drawable_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_glx_drawable_t); +} + +xcb_generic_iterator_t +xcb_glx_drawable_end (xcb_glx_drawable_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; +} + +void +xcb_glx_float32_next (xcb_glx_float32_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_glx_float32_t); +} + +xcb_generic_iterator_t +xcb_glx_float32_end (xcb_glx_float32_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; +} + +void +xcb_glx_float64_next (xcb_glx_float64_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_glx_float64_t); +} + +xcb_generic_iterator_t +xcb_glx_float64_end (xcb_glx_float64_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; +} + +void +xcb_glx_bool32_next (xcb_glx_bool32_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_glx_bool32_t); +} + +xcb_generic_iterator_t +xcb_glx_bool32_end (xcb_glx_bool32_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; +} + +void +xcb_glx_context_tag_next (xcb_glx_context_tag_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_glx_context_tag_t); +} + +xcb_generic_iterator_t +xcb_glx_context_tag_end (xcb_glx_context_tag_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; +} + +int +xcb_glx_render_sizeof (const void *_buffer, + uint32_t data_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_glx_render_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += data_len * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_glx_render_checked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t data_len, + const uint8_t *data) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_RENDER, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_glx_render_request_t xcb_out; + + xcb_out.context_tag = context_tag; + + 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; + /* uint8_t data */ + xcb_parts[4].iov_base = (char *) data; + xcb_parts[4].iov_len = data_len * sizeof(uint8_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_glx_render (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t data_len, + const uint8_t *data) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_RENDER, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_glx_render_request_t xcb_out; + + xcb_out.context_tag = context_tag; + + 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; + /* uint8_t data */ + xcb_parts[4].iov_base = (char *) data; + xcb_parts[4].iov_len = data_len * sizeof(uint8_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; +} + +uint8_t * +xcb_glx_render_data (const xcb_glx_render_request_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_glx_render_data_length (const xcb_glx_render_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_glx_render_request_t))/sizeof(uint8_t)); +} + +xcb_generic_iterator_t +xcb_glx_render_data_end (const xcb_glx_render_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_glx_render_request_t))/sizeof(uint8_t))); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_glx_render_large_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_render_large_request_t *_aux = (xcb_glx_render_large_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_glx_render_large_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->data_len * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_glx_render_large_checked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint16_t request_num, + uint16_t request_total, + uint32_t data_len, + const uint8_t *data) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_RENDER_LARGE, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_glx_render_large_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.request_num = request_num; + xcb_out.request_total = request_total; + xcb_out.data_len = data_len; + + 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; + /* uint8_t data */ + xcb_parts[4].iov_base = (char *) data; + xcb_parts[4].iov_len = data_len * sizeof(uint8_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_glx_render_large (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint16_t request_num, + uint16_t request_total, + uint32_t data_len, + const uint8_t *data) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_RENDER_LARGE, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_glx_render_large_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.request_num = request_num; + xcb_out.request_total = request_total; + xcb_out.data_len = data_len; + + 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; + /* uint8_t data */ + xcb_parts[4].iov_base = (char *) data; + xcb_parts[4].iov_len = data_len * sizeof(uint8_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; +} + +uint8_t * +xcb_glx_render_large_data (const xcb_glx_render_large_request_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_glx_render_large_data_length (const xcb_glx_render_large_request_t *R) +{ + return R->data_len; +} + +xcb_generic_iterator_t +xcb_glx_render_large_data_end (const xcb_glx_render_large_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + (R->data_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_glx_create_context_checked (xcb_connection_t *c, + xcb_glx_context_t context, + xcb_visualid_t visual, + uint32_t screen, + xcb_glx_context_t share_list, + uint8_t is_direct) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_CREATE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_create_context_request_t xcb_out; + + xcb_out.context = context; + xcb_out.visual = visual; + xcb_out.screen = screen; + xcb_out.share_list = share_list; + xcb_out.is_direct = is_direct; + 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_glx_create_context (xcb_connection_t *c, + xcb_glx_context_t context, + xcb_visualid_t visual, + uint32_t screen, + xcb_glx_context_t share_list, + uint8_t is_direct) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_CREATE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_create_context_request_t xcb_out; + + xcb_out.context = context; + xcb_out.visual = visual; + xcb_out.screen = screen; + xcb_out.share_list = share_list; + xcb_out.is_direct = is_direct; + 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_glx_destroy_context_checked (xcb_connection_t *c, + xcb_glx_context_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_DESTROY_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_destroy_context_request_t xcb_out; + + xcb_out.context = context; + + 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_glx_destroy_context (xcb_connection_t *c, + xcb_glx_context_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_DESTROY_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_destroy_context_request_t xcb_out; + + xcb_out.context = context; + + 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_glx_make_current_cookie_t +xcb_glx_make_current (xcb_connection_t *c, + xcb_glx_drawable_t drawable, + xcb_glx_context_t context, + xcb_glx_context_tag_t old_context_tag) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_MAKE_CURRENT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_make_current_cookie_t xcb_ret; + xcb_glx_make_current_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.context = context; + xcb_out.old_context_tag = old_context_tag; + + 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_glx_make_current_cookie_t +xcb_glx_make_current_unchecked (xcb_connection_t *c, + xcb_glx_drawable_t drawable, + xcb_glx_context_t context, + xcb_glx_context_tag_t old_context_tag) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_MAKE_CURRENT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_make_current_cookie_t xcb_ret; + xcb_glx_make_current_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.context = context; + xcb_out.old_context_tag = old_context_tag; + + 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_glx_make_current_reply_t * +xcb_glx_make_current_reply (xcb_connection_t *c, + xcb_glx_make_current_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_make_current_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_glx_is_direct_cookie_t +xcb_glx_is_direct (xcb_connection_t *c, + xcb_glx_context_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_IS_DIRECT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_is_direct_cookie_t xcb_ret; + xcb_glx_is_direct_request_t xcb_out; + + xcb_out.context = context; + + 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_glx_is_direct_cookie_t +xcb_glx_is_direct_unchecked (xcb_connection_t *c, + xcb_glx_context_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_IS_DIRECT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_is_direct_cookie_t xcb_ret; + xcb_glx_is_direct_request_t xcb_out; + + xcb_out.context = context; + + 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_glx_is_direct_reply_t * +xcb_glx_is_direct_reply (xcb_connection_t *c, + xcb_glx_is_direct_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_is_direct_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_glx_query_version_cookie_t +xcb_glx_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_glx_id, + .opcode = XCB_GLX_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_query_version_cookie_t xcb_ret; + xcb_glx_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_glx_query_version_cookie_t +xcb_glx_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_glx_id, + .opcode = XCB_GLX_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_query_version_cookie_t xcb_ret; + xcb_glx_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_glx_query_version_reply_t * +xcb_glx_query_version_reply (xcb_connection_t *c, + xcb_glx_query_version_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_glx_wait_gl_checked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_WAIT_GL, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_wait_gl_request_t xcb_out; + + xcb_out.context_tag = context_tag; + + 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_glx_wait_gl (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_WAIT_GL, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_wait_gl_request_t xcb_out; + + xcb_out.context_tag = context_tag; + + 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_glx_wait_x_checked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_WAIT_X, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_wait_x_request_t xcb_out; + + xcb_out.context_tag = context_tag; + + 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_glx_wait_x (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_WAIT_X, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_wait_x_request_t xcb_out; + + xcb_out.context_tag = context_tag; + + 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_glx_copy_context_checked (xcb_connection_t *c, + xcb_glx_context_t src, + xcb_glx_context_t dest, + uint32_t mask, + xcb_glx_context_tag_t src_context_tag) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_COPY_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_copy_context_request_t xcb_out; + + xcb_out.src = src; + xcb_out.dest = dest; + xcb_out.mask = mask; + xcb_out.src_context_tag = src_context_tag; + + 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_glx_copy_context (xcb_connection_t *c, + xcb_glx_context_t src, + xcb_glx_context_t dest, + uint32_t mask, + xcb_glx_context_tag_t src_context_tag) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_COPY_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_copy_context_request_t xcb_out; + + xcb_out.src = src; + xcb_out.dest = dest; + xcb_out.mask = mask; + xcb_out.src_context_tag = src_context_tag; + + 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_glx_swap_buffers_checked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + xcb_glx_drawable_t drawable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_SWAP_BUFFERS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_swap_buffers_request_t xcb_out; + + xcb_out.context_tag = context_tag; + 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_glx_swap_buffers (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + xcb_glx_drawable_t drawable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_SWAP_BUFFERS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_swap_buffers_request_t xcb_out; + + xcb_out.context_tag = context_tag; + 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_glx_use_x_font_checked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + xcb_font_t font, + uint32_t first, + uint32_t count, + uint32_t list_base) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_USE_X_FONT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_use_x_font_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.font = font; + xcb_out.first = first; + xcb_out.count = count; + xcb_out.list_base = list_base; + + 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_glx_use_x_font (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + xcb_font_t font, + uint32_t first, + uint32_t count, + uint32_t list_base) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_USE_X_FONT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_use_x_font_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.font = font; + xcb_out.first = first; + xcb_out.count = count; + xcb_out.list_base = list_base; + + 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_glx_create_glx_pixmap_checked (xcb_connection_t *c, + uint32_t screen, + xcb_visualid_t visual, + xcb_pixmap_t pixmap, + xcb_glx_pixmap_t glx_pixmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_CREATE_GLX_PIXMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_create_glx_pixmap_request_t xcb_out; + + xcb_out.screen = screen; + xcb_out.visual = visual; + xcb_out.pixmap = pixmap; + xcb_out.glx_pixmap = glx_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_glx_create_glx_pixmap (xcb_connection_t *c, + uint32_t screen, + xcb_visualid_t visual, + xcb_pixmap_t pixmap, + xcb_glx_pixmap_t glx_pixmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_CREATE_GLX_PIXMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_create_glx_pixmap_request_t xcb_out; + + xcb_out.screen = screen; + xcb_out.visual = visual; + xcb_out.pixmap = pixmap; + xcb_out.glx_pixmap = glx_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; +} + +int +xcb_glx_get_visual_configs_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_visual_configs_reply_t *_aux = (xcb_glx_get_visual_configs_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_glx_get_visual_configs_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* property_list */ + xcb_block_len += _aux->length * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_glx_get_visual_configs_cookie_t +xcb_glx_get_visual_configs (xcb_connection_t *c, + uint32_t screen) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_VISUAL_CONFIGS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_visual_configs_cookie_t xcb_ret; + xcb_glx_get_visual_configs_request_t xcb_out; + + 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_glx_get_visual_configs_cookie_t +xcb_glx_get_visual_configs_unchecked (xcb_connection_t *c, + uint32_t screen) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_VISUAL_CONFIGS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_visual_configs_cookie_t xcb_ret; + xcb_glx_get_visual_configs_request_t xcb_out; + + 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; +} + +uint32_t * +xcb_glx_get_visual_configs_property_list (const xcb_glx_get_visual_configs_reply_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_glx_get_visual_configs_property_list_length (const xcb_glx_get_visual_configs_reply_t *R) +{ + return R->length; +} + +xcb_generic_iterator_t +xcb_glx_get_visual_configs_property_list_end (const xcb_glx_get_visual_configs_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->length); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_visual_configs_reply_t * +xcb_glx_get_visual_configs_reply (xcb_connection_t *c, + xcb_glx_get_visual_configs_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_visual_configs_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_glx_destroy_glx_pixmap_checked (xcb_connection_t *c, + xcb_glx_pixmap_t glx_pixmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_DESTROY_GLX_PIXMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_destroy_glx_pixmap_request_t xcb_out; + + xcb_out.glx_pixmap = glx_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_glx_destroy_glx_pixmap (xcb_connection_t *c, + xcb_glx_pixmap_t glx_pixmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_DESTROY_GLX_PIXMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_destroy_glx_pixmap_request_t xcb_out; + + xcb_out.glx_pixmap = glx_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; +} + +int +xcb_glx_vendor_private_sizeof (const void *_buffer, + uint32_t data_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_glx_vendor_private_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += data_len * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_glx_vendor_private_checked (xcb_connection_t *c, + uint32_t vendor_code, + xcb_glx_context_tag_t context_tag, + uint32_t data_len, + const uint8_t *data) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_VENDOR_PRIVATE, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_glx_vendor_private_request_t xcb_out; + + xcb_out.vendor_code = vendor_code; + xcb_out.context_tag = context_tag; + + 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; + /* uint8_t data */ + xcb_parts[4].iov_base = (char *) data; + xcb_parts[4].iov_len = data_len * sizeof(uint8_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_glx_vendor_private (xcb_connection_t *c, + uint32_t vendor_code, + xcb_glx_context_tag_t context_tag, + uint32_t data_len, + const uint8_t *data) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_VENDOR_PRIVATE, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_glx_vendor_private_request_t xcb_out; + + xcb_out.vendor_code = vendor_code; + xcb_out.context_tag = context_tag; + + 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; + /* uint8_t data */ + xcb_parts[4].iov_base = (char *) data; + xcb_parts[4].iov_len = data_len * sizeof(uint8_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; +} + +uint8_t * +xcb_glx_vendor_private_data (const xcb_glx_vendor_private_request_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_glx_vendor_private_data_length (const xcb_glx_vendor_private_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_glx_vendor_private_request_t))/sizeof(uint8_t)); +} + +xcb_generic_iterator_t +xcb_glx_vendor_private_data_end (const xcb_glx_vendor_private_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_glx_vendor_private_request_t))/sizeof(uint8_t))); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_glx_vendor_private_with_reply_sizeof (const void *_buffer, + uint32_t data_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_glx_vendor_private_with_reply_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += data_len * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_glx_vendor_private_with_reply_cookie_t +xcb_glx_vendor_private_with_reply (xcb_connection_t *c, + uint32_t vendor_code, + xcb_glx_context_tag_t context_tag, + uint32_t data_len, + const uint8_t *data) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_VENDOR_PRIVATE_WITH_REPLY, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_glx_vendor_private_with_reply_cookie_t xcb_ret; + xcb_glx_vendor_private_with_reply_request_t xcb_out; + + xcb_out.vendor_code = vendor_code; + xcb_out.context_tag = context_tag; + + 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; + /* uint8_t data */ + xcb_parts[4].iov_base = (char *) data; + xcb_parts[4].iov_len = data_len * sizeof(uint8_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_glx_vendor_private_with_reply_cookie_t +xcb_glx_vendor_private_with_reply_unchecked (xcb_connection_t *c, + uint32_t vendor_code, + xcb_glx_context_tag_t context_tag, + uint32_t data_len, + const uint8_t *data) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_VENDOR_PRIVATE_WITH_REPLY, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_glx_vendor_private_with_reply_cookie_t xcb_ret; + xcb_glx_vendor_private_with_reply_request_t xcb_out; + + xcb_out.vendor_code = vendor_code; + xcb_out.context_tag = context_tag; + + 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; + /* uint8_t data */ + xcb_parts[4].iov_base = (char *) data; + xcb_parts[4].iov_len = data_len * sizeof(uint8_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; +} + +uint8_t * +xcb_glx_vendor_private_with_reply_data_2 (const xcb_glx_vendor_private_with_reply_reply_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_glx_vendor_private_with_reply_data_2_length (const xcb_glx_vendor_private_with_reply_reply_t *R) +{ + return (R->length * 4); +} + +xcb_generic_iterator_t +xcb_glx_vendor_private_with_reply_data_2_end (const xcb_glx_vendor_private_with_reply_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((R->length * 4)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_vendor_private_with_reply_reply_t * +xcb_glx_vendor_private_with_reply_reply (xcb_connection_t *c, + xcb_glx_vendor_private_with_reply_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_vendor_private_with_reply_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_glx_query_extensions_string_cookie_t +xcb_glx_query_extensions_string (xcb_connection_t *c, + uint32_t screen) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_QUERY_EXTENSIONS_STRING, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_query_extensions_string_cookie_t xcb_ret; + xcb_glx_query_extensions_string_request_t xcb_out; + + 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_glx_query_extensions_string_cookie_t +xcb_glx_query_extensions_string_unchecked (xcb_connection_t *c, + uint32_t screen) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_QUERY_EXTENSIONS_STRING, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_query_extensions_string_cookie_t xcb_ret; + xcb_glx_query_extensions_string_request_t xcb_out; + + 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_glx_query_extensions_string_reply_t * +xcb_glx_query_extensions_string_reply (xcb_connection_t *c, + xcb_glx_query_extensions_string_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_query_extensions_string_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_query_server_string_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_query_server_string_reply_t *_aux = (xcb_glx_query_server_string_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_glx_query_server_string_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* string */ + xcb_block_len += _aux->str_len * sizeof(char); + 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_glx_query_server_string_cookie_t +xcb_glx_query_server_string (xcb_connection_t *c, + uint32_t screen, + uint32_t name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_QUERY_SERVER_STRING, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_query_server_string_cookie_t xcb_ret; + xcb_glx_query_server_string_request_t xcb_out; + + xcb_out.screen = screen; + xcb_out.name = name; + + 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_glx_query_server_string_cookie_t +xcb_glx_query_server_string_unchecked (xcb_connection_t *c, + uint32_t screen, + uint32_t name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_QUERY_SERVER_STRING, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_query_server_string_cookie_t xcb_ret; + xcb_glx_query_server_string_request_t xcb_out; + + xcb_out.screen = screen; + xcb_out.name = name; + + 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; +} + +char * +xcb_glx_query_server_string_string (const xcb_glx_query_server_string_reply_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_glx_query_server_string_string_length (const xcb_glx_query_server_string_reply_t *R) +{ + return R->str_len; +} + +xcb_generic_iterator_t +xcb_glx_query_server_string_string_end (const xcb_glx_query_server_string_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->str_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_query_server_string_reply_t * +xcb_glx_query_server_string_reply (xcb_connection_t *c, + xcb_glx_query_server_string_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_query_server_string_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_client_info_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_client_info_request_t *_aux = (xcb_glx_client_info_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_glx_client_info_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* string */ + xcb_block_len += _aux->str_len * sizeof(char); + 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_glx_client_info_checked (xcb_connection_t *c, + uint32_t major_version, + uint32_t minor_version, + uint32_t str_len, + const char *string) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_CLIENT_INFO, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_glx_client_info_request_t xcb_out; + + xcb_out.major_version = major_version; + xcb_out.minor_version = minor_version; + xcb_out.str_len = str_len; + + 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 = str_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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_glx_client_info (xcb_connection_t *c, + uint32_t major_version, + uint32_t minor_version, + uint32_t str_len, + const char *string) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_CLIENT_INFO, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_glx_client_info_request_t xcb_out; + + xcb_out.major_version = major_version; + xcb_out.minor_version = minor_version; + xcb_out.str_len = str_len; + + 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 = str_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; +} + +char * +xcb_glx_client_info_string (const xcb_glx_client_info_request_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_glx_client_info_string_length (const xcb_glx_client_info_request_t *R) +{ + return R->str_len; +} + +xcb_generic_iterator_t +xcb_glx_client_info_string_end (const xcb_glx_client_info_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->str_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_glx_get_fb_configs_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_fb_configs_reply_t *_aux = (xcb_glx_get_fb_configs_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_glx_get_fb_configs_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* property_list */ + xcb_block_len += _aux->length * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_glx_get_fb_configs_cookie_t +xcb_glx_get_fb_configs (xcb_connection_t *c, + uint32_t screen) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_FB_CONFIGS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_fb_configs_cookie_t xcb_ret; + xcb_glx_get_fb_configs_request_t xcb_out; + + 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_glx_get_fb_configs_cookie_t +xcb_glx_get_fb_configs_unchecked (xcb_connection_t *c, + uint32_t screen) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_FB_CONFIGS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_fb_configs_cookie_t xcb_ret; + xcb_glx_get_fb_configs_request_t xcb_out; + + 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; +} + +uint32_t * +xcb_glx_get_fb_configs_property_list (const xcb_glx_get_fb_configs_reply_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_glx_get_fb_configs_property_list_length (const xcb_glx_get_fb_configs_reply_t *R) +{ + return R->length; +} + +xcb_generic_iterator_t +xcb_glx_get_fb_configs_property_list_end (const xcb_glx_get_fb_configs_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->length); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_fb_configs_reply_t * +xcb_glx_get_fb_configs_reply (xcb_connection_t *c, + xcb_glx_get_fb_configs_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_fb_configs_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_create_pixmap_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_create_pixmap_request_t *_aux = (xcb_glx_create_pixmap_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_glx_create_pixmap_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* attribs */ + xcb_block_len += (_aux->num_attribs * 2) * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_glx_create_pixmap_checked (xcb_connection_t *c, + uint32_t screen, + xcb_glx_fbconfig_t fbconfig, + xcb_pixmap_t pixmap, + xcb_glx_pixmap_t glx_pixmap, + uint32_t num_attribs, + const uint32_t *attribs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_CREATE_PIXMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_glx_create_pixmap_request_t xcb_out; + + xcb_out.screen = screen; + xcb_out.fbconfig = fbconfig; + xcb_out.pixmap = pixmap; + xcb_out.glx_pixmap = glx_pixmap; + xcb_out.num_attribs = num_attribs; + + 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; + /* uint32_t attribs */ + xcb_parts[4].iov_base = (char *) attribs; + xcb_parts[4].iov_len = (num_attribs * 2) * sizeof(uint32_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_glx_create_pixmap (xcb_connection_t *c, + uint32_t screen, + xcb_glx_fbconfig_t fbconfig, + xcb_pixmap_t pixmap, + xcb_glx_pixmap_t glx_pixmap, + uint32_t num_attribs, + const uint32_t *attribs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_CREATE_PIXMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_glx_create_pixmap_request_t xcb_out; + + xcb_out.screen = screen; + xcb_out.fbconfig = fbconfig; + xcb_out.pixmap = pixmap; + xcb_out.glx_pixmap = glx_pixmap; + xcb_out.num_attribs = num_attribs; + + 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; + /* uint32_t attribs */ + xcb_parts[4].iov_base = (char *) attribs; + xcb_parts[4].iov_len = (num_attribs * 2) * sizeof(uint32_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; +} + +uint32_t * +xcb_glx_create_pixmap_attribs (const xcb_glx_create_pixmap_request_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_glx_create_pixmap_attribs_length (const xcb_glx_create_pixmap_request_t *R) +{ + return (R->num_attribs * 2); +} + +xcb_generic_iterator_t +xcb_glx_create_pixmap_attribs_end (const xcb_glx_create_pixmap_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + ((R->num_attribs * 2)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_glx_destroy_pixmap_checked (xcb_connection_t *c, + xcb_glx_pixmap_t glx_pixmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_DESTROY_PIXMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_destroy_pixmap_request_t xcb_out; + + xcb_out.glx_pixmap = glx_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_glx_destroy_pixmap (xcb_connection_t *c, + xcb_glx_pixmap_t glx_pixmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_DESTROY_PIXMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_destroy_pixmap_request_t xcb_out; + + xcb_out.glx_pixmap = glx_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_void_cookie_t +xcb_glx_create_new_context_checked (xcb_connection_t *c, + xcb_glx_context_t context, + xcb_glx_fbconfig_t fbconfig, + uint32_t screen, + uint32_t render_type, + xcb_glx_context_t share_list, + uint8_t is_direct) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_CREATE_NEW_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_create_new_context_request_t xcb_out; + + xcb_out.context = context; + xcb_out.fbconfig = fbconfig; + xcb_out.screen = screen; + xcb_out.render_type = render_type; + xcb_out.share_list = share_list; + xcb_out.is_direct = is_direct; + 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_glx_create_new_context (xcb_connection_t *c, + xcb_glx_context_t context, + xcb_glx_fbconfig_t fbconfig, + uint32_t screen, + uint32_t render_type, + xcb_glx_context_t share_list, + uint8_t is_direct) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_CREATE_NEW_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_create_new_context_request_t xcb_out; + + xcb_out.context = context; + xcb_out.fbconfig = fbconfig; + xcb_out.screen = screen; + xcb_out.render_type = render_type; + xcb_out.share_list = share_list; + xcb_out.is_direct = is_direct; + 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; +} + +int +xcb_glx_query_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_query_context_reply_t *_aux = (xcb_glx_query_context_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_glx_query_context_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* attribs */ + xcb_block_len += (_aux->num_attribs * 2) * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_glx_query_context_cookie_t +xcb_glx_query_context (xcb_connection_t *c, + xcb_glx_context_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_QUERY_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_query_context_cookie_t xcb_ret; + xcb_glx_query_context_request_t xcb_out; + + xcb_out.context = context; + + 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_glx_query_context_cookie_t +xcb_glx_query_context_unchecked (xcb_connection_t *c, + xcb_glx_context_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_QUERY_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_query_context_cookie_t xcb_ret; + xcb_glx_query_context_request_t xcb_out; + + xcb_out.context = context; + + 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; +} + +uint32_t * +xcb_glx_query_context_attribs (const xcb_glx_query_context_reply_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_glx_query_context_attribs_length (const xcb_glx_query_context_reply_t *R) +{ + return (R->num_attribs * 2); +} + +xcb_generic_iterator_t +xcb_glx_query_context_attribs_end (const xcb_glx_query_context_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + ((R->num_attribs * 2)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_query_context_reply_t * +xcb_glx_query_context_reply (xcb_connection_t *c, + xcb_glx_query_context_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_query_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_glx_make_context_current_cookie_t +xcb_glx_make_context_current (xcb_connection_t *c, + xcb_glx_context_tag_t old_context_tag, + xcb_glx_drawable_t drawable, + xcb_glx_drawable_t read_drawable, + xcb_glx_context_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_MAKE_CONTEXT_CURRENT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_make_context_current_cookie_t xcb_ret; + xcb_glx_make_context_current_request_t xcb_out; + + xcb_out.old_context_tag = old_context_tag; + xcb_out.drawable = drawable; + xcb_out.read_drawable = read_drawable; + xcb_out.context = context; + + 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_glx_make_context_current_cookie_t +xcb_glx_make_context_current_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t old_context_tag, + xcb_glx_drawable_t drawable, + xcb_glx_drawable_t read_drawable, + xcb_glx_context_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_MAKE_CONTEXT_CURRENT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_make_context_current_cookie_t xcb_ret; + xcb_glx_make_context_current_request_t xcb_out; + + xcb_out.old_context_tag = old_context_tag; + xcb_out.drawable = drawable; + xcb_out.read_drawable = read_drawable; + xcb_out.context = context; + + 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_glx_make_context_current_reply_t * +xcb_glx_make_context_current_reply (xcb_connection_t *c, + xcb_glx_make_context_current_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_make_context_current_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_create_pbuffer_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_create_pbuffer_request_t *_aux = (xcb_glx_create_pbuffer_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_glx_create_pbuffer_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* attribs */ + xcb_block_len += (_aux->num_attribs * 2) * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_glx_create_pbuffer_checked (xcb_connection_t *c, + uint32_t screen, + xcb_glx_fbconfig_t fbconfig, + xcb_glx_pbuffer_t pbuffer, + uint32_t num_attribs, + const uint32_t *attribs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_CREATE_PBUFFER, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_glx_create_pbuffer_request_t xcb_out; + + xcb_out.screen = screen; + xcb_out.fbconfig = fbconfig; + xcb_out.pbuffer = pbuffer; + xcb_out.num_attribs = num_attribs; + + 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; + /* uint32_t attribs */ + xcb_parts[4].iov_base = (char *) attribs; + xcb_parts[4].iov_len = (num_attribs * 2) * sizeof(uint32_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_glx_create_pbuffer (xcb_connection_t *c, + uint32_t screen, + xcb_glx_fbconfig_t fbconfig, + xcb_glx_pbuffer_t pbuffer, + uint32_t num_attribs, + const uint32_t *attribs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_CREATE_PBUFFER, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_glx_create_pbuffer_request_t xcb_out; + + xcb_out.screen = screen; + xcb_out.fbconfig = fbconfig; + xcb_out.pbuffer = pbuffer; + xcb_out.num_attribs = num_attribs; + + 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; + /* uint32_t attribs */ + xcb_parts[4].iov_base = (char *) attribs; + xcb_parts[4].iov_len = (num_attribs * 2) * sizeof(uint32_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; +} + +uint32_t * +xcb_glx_create_pbuffer_attribs (const xcb_glx_create_pbuffer_request_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_glx_create_pbuffer_attribs_length (const xcb_glx_create_pbuffer_request_t *R) +{ + return (R->num_attribs * 2); +} + +xcb_generic_iterator_t +xcb_glx_create_pbuffer_attribs_end (const xcb_glx_create_pbuffer_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + ((R->num_attribs * 2)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_glx_destroy_pbuffer_checked (xcb_connection_t *c, + xcb_glx_pbuffer_t pbuffer) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_DESTROY_PBUFFER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_destroy_pbuffer_request_t xcb_out; + + xcb_out.pbuffer = pbuffer; + + 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_glx_destroy_pbuffer (xcb_connection_t *c, + xcb_glx_pbuffer_t pbuffer) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_DESTROY_PBUFFER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_destroy_pbuffer_request_t xcb_out; + + xcb_out.pbuffer = pbuffer; + + 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_glx_get_drawable_attributes_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_drawable_attributes_reply_t *_aux = (xcb_glx_get_drawable_attributes_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_glx_get_drawable_attributes_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* attribs */ + xcb_block_len += (_aux->num_attribs * 2) * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_glx_get_drawable_attributes_cookie_t +xcb_glx_get_drawable_attributes (xcb_connection_t *c, + xcb_glx_drawable_t drawable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_DRAWABLE_ATTRIBUTES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_drawable_attributes_cookie_t xcb_ret; + xcb_glx_get_drawable_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_glx_get_drawable_attributes_cookie_t +xcb_glx_get_drawable_attributes_unchecked (xcb_connection_t *c, + xcb_glx_drawable_t drawable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_DRAWABLE_ATTRIBUTES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_drawable_attributes_cookie_t xcb_ret; + xcb_glx_get_drawable_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; +} + +uint32_t * +xcb_glx_get_drawable_attributes_attribs (const xcb_glx_get_drawable_attributes_reply_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_glx_get_drawable_attributes_attribs_length (const xcb_glx_get_drawable_attributes_reply_t *R) +{ + return (R->num_attribs * 2); +} + +xcb_generic_iterator_t +xcb_glx_get_drawable_attributes_attribs_end (const xcb_glx_get_drawable_attributes_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + ((R->num_attribs * 2)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_drawable_attributes_reply_t * +xcb_glx_get_drawable_attributes_reply (xcb_connection_t *c, + xcb_glx_get_drawable_attributes_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_drawable_attributes_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_change_drawable_attributes_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_change_drawable_attributes_request_t *_aux = (xcb_glx_change_drawable_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_glx_change_drawable_attributes_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* attribs */ + xcb_block_len += (_aux->num_attribs * 2) * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_glx_change_drawable_attributes_checked (xcb_connection_t *c, + xcb_glx_drawable_t drawable, + uint32_t num_attribs, + const uint32_t *attribs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_CHANGE_DRAWABLE_ATTRIBUTES, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_glx_change_drawable_attributes_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.num_attribs = num_attribs; + + 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; + /* uint32_t attribs */ + xcb_parts[4].iov_base = (char *) attribs; + xcb_parts[4].iov_len = (num_attribs * 2) * sizeof(uint32_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_glx_change_drawable_attributes (xcb_connection_t *c, + xcb_glx_drawable_t drawable, + uint32_t num_attribs, + const uint32_t *attribs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_CHANGE_DRAWABLE_ATTRIBUTES, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_glx_change_drawable_attributes_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.num_attribs = num_attribs; + + 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; + /* uint32_t attribs */ + xcb_parts[4].iov_base = (char *) attribs; + xcb_parts[4].iov_len = (num_attribs * 2) * sizeof(uint32_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; +} + +uint32_t * +xcb_glx_change_drawable_attributes_attribs (const xcb_glx_change_drawable_attributes_request_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_glx_change_drawable_attributes_attribs_length (const xcb_glx_change_drawable_attributes_request_t *R) +{ + return (R->num_attribs * 2); +} + +xcb_generic_iterator_t +xcb_glx_change_drawable_attributes_attribs_end (const xcb_glx_change_drawable_attributes_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + ((R->num_attribs * 2)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_glx_create_window_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_create_window_request_t *_aux = (xcb_glx_create_window_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_glx_create_window_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* attribs */ + xcb_block_len += (_aux->num_attribs * 2) * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_glx_create_window_checked (xcb_connection_t *c, + uint32_t screen, + xcb_glx_fbconfig_t fbconfig, + xcb_window_t window, + xcb_glx_window_t glx_window, + uint32_t num_attribs, + const uint32_t *attribs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_CREATE_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_glx_create_window_request_t xcb_out; + + xcb_out.screen = screen; + xcb_out.fbconfig = fbconfig; + xcb_out.window = window; + xcb_out.glx_window = glx_window; + xcb_out.num_attribs = num_attribs; + + 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; + /* uint32_t attribs */ + xcb_parts[4].iov_base = (char *) attribs; + xcb_parts[4].iov_len = (num_attribs * 2) * sizeof(uint32_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_glx_create_window (xcb_connection_t *c, + uint32_t screen, + xcb_glx_fbconfig_t fbconfig, + xcb_window_t window, + xcb_glx_window_t glx_window, + uint32_t num_attribs, + const uint32_t *attribs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_CREATE_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_glx_create_window_request_t xcb_out; + + xcb_out.screen = screen; + xcb_out.fbconfig = fbconfig; + xcb_out.window = window; + xcb_out.glx_window = glx_window; + xcb_out.num_attribs = num_attribs; + + 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; + /* uint32_t attribs */ + xcb_parts[4].iov_base = (char *) attribs; + xcb_parts[4].iov_len = (num_attribs * 2) * sizeof(uint32_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; +} + +uint32_t * +xcb_glx_create_window_attribs (const xcb_glx_create_window_request_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_glx_create_window_attribs_length (const xcb_glx_create_window_request_t *R) +{ + return (R->num_attribs * 2); +} + +xcb_generic_iterator_t +xcb_glx_create_window_attribs_end (const xcb_glx_create_window_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + ((R->num_attribs * 2)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_glx_delete_window_checked (xcb_connection_t *c, + xcb_glx_window_t glxwindow) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_DELETE_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_delete_window_request_t xcb_out; + + xcb_out.glxwindow = glxwindow; + + 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_glx_delete_window (xcb_connection_t *c, + xcb_glx_window_t glxwindow) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_DELETE_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_delete_window_request_t xcb_out; + + xcb_out.glxwindow = glxwindow; + + 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_glx_set_client_info_arb_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_set_client_info_arb_request_t *_aux = (xcb_glx_set_client_info_arb_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_glx_set_client_info_arb_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* gl_versions */ + xcb_block_len += (_aux->num_versions * 2) * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* gl_extension_string */ + xcb_block_len += _aux->gl_str_len * sizeof(char); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(char); + xcb_align_to = 4; + /* 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; + /* 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; + /* glx_extension_string */ + xcb_block_len += _aux->glx_str_len * sizeof(char); + 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_glx_set_client_info_arb_checked (xcb_connection_t *c, + uint32_t major_version, + uint32_t minor_version, + uint32_t num_versions, + uint32_t gl_str_len, + uint32_t glx_str_len, + const uint32_t *gl_versions, + const char *gl_extension_string, + const char *glx_extension_string) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 8, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_SET_CLIENT_INFO_ARB, + .isvoid = 1 + }; + + struct iovec xcb_parts[10]; + xcb_void_cookie_t xcb_ret; + xcb_glx_set_client_info_arb_request_t xcb_out; + + xcb_out.major_version = major_version; + xcb_out.minor_version = minor_version; + xcb_out.num_versions = num_versions; + xcb_out.gl_str_len = gl_str_len; + xcb_out.glx_str_len = glx_str_len; + + 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; + /* uint32_t gl_versions */ + xcb_parts[4].iov_base = (char *) gl_versions; + xcb_parts[4].iov_len = (num_versions * 2) * sizeof(uint32_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* char gl_extension_string */ + xcb_parts[6].iov_base = (char *) gl_extension_string; + xcb_parts[6].iov_len = gl_str_len * sizeof(char); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + /* char glx_extension_string */ + xcb_parts[8].iov_base = (char *) glx_extension_string; + xcb_parts[8].iov_len = glx_str_len * sizeof(char); + xcb_parts[9].iov_base = 0; + xcb_parts[9].iov_len = -xcb_parts[8].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_glx_set_client_info_arb (xcb_connection_t *c, + uint32_t major_version, + uint32_t minor_version, + uint32_t num_versions, + uint32_t gl_str_len, + uint32_t glx_str_len, + const uint32_t *gl_versions, + const char *gl_extension_string, + const char *glx_extension_string) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 8, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_SET_CLIENT_INFO_ARB, + .isvoid = 1 + }; + + struct iovec xcb_parts[10]; + xcb_void_cookie_t xcb_ret; + xcb_glx_set_client_info_arb_request_t xcb_out; + + xcb_out.major_version = major_version; + xcb_out.minor_version = minor_version; + xcb_out.num_versions = num_versions; + xcb_out.gl_str_len = gl_str_len; + xcb_out.glx_str_len = glx_str_len; + + 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; + /* uint32_t gl_versions */ + xcb_parts[4].iov_base = (char *) gl_versions; + xcb_parts[4].iov_len = (num_versions * 2) * sizeof(uint32_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* char gl_extension_string */ + xcb_parts[6].iov_base = (char *) gl_extension_string; + xcb_parts[6].iov_len = gl_str_len * sizeof(char); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + /* char glx_extension_string */ + xcb_parts[8].iov_base = (char *) glx_extension_string; + xcb_parts[8].iov_len = glx_str_len * sizeof(char); + xcb_parts[9].iov_base = 0; + xcb_parts[9].iov_len = -xcb_parts[8].iov_len & 3; + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +uint32_t * +xcb_glx_set_client_info_arb_gl_versions (const xcb_glx_set_client_info_arb_request_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_glx_set_client_info_arb_gl_versions_length (const xcb_glx_set_client_info_arb_request_t *R) +{ + return (R->num_versions * 2); +} + +xcb_generic_iterator_t +xcb_glx_set_client_info_arb_gl_versions_end (const xcb_glx_set_client_info_arb_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + ((R->num_versions * 2)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +char * +xcb_glx_set_client_info_arb_gl_extension_string (const xcb_glx_set_client_info_arb_request_t *R) +{ + xcb_generic_iterator_t prev = xcb_glx_set_client_info_arb_gl_versions_end(R); + return (char *) ((char *) prev.data + XCB_TYPE_PAD(char, prev.index) + 0); +} + +int +xcb_glx_set_client_info_arb_gl_extension_string_length (const xcb_glx_set_client_info_arb_request_t *R) +{ + return R->gl_str_len; +} + +xcb_generic_iterator_t +xcb_glx_set_client_info_arb_gl_extension_string_end (const xcb_glx_set_client_info_arb_request_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_glx_set_client_info_arb_gl_versions_end(R); + i.data = ((char *) ((char*) prev.data + XCB_TYPE_PAD(char, prev.index))) + (R->gl_str_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +char * +xcb_glx_set_client_info_arb_glx_extension_string (const xcb_glx_set_client_info_arb_request_t *R) +{ + xcb_generic_iterator_t prev = xcb_glx_set_client_info_arb_gl_extension_string_end(R); + return (char *) ((char *) prev.data + ((-prev.index) & (4 - 1)) + 0); +} + +int +xcb_glx_set_client_info_arb_glx_extension_string_length (const xcb_glx_set_client_info_arb_request_t *R) +{ + return R->glx_str_len; +} + +xcb_generic_iterator_t +xcb_glx_set_client_info_arb_glx_extension_string_end (const xcb_glx_set_client_info_arb_request_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_glx_set_client_info_arb_gl_extension_string_end(R); + i.data = ((char *) ((char*) prev.data + ((-prev.index) & (4 - 1)))) + (R->glx_str_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_glx_create_context_attribs_arb_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_create_context_attribs_arb_request_t *_aux = (xcb_glx_create_context_attribs_arb_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_glx_create_context_attribs_arb_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* attribs */ + xcb_block_len += (_aux->num_attribs * 2) * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_glx_create_context_attribs_arb_checked (xcb_connection_t *c, + xcb_glx_context_t context, + xcb_glx_fbconfig_t fbconfig, + uint32_t screen, + xcb_glx_context_t share_list, + uint8_t is_direct, + uint32_t num_attribs, + const uint32_t *attribs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_CREATE_CONTEXT_ATTRIBS_ARB, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_glx_create_context_attribs_arb_request_t xcb_out; + + xcb_out.context = context; + xcb_out.fbconfig = fbconfig; + xcb_out.screen = screen; + xcb_out.share_list = share_list; + xcb_out.is_direct = is_direct; + memset(xcb_out.pad0, 0, 3); + xcb_out.num_attribs = num_attribs; + + 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; + /* uint32_t attribs */ + xcb_parts[4].iov_base = (char *) attribs; + xcb_parts[4].iov_len = (num_attribs * 2) * sizeof(uint32_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_glx_create_context_attribs_arb (xcb_connection_t *c, + xcb_glx_context_t context, + xcb_glx_fbconfig_t fbconfig, + uint32_t screen, + xcb_glx_context_t share_list, + uint8_t is_direct, + uint32_t num_attribs, + const uint32_t *attribs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_CREATE_CONTEXT_ATTRIBS_ARB, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_glx_create_context_attribs_arb_request_t xcb_out; + + xcb_out.context = context; + xcb_out.fbconfig = fbconfig; + xcb_out.screen = screen; + xcb_out.share_list = share_list; + xcb_out.is_direct = is_direct; + memset(xcb_out.pad0, 0, 3); + xcb_out.num_attribs = num_attribs; + + 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; + /* uint32_t attribs */ + xcb_parts[4].iov_base = (char *) attribs; + xcb_parts[4].iov_len = (num_attribs * 2) * sizeof(uint32_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; +} + +uint32_t * +xcb_glx_create_context_attribs_arb_attribs (const xcb_glx_create_context_attribs_arb_request_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_glx_create_context_attribs_arb_attribs_length (const xcb_glx_create_context_attribs_arb_request_t *R) +{ + return (R->num_attribs * 2); +} + +xcb_generic_iterator_t +xcb_glx_create_context_attribs_arb_attribs_end (const xcb_glx_create_context_attribs_arb_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + ((R->num_attribs * 2)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_glx_set_client_info_2arb_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_set_client_info_2arb_request_t *_aux = (xcb_glx_set_client_info_2arb_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_glx_set_client_info_2arb_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* gl_versions */ + xcb_block_len += (_aux->num_versions * 3) * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* gl_extension_string */ + xcb_block_len += _aux->gl_str_len * sizeof(char); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(char); + xcb_align_to = 4; + /* 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; + /* 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; + /* glx_extension_string */ + xcb_block_len += _aux->glx_str_len * sizeof(char); + 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_glx_set_client_info_2arb_checked (xcb_connection_t *c, + uint32_t major_version, + uint32_t minor_version, + uint32_t num_versions, + uint32_t gl_str_len, + uint32_t glx_str_len, + const uint32_t *gl_versions, + const char *gl_extension_string, + const char *glx_extension_string) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 8, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_SET_CLIENT_INFO_2ARB, + .isvoid = 1 + }; + + struct iovec xcb_parts[10]; + xcb_void_cookie_t xcb_ret; + xcb_glx_set_client_info_2arb_request_t xcb_out; + + xcb_out.major_version = major_version; + xcb_out.minor_version = minor_version; + xcb_out.num_versions = num_versions; + xcb_out.gl_str_len = gl_str_len; + xcb_out.glx_str_len = glx_str_len; + + 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; + /* uint32_t gl_versions */ + xcb_parts[4].iov_base = (char *) gl_versions; + xcb_parts[4].iov_len = (num_versions * 3) * sizeof(uint32_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* char gl_extension_string */ + xcb_parts[6].iov_base = (char *) gl_extension_string; + xcb_parts[6].iov_len = gl_str_len * sizeof(char); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + /* char glx_extension_string */ + xcb_parts[8].iov_base = (char *) glx_extension_string; + xcb_parts[8].iov_len = glx_str_len * sizeof(char); + xcb_parts[9].iov_base = 0; + xcb_parts[9].iov_len = -xcb_parts[8].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_glx_set_client_info_2arb (xcb_connection_t *c, + uint32_t major_version, + uint32_t minor_version, + uint32_t num_versions, + uint32_t gl_str_len, + uint32_t glx_str_len, + const uint32_t *gl_versions, + const char *gl_extension_string, + const char *glx_extension_string) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 8, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_SET_CLIENT_INFO_2ARB, + .isvoid = 1 + }; + + struct iovec xcb_parts[10]; + xcb_void_cookie_t xcb_ret; + xcb_glx_set_client_info_2arb_request_t xcb_out; + + xcb_out.major_version = major_version; + xcb_out.minor_version = minor_version; + xcb_out.num_versions = num_versions; + xcb_out.gl_str_len = gl_str_len; + xcb_out.glx_str_len = glx_str_len; + + 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; + /* uint32_t gl_versions */ + xcb_parts[4].iov_base = (char *) gl_versions; + xcb_parts[4].iov_len = (num_versions * 3) * sizeof(uint32_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* char gl_extension_string */ + xcb_parts[6].iov_base = (char *) gl_extension_string; + xcb_parts[6].iov_len = gl_str_len * sizeof(char); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + /* char glx_extension_string */ + xcb_parts[8].iov_base = (char *) glx_extension_string; + xcb_parts[8].iov_len = glx_str_len * sizeof(char); + xcb_parts[9].iov_base = 0; + xcb_parts[9].iov_len = -xcb_parts[8].iov_len & 3; + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +uint32_t * +xcb_glx_set_client_info_2arb_gl_versions (const xcb_glx_set_client_info_2arb_request_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_glx_set_client_info_2arb_gl_versions_length (const xcb_glx_set_client_info_2arb_request_t *R) +{ + return (R->num_versions * 3); +} + +xcb_generic_iterator_t +xcb_glx_set_client_info_2arb_gl_versions_end (const xcb_glx_set_client_info_2arb_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + ((R->num_versions * 3)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +char * +xcb_glx_set_client_info_2arb_gl_extension_string (const xcb_glx_set_client_info_2arb_request_t *R) +{ + xcb_generic_iterator_t prev = xcb_glx_set_client_info_2arb_gl_versions_end(R); + return (char *) ((char *) prev.data + XCB_TYPE_PAD(char, prev.index) + 0); +} + +int +xcb_glx_set_client_info_2arb_gl_extension_string_length (const xcb_glx_set_client_info_2arb_request_t *R) +{ + return R->gl_str_len; +} + +xcb_generic_iterator_t +xcb_glx_set_client_info_2arb_gl_extension_string_end (const xcb_glx_set_client_info_2arb_request_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_glx_set_client_info_2arb_gl_versions_end(R); + i.data = ((char *) ((char*) prev.data + XCB_TYPE_PAD(char, prev.index))) + (R->gl_str_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +char * +xcb_glx_set_client_info_2arb_glx_extension_string (const xcb_glx_set_client_info_2arb_request_t *R) +{ + xcb_generic_iterator_t prev = xcb_glx_set_client_info_2arb_gl_extension_string_end(R); + return (char *) ((char *) prev.data + ((-prev.index) & (4 - 1)) + 0); +} + +int +xcb_glx_set_client_info_2arb_glx_extension_string_length (const xcb_glx_set_client_info_2arb_request_t *R) +{ + return R->glx_str_len; +} + +xcb_generic_iterator_t +xcb_glx_set_client_info_2arb_glx_extension_string_end (const xcb_glx_set_client_info_2arb_request_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_glx_set_client_info_2arb_gl_extension_string_end(R); + i.data = ((char *) ((char*) prev.data + ((-prev.index) & (4 - 1)))) + (R->glx_str_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_glx_new_list_checked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t list, + uint32_t mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_NEW_LIST, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_new_list_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.list = list; + xcb_out.mode = mode; + + 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_glx_new_list (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t list, + uint32_t mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_NEW_LIST, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_new_list_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.list = list; + xcb_out.mode = mode; + + 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_glx_end_list_checked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_END_LIST, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_end_list_request_t xcb_out; + + xcb_out.context_tag = context_tag; + + 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_glx_end_list (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_END_LIST, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_end_list_request_t xcb_out; + + xcb_out.context_tag = context_tag; + + 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_glx_delete_lists_checked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t list, + int32_t range) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_DELETE_LISTS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_delete_lists_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.list = list; + xcb_out.range = range; + + 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_glx_delete_lists (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t list, + int32_t range) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_DELETE_LISTS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_delete_lists_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.list = list; + xcb_out.range = range; + + 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_glx_gen_lists_cookie_t +xcb_glx_gen_lists (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + int32_t range) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GEN_LISTS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_gen_lists_cookie_t xcb_ret; + xcb_glx_gen_lists_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.range = range; + + 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_glx_gen_lists_cookie_t +xcb_glx_gen_lists_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + int32_t range) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GEN_LISTS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_gen_lists_cookie_t xcb_ret; + xcb_glx_gen_lists_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.range = range; + + 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_glx_gen_lists_reply_t * +xcb_glx_gen_lists_reply (xcb_connection_t *c, + xcb_glx_gen_lists_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_gen_lists_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_glx_feedback_buffer_checked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + int32_t size, + int32_t type) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_FEEDBACK_BUFFER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_feedback_buffer_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.size = size; + xcb_out.type = type; + + 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_glx_feedback_buffer (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + int32_t size, + int32_t type) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_FEEDBACK_BUFFER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_feedback_buffer_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.size = size; + xcb_out.type = type; + + 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_glx_select_buffer_checked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + int32_t size) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_SELECT_BUFFER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_select_buffer_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.size = size; + + 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_glx_select_buffer (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + int32_t size) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_SELECT_BUFFER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_select_buffer_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.size = size; + + 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_glx_render_mode_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_render_mode_reply_t *_aux = (xcb_glx_render_mode_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_glx_render_mode_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_glx_render_mode_cookie_t +xcb_glx_render_mode (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_RENDER_MODE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_render_mode_cookie_t xcb_ret; + xcb_glx_render_mode_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.mode = mode; + + 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_glx_render_mode_cookie_t +xcb_glx_render_mode_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_RENDER_MODE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_render_mode_cookie_t xcb_ret; + xcb_glx_render_mode_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.mode = mode; + + 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; +} + +uint32_t * +xcb_glx_render_mode_data (const xcb_glx_render_mode_reply_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_glx_render_mode_data_length (const xcb_glx_render_mode_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_render_mode_data_end (const xcb_glx_render_mode_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_render_mode_reply_t * +xcb_glx_render_mode_reply (xcb_connection_t *c, + xcb_glx_render_mode_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_render_mode_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_glx_finish_cookie_t +xcb_glx_finish (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_FINISH, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_finish_cookie_t xcb_ret; + xcb_glx_finish_request_t xcb_out; + + xcb_out.context_tag = context_tag; + + 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_glx_finish_cookie_t +xcb_glx_finish_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_FINISH, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_finish_cookie_t xcb_ret; + xcb_glx_finish_request_t xcb_out; + + xcb_out.context_tag = context_tag; + + 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_glx_finish_reply_t * +xcb_glx_finish_reply (xcb_connection_t *c, + xcb_glx_finish_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_finish_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_glx_pixel_storef_checked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t pname, + xcb_glx_float32_t datum) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_PIXEL_STOREF, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_pixel_storef_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.pname = pname; + xcb_out.datum = datum; + + 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_glx_pixel_storef (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t pname, + xcb_glx_float32_t datum) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_PIXEL_STOREF, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_pixel_storef_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.pname = pname; + xcb_out.datum = datum; + + 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_glx_pixel_storei_checked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t pname, + int32_t datum) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_PIXEL_STOREI, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_pixel_storei_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.pname = pname; + xcb_out.datum = datum; + + 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_glx_pixel_storei (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t pname, + int32_t datum) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_PIXEL_STOREI, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_pixel_storei_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.pname = pname; + xcb_out.datum = datum; + + 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_glx_read_pixels_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_read_pixels_reply_t *_aux = (xcb_glx_read_pixels_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_glx_read_pixels_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += (_aux->length * 4) * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_glx_read_pixels_cookie_t +xcb_glx_read_pixels (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + int32_t x, + int32_t y, + int32_t width, + int32_t height, + uint32_t format, + uint32_t type, + uint8_t swap_bytes, + uint8_t lsb_first) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_READ_PIXELS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_read_pixels_cookie_t xcb_ret; + xcb_glx_read_pixels_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.x = x; + xcb_out.y = y; + xcb_out.width = width; + xcb_out.height = height; + xcb_out.format = format; + xcb_out.type = type; + xcb_out.swap_bytes = swap_bytes; + xcb_out.lsb_first = lsb_first; + + 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_glx_read_pixels_cookie_t +xcb_glx_read_pixels_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + int32_t x, + int32_t y, + int32_t width, + int32_t height, + uint32_t format, + uint32_t type, + uint8_t swap_bytes, + uint8_t lsb_first) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_READ_PIXELS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_read_pixels_cookie_t xcb_ret; + xcb_glx_read_pixels_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.x = x; + xcb_out.y = y; + xcb_out.width = width; + xcb_out.height = height; + xcb_out.format = format; + xcb_out.type = type; + xcb_out.swap_bytes = swap_bytes; + xcb_out.lsb_first = lsb_first; + + 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; +} + +uint8_t * +xcb_glx_read_pixels_data (const xcb_glx_read_pixels_reply_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_glx_read_pixels_data_length (const xcb_glx_read_pixels_reply_t *R) +{ + return (R->length * 4); +} + +xcb_generic_iterator_t +xcb_glx_read_pixels_data_end (const xcb_glx_read_pixels_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((R->length * 4)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_read_pixels_reply_t * +xcb_glx_read_pixels_reply (xcb_connection_t *c, + xcb_glx_read_pixels_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_read_pixels_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_booleanv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_booleanv_reply_t *_aux = (xcb_glx_get_booleanv_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_glx_get_booleanv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_glx_get_booleanv_cookie_t +xcb_glx_get_booleanv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + int32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_BOOLEANV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_booleanv_cookie_t xcb_ret; + xcb_glx_get_booleanv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.pname = pname; + + 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_glx_get_booleanv_cookie_t +xcb_glx_get_booleanv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + int32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_BOOLEANV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_booleanv_cookie_t xcb_ret; + xcb_glx_get_booleanv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.pname = pname; + + 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; +} + +uint8_t * +xcb_glx_get_booleanv_data (const xcb_glx_get_booleanv_reply_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_glx_get_booleanv_data_length (const xcb_glx_get_booleanv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_booleanv_data_end (const xcb_glx_get_booleanv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_booleanv_reply_t * +xcb_glx_get_booleanv_reply (xcb_connection_t *c, + xcb_glx_get_booleanv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_booleanv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_clip_plane_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_clip_plane_reply_t *_aux = (xcb_glx_get_clip_plane_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_glx_get_clip_plane_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += (_aux->length / 2) * sizeof(xcb_glx_float64_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_glx_float64_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_glx_get_clip_plane_cookie_t +xcb_glx_get_clip_plane (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + int32_t plane) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_CLIP_PLANE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_clip_plane_cookie_t xcb_ret; + xcb_glx_get_clip_plane_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.plane = plane; + + 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_glx_get_clip_plane_cookie_t +xcb_glx_get_clip_plane_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + int32_t plane) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_CLIP_PLANE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_clip_plane_cookie_t xcb_ret; + xcb_glx_get_clip_plane_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.plane = plane; + + 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_glx_float64_t * +xcb_glx_get_clip_plane_data (const xcb_glx_get_clip_plane_reply_t *R) +{ + return (xcb_glx_float64_t *) (R + 1); +} + +int +xcb_glx_get_clip_plane_data_length (const xcb_glx_get_clip_plane_reply_t *R) +{ + return (R->length / 2); +} + +xcb_generic_iterator_t +xcb_glx_get_clip_plane_data_end (const xcb_glx_get_clip_plane_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_glx_float64_t *) (R + 1)) + ((R->length / 2)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_clip_plane_reply_t * +xcb_glx_get_clip_plane_reply (xcb_connection_t *c, + xcb_glx_get_clip_plane_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_clip_plane_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_doublev_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_doublev_reply_t *_aux = (xcb_glx_get_doublev_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_glx_get_doublev_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(xcb_glx_float64_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_glx_float64_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_glx_get_doublev_cookie_t +xcb_glx_get_doublev (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_DOUBLEV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_doublev_cookie_t xcb_ret; + xcb_glx_get_doublev_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.pname = pname; + + 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_glx_get_doublev_cookie_t +xcb_glx_get_doublev_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_DOUBLEV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_doublev_cookie_t xcb_ret; + xcb_glx_get_doublev_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.pname = pname; + + 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_glx_float64_t * +xcb_glx_get_doublev_data (const xcb_glx_get_doublev_reply_t *R) +{ + return (xcb_glx_float64_t *) (R + 1); +} + +int +xcb_glx_get_doublev_data_length (const xcb_glx_get_doublev_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_doublev_data_end (const xcb_glx_get_doublev_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_glx_float64_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_doublev_reply_t * +xcb_glx_get_doublev_reply (xcb_connection_t *c, + xcb_glx_get_doublev_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_doublev_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_glx_get_error_cookie_t +xcb_glx_get_error (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_ERROR, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_error_cookie_t xcb_ret; + xcb_glx_get_error_request_t xcb_out; + + xcb_out.context_tag = context_tag; + + 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_glx_get_error_cookie_t +xcb_glx_get_error_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_ERROR, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_error_cookie_t xcb_ret; + xcb_glx_get_error_request_t xcb_out; + + xcb_out.context_tag = context_tag; + + 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_glx_get_error_reply_t * +xcb_glx_get_error_reply (xcb_connection_t *c, + xcb_glx_get_error_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_error_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_floatv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_floatv_reply_t *_aux = (xcb_glx_get_floatv_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_glx_get_floatv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(xcb_glx_float32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_glx_float32_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_glx_get_floatv_cookie_t +xcb_glx_get_floatv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_FLOATV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_floatv_cookie_t xcb_ret; + xcb_glx_get_floatv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.pname = pname; + + 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_glx_get_floatv_cookie_t +xcb_glx_get_floatv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_FLOATV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_floatv_cookie_t xcb_ret; + xcb_glx_get_floatv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.pname = pname; + + 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_glx_float32_t * +xcb_glx_get_floatv_data (const xcb_glx_get_floatv_reply_t *R) +{ + return (xcb_glx_float32_t *) (R + 1); +} + +int +xcb_glx_get_floatv_data_length (const xcb_glx_get_floatv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_floatv_data_end (const xcb_glx_get_floatv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_glx_float32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_floatv_reply_t * +xcb_glx_get_floatv_reply (xcb_connection_t *c, + xcb_glx_get_floatv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_floatv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_integerv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_integerv_reply_t *_aux = (xcb_glx_get_integerv_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_glx_get_integerv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(int32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(int32_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_glx_get_integerv_cookie_t +xcb_glx_get_integerv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_INTEGERV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_integerv_cookie_t xcb_ret; + xcb_glx_get_integerv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.pname = pname; + + 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_glx_get_integerv_cookie_t +xcb_glx_get_integerv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_INTEGERV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_integerv_cookie_t xcb_ret; + xcb_glx_get_integerv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.pname = pname; + + 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; +} + +int32_t * +xcb_glx_get_integerv_data (const xcb_glx_get_integerv_reply_t *R) +{ + return (int32_t *) (R + 1); +} + +int +xcb_glx_get_integerv_data_length (const xcb_glx_get_integerv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_integerv_data_end (const xcb_glx_get_integerv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((int32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_integerv_reply_t * +xcb_glx_get_integerv_reply (xcb_connection_t *c, + xcb_glx_get_integerv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_integerv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_lightfv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_lightfv_reply_t *_aux = (xcb_glx_get_lightfv_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_glx_get_lightfv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(xcb_glx_float32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_glx_float32_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_glx_get_lightfv_cookie_t +xcb_glx_get_lightfv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t light, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_LIGHTFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_lightfv_cookie_t xcb_ret; + xcb_glx_get_lightfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.light = light; + xcb_out.pname = pname; + + 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_glx_get_lightfv_cookie_t +xcb_glx_get_lightfv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t light, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_LIGHTFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_lightfv_cookie_t xcb_ret; + xcb_glx_get_lightfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.light = light; + xcb_out.pname = pname; + + 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_glx_float32_t * +xcb_glx_get_lightfv_data (const xcb_glx_get_lightfv_reply_t *R) +{ + return (xcb_glx_float32_t *) (R + 1); +} + +int +xcb_glx_get_lightfv_data_length (const xcb_glx_get_lightfv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_lightfv_data_end (const xcb_glx_get_lightfv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_glx_float32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_lightfv_reply_t * +xcb_glx_get_lightfv_reply (xcb_connection_t *c, + xcb_glx_get_lightfv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_lightfv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_lightiv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_lightiv_reply_t *_aux = (xcb_glx_get_lightiv_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_glx_get_lightiv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(int32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(int32_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_glx_get_lightiv_cookie_t +xcb_glx_get_lightiv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t light, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_LIGHTIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_lightiv_cookie_t xcb_ret; + xcb_glx_get_lightiv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.light = light; + xcb_out.pname = pname; + + 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_glx_get_lightiv_cookie_t +xcb_glx_get_lightiv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t light, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_LIGHTIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_lightiv_cookie_t xcb_ret; + xcb_glx_get_lightiv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.light = light; + xcb_out.pname = pname; + + 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; +} + +int32_t * +xcb_glx_get_lightiv_data (const xcb_glx_get_lightiv_reply_t *R) +{ + return (int32_t *) (R + 1); +} + +int +xcb_glx_get_lightiv_data_length (const xcb_glx_get_lightiv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_lightiv_data_end (const xcb_glx_get_lightiv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((int32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_lightiv_reply_t * +xcb_glx_get_lightiv_reply (xcb_connection_t *c, + xcb_glx_get_lightiv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_lightiv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_mapdv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_mapdv_reply_t *_aux = (xcb_glx_get_mapdv_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_glx_get_mapdv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(xcb_glx_float64_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_glx_float64_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_glx_get_mapdv_cookie_t +xcb_glx_get_mapdv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t query) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_MAPDV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_mapdv_cookie_t xcb_ret; + xcb_glx_get_mapdv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.query = query; + + 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_glx_get_mapdv_cookie_t +xcb_glx_get_mapdv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t query) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_MAPDV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_mapdv_cookie_t xcb_ret; + xcb_glx_get_mapdv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.query = query; + + 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_glx_float64_t * +xcb_glx_get_mapdv_data (const xcb_glx_get_mapdv_reply_t *R) +{ + return (xcb_glx_float64_t *) (R + 1); +} + +int +xcb_glx_get_mapdv_data_length (const xcb_glx_get_mapdv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_mapdv_data_end (const xcb_glx_get_mapdv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_glx_float64_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_mapdv_reply_t * +xcb_glx_get_mapdv_reply (xcb_connection_t *c, + xcb_glx_get_mapdv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_mapdv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_mapfv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_mapfv_reply_t *_aux = (xcb_glx_get_mapfv_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_glx_get_mapfv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(xcb_glx_float32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_glx_float32_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_glx_get_mapfv_cookie_t +xcb_glx_get_mapfv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t query) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_MAPFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_mapfv_cookie_t xcb_ret; + xcb_glx_get_mapfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.query = query; + + 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_glx_get_mapfv_cookie_t +xcb_glx_get_mapfv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t query) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_MAPFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_mapfv_cookie_t xcb_ret; + xcb_glx_get_mapfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.query = query; + + 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_glx_float32_t * +xcb_glx_get_mapfv_data (const xcb_glx_get_mapfv_reply_t *R) +{ + return (xcb_glx_float32_t *) (R + 1); +} + +int +xcb_glx_get_mapfv_data_length (const xcb_glx_get_mapfv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_mapfv_data_end (const xcb_glx_get_mapfv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_glx_float32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_mapfv_reply_t * +xcb_glx_get_mapfv_reply (xcb_connection_t *c, + xcb_glx_get_mapfv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_mapfv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_mapiv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_mapiv_reply_t *_aux = (xcb_glx_get_mapiv_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_glx_get_mapiv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(int32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(int32_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_glx_get_mapiv_cookie_t +xcb_glx_get_mapiv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t query) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_MAPIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_mapiv_cookie_t xcb_ret; + xcb_glx_get_mapiv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.query = query; + + 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_glx_get_mapiv_cookie_t +xcb_glx_get_mapiv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t query) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_MAPIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_mapiv_cookie_t xcb_ret; + xcb_glx_get_mapiv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.query = query; + + 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; +} + +int32_t * +xcb_glx_get_mapiv_data (const xcb_glx_get_mapiv_reply_t *R) +{ + return (int32_t *) (R + 1); +} + +int +xcb_glx_get_mapiv_data_length (const xcb_glx_get_mapiv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_mapiv_data_end (const xcb_glx_get_mapiv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((int32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_mapiv_reply_t * +xcb_glx_get_mapiv_reply (xcb_connection_t *c, + xcb_glx_get_mapiv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_mapiv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_materialfv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_materialfv_reply_t *_aux = (xcb_glx_get_materialfv_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_glx_get_materialfv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(xcb_glx_float32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_glx_float32_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_glx_get_materialfv_cookie_t +xcb_glx_get_materialfv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t face, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_MATERIALFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_materialfv_cookie_t xcb_ret; + xcb_glx_get_materialfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.face = face; + xcb_out.pname = pname; + + 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_glx_get_materialfv_cookie_t +xcb_glx_get_materialfv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t face, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_MATERIALFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_materialfv_cookie_t xcb_ret; + xcb_glx_get_materialfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.face = face; + xcb_out.pname = pname; + + 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_glx_float32_t * +xcb_glx_get_materialfv_data (const xcb_glx_get_materialfv_reply_t *R) +{ + return (xcb_glx_float32_t *) (R + 1); +} + +int +xcb_glx_get_materialfv_data_length (const xcb_glx_get_materialfv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_materialfv_data_end (const xcb_glx_get_materialfv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_glx_float32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_materialfv_reply_t * +xcb_glx_get_materialfv_reply (xcb_connection_t *c, + xcb_glx_get_materialfv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_materialfv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_materialiv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_materialiv_reply_t *_aux = (xcb_glx_get_materialiv_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_glx_get_materialiv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(int32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(int32_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_glx_get_materialiv_cookie_t +xcb_glx_get_materialiv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t face, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_MATERIALIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_materialiv_cookie_t xcb_ret; + xcb_glx_get_materialiv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.face = face; + xcb_out.pname = pname; + + 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_glx_get_materialiv_cookie_t +xcb_glx_get_materialiv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t face, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_MATERIALIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_materialiv_cookie_t xcb_ret; + xcb_glx_get_materialiv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.face = face; + xcb_out.pname = pname; + + 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; +} + +int32_t * +xcb_glx_get_materialiv_data (const xcb_glx_get_materialiv_reply_t *R) +{ + return (int32_t *) (R + 1); +} + +int +xcb_glx_get_materialiv_data_length (const xcb_glx_get_materialiv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_materialiv_data_end (const xcb_glx_get_materialiv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((int32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_materialiv_reply_t * +xcb_glx_get_materialiv_reply (xcb_connection_t *c, + xcb_glx_get_materialiv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_materialiv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_pixel_mapfv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_pixel_mapfv_reply_t *_aux = (xcb_glx_get_pixel_mapfv_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_glx_get_pixel_mapfv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(xcb_glx_float32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_glx_float32_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_glx_get_pixel_mapfv_cookie_t +xcb_glx_get_pixel_mapfv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t map) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_PIXEL_MAPFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_pixel_mapfv_cookie_t xcb_ret; + xcb_glx_get_pixel_mapfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.map = map; + + 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_glx_get_pixel_mapfv_cookie_t +xcb_glx_get_pixel_mapfv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t map) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_PIXEL_MAPFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_pixel_mapfv_cookie_t xcb_ret; + xcb_glx_get_pixel_mapfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.map = map; + + 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_glx_float32_t * +xcb_glx_get_pixel_mapfv_data (const xcb_glx_get_pixel_mapfv_reply_t *R) +{ + return (xcb_glx_float32_t *) (R + 1); +} + +int +xcb_glx_get_pixel_mapfv_data_length (const xcb_glx_get_pixel_mapfv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_pixel_mapfv_data_end (const xcb_glx_get_pixel_mapfv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_glx_float32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_pixel_mapfv_reply_t * +xcb_glx_get_pixel_mapfv_reply (xcb_connection_t *c, + xcb_glx_get_pixel_mapfv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_pixel_mapfv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_pixel_mapuiv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_pixel_mapuiv_reply_t *_aux = (xcb_glx_get_pixel_mapuiv_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_glx_get_pixel_mapuiv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_glx_get_pixel_mapuiv_cookie_t +xcb_glx_get_pixel_mapuiv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t map) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_PIXEL_MAPUIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_pixel_mapuiv_cookie_t xcb_ret; + xcb_glx_get_pixel_mapuiv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.map = map; + + 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_glx_get_pixel_mapuiv_cookie_t +xcb_glx_get_pixel_mapuiv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t map) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_PIXEL_MAPUIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_pixel_mapuiv_cookie_t xcb_ret; + xcb_glx_get_pixel_mapuiv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.map = map; + + 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; +} + +uint32_t * +xcb_glx_get_pixel_mapuiv_data (const xcb_glx_get_pixel_mapuiv_reply_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_glx_get_pixel_mapuiv_data_length (const xcb_glx_get_pixel_mapuiv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_pixel_mapuiv_data_end (const xcb_glx_get_pixel_mapuiv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_pixel_mapuiv_reply_t * +xcb_glx_get_pixel_mapuiv_reply (xcb_connection_t *c, + xcb_glx_get_pixel_mapuiv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_pixel_mapuiv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_pixel_mapusv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_pixel_mapusv_reply_t *_aux = (xcb_glx_get_pixel_mapusv_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_glx_get_pixel_mapusv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(uint16_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint16_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_glx_get_pixel_mapusv_cookie_t +xcb_glx_get_pixel_mapusv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t map) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_PIXEL_MAPUSV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_pixel_mapusv_cookie_t xcb_ret; + xcb_glx_get_pixel_mapusv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.map = map; + + 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_glx_get_pixel_mapusv_cookie_t +xcb_glx_get_pixel_mapusv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t map) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_PIXEL_MAPUSV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_pixel_mapusv_cookie_t xcb_ret; + xcb_glx_get_pixel_mapusv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.map = map; + + 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; +} + +uint16_t * +xcb_glx_get_pixel_mapusv_data (const xcb_glx_get_pixel_mapusv_reply_t *R) +{ + return (uint16_t *) (R + 1); +} + +int +xcb_glx_get_pixel_mapusv_data_length (const xcb_glx_get_pixel_mapusv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_pixel_mapusv_data_end (const xcb_glx_get_pixel_mapusv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint16_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_pixel_mapusv_reply_t * +xcb_glx_get_pixel_mapusv_reply (xcb_connection_t *c, + xcb_glx_get_pixel_mapusv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_pixel_mapusv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_polygon_stipple_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_polygon_stipple_reply_t *_aux = (xcb_glx_get_polygon_stipple_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_glx_get_polygon_stipple_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += (_aux->length * 4) * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_glx_get_polygon_stipple_cookie_t +xcb_glx_get_polygon_stipple (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint8_t lsb_first) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_POLYGON_STIPPLE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_polygon_stipple_cookie_t xcb_ret; + xcb_glx_get_polygon_stipple_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.lsb_first = lsb_first; + + 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_glx_get_polygon_stipple_cookie_t +xcb_glx_get_polygon_stipple_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint8_t lsb_first) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_POLYGON_STIPPLE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_polygon_stipple_cookie_t xcb_ret; + xcb_glx_get_polygon_stipple_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.lsb_first = lsb_first; + + 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; +} + +uint8_t * +xcb_glx_get_polygon_stipple_data (const xcb_glx_get_polygon_stipple_reply_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_glx_get_polygon_stipple_data_length (const xcb_glx_get_polygon_stipple_reply_t *R) +{ + return (R->length * 4); +} + +xcb_generic_iterator_t +xcb_glx_get_polygon_stipple_data_end (const xcb_glx_get_polygon_stipple_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((R->length * 4)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_polygon_stipple_reply_t * +xcb_glx_get_polygon_stipple_reply (xcb_connection_t *c, + xcb_glx_get_polygon_stipple_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_polygon_stipple_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_string_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_string_reply_t *_aux = (xcb_glx_get_string_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_glx_get_string_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* string */ + xcb_block_len += _aux->n * sizeof(char); + 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_glx_get_string_cookie_t +xcb_glx_get_string (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_STRING, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_string_cookie_t xcb_ret; + xcb_glx_get_string_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.name = name; + + 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_glx_get_string_cookie_t +xcb_glx_get_string_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_STRING, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_string_cookie_t xcb_ret; + xcb_glx_get_string_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.name = name; + + 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; +} + +char * +xcb_glx_get_string_string (const xcb_glx_get_string_reply_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_glx_get_string_string_length (const xcb_glx_get_string_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_string_string_end (const xcb_glx_get_string_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_string_reply_t * +xcb_glx_get_string_reply (xcb_connection_t *c, + xcb_glx_get_string_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_string_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_tex_envfv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_tex_envfv_reply_t *_aux = (xcb_glx_get_tex_envfv_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_glx_get_tex_envfv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(xcb_glx_float32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_glx_float32_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_glx_get_tex_envfv_cookie_t +xcb_glx_get_tex_envfv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_TEX_ENVFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_tex_envfv_cookie_t xcb_ret; + xcb_glx_get_tex_envfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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_glx_get_tex_envfv_cookie_t +xcb_glx_get_tex_envfv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_TEX_ENVFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_tex_envfv_cookie_t xcb_ret; + xcb_glx_get_tex_envfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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_glx_float32_t * +xcb_glx_get_tex_envfv_data (const xcb_glx_get_tex_envfv_reply_t *R) +{ + return (xcb_glx_float32_t *) (R + 1); +} + +int +xcb_glx_get_tex_envfv_data_length (const xcb_glx_get_tex_envfv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_tex_envfv_data_end (const xcb_glx_get_tex_envfv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_glx_float32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_tex_envfv_reply_t * +xcb_glx_get_tex_envfv_reply (xcb_connection_t *c, + xcb_glx_get_tex_envfv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_tex_envfv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_tex_enviv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_tex_enviv_reply_t *_aux = (xcb_glx_get_tex_enviv_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_glx_get_tex_enviv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(int32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(int32_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_glx_get_tex_enviv_cookie_t +xcb_glx_get_tex_enviv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_TEX_ENVIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_tex_enviv_cookie_t xcb_ret; + xcb_glx_get_tex_enviv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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_glx_get_tex_enviv_cookie_t +xcb_glx_get_tex_enviv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_TEX_ENVIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_tex_enviv_cookie_t xcb_ret; + xcb_glx_get_tex_enviv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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; +} + +int32_t * +xcb_glx_get_tex_enviv_data (const xcb_glx_get_tex_enviv_reply_t *R) +{ + return (int32_t *) (R + 1); +} + +int +xcb_glx_get_tex_enviv_data_length (const xcb_glx_get_tex_enviv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_tex_enviv_data_end (const xcb_glx_get_tex_enviv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((int32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_tex_enviv_reply_t * +xcb_glx_get_tex_enviv_reply (xcb_connection_t *c, + xcb_glx_get_tex_enviv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_tex_enviv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_tex_gendv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_tex_gendv_reply_t *_aux = (xcb_glx_get_tex_gendv_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_glx_get_tex_gendv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(xcb_glx_float64_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_glx_float64_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_glx_get_tex_gendv_cookie_t +xcb_glx_get_tex_gendv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t coord, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_TEX_GENDV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_tex_gendv_cookie_t xcb_ret; + xcb_glx_get_tex_gendv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.coord = coord; + xcb_out.pname = pname; + + 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_glx_get_tex_gendv_cookie_t +xcb_glx_get_tex_gendv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t coord, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_TEX_GENDV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_tex_gendv_cookie_t xcb_ret; + xcb_glx_get_tex_gendv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.coord = coord; + xcb_out.pname = pname; + + 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_glx_float64_t * +xcb_glx_get_tex_gendv_data (const xcb_glx_get_tex_gendv_reply_t *R) +{ + return (xcb_glx_float64_t *) (R + 1); +} + +int +xcb_glx_get_tex_gendv_data_length (const xcb_glx_get_tex_gendv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_tex_gendv_data_end (const xcb_glx_get_tex_gendv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_glx_float64_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_tex_gendv_reply_t * +xcb_glx_get_tex_gendv_reply (xcb_connection_t *c, + xcb_glx_get_tex_gendv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_tex_gendv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_tex_genfv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_tex_genfv_reply_t *_aux = (xcb_glx_get_tex_genfv_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_glx_get_tex_genfv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(xcb_glx_float32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_glx_float32_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_glx_get_tex_genfv_cookie_t +xcb_glx_get_tex_genfv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t coord, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_TEX_GENFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_tex_genfv_cookie_t xcb_ret; + xcb_glx_get_tex_genfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.coord = coord; + xcb_out.pname = pname; + + 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_glx_get_tex_genfv_cookie_t +xcb_glx_get_tex_genfv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t coord, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_TEX_GENFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_tex_genfv_cookie_t xcb_ret; + xcb_glx_get_tex_genfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.coord = coord; + xcb_out.pname = pname; + + 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_glx_float32_t * +xcb_glx_get_tex_genfv_data (const xcb_glx_get_tex_genfv_reply_t *R) +{ + return (xcb_glx_float32_t *) (R + 1); +} + +int +xcb_glx_get_tex_genfv_data_length (const xcb_glx_get_tex_genfv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_tex_genfv_data_end (const xcb_glx_get_tex_genfv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_glx_float32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_tex_genfv_reply_t * +xcb_glx_get_tex_genfv_reply (xcb_connection_t *c, + xcb_glx_get_tex_genfv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_tex_genfv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_tex_geniv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_tex_geniv_reply_t *_aux = (xcb_glx_get_tex_geniv_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_glx_get_tex_geniv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(int32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(int32_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_glx_get_tex_geniv_cookie_t +xcb_glx_get_tex_geniv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t coord, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_TEX_GENIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_tex_geniv_cookie_t xcb_ret; + xcb_glx_get_tex_geniv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.coord = coord; + xcb_out.pname = pname; + + 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_glx_get_tex_geniv_cookie_t +xcb_glx_get_tex_geniv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t coord, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_TEX_GENIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_tex_geniv_cookie_t xcb_ret; + xcb_glx_get_tex_geniv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.coord = coord; + xcb_out.pname = pname; + + 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; +} + +int32_t * +xcb_glx_get_tex_geniv_data (const xcb_glx_get_tex_geniv_reply_t *R) +{ + return (int32_t *) (R + 1); +} + +int +xcb_glx_get_tex_geniv_data_length (const xcb_glx_get_tex_geniv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_tex_geniv_data_end (const xcb_glx_get_tex_geniv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((int32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_tex_geniv_reply_t * +xcb_glx_get_tex_geniv_reply (xcb_connection_t *c, + xcb_glx_get_tex_geniv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_tex_geniv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_tex_image_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_tex_image_reply_t *_aux = (xcb_glx_get_tex_image_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_glx_get_tex_image_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += (_aux->length * 4) * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_glx_get_tex_image_cookie_t +xcb_glx_get_tex_image (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + int32_t level, + uint32_t format, + uint32_t type, + uint8_t swap_bytes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_TEX_IMAGE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_tex_image_cookie_t xcb_ret; + xcb_glx_get_tex_image_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.level = level; + xcb_out.format = format; + xcb_out.type = type; + xcb_out.swap_bytes = swap_bytes; + + 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_glx_get_tex_image_cookie_t +xcb_glx_get_tex_image_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + int32_t level, + uint32_t format, + uint32_t type, + uint8_t swap_bytes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_TEX_IMAGE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_tex_image_cookie_t xcb_ret; + xcb_glx_get_tex_image_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.level = level; + xcb_out.format = format; + xcb_out.type = type; + xcb_out.swap_bytes = swap_bytes; + + 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; +} + +uint8_t * +xcb_glx_get_tex_image_data (const xcb_glx_get_tex_image_reply_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_glx_get_tex_image_data_length (const xcb_glx_get_tex_image_reply_t *R) +{ + return (R->length * 4); +} + +xcb_generic_iterator_t +xcb_glx_get_tex_image_data_end (const xcb_glx_get_tex_image_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((R->length * 4)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_tex_image_reply_t * +xcb_glx_get_tex_image_reply (xcb_connection_t *c, + xcb_glx_get_tex_image_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_tex_image_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_tex_parameterfv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_tex_parameterfv_reply_t *_aux = (xcb_glx_get_tex_parameterfv_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_glx_get_tex_parameterfv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(xcb_glx_float32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_glx_float32_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_glx_get_tex_parameterfv_cookie_t +xcb_glx_get_tex_parameterfv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_TEX_PARAMETERFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_tex_parameterfv_cookie_t xcb_ret; + xcb_glx_get_tex_parameterfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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_glx_get_tex_parameterfv_cookie_t +xcb_glx_get_tex_parameterfv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_TEX_PARAMETERFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_tex_parameterfv_cookie_t xcb_ret; + xcb_glx_get_tex_parameterfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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_glx_float32_t * +xcb_glx_get_tex_parameterfv_data (const xcb_glx_get_tex_parameterfv_reply_t *R) +{ + return (xcb_glx_float32_t *) (R + 1); +} + +int +xcb_glx_get_tex_parameterfv_data_length (const xcb_glx_get_tex_parameterfv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_tex_parameterfv_data_end (const xcb_glx_get_tex_parameterfv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_glx_float32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_tex_parameterfv_reply_t * +xcb_glx_get_tex_parameterfv_reply (xcb_connection_t *c, + xcb_glx_get_tex_parameterfv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_tex_parameterfv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_tex_parameteriv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_tex_parameteriv_reply_t *_aux = (xcb_glx_get_tex_parameteriv_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_glx_get_tex_parameteriv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(int32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(int32_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_glx_get_tex_parameteriv_cookie_t +xcb_glx_get_tex_parameteriv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_TEX_PARAMETERIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_tex_parameteriv_cookie_t xcb_ret; + xcb_glx_get_tex_parameteriv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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_glx_get_tex_parameteriv_cookie_t +xcb_glx_get_tex_parameteriv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_TEX_PARAMETERIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_tex_parameteriv_cookie_t xcb_ret; + xcb_glx_get_tex_parameteriv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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; +} + +int32_t * +xcb_glx_get_tex_parameteriv_data (const xcb_glx_get_tex_parameteriv_reply_t *R) +{ + return (int32_t *) (R + 1); +} + +int +xcb_glx_get_tex_parameteriv_data_length (const xcb_glx_get_tex_parameteriv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_tex_parameteriv_data_end (const xcb_glx_get_tex_parameteriv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((int32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_tex_parameteriv_reply_t * +xcb_glx_get_tex_parameteriv_reply (xcb_connection_t *c, + xcb_glx_get_tex_parameteriv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_tex_parameteriv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_tex_level_parameterfv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_tex_level_parameterfv_reply_t *_aux = (xcb_glx_get_tex_level_parameterfv_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_glx_get_tex_level_parameterfv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(xcb_glx_float32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_glx_float32_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_glx_get_tex_level_parameterfv_cookie_t +xcb_glx_get_tex_level_parameterfv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + int32_t level, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_TEX_LEVEL_PARAMETERFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_tex_level_parameterfv_cookie_t xcb_ret; + xcb_glx_get_tex_level_parameterfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.level = level; + xcb_out.pname = pname; + + 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_glx_get_tex_level_parameterfv_cookie_t +xcb_glx_get_tex_level_parameterfv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + int32_t level, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_TEX_LEVEL_PARAMETERFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_tex_level_parameterfv_cookie_t xcb_ret; + xcb_glx_get_tex_level_parameterfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.level = level; + xcb_out.pname = pname; + + 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_glx_float32_t * +xcb_glx_get_tex_level_parameterfv_data (const xcb_glx_get_tex_level_parameterfv_reply_t *R) +{ + return (xcb_glx_float32_t *) (R + 1); +} + +int +xcb_glx_get_tex_level_parameterfv_data_length (const xcb_glx_get_tex_level_parameterfv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_tex_level_parameterfv_data_end (const xcb_glx_get_tex_level_parameterfv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_glx_float32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_tex_level_parameterfv_reply_t * +xcb_glx_get_tex_level_parameterfv_reply (xcb_connection_t *c, + xcb_glx_get_tex_level_parameterfv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_tex_level_parameterfv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_tex_level_parameteriv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_tex_level_parameteriv_reply_t *_aux = (xcb_glx_get_tex_level_parameteriv_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_glx_get_tex_level_parameteriv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(int32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(int32_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_glx_get_tex_level_parameteriv_cookie_t +xcb_glx_get_tex_level_parameteriv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + int32_t level, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_TEX_LEVEL_PARAMETERIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_tex_level_parameteriv_cookie_t xcb_ret; + xcb_glx_get_tex_level_parameteriv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.level = level; + xcb_out.pname = pname; + + 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_glx_get_tex_level_parameteriv_cookie_t +xcb_glx_get_tex_level_parameteriv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + int32_t level, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_TEX_LEVEL_PARAMETERIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_tex_level_parameteriv_cookie_t xcb_ret; + xcb_glx_get_tex_level_parameteriv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.level = level; + xcb_out.pname = pname; + + 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; +} + +int32_t * +xcb_glx_get_tex_level_parameteriv_data (const xcb_glx_get_tex_level_parameteriv_reply_t *R) +{ + return (int32_t *) (R + 1); +} + +int +xcb_glx_get_tex_level_parameteriv_data_length (const xcb_glx_get_tex_level_parameteriv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_tex_level_parameteriv_data_end (const xcb_glx_get_tex_level_parameteriv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((int32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_tex_level_parameteriv_reply_t * +xcb_glx_get_tex_level_parameteriv_reply (xcb_connection_t *c, + xcb_glx_get_tex_level_parameteriv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_tex_level_parameteriv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_glx_is_enabled_cookie_t +xcb_glx_is_enabled (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t capability) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_IS_ENABLED, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_is_enabled_cookie_t xcb_ret; + xcb_glx_is_enabled_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.capability = capability; + + 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_glx_is_enabled_cookie_t +xcb_glx_is_enabled_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t capability) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_IS_ENABLED, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_is_enabled_cookie_t xcb_ret; + xcb_glx_is_enabled_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.capability = capability; + + 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_glx_is_enabled_reply_t * +xcb_glx_is_enabled_reply (xcb_connection_t *c, + xcb_glx_is_enabled_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_is_enabled_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_glx_is_list_cookie_t +xcb_glx_is_list (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_IS_LIST, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_is_list_cookie_t xcb_ret; + xcb_glx_is_list_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.list = list; + + 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_glx_is_list_cookie_t +xcb_glx_is_list_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_IS_LIST, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_is_list_cookie_t xcb_ret; + xcb_glx_is_list_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.list = list; + + 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_glx_is_list_reply_t * +xcb_glx_is_list_reply (xcb_connection_t *c, + xcb_glx_is_list_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_is_list_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_glx_flush_checked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_FLUSH, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_flush_request_t xcb_out; + + xcb_out.context_tag = context_tag; + + 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_glx_flush (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_FLUSH, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_glx_flush_request_t xcb_out; + + xcb_out.context_tag = context_tag; + + 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_glx_are_textures_resident_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_are_textures_resident_request_t *_aux = (xcb_glx_are_textures_resident_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_glx_are_textures_resident_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* textures */ + xcb_block_len += _aux->n * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_glx_are_textures_resident_cookie_t +xcb_glx_are_textures_resident (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + int32_t n, + const uint32_t *textures) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_ARE_TEXTURES_RESIDENT, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_glx_are_textures_resident_cookie_t xcb_ret; + xcb_glx_are_textures_resident_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.n = n; + + 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; + /* uint32_t textures */ + xcb_parts[4].iov_base = (char *) textures; + xcb_parts[4].iov_len = n * sizeof(xcb_glx_bool32_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_glx_are_textures_resident_cookie_t +xcb_glx_are_textures_resident_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + int32_t n, + const uint32_t *textures) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_ARE_TEXTURES_RESIDENT, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_glx_are_textures_resident_cookie_t xcb_ret; + xcb_glx_are_textures_resident_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.n = n; + + 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; + /* uint32_t textures */ + xcb_parts[4].iov_base = (char *) textures; + xcb_parts[4].iov_len = n * sizeof(xcb_glx_bool32_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; +} + +uint8_t * +xcb_glx_are_textures_resident_data (const xcb_glx_are_textures_resident_reply_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_glx_are_textures_resident_data_length (const xcb_glx_are_textures_resident_reply_t *R) +{ + return (R->length * 4); +} + +xcb_generic_iterator_t +xcb_glx_are_textures_resident_data_end (const xcb_glx_are_textures_resident_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((R->length * 4)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_are_textures_resident_reply_t * +xcb_glx_are_textures_resident_reply (xcb_connection_t *c, + xcb_glx_are_textures_resident_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_are_textures_resident_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_delete_textures_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_delete_textures_request_t *_aux = (xcb_glx_delete_textures_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_glx_delete_textures_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* textures */ + xcb_block_len += _aux->n * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_glx_delete_textures_checked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + int32_t n, + const uint32_t *textures) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_DELETE_TEXTURES, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_glx_delete_textures_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.n = n; + + 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; + /* uint32_t textures */ + xcb_parts[4].iov_base = (char *) textures; + xcb_parts[4].iov_len = n * sizeof(uint32_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_glx_delete_textures (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + int32_t n, + const uint32_t *textures) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_DELETE_TEXTURES, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_glx_delete_textures_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.n = n; + + 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; + /* uint32_t textures */ + xcb_parts[4].iov_base = (char *) textures; + xcb_parts[4].iov_len = n * sizeof(uint32_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; +} + +uint32_t * +xcb_glx_delete_textures_textures (const xcb_glx_delete_textures_request_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_glx_delete_textures_textures_length (const xcb_glx_delete_textures_request_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_delete_textures_textures_end (const xcb_glx_delete_textures_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_glx_gen_textures_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_gen_textures_reply_t *_aux = (xcb_glx_gen_textures_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_glx_gen_textures_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->length * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_glx_gen_textures_cookie_t +xcb_glx_gen_textures (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + int32_t n) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GEN_TEXTURES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_gen_textures_cookie_t xcb_ret; + xcb_glx_gen_textures_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.n = n; + + 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_glx_gen_textures_cookie_t +xcb_glx_gen_textures_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + int32_t n) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GEN_TEXTURES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_gen_textures_cookie_t xcb_ret; + xcb_glx_gen_textures_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.n = n; + + 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; +} + +uint32_t * +xcb_glx_gen_textures_data (const xcb_glx_gen_textures_reply_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_glx_gen_textures_data_length (const xcb_glx_gen_textures_reply_t *R) +{ + return R->length; +} + +xcb_generic_iterator_t +xcb_glx_gen_textures_data_end (const xcb_glx_gen_textures_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->length); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_gen_textures_reply_t * +xcb_glx_gen_textures_reply (xcb_connection_t *c, + xcb_glx_gen_textures_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_gen_textures_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_glx_is_texture_cookie_t +xcb_glx_is_texture (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t texture) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_IS_TEXTURE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_is_texture_cookie_t xcb_ret; + xcb_glx_is_texture_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.texture = texture; + + 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_glx_is_texture_cookie_t +xcb_glx_is_texture_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t texture) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_IS_TEXTURE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_is_texture_cookie_t xcb_ret; + xcb_glx_is_texture_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.texture = texture; + + 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_glx_is_texture_reply_t * +xcb_glx_is_texture_reply (xcb_connection_t *c, + xcb_glx_is_texture_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_is_texture_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_color_table_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_color_table_reply_t *_aux = (xcb_glx_get_color_table_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_glx_get_color_table_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += (_aux->length * 4) * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_glx_get_color_table_cookie_t +xcb_glx_get_color_table (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t format, + uint32_t type, + uint8_t swap_bytes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_COLOR_TABLE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_color_table_cookie_t xcb_ret; + xcb_glx_get_color_table_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.format = format; + xcb_out.type = type; + xcb_out.swap_bytes = swap_bytes; + + 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_glx_get_color_table_cookie_t +xcb_glx_get_color_table_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t format, + uint32_t type, + uint8_t swap_bytes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_COLOR_TABLE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_color_table_cookie_t xcb_ret; + xcb_glx_get_color_table_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.format = format; + xcb_out.type = type; + xcb_out.swap_bytes = swap_bytes; + + 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; +} + +uint8_t * +xcb_glx_get_color_table_data (const xcb_glx_get_color_table_reply_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_glx_get_color_table_data_length (const xcb_glx_get_color_table_reply_t *R) +{ + return (R->length * 4); +} + +xcb_generic_iterator_t +xcb_glx_get_color_table_data_end (const xcb_glx_get_color_table_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((R->length * 4)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_color_table_reply_t * +xcb_glx_get_color_table_reply (xcb_connection_t *c, + xcb_glx_get_color_table_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_color_table_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_color_table_parameterfv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_color_table_parameterfv_reply_t *_aux = (xcb_glx_get_color_table_parameterfv_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_glx_get_color_table_parameterfv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(xcb_glx_float32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_glx_float32_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_glx_get_color_table_parameterfv_cookie_t +xcb_glx_get_color_table_parameterfv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_COLOR_TABLE_PARAMETERFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_color_table_parameterfv_cookie_t xcb_ret; + xcb_glx_get_color_table_parameterfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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_glx_get_color_table_parameterfv_cookie_t +xcb_glx_get_color_table_parameterfv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_COLOR_TABLE_PARAMETERFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_color_table_parameterfv_cookie_t xcb_ret; + xcb_glx_get_color_table_parameterfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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_glx_float32_t * +xcb_glx_get_color_table_parameterfv_data (const xcb_glx_get_color_table_parameterfv_reply_t *R) +{ + return (xcb_glx_float32_t *) (R + 1); +} + +int +xcb_glx_get_color_table_parameterfv_data_length (const xcb_glx_get_color_table_parameterfv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_color_table_parameterfv_data_end (const xcb_glx_get_color_table_parameterfv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_glx_float32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_color_table_parameterfv_reply_t * +xcb_glx_get_color_table_parameterfv_reply (xcb_connection_t *c, + xcb_glx_get_color_table_parameterfv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_color_table_parameterfv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_color_table_parameteriv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_color_table_parameteriv_reply_t *_aux = (xcb_glx_get_color_table_parameteriv_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_glx_get_color_table_parameteriv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(int32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(int32_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_glx_get_color_table_parameteriv_cookie_t +xcb_glx_get_color_table_parameteriv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_COLOR_TABLE_PARAMETERIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_color_table_parameteriv_cookie_t xcb_ret; + xcb_glx_get_color_table_parameteriv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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_glx_get_color_table_parameteriv_cookie_t +xcb_glx_get_color_table_parameteriv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_COLOR_TABLE_PARAMETERIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_color_table_parameteriv_cookie_t xcb_ret; + xcb_glx_get_color_table_parameteriv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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; +} + +int32_t * +xcb_glx_get_color_table_parameteriv_data (const xcb_glx_get_color_table_parameteriv_reply_t *R) +{ + return (int32_t *) (R + 1); +} + +int +xcb_glx_get_color_table_parameteriv_data_length (const xcb_glx_get_color_table_parameteriv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_color_table_parameteriv_data_end (const xcb_glx_get_color_table_parameteriv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((int32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_color_table_parameteriv_reply_t * +xcb_glx_get_color_table_parameteriv_reply (xcb_connection_t *c, + xcb_glx_get_color_table_parameteriv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_color_table_parameteriv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_convolution_filter_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_convolution_filter_reply_t *_aux = (xcb_glx_get_convolution_filter_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_glx_get_convolution_filter_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += (_aux->length * 4) * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_glx_get_convolution_filter_cookie_t +xcb_glx_get_convolution_filter (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t format, + uint32_t type, + uint8_t swap_bytes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_CONVOLUTION_FILTER, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_convolution_filter_cookie_t xcb_ret; + xcb_glx_get_convolution_filter_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.format = format; + xcb_out.type = type; + xcb_out.swap_bytes = swap_bytes; + + 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_glx_get_convolution_filter_cookie_t +xcb_glx_get_convolution_filter_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t format, + uint32_t type, + uint8_t swap_bytes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_CONVOLUTION_FILTER, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_convolution_filter_cookie_t xcb_ret; + xcb_glx_get_convolution_filter_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.format = format; + xcb_out.type = type; + xcb_out.swap_bytes = swap_bytes; + + 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; +} + +uint8_t * +xcb_glx_get_convolution_filter_data (const xcb_glx_get_convolution_filter_reply_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_glx_get_convolution_filter_data_length (const xcb_glx_get_convolution_filter_reply_t *R) +{ + return (R->length * 4); +} + +xcb_generic_iterator_t +xcb_glx_get_convolution_filter_data_end (const xcb_glx_get_convolution_filter_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((R->length * 4)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_convolution_filter_reply_t * +xcb_glx_get_convolution_filter_reply (xcb_connection_t *c, + xcb_glx_get_convolution_filter_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_convolution_filter_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_convolution_parameterfv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_convolution_parameterfv_reply_t *_aux = (xcb_glx_get_convolution_parameterfv_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_glx_get_convolution_parameterfv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(xcb_glx_float32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_glx_float32_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_glx_get_convolution_parameterfv_cookie_t +xcb_glx_get_convolution_parameterfv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_CONVOLUTION_PARAMETERFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_convolution_parameterfv_cookie_t xcb_ret; + xcb_glx_get_convolution_parameterfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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_glx_get_convolution_parameterfv_cookie_t +xcb_glx_get_convolution_parameterfv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_CONVOLUTION_PARAMETERFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_convolution_parameterfv_cookie_t xcb_ret; + xcb_glx_get_convolution_parameterfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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_glx_float32_t * +xcb_glx_get_convolution_parameterfv_data (const xcb_glx_get_convolution_parameterfv_reply_t *R) +{ + return (xcb_glx_float32_t *) (R + 1); +} + +int +xcb_glx_get_convolution_parameterfv_data_length (const xcb_glx_get_convolution_parameterfv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_convolution_parameterfv_data_end (const xcb_glx_get_convolution_parameterfv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_glx_float32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_convolution_parameterfv_reply_t * +xcb_glx_get_convolution_parameterfv_reply (xcb_connection_t *c, + xcb_glx_get_convolution_parameterfv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_convolution_parameterfv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_convolution_parameteriv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_convolution_parameteriv_reply_t *_aux = (xcb_glx_get_convolution_parameteriv_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_glx_get_convolution_parameteriv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(int32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(int32_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_glx_get_convolution_parameteriv_cookie_t +xcb_glx_get_convolution_parameteriv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_CONVOLUTION_PARAMETERIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_convolution_parameteriv_cookie_t xcb_ret; + xcb_glx_get_convolution_parameteriv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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_glx_get_convolution_parameteriv_cookie_t +xcb_glx_get_convolution_parameteriv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_CONVOLUTION_PARAMETERIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_convolution_parameteriv_cookie_t xcb_ret; + xcb_glx_get_convolution_parameteriv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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; +} + +int32_t * +xcb_glx_get_convolution_parameteriv_data (const xcb_glx_get_convolution_parameteriv_reply_t *R) +{ + return (int32_t *) (R + 1); +} + +int +xcb_glx_get_convolution_parameteriv_data_length (const xcb_glx_get_convolution_parameteriv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_convolution_parameteriv_data_end (const xcb_glx_get_convolution_parameteriv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((int32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_convolution_parameteriv_reply_t * +xcb_glx_get_convolution_parameteriv_reply (xcb_connection_t *c, + xcb_glx_get_convolution_parameteriv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_convolution_parameteriv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_separable_filter_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_separable_filter_reply_t *_aux = (xcb_glx_get_separable_filter_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_glx_get_separable_filter_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* rows_and_cols */ + xcb_block_len += (_aux->length * 4) * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_glx_get_separable_filter_cookie_t +xcb_glx_get_separable_filter (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t format, + uint32_t type, + uint8_t swap_bytes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_SEPARABLE_FILTER, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_separable_filter_cookie_t xcb_ret; + xcb_glx_get_separable_filter_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.format = format; + xcb_out.type = type; + xcb_out.swap_bytes = swap_bytes; + + 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_glx_get_separable_filter_cookie_t +xcb_glx_get_separable_filter_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t format, + uint32_t type, + uint8_t swap_bytes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_SEPARABLE_FILTER, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_separable_filter_cookie_t xcb_ret; + xcb_glx_get_separable_filter_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.format = format; + xcb_out.type = type; + xcb_out.swap_bytes = swap_bytes; + + 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; +} + +uint8_t * +xcb_glx_get_separable_filter_rows_and_cols (const xcb_glx_get_separable_filter_reply_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_glx_get_separable_filter_rows_and_cols_length (const xcb_glx_get_separable_filter_reply_t *R) +{ + return (R->length * 4); +} + +xcb_generic_iterator_t +xcb_glx_get_separable_filter_rows_and_cols_end (const xcb_glx_get_separable_filter_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((R->length * 4)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_separable_filter_reply_t * +xcb_glx_get_separable_filter_reply (xcb_connection_t *c, + xcb_glx_get_separable_filter_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_separable_filter_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_histogram_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_histogram_reply_t *_aux = (xcb_glx_get_histogram_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_glx_get_histogram_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += (_aux->length * 4) * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_glx_get_histogram_cookie_t +xcb_glx_get_histogram (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t format, + uint32_t type, + uint8_t swap_bytes, + uint8_t reset) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_HISTOGRAM, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_histogram_cookie_t xcb_ret; + xcb_glx_get_histogram_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.format = format; + xcb_out.type = type; + xcb_out.swap_bytes = swap_bytes; + xcb_out.reset = reset; + + 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_glx_get_histogram_cookie_t +xcb_glx_get_histogram_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t format, + uint32_t type, + uint8_t swap_bytes, + uint8_t reset) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_HISTOGRAM, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_histogram_cookie_t xcb_ret; + xcb_glx_get_histogram_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.format = format; + xcb_out.type = type; + xcb_out.swap_bytes = swap_bytes; + xcb_out.reset = reset; + + 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; +} + +uint8_t * +xcb_glx_get_histogram_data (const xcb_glx_get_histogram_reply_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_glx_get_histogram_data_length (const xcb_glx_get_histogram_reply_t *R) +{ + return (R->length * 4); +} + +xcb_generic_iterator_t +xcb_glx_get_histogram_data_end (const xcb_glx_get_histogram_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((R->length * 4)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_histogram_reply_t * +xcb_glx_get_histogram_reply (xcb_connection_t *c, + xcb_glx_get_histogram_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_histogram_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_histogram_parameterfv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_histogram_parameterfv_reply_t *_aux = (xcb_glx_get_histogram_parameterfv_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_glx_get_histogram_parameterfv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(xcb_glx_float32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_glx_float32_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_glx_get_histogram_parameterfv_cookie_t +xcb_glx_get_histogram_parameterfv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_HISTOGRAM_PARAMETERFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_histogram_parameterfv_cookie_t xcb_ret; + xcb_glx_get_histogram_parameterfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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_glx_get_histogram_parameterfv_cookie_t +xcb_glx_get_histogram_parameterfv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_HISTOGRAM_PARAMETERFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_histogram_parameterfv_cookie_t xcb_ret; + xcb_glx_get_histogram_parameterfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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_glx_float32_t * +xcb_glx_get_histogram_parameterfv_data (const xcb_glx_get_histogram_parameterfv_reply_t *R) +{ + return (xcb_glx_float32_t *) (R + 1); +} + +int +xcb_glx_get_histogram_parameterfv_data_length (const xcb_glx_get_histogram_parameterfv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_histogram_parameterfv_data_end (const xcb_glx_get_histogram_parameterfv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_glx_float32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_histogram_parameterfv_reply_t * +xcb_glx_get_histogram_parameterfv_reply (xcb_connection_t *c, + xcb_glx_get_histogram_parameterfv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_histogram_parameterfv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_histogram_parameteriv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_histogram_parameteriv_reply_t *_aux = (xcb_glx_get_histogram_parameteriv_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_glx_get_histogram_parameteriv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(int32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(int32_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_glx_get_histogram_parameteriv_cookie_t +xcb_glx_get_histogram_parameteriv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_HISTOGRAM_PARAMETERIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_histogram_parameteriv_cookie_t xcb_ret; + xcb_glx_get_histogram_parameteriv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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_glx_get_histogram_parameteriv_cookie_t +xcb_glx_get_histogram_parameteriv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_HISTOGRAM_PARAMETERIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_histogram_parameteriv_cookie_t xcb_ret; + xcb_glx_get_histogram_parameteriv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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; +} + +int32_t * +xcb_glx_get_histogram_parameteriv_data (const xcb_glx_get_histogram_parameteriv_reply_t *R) +{ + return (int32_t *) (R + 1); +} + +int +xcb_glx_get_histogram_parameteriv_data_length (const xcb_glx_get_histogram_parameteriv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_histogram_parameteriv_data_end (const xcb_glx_get_histogram_parameteriv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((int32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_histogram_parameteriv_reply_t * +xcb_glx_get_histogram_parameteriv_reply (xcb_connection_t *c, + xcb_glx_get_histogram_parameteriv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_histogram_parameteriv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_minmax_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_minmax_reply_t *_aux = (xcb_glx_get_minmax_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_glx_get_minmax_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += (_aux->length * 4) * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_glx_get_minmax_cookie_t +xcb_glx_get_minmax (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t format, + uint32_t type, + uint8_t swap_bytes, + uint8_t reset) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_MINMAX, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_minmax_cookie_t xcb_ret; + xcb_glx_get_minmax_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.format = format; + xcb_out.type = type; + xcb_out.swap_bytes = swap_bytes; + xcb_out.reset = reset; + + 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_glx_get_minmax_cookie_t +xcb_glx_get_minmax_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t format, + uint32_t type, + uint8_t swap_bytes, + uint8_t reset) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_MINMAX, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_minmax_cookie_t xcb_ret; + xcb_glx_get_minmax_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.format = format; + xcb_out.type = type; + xcb_out.swap_bytes = swap_bytes; + xcb_out.reset = reset; + + 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; +} + +uint8_t * +xcb_glx_get_minmax_data (const xcb_glx_get_minmax_reply_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_glx_get_minmax_data_length (const xcb_glx_get_minmax_reply_t *R) +{ + return (R->length * 4); +} + +xcb_generic_iterator_t +xcb_glx_get_minmax_data_end (const xcb_glx_get_minmax_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((R->length * 4)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_minmax_reply_t * +xcb_glx_get_minmax_reply (xcb_connection_t *c, + xcb_glx_get_minmax_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_minmax_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_minmax_parameterfv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_minmax_parameterfv_reply_t *_aux = (xcb_glx_get_minmax_parameterfv_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_glx_get_minmax_parameterfv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(xcb_glx_float32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_glx_float32_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_glx_get_minmax_parameterfv_cookie_t +xcb_glx_get_minmax_parameterfv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_MINMAX_PARAMETERFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_minmax_parameterfv_cookie_t xcb_ret; + xcb_glx_get_minmax_parameterfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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_glx_get_minmax_parameterfv_cookie_t +xcb_glx_get_minmax_parameterfv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_MINMAX_PARAMETERFV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_minmax_parameterfv_cookie_t xcb_ret; + xcb_glx_get_minmax_parameterfv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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_glx_float32_t * +xcb_glx_get_minmax_parameterfv_data (const xcb_glx_get_minmax_parameterfv_reply_t *R) +{ + return (xcb_glx_float32_t *) (R + 1); +} + +int +xcb_glx_get_minmax_parameterfv_data_length (const xcb_glx_get_minmax_parameterfv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_minmax_parameterfv_data_end (const xcb_glx_get_minmax_parameterfv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_glx_float32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_minmax_parameterfv_reply_t * +xcb_glx_get_minmax_parameterfv_reply (xcb_connection_t *c, + xcb_glx_get_minmax_parameterfv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_minmax_parameterfv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_minmax_parameteriv_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_minmax_parameteriv_reply_t *_aux = (xcb_glx_get_minmax_parameteriv_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_glx_get_minmax_parameteriv_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(int32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(int32_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_glx_get_minmax_parameteriv_cookie_t +xcb_glx_get_minmax_parameteriv (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_MINMAX_PARAMETERIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_minmax_parameteriv_cookie_t xcb_ret; + xcb_glx_get_minmax_parameteriv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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_glx_get_minmax_parameteriv_cookie_t +xcb_glx_get_minmax_parameteriv_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_MINMAX_PARAMETERIV, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_minmax_parameteriv_cookie_t xcb_ret; + xcb_glx_get_minmax_parameteriv_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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; +} + +int32_t * +xcb_glx_get_minmax_parameteriv_data (const xcb_glx_get_minmax_parameteriv_reply_t *R) +{ + return (int32_t *) (R + 1); +} + +int +xcb_glx_get_minmax_parameteriv_data_length (const xcb_glx_get_minmax_parameteriv_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_minmax_parameteriv_data_end (const xcb_glx_get_minmax_parameteriv_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((int32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_minmax_parameteriv_reply_t * +xcb_glx_get_minmax_parameteriv_reply (xcb_connection_t *c, + xcb_glx_get_minmax_parameteriv_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_minmax_parameteriv_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_compressed_tex_image_arb_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_compressed_tex_image_arb_reply_t *_aux = (xcb_glx_get_compressed_tex_image_arb_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_glx_get_compressed_tex_image_arb_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += (_aux->length * 4) * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_glx_get_compressed_tex_image_arb_cookie_t +xcb_glx_get_compressed_tex_image_arb (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + int32_t level) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_COMPRESSED_TEX_IMAGE_ARB, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_compressed_tex_image_arb_cookie_t xcb_ret; + xcb_glx_get_compressed_tex_image_arb_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.level = 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_glx_get_compressed_tex_image_arb_cookie_t +xcb_glx_get_compressed_tex_image_arb_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + int32_t level) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_COMPRESSED_TEX_IMAGE_ARB, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_compressed_tex_image_arb_cookie_t xcb_ret; + xcb_glx_get_compressed_tex_image_arb_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.level = 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; +} + +uint8_t * +xcb_glx_get_compressed_tex_image_arb_data (const xcb_glx_get_compressed_tex_image_arb_reply_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_glx_get_compressed_tex_image_arb_data_length (const xcb_glx_get_compressed_tex_image_arb_reply_t *R) +{ + return (R->length * 4); +} + +xcb_generic_iterator_t +xcb_glx_get_compressed_tex_image_arb_data_end (const xcb_glx_get_compressed_tex_image_arb_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((R->length * 4)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_compressed_tex_image_arb_reply_t * +xcb_glx_get_compressed_tex_image_arb_reply (xcb_connection_t *c, + xcb_glx_get_compressed_tex_image_arb_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_compressed_tex_image_arb_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_delete_queries_arb_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_delete_queries_arb_request_t *_aux = (xcb_glx_delete_queries_arb_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_glx_delete_queries_arb_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* ids */ + xcb_block_len += _aux->n * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_glx_delete_queries_arb_checked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + int32_t n, + const uint32_t *ids) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_DELETE_QUERIES_ARB, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_glx_delete_queries_arb_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.n = n; + + 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; + /* uint32_t ids */ + xcb_parts[4].iov_base = (char *) ids; + xcb_parts[4].iov_len = n * sizeof(uint32_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_glx_delete_queries_arb (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + int32_t n, + const uint32_t *ids) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_DELETE_QUERIES_ARB, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_glx_delete_queries_arb_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.n = n; + + 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; + /* uint32_t ids */ + xcb_parts[4].iov_base = (char *) ids; + xcb_parts[4].iov_len = n * sizeof(uint32_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; +} + +uint32_t * +xcb_glx_delete_queries_arb_ids (const xcb_glx_delete_queries_arb_request_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_glx_delete_queries_arb_ids_length (const xcb_glx_delete_queries_arb_request_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_delete_queries_arb_ids_end (const xcb_glx_delete_queries_arb_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_glx_gen_queries_arb_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_gen_queries_arb_reply_t *_aux = (xcb_glx_gen_queries_arb_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_glx_gen_queries_arb_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->length * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_glx_gen_queries_arb_cookie_t +xcb_glx_gen_queries_arb (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + int32_t n) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GEN_QUERIES_ARB, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_gen_queries_arb_cookie_t xcb_ret; + xcb_glx_gen_queries_arb_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.n = n; + + 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_glx_gen_queries_arb_cookie_t +xcb_glx_gen_queries_arb_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + int32_t n) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GEN_QUERIES_ARB, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_gen_queries_arb_cookie_t xcb_ret; + xcb_glx_gen_queries_arb_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.n = n; + + 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; +} + +uint32_t * +xcb_glx_gen_queries_arb_data (const xcb_glx_gen_queries_arb_reply_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_glx_gen_queries_arb_data_length (const xcb_glx_gen_queries_arb_reply_t *R) +{ + return R->length; +} + +xcb_generic_iterator_t +xcb_glx_gen_queries_arb_data_end (const xcb_glx_gen_queries_arb_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->length); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_gen_queries_arb_reply_t * +xcb_glx_gen_queries_arb_reply (xcb_connection_t *c, + xcb_glx_gen_queries_arb_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_gen_queries_arb_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_glx_is_query_arb_cookie_t +xcb_glx_is_query_arb (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_IS_QUERY_ARB, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_is_query_arb_cookie_t xcb_ret; + xcb_glx_is_query_arb_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.id = id; + + 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_glx_is_query_arb_cookie_t +xcb_glx_is_query_arb_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_IS_QUERY_ARB, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_is_query_arb_cookie_t xcb_ret; + xcb_glx_is_query_arb_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.id = id; + + 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_glx_is_query_arb_reply_t * +xcb_glx_is_query_arb_reply (xcb_connection_t *c, + xcb_glx_is_query_arb_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_is_query_arb_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_queryiv_arb_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_queryiv_arb_reply_t *_aux = (xcb_glx_get_queryiv_arb_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_glx_get_queryiv_arb_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(int32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(int32_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_glx_get_queryiv_arb_cookie_t +xcb_glx_get_queryiv_arb (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_QUERYIV_ARB, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_queryiv_arb_cookie_t xcb_ret; + xcb_glx_get_queryiv_arb_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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_glx_get_queryiv_arb_cookie_t +xcb_glx_get_queryiv_arb_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t target, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_QUERYIV_ARB, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_queryiv_arb_cookie_t xcb_ret; + xcb_glx_get_queryiv_arb_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.target = target; + xcb_out.pname = pname; + + 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; +} + +int32_t * +xcb_glx_get_queryiv_arb_data (const xcb_glx_get_queryiv_arb_reply_t *R) +{ + return (int32_t *) (R + 1); +} + +int +xcb_glx_get_queryiv_arb_data_length (const xcb_glx_get_queryiv_arb_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_queryiv_arb_data_end (const xcb_glx_get_queryiv_arb_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((int32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_queryiv_arb_reply_t * +xcb_glx_get_queryiv_arb_reply (xcb_connection_t *c, + xcb_glx_get_queryiv_arb_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_queryiv_arb_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_query_objectiv_arb_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_query_objectiv_arb_reply_t *_aux = (xcb_glx_get_query_objectiv_arb_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_glx_get_query_objectiv_arb_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(int32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(int32_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_glx_get_query_objectiv_arb_cookie_t +xcb_glx_get_query_objectiv_arb (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t id, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_QUERY_OBJECTIV_ARB, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_query_objectiv_arb_cookie_t xcb_ret; + xcb_glx_get_query_objectiv_arb_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.id = id; + xcb_out.pname = pname; + + 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_glx_get_query_objectiv_arb_cookie_t +xcb_glx_get_query_objectiv_arb_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t id, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_QUERY_OBJECTIV_ARB, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_query_objectiv_arb_cookie_t xcb_ret; + xcb_glx_get_query_objectiv_arb_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.id = id; + xcb_out.pname = pname; + + 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; +} + +int32_t * +xcb_glx_get_query_objectiv_arb_data (const xcb_glx_get_query_objectiv_arb_reply_t *R) +{ + return (int32_t *) (R + 1); +} + +int +xcb_glx_get_query_objectiv_arb_data_length (const xcb_glx_get_query_objectiv_arb_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_query_objectiv_arb_data_end (const xcb_glx_get_query_objectiv_arb_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((int32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_query_objectiv_arb_reply_t * +xcb_glx_get_query_objectiv_arb_reply (xcb_connection_t *c, + xcb_glx_get_query_objectiv_arb_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_query_objectiv_arb_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_glx_get_query_objectuiv_arb_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_glx_get_query_objectuiv_arb_reply_t *_aux = (xcb_glx_get_query_objectuiv_arb_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_glx_get_query_objectuiv_arb_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->n * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_glx_get_query_objectuiv_arb_cookie_t +xcb_glx_get_query_objectuiv_arb (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t id, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_QUERY_OBJECTUIV_ARB, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_query_objectuiv_arb_cookie_t xcb_ret; + xcb_glx_get_query_objectuiv_arb_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.id = id; + xcb_out.pname = pname; + + 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_glx_get_query_objectuiv_arb_cookie_t +xcb_glx_get_query_objectuiv_arb_unchecked (xcb_connection_t *c, + xcb_glx_context_tag_t context_tag, + uint32_t id, + uint32_t pname) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_glx_id, + .opcode = XCB_GLX_GET_QUERY_OBJECTUIV_ARB, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_glx_get_query_objectuiv_arb_cookie_t xcb_ret; + xcb_glx_get_query_objectuiv_arb_request_t xcb_out; + + xcb_out.context_tag = context_tag; + xcb_out.id = id; + xcb_out.pname = pname; + + 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; +} + +uint32_t * +xcb_glx_get_query_objectuiv_arb_data (const xcb_glx_get_query_objectuiv_arb_reply_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_glx_get_query_objectuiv_arb_data_length (const xcb_glx_get_query_objectuiv_arb_reply_t *R) +{ + return R->n; +} + +xcb_generic_iterator_t +xcb_glx_get_query_objectuiv_arb_data_end (const xcb_glx_get_query_objectuiv_arb_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->n); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_glx_get_query_objectuiv_arb_reply_t * +xcb_glx_get_query_objectuiv_arb_reply (xcb_connection_t *c, + xcb_glx_get_query_objectuiv_arb_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_glx_get_query_objectuiv_arb_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + diff --git a/depends/libxcb/src/present.c b/depends/libxcb/src/present.c new file mode 100644 index 0000000..27aeecc --- /dev/null +++ b/depends/libxcb/src/present.c @@ -0,0 +1,539 @@ +/* + * This file generated automatically from present.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "present.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) +#include "xproto.h" +#include "randr.h" +#include "xfixes.h" +#include "sync.h" + +xcb_extension_t xcb_present_id = { "Present", 0 }; + +void +xcb_present_notify_next (xcb_present_notify_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_present_notify_t); +} + +xcb_generic_iterator_t +xcb_present_notify_end (xcb_present_notify_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_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; +} + diff --git a/depends/libxcb/src/randr.c b/depends/libxcb/src/randr.c new file mode 100644 index 0000000..efff1aa --- /dev/null +++ b/depends/libxcb/src/randr.c @@ -0,0 +1,5684 @@ +/* + * This file generated automatically from randr.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "randr.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) +#include "xproto.h" +#include "render.h" + +xcb_extension_t xcb_randr_id = { "RANDR", 0 }; + +void +xcb_randr_mode_next (xcb_randr_mode_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_randr_mode_t); +} + +xcb_generic_iterator_t +xcb_randr_mode_end (xcb_randr_mode_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; +} + +void +xcb_randr_crtc_next (xcb_randr_crtc_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_randr_crtc_t); +} + +xcb_generic_iterator_t +xcb_randr_crtc_end (xcb_randr_crtc_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; +} + +void +xcb_randr_output_next (xcb_randr_output_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_randr_output_t); +} + +xcb_generic_iterator_t +xcb_randr_output_end (xcb_randr_output_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; +} + +void +xcb_randr_provider_next (xcb_randr_provider_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_randr_provider_t); +} + +xcb_generic_iterator_t +xcb_randr_provider_end (xcb_randr_provider_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; +} + +void +xcb_randr_lease_next (xcb_randr_lease_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_randr_lease_t); +} + +xcb_generic_iterator_t +xcb_randr_lease_end (xcb_randr_lease_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; +} + +void +xcb_randr_screen_size_next (xcb_randr_screen_size_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_randr_screen_size_t); +} + +xcb_generic_iterator_t +xcb_randr_screen_size_end (xcb_randr_screen_size_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; +} + +int +xcb_randr_refresh_rates_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_randr_refresh_rates_t *_aux = (xcb_randr_refresh_rates_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_randr_refresh_rates_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* rates */ + xcb_block_len += _aux->nRates * sizeof(uint16_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint16_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; +} + +uint16_t * +xcb_randr_refresh_rates_rates (const xcb_randr_refresh_rates_t *R) +{ + return (uint16_t *) (R + 1); +} + +int +xcb_randr_refresh_rates_rates_length (const xcb_randr_refresh_rates_t *R) +{ + return R->nRates; +} + +xcb_generic_iterator_t +xcb_randr_refresh_rates_rates_end (const xcb_randr_refresh_rates_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint16_t *) (R + 1)) + (R->nRates); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_randr_refresh_rates_next (xcb_randr_refresh_rates_iterator_t *i) +{ + xcb_randr_refresh_rates_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_randr_refresh_rates_t *)(((char *)R) + xcb_randr_refresh_rates_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_randr_refresh_rates_t *) child.data; +} + +xcb_generic_iterator_t +xcb_randr_refresh_rates_end (xcb_randr_refresh_rates_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_randr_refresh_rates_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +xcb_randr_query_version_cookie_t +xcb_randr_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_randr_id, + .opcode = XCB_RANDR_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_query_version_cookie_t xcb_ret; + xcb_randr_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_randr_query_version_cookie_t +xcb_randr_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_randr_id, + .opcode = XCB_RANDR_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_query_version_cookie_t xcb_ret; + xcb_randr_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_randr_query_version_reply_t * +xcb_randr_query_version_reply (xcb_connection_t *c, + xcb_randr_query_version_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_randr_set_screen_config_cookie_t +xcb_randr_set_screen_config (xcb_connection_t *c, + xcb_window_t window, + xcb_timestamp_t timestamp, + xcb_timestamp_t config_timestamp, + uint16_t sizeID, + uint16_t rotation, + uint16_t rate) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_SET_SCREEN_CONFIG, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_set_screen_config_cookie_t xcb_ret; + xcb_randr_set_screen_config_request_t xcb_out; + + xcb_out.window = window; + xcb_out.timestamp = timestamp; + xcb_out.config_timestamp = config_timestamp; + xcb_out.sizeID = sizeID; + xcb_out.rotation = rotation; + xcb_out.rate = rate; + 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_randr_set_screen_config_cookie_t +xcb_randr_set_screen_config_unchecked (xcb_connection_t *c, + xcb_window_t window, + xcb_timestamp_t timestamp, + xcb_timestamp_t config_timestamp, + uint16_t sizeID, + uint16_t rotation, + uint16_t rate) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_SET_SCREEN_CONFIG, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_set_screen_config_cookie_t xcb_ret; + xcb_randr_set_screen_config_request_t xcb_out; + + xcb_out.window = window; + xcb_out.timestamp = timestamp; + xcb_out.config_timestamp = config_timestamp; + xcb_out.sizeID = sizeID; + xcb_out.rotation = rotation; + xcb_out.rate = rate; + 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_randr_set_screen_config_reply_t * +xcb_randr_set_screen_config_reply (xcb_connection_t *c, + xcb_randr_set_screen_config_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_set_screen_config_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_randr_select_input_checked (xcb_connection_t *c, + xcb_window_t window, + uint16_t enable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_SELECT_INPUT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_select_input_request_t xcb_out; + + xcb_out.window = window; + xcb_out.enable = enable; + 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_void_cookie_t +xcb_randr_select_input (xcb_connection_t *c, + xcb_window_t window, + uint16_t enable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_SELECT_INPUT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_select_input_request_t xcb_out; + + xcb_out.window = window; + xcb_out.enable = enable; + 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; +} + +int +xcb_randr_get_screen_info_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_randr_get_screen_info_reply_t *_aux = (xcb_randr_get_screen_info_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_randr_get_screen_info_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* sizes */ + xcb_block_len += _aux->nSizes * sizeof(xcb_randr_screen_size_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_randr_screen_size_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; + /* rates */ + for(i=0; i<(_aux->nInfo - _aux->nSizes); i++) { + xcb_tmp_len = xcb_randr_refresh_rates_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_randr_refresh_rates_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_randr_get_screen_info_cookie_t +xcb_randr_get_screen_info (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_SCREEN_INFO, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_screen_info_cookie_t xcb_ret; + xcb_randr_get_screen_info_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_randr_get_screen_info_cookie_t +xcb_randr_get_screen_info_unchecked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_SCREEN_INFO, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_screen_info_cookie_t xcb_ret; + xcb_randr_get_screen_info_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_randr_screen_size_t * +xcb_randr_get_screen_info_sizes (const xcb_randr_get_screen_info_reply_t *R) +{ + return (xcb_randr_screen_size_t *) (R + 1); +} + +int +xcb_randr_get_screen_info_sizes_length (const xcb_randr_get_screen_info_reply_t *R) +{ + return R->nSizes; +} + +xcb_randr_screen_size_iterator_t +xcb_randr_get_screen_info_sizes_iterator (const xcb_randr_get_screen_info_reply_t *R) +{ + xcb_randr_screen_size_iterator_t i; + i.data = (xcb_randr_screen_size_t *) (R + 1); + i.rem = R->nSizes; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_randr_get_screen_info_rates_length (const xcb_randr_get_screen_info_reply_t *R) +{ + return (R->nInfo - R->nSizes); +} + +xcb_randr_refresh_rates_iterator_t +xcb_randr_get_screen_info_rates_iterator (const xcb_randr_get_screen_info_reply_t *R) +{ + xcb_randr_refresh_rates_iterator_t i; + xcb_generic_iterator_t prev = xcb_randr_screen_size_end(xcb_randr_get_screen_info_sizes_iterator(R)); + i.data = (xcb_randr_refresh_rates_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_refresh_rates_t, prev.index)); + i.rem = (R->nInfo - R->nSizes); + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_get_screen_info_reply_t * +xcb_randr_get_screen_info_reply (xcb_connection_t *c, + xcb_randr_get_screen_info_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_get_screen_info_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_randr_get_screen_size_range_cookie_t +xcb_randr_get_screen_size_range (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_SCREEN_SIZE_RANGE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_screen_size_range_cookie_t xcb_ret; + xcb_randr_get_screen_size_range_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_randr_get_screen_size_range_cookie_t +xcb_randr_get_screen_size_range_unchecked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_SCREEN_SIZE_RANGE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_screen_size_range_cookie_t xcb_ret; + xcb_randr_get_screen_size_range_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_randr_get_screen_size_range_reply_t * +xcb_randr_get_screen_size_range_reply (xcb_connection_t *c, + xcb_randr_get_screen_size_range_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_get_screen_size_range_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_randr_set_screen_size_checked (xcb_connection_t *c, + xcb_window_t window, + uint16_t width, + uint16_t height, + uint32_t mm_width, + uint32_t mm_height) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_SET_SCREEN_SIZE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_set_screen_size_request_t xcb_out; + + xcb_out.window = window; + xcb_out.width = width; + xcb_out.height = height; + xcb_out.mm_width = mm_width; + xcb_out.mm_height = mm_height; + + 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_randr_set_screen_size (xcb_connection_t *c, + xcb_window_t window, + uint16_t width, + uint16_t height, + uint32_t mm_width, + uint32_t mm_height) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_SET_SCREEN_SIZE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_set_screen_size_request_t xcb_out; + + xcb_out.window = window; + xcb_out.width = width; + xcb_out.height = height; + xcb_out.mm_width = mm_width; + xcb_out.mm_height = mm_height; + + 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_randr_mode_info_next (xcb_randr_mode_info_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_randr_mode_info_t); +} + +xcb_generic_iterator_t +xcb_randr_mode_info_end (xcb_randr_mode_info_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; +} + +int +xcb_randr_get_screen_resources_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_randr_get_screen_resources_reply_t *_aux = (xcb_randr_get_screen_resources_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_randr_get_screen_resources_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* crtcs */ + xcb_block_len += _aux->num_crtcs * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_randr_crtc_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; + /* outputs */ + xcb_block_len += _aux->num_outputs * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_randr_output_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; + /* modes */ + xcb_block_len += _aux->num_modes * sizeof(xcb_randr_mode_info_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_randr_mode_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; + /* names */ + xcb_block_len += _aux->names_len * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_randr_get_screen_resources_cookie_t +xcb_randr_get_screen_resources (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_SCREEN_RESOURCES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_screen_resources_cookie_t xcb_ret; + xcb_randr_get_screen_resources_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_randr_get_screen_resources_cookie_t +xcb_randr_get_screen_resources_unchecked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_SCREEN_RESOURCES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_screen_resources_cookie_t xcb_ret; + xcb_randr_get_screen_resources_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_randr_crtc_t * +xcb_randr_get_screen_resources_crtcs (const xcb_randr_get_screen_resources_reply_t *R) +{ + return (xcb_randr_crtc_t *) (R + 1); +} + +int +xcb_randr_get_screen_resources_crtcs_length (const xcb_randr_get_screen_resources_reply_t *R) +{ + return R->num_crtcs; +} + +xcb_generic_iterator_t +xcb_randr_get_screen_resources_crtcs_end (const xcb_randr_get_screen_resources_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_randr_crtc_t *) (R + 1)) + (R->num_crtcs); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_output_t * +xcb_randr_get_screen_resources_outputs (const xcb_randr_get_screen_resources_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_randr_get_screen_resources_crtcs_end(R); + return (xcb_randr_output_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_output_t, prev.index) + 0); +} + +int +xcb_randr_get_screen_resources_outputs_length (const xcb_randr_get_screen_resources_reply_t *R) +{ + return R->num_outputs; +} + +xcb_generic_iterator_t +xcb_randr_get_screen_resources_outputs_end (const xcb_randr_get_screen_resources_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_randr_get_screen_resources_crtcs_end(R); + i.data = ((xcb_randr_output_t *) ((char*) prev.data + XCB_TYPE_PAD(xcb_randr_output_t, prev.index))) + (R->num_outputs); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_mode_info_t * +xcb_randr_get_screen_resources_modes (const xcb_randr_get_screen_resources_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_randr_get_screen_resources_outputs_end(R); + return (xcb_randr_mode_info_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_mode_info_t, prev.index) + 0); +} + +int +xcb_randr_get_screen_resources_modes_length (const xcb_randr_get_screen_resources_reply_t *R) +{ + return R->num_modes; +} + +xcb_randr_mode_info_iterator_t +xcb_randr_get_screen_resources_modes_iterator (const xcb_randr_get_screen_resources_reply_t *R) +{ + xcb_randr_mode_info_iterator_t i; + xcb_generic_iterator_t prev = xcb_randr_get_screen_resources_outputs_end(R); + i.data = (xcb_randr_mode_info_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_mode_info_t, prev.index)); + i.rem = R->num_modes; + i.index = (char *) i.data - (char *) R; + return i; +} + +uint8_t * +xcb_randr_get_screen_resources_names (const xcb_randr_get_screen_resources_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_randr_mode_info_end(xcb_randr_get_screen_resources_modes_iterator(R)); + return (uint8_t *) ((char *) prev.data + XCB_TYPE_PAD(uint8_t, prev.index) + 0); +} + +int +xcb_randr_get_screen_resources_names_length (const xcb_randr_get_screen_resources_reply_t *R) +{ + return R->names_len; +} + +xcb_generic_iterator_t +xcb_randr_get_screen_resources_names_end (const xcb_randr_get_screen_resources_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_randr_mode_info_end(xcb_randr_get_screen_resources_modes_iterator(R)); + i.data = ((uint8_t *) ((char*) prev.data + XCB_TYPE_PAD(uint8_t, prev.index))) + (R->names_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_get_screen_resources_reply_t * +xcb_randr_get_screen_resources_reply (xcb_connection_t *c, + xcb_randr_get_screen_resources_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_get_screen_resources_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_randr_get_output_info_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_randr_get_output_info_reply_t *_aux = (xcb_randr_get_output_info_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_randr_get_output_info_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* crtcs */ + xcb_block_len += _aux->num_crtcs * sizeof(xcb_randr_output_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_randr_crtc_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; + /* modes */ + xcb_block_len += _aux->num_modes * sizeof(xcb_randr_output_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_randr_mode_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; + /* clones */ + xcb_block_len += _aux->num_clones * sizeof(xcb_randr_output_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_randr_output_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; + /* name */ + xcb_block_len += _aux->name_len * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_randr_get_output_info_cookie_t +xcb_randr_get_output_info (xcb_connection_t *c, + xcb_randr_output_t output, + xcb_timestamp_t config_timestamp) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_OUTPUT_INFO, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_output_info_cookie_t xcb_ret; + xcb_randr_get_output_info_request_t xcb_out; + + xcb_out.output = output; + xcb_out.config_timestamp = config_timestamp; + + 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_randr_get_output_info_cookie_t +xcb_randr_get_output_info_unchecked (xcb_connection_t *c, + xcb_randr_output_t output, + xcb_timestamp_t config_timestamp) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_OUTPUT_INFO, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_output_info_cookie_t xcb_ret; + xcb_randr_get_output_info_request_t xcb_out; + + xcb_out.output = output; + xcb_out.config_timestamp = config_timestamp; + + 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_randr_crtc_t * +xcb_randr_get_output_info_crtcs (const xcb_randr_get_output_info_reply_t *R) +{ + return (xcb_randr_crtc_t *) (R + 1); +} + +int +xcb_randr_get_output_info_crtcs_length (const xcb_randr_get_output_info_reply_t *R) +{ + return R->num_crtcs; +} + +xcb_generic_iterator_t +xcb_randr_get_output_info_crtcs_end (const xcb_randr_get_output_info_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_randr_crtc_t *) (R + 1)) + (R->num_crtcs); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_mode_t * +xcb_randr_get_output_info_modes (const xcb_randr_get_output_info_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_randr_get_output_info_crtcs_end(R); + return (xcb_randr_mode_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_mode_t, prev.index) + 0); +} + +int +xcb_randr_get_output_info_modes_length (const xcb_randr_get_output_info_reply_t *R) +{ + return R->num_modes; +} + +xcb_generic_iterator_t +xcb_randr_get_output_info_modes_end (const xcb_randr_get_output_info_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_randr_get_output_info_crtcs_end(R); + i.data = ((xcb_randr_mode_t *) ((char*) prev.data + XCB_TYPE_PAD(xcb_randr_mode_t, prev.index))) + (R->num_modes); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_output_t * +xcb_randr_get_output_info_clones (const xcb_randr_get_output_info_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_randr_get_output_info_modes_end(R); + return (xcb_randr_output_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_output_t, prev.index) + 0); +} + +int +xcb_randr_get_output_info_clones_length (const xcb_randr_get_output_info_reply_t *R) +{ + return R->num_clones; +} + +xcb_generic_iterator_t +xcb_randr_get_output_info_clones_end (const xcb_randr_get_output_info_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_randr_get_output_info_modes_end(R); + i.data = ((xcb_randr_output_t *) ((char*) prev.data + XCB_TYPE_PAD(xcb_randr_output_t, prev.index))) + (R->num_clones); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +uint8_t * +xcb_randr_get_output_info_name (const xcb_randr_get_output_info_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_randr_get_output_info_clones_end(R); + return (uint8_t *) ((char *) prev.data + XCB_TYPE_PAD(uint8_t, prev.index) + 0); +} + +int +xcb_randr_get_output_info_name_length (const xcb_randr_get_output_info_reply_t *R) +{ + return R->name_len; +} + +xcb_generic_iterator_t +xcb_randr_get_output_info_name_end (const xcb_randr_get_output_info_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_randr_get_output_info_clones_end(R); + i.data = ((uint8_t *) ((char*) prev.data + XCB_TYPE_PAD(uint8_t, prev.index))) + (R->name_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_get_output_info_reply_t * +xcb_randr_get_output_info_reply (xcb_connection_t *c, + xcb_randr_get_output_info_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_get_output_info_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_randr_list_output_properties_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_randr_list_output_properties_reply_t *_aux = (xcb_randr_list_output_properties_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_randr_list_output_properties_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* atoms */ + xcb_block_len += _aux->num_atoms * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_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_randr_list_output_properties_cookie_t +xcb_randr_list_output_properties (xcb_connection_t *c, + xcb_randr_output_t output) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_LIST_OUTPUT_PROPERTIES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_list_output_properties_cookie_t xcb_ret; + xcb_randr_list_output_properties_request_t xcb_out; + + xcb_out.output = output; + + 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_randr_list_output_properties_cookie_t +xcb_randr_list_output_properties_unchecked (xcb_connection_t *c, + xcb_randr_output_t output) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_LIST_OUTPUT_PROPERTIES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_list_output_properties_cookie_t xcb_ret; + xcb_randr_list_output_properties_request_t xcb_out; + + xcb_out.output = output; + + 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_atom_t * +xcb_randr_list_output_properties_atoms (const xcb_randr_list_output_properties_reply_t *R) +{ + return (xcb_atom_t *) (R + 1); +} + +int +xcb_randr_list_output_properties_atoms_length (const xcb_randr_list_output_properties_reply_t *R) +{ + return R->num_atoms; +} + +xcb_generic_iterator_t +xcb_randr_list_output_properties_atoms_end (const xcb_randr_list_output_properties_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_atom_t *) (R + 1)) + (R->num_atoms); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_list_output_properties_reply_t * +xcb_randr_list_output_properties_reply (xcb_connection_t *c, + xcb_randr_list_output_properties_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_list_output_properties_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_randr_query_output_property_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_randr_query_output_property_reply_t *_aux = (xcb_randr_query_output_property_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_randr_query_output_property_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* validValues */ + xcb_block_len += _aux->length * sizeof(int32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(int32_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_randr_query_output_property_cookie_t +xcb_randr_query_output_property (xcb_connection_t *c, + xcb_randr_output_t output, + xcb_atom_t property) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_QUERY_OUTPUT_PROPERTY, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_query_output_property_cookie_t xcb_ret; + xcb_randr_query_output_property_request_t xcb_out; + + xcb_out.output = output; + xcb_out.property = property; + + 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_randr_query_output_property_cookie_t +xcb_randr_query_output_property_unchecked (xcb_connection_t *c, + xcb_randr_output_t output, + xcb_atom_t property) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_QUERY_OUTPUT_PROPERTY, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_query_output_property_cookie_t xcb_ret; + xcb_randr_query_output_property_request_t xcb_out; + + xcb_out.output = output; + xcb_out.property = property; + + 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; +} + +int32_t * +xcb_randr_query_output_property_valid_values (const xcb_randr_query_output_property_reply_t *R) +{ + return (int32_t *) (R + 1); +} + +int +xcb_randr_query_output_property_valid_values_length (const xcb_randr_query_output_property_reply_t *R) +{ + return R->length; +} + +xcb_generic_iterator_t +xcb_randr_query_output_property_valid_values_end (const xcb_randr_query_output_property_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((int32_t *) (R + 1)) + (R->length); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_query_output_property_reply_t * +xcb_randr_query_output_property_reply (xcb_connection_t *c, + xcb_randr_query_output_property_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_query_output_property_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_randr_configure_output_property_sizeof (const void *_buffer, + uint32_t values_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_randr_configure_output_property_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* values */ + xcb_block_len += values_len * sizeof(int32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(int32_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_randr_configure_output_property_checked (xcb_connection_t *c, + xcb_randr_output_t output, + xcb_atom_t property, + uint8_t pending, + uint8_t range, + uint32_t values_len, + const int32_t *values) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_CONFIGURE_OUTPUT_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_randr_configure_output_property_request_t xcb_out; + + xcb_out.output = output; + xcb_out.property = property; + xcb_out.pending = pending; + xcb_out.range = range; + 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; + /* int32_t values */ + xcb_parts[4].iov_base = (char *) values; + xcb_parts[4].iov_len = values_len * sizeof(int32_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_randr_configure_output_property (xcb_connection_t *c, + xcb_randr_output_t output, + xcb_atom_t property, + uint8_t pending, + uint8_t range, + uint32_t values_len, + const int32_t *values) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_CONFIGURE_OUTPUT_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_randr_configure_output_property_request_t xcb_out; + + xcb_out.output = output; + xcb_out.property = property; + xcb_out.pending = pending; + xcb_out.range = range; + 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; + /* int32_t values */ + xcb_parts[4].iov_base = (char *) values; + xcb_parts[4].iov_len = values_len * sizeof(int32_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; +} + +int32_t * +xcb_randr_configure_output_property_values (const xcb_randr_configure_output_property_request_t *R) +{ + return (int32_t *) (R + 1); +} + +int +xcb_randr_configure_output_property_values_length (const xcb_randr_configure_output_property_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_randr_configure_output_property_request_t))/sizeof(int32_t)); +} + +xcb_generic_iterator_t +xcb_randr_configure_output_property_values_end (const xcb_randr_configure_output_property_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((int32_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_randr_configure_output_property_request_t))/sizeof(int32_t))); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_randr_change_output_property_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_randr_change_output_property_request_t *_aux = (xcb_randr_change_output_property_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_randr_change_output_property_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += ((_aux->num_units * _aux->format) / 8) * sizeof(char); + 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_randr_change_output_property_checked (xcb_connection_t *c, + xcb_randr_output_t output, + xcb_atom_t property, + xcb_atom_t type, + uint8_t format, + uint8_t mode, + uint32_t num_units, + const void *data) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_CHANGE_OUTPUT_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_randr_change_output_property_request_t xcb_out; + + xcb_out.output = output; + xcb_out.property = property; + xcb_out.type = type; + xcb_out.format = format; + xcb_out.mode = mode; + memset(xcb_out.pad0, 0, 2); + xcb_out.num_units = num_units; + + 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; + /* void data */ + xcb_parts[4].iov_base = (char *) data; + xcb_parts[4].iov_len = ((num_units * format) / 8) * 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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_randr_change_output_property (xcb_connection_t *c, + xcb_randr_output_t output, + xcb_atom_t property, + xcb_atom_t type, + uint8_t format, + uint8_t mode, + uint32_t num_units, + const void *data) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_CHANGE_OUTPUT_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_randr_change_output_property_request_t xcb_out; + + xcb_out.output = output; + xcb_out.property = property; + xcb_out.type = type; + xcb_out.format = format; + xcb_out.mode = mode; + memset(xcb_out.pad0, 0, 2); + xcb_out.num_units = num_units; + + 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; + /* void data */ + xcb_parts[4].iov_base = (char *) data; + xcb_parts[4].iov_len = ((num_units * format) / 8) * 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; +} + +void * +xcb_randr_change_output_property_data (const xcb_randr_change_output_property_request_t *R) +{ + return (void *) (R + 1); +} + +int +xcb_randr_change_output_property_data_length (const xcb_randr_change_output_property_request_t *R) +{ + return ((R->num_units * R->format) / 8); +} + +xcb_generic_iterator_t +xcb_randr_change_output_property_data_end (const xcb_randr_change_output_property_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (((R->num_units * R->format) / 8)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_randr_delete_output_property_checked (xcb_connection_t *c, + xcb_randr_output_t output, + xcb_atom_t property) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_DELETE_OUTPUT_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_delete_output_property_request_t xcb_out; + + xcb_out.output = output; + xcb_out.property = property; + + 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_randr_delete_output_property (xcb_connection_t *c, + xcb_randr_output_t output, + xcb_atom_t property) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_DELETE_OUTPUT_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_delete_output_property_request_t xcb_out; + + xcb_out.output = output; + xcb_out.property = property; + + 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_randr_get_output_property_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_randr_get_output_property_reply_t *_aux = (xcb_randr_get_output_property_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_randr_get_output_property_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += (_aux->num_items * (_aux->format / 8)) * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_randr_get_output_property_cookie_t +xcb_randr_get_output_property (xcb_connection_t *c, + xcb_randr_output_t output, + xcb_atom_t property, + xcb_atom_t type, + uint32_t long_offset, + uint32_t long_length, + uint8_t _delete, + uint8_t pending) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_OUTPUT_PROPERTY, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_output_property_cookie_t xcb_ret; + xcb_randr_get_output_property_request_t xcb_out; + + xcb_out.output = output; + xcb_out.property = property; + xcb_out.type = type; + xcb_out.long_offset = long_offset; + xcb_out.long_length = long_length; + xcb_out._delete = _delete; + xcb_out.pending = pending; + 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_randr_get_output_property_cookie_t +xcb_randr_get_output_property_unchecked (xcb_connection_t *c, + xcb_randr_output_t output, + xcb_atom_t property, + xcb_atom_t type, + uint32_t long_offset, + uint32_t long_length, + uint8_t _delete, + uint8_t pending) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_OUTPUT_PROPERTY, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_output_property_cookie_t xcb_ret; + xcb_randr_get_output_property_request_t xcb_out; + + xcb_out.output = output; + xcb_out.property = property; + xcb_out.type = type; + xcb_out.long_offset = long_offset; + xcb_out.long_length = long_length; + xcb_out._delete = _delete; + xcb_out.pending = pending; + 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; +} + +uint8_t * +xcb_randr_get_output_property_data (const xcb_randr_get_output_property_reply_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_randr_get_output_property_data_length (const xcb_randr_get_output_property_reply_t *R) +{ + return (R->num_items * (R->format / 8)); +} + +xcb_generic_iterator_t +xcb_randr_get_output_property_data_end (const xcb_randr_get_output_property_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((R->num_items * (R->format / 8))); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_get_output_property_reply_t * +xcb_randr_get_output_property_reply (xcb_connection_t *c, + xcb_randr_get_output_property_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_get_output_property_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_randr_create_mode_sizeof (const void *_buffer, + uint32_t name_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_randr_create_mode_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* name */ + xcb_block_len += name_len * sizeof(char); + 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_randr_create_mode_cookie_t +xcb_randr_create_mode (xcb_connection_t *c, + xcb_window_t window, + xcb_randr_mode_info_t mode_info, + uint32_t name_len, + const char *name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_CREATE_MODE, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_randr_create_mode_cookie_t xcb_ret; + xcb_randr_create_mode_request_t xcb_out; + + xcb_out.window = window; + xcb_out.mode_info = mode_info; + + 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 name */ + xcb_parts[4].iov_base = (char *) name; + xcb_parts[4].iov_len = name_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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_randr_create_mode_cookie_t +xcb_randr_create_mode_unchecked (xcb_connection_t *c, + xcb_window_t window, + xcb_randr_mode_info_t mode_info, + uint32_t name_len, + const char *name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_CREATE_MODE, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_randr_create_mode_cookie_t xcb_ret; + xcb_randr_create_mode_request_t xcb_out; + + xcb_out.window = window; + xcb_out.mode_info = mode_info; + + 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 name */ + xcb_parts[4].iov_base = (char *) name; + xcb_parts[4].iov_len = name_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; +} + +xcb_randr_create_mode_reply_t * +xcb_randr_create_mode_reply (xcb_connection_t *c, + xcb_randr_create_mode_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_create_mode_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_randr_destroy_mode_checked (xcb_connection_t *c, + xcb_randr_mode_t mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_DESTROY_MODE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_destroy_mode_request_t xcb_out; + + xcb_out.mode = mode; + + 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_randr_destroy_mode (xcb_connection_t *c, + xcb_randr_mode_t mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_DESTROY_MODE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_destroy_mode_request_t xcb_out; + + xcb_out.mode = mode; + + 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_randr_add_output_mode_checked (xcb_connection_t *c, + xcb_randr_output_t output, + xcb_randr_mode_t mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_ADD_OUTPUT_MODE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_add_output_mode_request_t xcb_out; + + xcb_out.output = output; + xcb_out.mode = mode; + + 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_randr_add_output_mode (xcb_connection_t *c, + xcb_randr_output_t output, + xcb_randr_mode_t mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_ADD_OUTPUT_MODE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_add_output_mode_request_t xcb_out; + + xcb_out.output = output; + xcb_out.mode = mode; + + 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_randr_delete_output_mode_checked (xcb_connection_t *c, + xcb_randr_output_t output, + xcb_randr_mode_t mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_DELETE_OUTPUT_MODE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_delete_output_mode_request_t xcb_out; + + xcb_out.output = output; + xcb_out.mode = mode; + + 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_randr_delete_output_mode (xcb_connection_t *c, + xcb_randr_output_t output, + xcb_randr_mode_t mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_DELETE_OUTPUT_MODE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_delete_output_mode_request_t xcb_out; + + xcb_out.output = output; + xcb_out.mode = mode; + + 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_randr_get_crtc_info_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_randr_get_crtc_info_reply_t *_aux = (xcb_randr_get_crtc_info_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_randr_get_crtc_info_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* outputs */ + xcb_block_len += _aux->num_outputs * sizeof(xcb_randr_output_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_randr_output_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; + /* possible */ + xcb_block_len += _aux->num_possible_outputs * sizeof(xcb_randr_output_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_randr_output_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_randr_get_crtc_info_cookie_t +xcb_randr_get_crtc_info (xcb_connection_t *c, + xcb_randr_crtc_t crtc, + xcb_timestamp_t config_timestamp) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_CRTC_INFO, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_crtc_info_cookie_t xcb_ret; + xcb_randr_get_crtc_info_request_t xcb_out; + + xcb_out.crtc = crtc; + xcb_out.config_timestamp = config_timestamp; + + 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_randr_get_crtc_info_cookie_t +xcb_randr_get_crtc_info_unchecked (xcb_connection_t *c, + xcb_randr_crtc_t crtc, + xcb_timestamp_t config_timestamp) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_CRTC_INFO, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_crtc_info_cookie_t xcb_ret; + xcb_randr_get_crtc_info_request_t xcb_out; + + xcb_out.crtc = crtc; + xcb_out.config_timestamp = config_timestamp; + + 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_randr_output_t * +xcb_randr_get_crtc_info_outputs (const xcb_randr_get_crtc_info_reply_t *R) +{ + return (xcb_randr_output_t *) (R + 1); +} + +int +xcb_randr_get_crtc_info_outputs_length (const xcb_randr_get_crtc_info_reply_t *R) +{ + return R->num_outputs; +} + +xcb_generic_iterator_t +xcb_randr_get_crtc_info_outputs_end (const xcb_randr_get_crtc_info_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_randr_output_t *) (R + 1)) + (R->num_outputs); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_output_t * +xcb_randr_get_crtc_info_possible (const xcb_randr_get_crtc_info_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_randr_get_crtc_info_outputs_end(R); + return (xcb_randr_output_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_output_t, prev.index) + 0); +} + +int +xcb_randr_get_crtc_info_possible_length (const xcb_randr_get_crtc_info_reply_t *R) +{ + return R->num_possible_outputs; +} + +xcb_generic_iterator_t +xcb_randr_get_crtc_info_possible_end (const xcb_randr_get_crtc_info_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_randr_get_crtc_info_outputs_end(R); + i.data = ((xcb_randr_output_t *) ((char*) prev.data + XCB_TYPE_PAD(xcb_randr_output_t, prev.index))) + (R->num_possible_outputs); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_get_crtc_info_reply_t * +xcb_randr_get_crtc_info_reply (xcb_connection_t *c, + xcb_randr_get_crtc_info_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_get_crtc_info_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_randr_set_crtc_config_sizeof (const void *_buffer, + uint32_t outputs_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_randr_set_crtc_config_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* outputs */ + xcb_block_len += outputs_len * sizeof(xcb_randr_output_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_randr_output_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_randr_set_crtc_config_cookie_t +xcb_randr_set_crtc_config (xcb_connection_t *c, + xcb_randr_crtc_t crtc, + xcb_timestamp_t timestamp, + xcb_timestamp_t config_timestamp, + int16_t x, + int16_t y, + xcb_randr_mode_t mode, + uint16_t rotation, + uint32_t outputs_len, + const xcb_randr_output_t *outputs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_SET_CRTC_CONFIG, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_randr_set_crtc_config_cookie_t xcb_ret; + xcb_randr_set_crtc_config_request_t xcb_out; + + xcb_out.crtc = crtc; + xcb_out.timestamp = timestamp; + xcb_out.config_timestamp = config_timestamp; + xcb_out.x = x; + xcb_out.y = y; + xcb_out.mode = mode; + xcb_out.rotation = rotation; + 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_randr_output_t outputs */ + xcb_parts[4].iov_base = (char *) outputs; + xcb_parts[4].iov_len = outputs_len * sizeof(xcb_timestamp_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_randr_set_crtc_config_cookie_t +xcb_randr_set_crtc_config_unchecked (xcb_connection_t *c, + xcb_randr_crtc_t crtc, + xcb_timestamp_t timestamp, + xcb_timestamp_t config_timestamp, + int16_t x, + int16_t y, + xcb_randr_mode_t mode, + uint16_t rotation, + uint32_t outputs_len, + const xcb_randr_output_t *outputs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_SET_CRTC_CONFIG, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_randr_set_crtc_config_cookie_t xcb_ret; + xcb_randr_set_crtc_config_request_t xcb_out; + + xcb_out.crtc = crtc; + xcb_out.timestamp = timestamp; + xcb_out.config_timestamp = config_timestamp; + xcb_out.x = x; + xcb_out.y = y; + xcb_out.mode = mode; + xcb_out.rotation = rotation; + 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_randr_output_t outputs */ + xcb_parts[4].iov_base = (char *) outputs; + xcb_parts[4].iov_len = outputs_len * sizeof(xcb_timestamp_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_randr_set_crtc_config_reply_t * +xcb_randr_set_crtc_config_reply (xcb_connection_t *c, + xcb_randr_set_crtc_config_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_set_crtc_config_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_randr_get_crtc_gamma_size_cookie_t +xcb_randr_get_crtc_gamma_size (xcb_connection_t *c, + xcb_randr_crtc_t crtc) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_CRTC_GAMMA_SIZE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_crtc_gamma_size_cookie_t xcb_ret; + xcb_randr_get_crtc_gamma_size_request_t xcb_out; + + xcb_out.crtc = crtc; + + 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_randr_get_crtc_gamma_size_cookie_t +xcb_randr_get_crtc_gamma_size_unchecked (xcb_connection_t *c, + xcb_randr_crtc_t crtc) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_CRTC_GAMMA_SIZE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_crtc_gamma_size_cookie_t xcb_ret; + xcb_randr_get_crtc_gamma_size_request_t xcb_out; + + xcb_out.crtc = crtc; + + 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_randr_get_crtc_gamma_size_reply_t * +xcb_randr_get_crtc_gamma_size_reply (xcb_connection_t *c, + xcb_randr_get_crtc_gamma_size_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_get_crtc_gamma_size_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_randr_get_crtc_gamma_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_randr_get_crtc_gamma_reply_t *_aux = (xcb_randr_get_crtc_gamma_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_randr_get_crtc_gamma_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* red */ + xcb_block_len += _aux->size * sizeof(uint16_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint16_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; + /* green */ + xcb_block_len += _aux->size * sizeof(uint16_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint16_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; + /* blue */ + xcb_block_len += _aux->size * sizeof(uint16_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint16_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_randr_get_crtc_gamma_cookie_t +xcb_randr_get_crtc_gamma (xcb_connection_t *c, + xcb_randr_crtc_t crtc) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_CRTC_GAMMA, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_crtc_gamma_cookie_t xcb_ret; + xcb_randr_get_crtc_gamma_request_t xcb_out; + + xcb_out.crtc = crtc; + + 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_randr_get_crtc_gamma_cookie_t +xcb_randr_get_crtc_gamma_unchecked (xcb_connection_t *c, + xcb_randr_crtc_t crtc) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_CRTC_GAMMA, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_crtc_gamma_cookie_t xcb_ret; + xcb_randr_get_crtc_gamma_request_t xcb_out; + + xcb_out.crtc = crtc; + + 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; +} + +uint16_t * +xcb_randr_get_crtc_gamma_red (const xcb_randr_get_crtc_gamma_reply_t *R) +{ + return (uint16_t *) (R + 1); +} + +int +xcb_randr_get_crtc_gamma_red_length (const xcb_randr_get_crtc_gamma_reply_t *R) +{ + return R->size; +} + +xcb_generic_iterator_t +xcb_randr_get_crtc_gamma_red_end (const xcb_randr_get_crtc_gamma_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint16_t *) (R + 1)) + (R->size); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +uint16_t * +xcb_randr_get_crtc_gamma_green (const xcb_randr_get_crtc_gamma_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_randr_get_crtc_gamma_red_end(R); + return (uint16_t *) ((char *) prev.data + XCB_TYPE_PAD(uint16_t, prev.index) + 0); +} + +int +xcb_randr_get_crtc_gamma_green_length (const xcb_randr_get_crtc_gamma_reply_t *R) +{ + return R->size; +} + +xcb_generic_iterator_t +xcb_randr_get_crtc_gamma_green_end (const xcb_randr_get_crtc_gamma_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_randr_get_crtc_gamma_red_end(R); + i.data = ((uint16_t *) ((char*) prev.data + XCB_TYPE_PAD(uint16_t, prev.index))) + (R->size); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +uint16_t * +xcb_randr_get_crtc_gamma_blue (const xcb_randr_get_crtc_gamma_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_randr_get_crtc_gamma_green_end(R); + return (uint16_t *) ((char *) prev.data + XCB_TYPE_PAD(uint16_t, prev.index) + 0); +} + +int +xcb_randr_get_crtc_gamma_blue_length (const xcb_randr_get_crtc_gamma_reply_t *R) +{ + return R->size; +} + +xcb_generic_iterator_t +xcb_randr_get_crtc_gamma_blue_end (const xcb_randr_get_crtc_gamma_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_randr_get_crtc_gamma_green_end(R); + i.data = ((uint16_t *) ((char*) prev.data + XCB_TYPE_PAD(uint16_t, prev.index))) + (R->size); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_get_crtc_gamma_reply_t * +xcb_randr_get_crtc_gamma_reply (xcb_connection_t *c, + xcb_randr_get_crtc_gamma_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_get_crtc_gamma_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_randr_set_crtc_gamma_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_randr_set_crtc_gamma_request_t *_aux = (xcb_randr_set_crtc_gamma_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_randr_set_crtc_gamma_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* red */ + xcb_block_len += _aux->size * sizeof(uint16_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint16_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; + /* green */ + xcb_block_len += _aux->size * sizeof(uint16_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint16_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; + /* blue */ + xcb_block_len += _aux->size * sizeof(uint16_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint16_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_randr_set_crtc_gamma_checked (xcb_connection_t *c, + xcb_randr_crtc_t crtc, + uint16_t size, + const uint16_t *red, + const uint16_t *green, + const uint16_t *blue) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 8, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_SET_CRTC_GAMMA, + .isvoid = 1 + }; + + struct iovec xcb_parts[10]; + xcb_void_cookie_t xcb_ret; + xcb_randr_set_crtc_gamma_request_t xcb_out; + + xcb_out.crtc = crtc; + xcb_out.size = size; + 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; + /* uint16_t red */ + xcb_parts[4].iov_base = (char *) red; + xcb_parts[4].iov_len = size * sizeof(uint16_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* uint16_t green */ + xcb_parts[6].iov_base = (char *) green; + xcb_parts[6].iov_len = size * sizeof(uint16_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + /* uint16_t blue */ + xcb_parts[8].iov_base = (char *) blue; + xcb_parts[8].iov_len = size * sizeof(uint16_t); + xcb_parts[9].iov_base = 0; + xcb_parts[9].iov_len = -xcb_parts[8].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_randr_set_crtc_gamma (xcb_connection_t *c, + xcb_randr_crtc_t crtc, + uint16_t size, + const uint16_t *red, + const uint16_t *green, + const uint16_t *blue) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 8, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_SET_CRTC_GAMMA, + .isvoid = 1 + }; + + struct iovec xcb_parts[10]; + xcb_void_cookie_t xcb_ret; + xcb_randr_set_crtc_gamma_request_t xcb_out; + + xcb_out.crtc = crtc; + xcb_out.size = size; + 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; + /* uint16_t red */ + xcb_parts[4].iov_base = (char *) red; + xcb_parts[4].iov_len = size * sizeof(uint16_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* uint16_t green */ + xcb_parts[6].iov_base = (char *) green; + xcb_parts[6].iov_len = size * sizeof(uint16_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + /* uint16_t blue */ + xcb_parts[8].iov_base = (char *) blue; + xcb_parts[8].iov_len = size * sizeof(uint16_t); + xcb_parts[9].iov_base = 0; + xcb_parts[9].iov_len = -xcb_parts[8].iov_len & 3; + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +uint16_t * +xcb_randr_set_crtc_gamma_red (const xcb_randr_set_crtc_gamma_request_t *R) +{ + return (uint16_t *) (R + 1); +} + +int +xcb_randr_set_crtc_gamma_red_length (const xcb_randr_set_crtc_gamma_request_t *R) +{ + return R->size; +} + +xcb_generic_iterator_t +xcb_randr_set_crtc_gamma_red_end (const xcb_randr_set_crtc_gamma_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint16_t *) (R + 1)) + (R->size); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +uint16_t * +xcb_randr_set_crtc_gamma_green (const xcb_randr_set_crtc_gamma_request_t *R) +{ + xcb_generic_iterator_t prev = xcb_randr_set_crtc_gamma_red_end(R); + return (uint16_t *) ((char *) prev.data + XCB_TYPE_PAD(uint16_t, prev.index) + 0); +} + +int +xcb_randr_set_crtc_gamma_green_length (const xcb_randr_set_crtc_gamma_request_t *R) +{ + return R->size; +} + +xcb_generic_iterator_t +xcb_randr_set_crtc_gamma_green_end (const xcb_randr_set_crtc_gamma_request_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_randr_set_crtc_gamma_red_end(R); + i.data = ((uint16_t *) ((char*) prev.data + XCB_TYPE_PAD(uint16_t, prev.index))) + (R->size); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +uint16_t * +xcb_randr_set_crtc_gamma_blue (const xcb_randr_set_crtc_gamma_request_t *R) +{ + xcb_generic_iterator_t prev = xcb_randr_set_crtc_gamma_green_end(R); + return (uint16_t *) ((char *) prev.data + XCB_TYPE_PAD(uint16_t, prev.index) + 0); +} + +int +xcb_randr_set_crtc_gamma_blue_length (const xcb_randr_set_crtc_gamma_request_t *R) +{ + return R->size; +} + +xcb_generic_iterator_t +xcb_randr_set_crtc_gamma_blue_end (const xcb_randr_set_crtc_gamma_request_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_randr_set_crtc_gamma_green_end(R); + i.data = ((uint16_t *) ((char*) prev.data + XCB_TYPE_PAD(uint16_t, prev.index))) + (R->size); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_randr_get_screen_resources_current_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_randr_get_screen_resources_current_reply_t *_aux = (xcb_randr_get_screen_resources_current_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_randr_get_screen_resources_current_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* crtcs */ + xcb_block_len += _aux->num_crtcs * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_randr_crtc_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; + /* outputs */ + xcb_block_len += _aux->num_outputs * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_randr_output_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; + /* modes */ + xcb_block_len += _aux->num_modes * sizeof(xcb_randr_mode_info_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_randr_mode_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; + /* names */ + xcb_block_len += _aux->names_len * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_randr_get_screen_resources_current_cookie_t +xcb_randr_get_screen_resources_current (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_SCREEN_RESOURCES_CURRENT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_screen_resources_current_cookie_t xcb_ret; + xcb_randr_get_screen_resources_current_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_randr_get_screen_resources_current_cookie_t +xcb_randr_get_screen_resources_current_unchecked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_SCREEN_RESOURCES_CURRENT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_screen_resources_current_cookie_t xcb_ret; + xcb_randr_get_screen_resources_current_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_randr_crtc_t * +xcb_randr_get_screen_resources_current_crtcs (const xcb_randr_get_screen_resources_current_reply_t *R) +{ + return (xcb_randr_crtc_t *) (R + 1); +} + +int +xcb_randr_get_screen_resources_current_crtcs_length (const xcb_randr_get_screen_resources_current_reply_t *R) +{ + return R->num_crtcs; +} + +xcb_generic_iterator_t +xcb_randr_get_screen_resources_current_crtcs_end (const xcb_randr_get_screen_resources_current_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_randr_crtc_t *) (R + 1)) + (R->num_crtcs); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_output_t * +xcb_randr_get_screen_resources_current_outputs (const xcb_randr_get_screen_resources_current_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_randr_get_screen_resources_current_crtcs_end(R); + return (xcb_randr_output_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_output_t, prev.index) + 0); +} + +int +xcb_randr_get_screen_resources_current_outputs_length (const xcb_randr_get_screen_resources_current_reply_t *R) +{ + return R->num_outputs; +} + +xcb_generic_iterator_t +xcb_randr_get_screen_resources_current_outputs_end (const xcb_randr_get_screen_resources_current_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_randr_get_screen_resources_current_crtcs_end(R); + i.data = ((xcb_randr_output_t *) ((char*) prev.data + XCB_TYPE_PAD(xcb_randr_output_t, prev.index))) + (R->num_outputs); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_mode_info_t * +xcb_randr_get_screen_resources_current_modes (const xcb_randr_get_screen_resources_current_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_randr_get_screen_resources_current_outputs_end(R); + return (xcb_randr_mode_info_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_mode_info_t, prev.index) + 0); +} + +int +xcb_randr_get_screen_resources_current_modes_length (const xcb_randr_get_screen_resources_current_reply_t *R) +{ + return R->num_modes; +} + +xcb_randr_mode_info_iterator_t +xcb_randr_get_screen_resources_current_modes_iterator (const xcb_randr_get_screen_resources_current_reply_t *R) +{ + xcb_randr_mode_info_iterator_t i; + xcb_generic_iterator_t prev = xcb_randr_get_screen_resources_current_outputs_end(R); + i.data = (xcb_randr_mode_info_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_mode_info_t, prev.index)); + i.rem = R->num_modes; + i.index = (char *) i.data - (char *) R; + return i; +} + +uint8_t * +xcb_randr_get_screen_resources_current_names (const xcb_randr_get_screen_resources_current_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_randr_mode_info_end(xcb_randr_get_screen_resources_current_modes_iterator(R)); + return (uint8_t *) ((char *) prev.data + XCB_TYPE_PAD(uint8_t, prev.index) + 0); +} + +int +xcb_randr_get_screen_resources_current_names_length (const xcb_randr_get_screen_resources_current_reply_t *R) +{ + return R->names_len; +} + +xcb_generic_iterator_t +xcb_randr_get_screen_resources_current_names_end (const xcb_randr_get_screen_resources_current_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_randr_mode_info_end(xcb_randr_get_screen_resources_current_modes_iterator(R)); + i.data = ((uint8_t *) ((char*) prev.data + XCB_TYPE_PAD(uint8_t, prev.index))) + (R->names_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_get_screen_resources_current_reply_t * +xcb_randr_get_screen_resources_current_reply (xcb_connection_t *c, + xcb_randr_get_screen_resources_current_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_get_screen_resources_current_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_randr_set_crtc_transform_sizeof (const void *_buffer, + uint32_t filter_params_len) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_randr_set_crtc_transform_request_t *_aux = (xcb_randr_set_crtc_transform_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_randr_set_crtc_transform_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* filter_name */ + xcb_block_len += _aux->filter_len * sizeof(char); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(char); + xcb_align_to = 4; + /* 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; + /* 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; + /* filter_params */ + xcb_block_len += filter_params_len * sizeof(xcb_render_fixed_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_render_fixed_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_randr_set_crtc_transform_checked (xcb_connection_t *c, + xcb_randr_crtc_t crtc, + xcb_render_transform_t transform, + uint16_t filter_len, + const char *filter_name, + uint32_t filter_params_len, + const xcb_render_fixed_t *filter_params) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_SET_CRTC_TRANSFORM, + .isvoid = 1 + }; + + struct iovec xcb_parts[8]; + xcb_void_cookie_t xcb_ret; + xcb_randr_set_crtc_transform_request_t xcb_out; + + xcb_out.crtc = crtc; + xcb_out.transform = transform; + xcb_out.filter_len = filter_len; + 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; + /* char filter_name */ + xcb_parts[4].iov_base = (char *) filter_name; + xcb_parts[4].iov_len = filter_len * sizeof(char); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_render_fixed_t filter_params */ + xcb_parts[6].iov_base = (char *) filter_params; + xcb_parts[6].iov_len = filter_params_len * sizeof(xcb_render_fixed_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].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_randr_set_crtc_transform (xcb_connection_t *c, + xcb_randr_crtc_t crtc, + xcb_render_transform_t transform, + uint16_t filter_len, + const char *filter_name, + uint32_t filter_params_len, + const xcb_render_fixed_t *filter_params) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_SET_CRTC_TRANSFORM, + .isvoid = 1 + }; + + struct iovec xcb_parts[8]; + xcb_void_cookie_t xcb_ret; + xcb_randr_set_crtc_transform_request_t xcb_out; + + xcb_out.crtc = crtc; + xcb_out.transform = transform; + xcb_out.filter_len = filter_len; + 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; + /* char filter_name */ + xcb_parts[4].iov_base = (char *) filter_name; + xcb_parts[4].iov_len = filter_len * sizeof(char); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_render_fixed_t filter_params */ + xcb_parts[6].iov_base = (char *) filter_params; + xcb_parts[6].iov_len = filter_params_len * sizeof(xcb_render_fixed_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +char * +xcb_randr_set_crtc_transform_filter_name (const xcb_randr_set_crtc_transform_request_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_randr_set_crtc_transform_filter_name_length (const xcb_randr_set_crtc_transform_request_t *R) +{ + return R->filter_len; +} + +xcb_generic_iterator_t +xcb_randr_set_crtc_transform_filter_name_end (const xcb_randr_set_crtc_transform_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->filter_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_render_fixed_t * +xcb_randr_set_crtc_transform_filter_params (const xcb_randr_set_crtc_transform_request_t *R) +{ + xcb_generic_iterator_t prev = xcb_randr_set_crtc_transform_filter_name_end(R); + return (xcb_render_fixed_t *) ((char *) prev.data + ((-prev.index) & (4 - 1)) + 0); +} + +int +xcb_randr_set_crtc_transform_filter_params_length (const xcb_randr_set_crtc_transform_request_t *R) +{ + return ((((char*)R) + R->length * 4) - (char*)(xcb_randr_set_crtc_transform_filter_params(R))) / sizeof(xcb_render_fixed_t); +} + +xcb_generic_iterator_t +xcb_randr_set_crtc_transform_filter_params_end (const xcb_randr_set_crtc_transform_request_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_randr_set_crtc_transform_filter_name_end(R); + i.data = ((xcb_render_fixed_t *) ((char*) prev.data + ((-prev.index) & (4 - 1)))) + (((((char*)R) + R->length * 4) - (char*)(xcb_randr_set_crtc_transform_filter_params(R))) / sizeof(xcb_render_fixed_t)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_randr_get_crtc_transform_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_randr_get_crtc_transform_reply_t *_aux = (xcb_randr_get_crtc_transform_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_randr_get_crtc_transform_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* pending_filter_name */ + xcb_block_len += _aux->pending_len * sizeof(char); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(char); + xcb_align_to = 4; + /* 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; + /* 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; + /* pending_params */ + xcb_block_len += _aux->pending_nparams * sizeof(xcb_render_fixed_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_render_fixed_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; + /* current_filter_name */ + xcb_block_len += _aux->current_len * sizeof(char); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(char); + xcb_align_to = 4; + /* 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; + /* 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; + /* current_params */ + xcb_block_len += _aux->current_nparams * sizeof(xcb_render_fixed_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_render_fixed_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_randr_get_crtc_transform_cookie_t +xcb_randr_get_crtc_transform (xcb_connection_t *c, + xcb_randr_crtc_t crtc) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_CRTC_TRANSFORM, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_crtc_transform_cookie_t xcb_ret; + xcb_randr_get_crtc_transform_request_t xcb_out; + + xcb_out.crtc = crtc; + + 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_randr_get_crtc_transform_cookie_t +xcb_randr_get_crtc_transform_unchecked (xcb_connection_t *c, + xcb_randr_crtc_t crtc) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_CRTC_TRANSFORM, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_crtc_transform_cookie_t xcb_ret; + xcb_randr_get_crtc_transform_request_t xcb_out; + + xcb_out.crtc = crtc; + + 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; +} + +char * +xcb_randr_get_crtc_transform_pending_filter_name (const xcb_randr_get_crtc_transform_reply_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_randr_get_crtc_transform_pending_filter_name_length (const xcb_randr_get_crtc_transform_reply_t *R) +{ + return R->pending_len; +} + +xcb_generic_iterator_t +xcb_randr_get_crtc_transform_pending_filter_name_end (const xcb_randr_get_crtc_transform_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->pending_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_render_fixed_t * +xcb_randr_get_crtc_transform_pending_params (const xcb_randr_get_crtc_transform_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_randr_get_crtc_transform_pending_filter_name_end(R); + return (xcb_render_fixed_t *) ((char *) prev.data + ((-prev.index) & (4 - 1)) + 0); +} + +int +xcb_randr_get_crtc_transform_pending_params_length (const xcb_randr_get_crtc_transform_reply_t *R) +{ + return R->pending_nparams; +} + +xcb_generic_iterator_t +xcb_randr_get_crtc_transform_pending_params_end (const xcb_randr_get_crtc_transform_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_randr_get_crtc_transform_pending_filter_name_end(R); + i.data = ((xcb_render_fixed_t *) ((char*) prev.data + ((-prev.index) & (4 - 1)))) + (R->pending_nparams); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +char * +xcb_randr_get_crtc_transform_current_filter_name (const xcb_randr_get_crtc_transform_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_randr_get_crtc_transform_pending_params_end(R); + return (char *) ((char *) prev.data + XCB_TYPE_PAD(char, prev.index) + 0); +} + +int +xcb_randr_get_crtc_transform_current_filter_name_length (const xcb_randr_get_crtc_transform_reply_t *R) +{ + return R->current_len; +} + +xcb_generic_iterator_t +xcb_randr_get_crtc_transform_current_filter_name_end (const xcb_randr_get_crtc_transform_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_randr_get_crtc_transform_pending_params_end(R); + i.data = ((char *) ((char*) prev.data + XCB_TYPE_PAD(char, prev.index))) + (R->current_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_render_fixed_t * +xcb_randr_get_crtc_transform_current_params (const xcb_randr_get_crtc_transform_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_randr_get_crtc_transform_current_filter_name_end(R); + return (xcb_render_fixed_t *) ((char *) prev.data + ((-prev.index) & (4 - 1)) + 0); +} + +int +xcb_randr_get_crtc_transform_current_params_length (const xcb_randr_get_crtc_transform_reply_t *R) +{ + return R->current_nparams; +} + +xcb_generic_iterator_t +xcb_randr_get_crtc_transform_current_params_end (const xcb_randr_get_crtc_transform_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_randr_get_crtc_transform_current_filter_name_end(R); + i.data = ((xcb_render_fixed_t *) ((char*) prev.data + ((-prev.index) & (4 - 1)))) + (R->current_nparams); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_get_crtc_transform_reply_t * +xcb_randr_get_crtc_transform_reply (xcb_connection_t *c, + xcb_randr_get_crtc_transform_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_get_crtc_transform_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_randr_get_panning_cookie_t +xcb_randr_get_panning (xcb_connection_t *c, + xcb_randr_crtc_t crtc) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_PANNING, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_panning_cookie_t xcb_ret; + xcb_randr_get_panning_request_t xcb_out; + + xcb_out.crtc = crtc; + + 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_randr_get_panning_cookie_t +xcb_randr_get_panning_unchecked (xcb_connection_t *c, + xcb_randr_crtc_t crtc) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_PANNING, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_panning_cookie_t xcb_ret; + xcb_randr_get_panning_request_t xcb_out; + + xcb_out.crtc = crtc; + + 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_randr_get_panning_reply_t * +xcb_randr_get_panning_reply (xcb_connection_t *c, + xcb_randr_get_panning_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_get_panning_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_randr_set_panning_cookie_t +xcb_randr_set_panning (xcb_connection_t *c, + xcb_randr_crtc_t crtc, + xcb_timestamp_t timestamp, + uint16_t left, + uint16_t top, + uint16_t width, + uint16_t height, + uint16_t track_left, + uint16_t track_top, + uint16_t track_width, + uint16_t track_height, + int16_t border_left, + int16_t border_top, + int16_t border_right, + int16_t border_bottom) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_SET_PANNING, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_set_panning_cookie_t xcb_ret; + xcb_randr_set_panning_request_t xcb_out; + + xcb_out.crtc = crtc; + xcb_out.timestamp = timestamp; + xcb_out.left = left; + xcb_out.top = top; + xcb_out.width = width; + xcb_out.height = height; + xcb_out.track_left = track_left; + xcb_out.track_top = track_top; + xcb_out.track_width = track_width; + xcb_out.track_height = track_height; + xcb_out.border_left = border_left; + xcb_out.border_top = border_top; + xcb_out.border_right = border_right; + xcb_out.border_bottom = border_bottom; + + 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_randr_set_panning_cookie_t +xcb_randr_set_panning_unchecked (xcb_connection_t *c, + xcb_randr_crtc_t crtc, + xcb_timestamp_t timestamp, + uint16_t left, + uint16_t top, + uint16_t width, + uint16_t height, + uint16_t track_left, + uint16_t track_top, + uint16_t track_width, + uint16_t track_height, + int16_t border_left, + int16_t border_top, + int16_t border_right, + int16_t border_bottom) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_SET_PANNING, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_set_panning_cookie_t xcb_ret; + xcb_randr_set_panning_request_t xcb_out; + + xcb_out.crtc = crtc; + xcb_out.timestamp = timestamp; + xcb_out.left = left; + xcb_out.top = top; + xcb_out.width = width; + xcb_out.height = height; + xcb_out.track_left = track_left; + xcb_out.track_top = track_top; + xcb_out.track_width = track_width; + xcb_out.track_height = track_height; + xcb_out.border_left = border_left; + xcb_out.border_top = border_top; + xcb_out.border_right = border_right; + xcb_out.border_bottom = border_bottom; + + 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_randr_set_panning_reply_t * +xcb_randr_set_panning_reply (xcb_connection_t *c, + xcb_randr_set_panning_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_set_panning_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_randr_set_output_primary_checked (xcb_connection_t *c, + xcb_window_t window, + xcb_randr_output_t output) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_SET_OUTPUT_PRIMARY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_set_output_primary_request_t xcb_out; + + xcb_out.window = window; + xcb_out.output = output; + + 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_randr_set_output_primary (xcb_connection_t *c, + xcb_window_t window, + xcb_randr_output_t output) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_SET_OUTPUT_PRIMARY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_set_output_primary_request_t xcb_out; + + xcb_out.window = window; + xcb_out.output = output; + + 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_randr_get_output_primary_cookie_t +xcb_randr_get_output_primary (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_OUTPUT_PRIMARY, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_output_primary_cookie_t xcb_ret; + xcb_randr_get_output_primary_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_randr_get_output_primary_cookie_t +xcb_randr_get_output_primary_unchecked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_OUTPUT_PRIMARY, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_output_primary_cookie_t xcb_ret; + xcb_randr_get_output_primary_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_randr_get_output_primary_reply_t * +xcb_randr_get_output_primary_reply (xcb_connection_t *c, + xcb_randr_get_output_primary_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_get_output_primary_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_randr_get_providers_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_randr_get_providers_reply_t *_aux = (xcb_randr_get_providers_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_randr_get_providers_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* providers */ + xcb_block_len += _aux->num_providers * sizeof(xcb_randr_provider_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_randr_provider_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_randr_get_providers_cookie_t +xcb_randr_get_providers (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_PROVIDERS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_providers_cookie_t xcb_ret; + xcb_randr_get_providers_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_randr_get_providers_cookie_t +xcb_randr_get_providers_unchecked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_PROVIDERS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_providers_cookie_t xcb_ret; + xcb_randr_get_providers_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_randr_provider_t * +xcb_randr_get_providers_providers (const xcb_randr_get_providers_reply_t *R) +{ + return (xcb_randr_provider_t *) (R + 1); +} + +int +xcb_randr_get_providers_providers_length (const xcb_randr_get_providers_reply_t *R) +{ + return R->num_providers; +} + +xcb_generic_iterator_t +xcb_randr_get_providers_providers_end (const xcb_randr_get_providers_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_randr_provider_t *) (R + 1)) + (R->num_providers); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_get_providers_reply_t * +xcb_randr_get_providers_reply (xcb_connection_t *c, + xcb_randr_get_providers_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_get_providers_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_randr_get_provider_info_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_randr_get_provider_info_reply_t *_aux = (xcb_randr_get_provider_info_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_randr_get_provider_info_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* crtcs */ + xcb_block_len += _aux->num_crtcs * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_randr_crtc_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; + /* outputs */ + xcb_block_len += _aux->num_outputs * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_randr_output_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; + /* associated_providers */ + xcb_block_len += _aux->num_associated_providers * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_randr_provider_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; + /* associated_capability */ + xcb_block_len += _aux->num_associated_providers * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* name */ + xcb_block_len += _aux->name_len * sizeof(char); + 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_randr_get_provider_info_cookie_t +xcb_randr_get_provider_info (xcb_connection_t *c, + xcb_randr_provider_t provider, + xcb_timestamp_t config_timestamp) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_PROVIDER_INFO, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_provider_info_cookie_t xcb_ret; + xcb_randr_get_provider_info_request_t xcb_out; + + xcb_out.provider = provider; + xcb_out.config_timestamp = config_timestamp; + + 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_randr_get_provider_info_cookie_t +xcb_randr_get_provider_info_unchecked (xcb_connection_t *c, + xcb_randr_provider_t provider, + xcb_timestamp_t config_timestamp) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_PROVIDER_INFO, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_provider_info_cookie_t xcb_ret; + xcb_randr_get_provider_info_request_t xcb_out; + + xcb_out.provider = provider; + xcb_out.config_timestamp = config_timestamp; + + 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_randr_crtc_t * +xcb_randr_get_provider_info_crtcs (const xcb_randr_get_provider_info_reply_t *R) +{ + return (xcb_randr_crtc_t *) (R + 1); +} + +int +xcb_randr_get_provider_info_crtcs_length (const xcb_randr_get_provider_info_reply_t *R) +{ + return R->num_crtcs; +} + +xcb_generic_iterator_t +xcb_randr_get_provider_info_crtcs_end (const xcb_randr_get_provider_info_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_randr_crtc_t *) (R + 1)) + (R->num_crtcs); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_output_t * +xcb_randr_get_provider_info_outputs (const xcb_randr_get_provider_info_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_randr_get_provider_info_crtcs_end(R); + return (xcb_randr_output_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_output_t, prev.index) + 0); +} + +int +xcb_randr_get_provider_info_outputs_length (const xcb_randr_get_provider_info_reply_t *R) +{ + return R->num_outputs; +} + +xcb_generic_iterator_t +xcb_randr_get_provider_info_outputs_end (const xcb_randr_get_provider_info_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_randr_get_provider_info_crtcs_end(R); + i.data = ((xcb_randr_output_t *) ((char*) prev.data + XCB_TYPE_PAD(xcb_randr_output_t, prev.index))) + (R->num_outputs); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_provider_t * +xcb_randr_get_provider_info_associated_providers (const xcb_randr_get_provider_info_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_randr_get_provider_info_outputs_end(R); + return (xcb_randr_provider_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_provider_t, prev.index) + 0); +} + +int +xcb_randr_get_provider_info_associated_providers_length (const xcb_randr_get_provider_info_reply_t *R) +{ + return R->num_associated_providers; +} + +xcb_generic_iterator_t +xcb_randr_get_provider_info_associated_providers_end (const xcb_randr_get_provider_info_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_randr_get_provider_info_outputs_end(R); + i.data = ((xcb_randr_provider_t *) ((char*) prev.data + XCB_TYPE_PAD(xcb_randr_provider_t, prev.index))) + (R->num_associated_providers); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +uint32_t * +xcb_randr_get_provider_info_associated_capability (const xcb_randr_get_provider_info_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_randr_get_provider_info_associated_providers_end(R); + return (uint32_t *) ((char *) prev.data + XCB_TYPE_PAD(uint32_t, prev.index) + 0); +} + +int +xcb_randr_get_provider_info_associated_capability_length (const xcb_randr_get_provider_info_reply_t *R) +{ + return R->num_associated_providers; +} + +xcb_generic_iterator_t +xcb_randr_get_provider_info_associated_capability_end (const xcb_randr_get_provider_info_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_randr_get_provider_info_associated_providers_end(R); + i.data = ((uint32_t *) ((char*) prev.data + XCB_TYPE_PAD(uint32_t, prev.index))) + (R->num_associated_providers); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +char * +xcb_randr_get_provider_info_name (const xcb_randr_get_provider_info_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_randr_get_provider_info_associated_capability_end(R); + return (char *) ((char *) prev.data + XCB_TYPE_PAD(char, prev.index) + 0); +} + +int +xcb_randr_get_provider_info_name_length (const xcb_randr_get_provider_info_reply_t *R) +{ + return R->name_len; +} + +xcb_generic_iterator_t +xcb_randr_get_provider_info_name_end (const xcb_randr_get_provider_info_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_randr_get_provider_info_associated_capability_end(R); + i.data = ((char *) ((char*) prev.data + XCB_TYPE_PAD(char, prev.index))) + (R->name_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_get_provider_info_reply_t * +xcb_randr_get_provider_info_reply (xcb_connection_t *c, + xcb_randr_get_provider_info_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_get_provider_info_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_randr_set_provider_offload_sink_checked (xcb_connection_t *c, + xcb_randr_provider_t provider, + xcb_randr_provider_t sink_provider, + xcb_timestamp_t config_timestamp) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_SET_PROVIDER_OFFLOAD_SINK, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_set_provider_offload_sink_request_t xcb_out; + + xcb_out.provider = provider; + xcb_out.sink_provider = sink_provider; + xcb_out.config_timestamp = config_timestamp; + + 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_randr_set_provider_offload_sink (xcb_connection_t *c, + xcb_randr_provider_t provider, + xcb_randr_provider_t sink_provider, + xcb_timestamp_t config_timestamp) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_SET_PROVIDER_OFFLOAD_SINK, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_set_provider_offload_sink_request_t xcb_out; + + xcb_out.provider = provider; + xcb_out.sink_provider = sink_provider; + xcb_out.config_timestamp = config_timestamp; + + 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_randr_set_provider_output_source_checked (xcb_connection_t *c, + xcb_randr_provider_t provider, + xcb_randr_provider_t source_provider, + xcb_timestamp_t config_timestamp) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_SET_PROVIDER_OUTPUT_SOURCE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_set_provider_output_source_request_t xcb_out; + + xcb_out.provider = provider; + xcb_out.source_provider = source_provider; + xcb_out.config_timestamp = config_timestamp; + + 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_randr_set_provider_output_source (xcb_connection_t *c, + xcb_randr_provider_t provider, + xcb_randr_provider_t source_provider, + xcb_timestamp_t config_timestamp) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_SET_PROVIDER_OUTPUT_SOURCE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_set_provider_output_source_request_t xcb_out; + + xcb_out.provider = provider; + xcb_out.source_provider = source_provider; + xcb_out.config_timestamp = config_timestamp; + + 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_randr_list_provider_properties_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_randr_list_provider_properties_reply_t *_aux = (xcb_randr_list_provider_properties_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_randr_list_provider_properties_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* atoms */ + xcb_block_len += _aux->num_atoms * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_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_randr_list_provider_properties_cookie_t +xcb_randr_list_provider_properties (xcb_connection_t *c, + xcb_randr_provider_t provider) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_LIST_PROVIDER_PROPERTIES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_list_provider_properties_cookie_t xcb_ret; + xcb_randr_list_provider_properties_request_t xcb_out; + + xcb_out.provider = provider; + + 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_randr_list_provider_properties_cookie_t +xcb_randr_list_provider_properties_unchecked (xcb_connection_t *c, + xcb_randr_provider_t provider) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_LIST_PROVIDER_PROPERTIES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_list_provider_properties_cookie_t xcb_ret; + xcb_randr_list_provider_properties_request_t xcb_out; + + xcb_out.provider = provider; + + 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_atom_t * +xcb_randr_list_provider_properties_atoms (const xcb_randr_list_provider_properties_reply_t *R) +{ + return (xcb_atom_t *) (R + 1); +} + +int +xcb_randr_list_provider_properties_atoms_length (const xcb_randr_list_provider_properties_reply_t *R) +{ + return R->num_atoms; +} + +xcb_generic_iterator_t +xcb_randr_list_provider_properties_atoms_end (const xcb_randr_list_provider_properties_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_atom_t *) (R + 1)) + (R->num_atoms); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_list_provider_properties_reply_t * +xcb_randr_list_provider_properties_reply (xcb_connection_t *c, + xcb_randr_list_provider_properties_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_list_provider_properties_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_randr_query_provider_property_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_randr_query_provider_property_reply_t *_aux = (xcb_randr_query_provider_property_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_randr_query_provider_property_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* valid_values */ + xcb_block_len += _aux->length * sizeof(int32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(int32_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_randr_query_provider_property_cookie_t +xcb_randr_query_provider_property (xcb_connection_t *c, + xcb_randr_provider_t provider, + xcb_atom_t property) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_QUERY_PROVIDER_PROPERTY, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_query_provider_property_cookie_t xcb_ret; + xcb_randr_query_provider_property_request_t xcb_out; + + xcb_out.provider = provider; + xcb_out.property = property; + + 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_randr_query_provider_property_cookie_t +xcb_randr_query_provider_property_unchecked (xcb_connection_t *c, + xcb_randr_provider_t provider, + xcb_atom_t property) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_QUERY_PROVIDER_PROPERTY, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_query_provider_property_cookie_t xcb_ret; + xcb_randr_query_provider_property_request_t xcb_out; + + xcb_out.provider = provider; + xcb_out.property = property; + + 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; +} + +int32_t * +xcb_randr_query_provider_property_valid_values (const xcb_randr_query_provider_property_reply_t *R) +{ + return (int32_t *) (R + 1); +} + +int +xcb_randr_query_provider_property_valid_values_length (const xcb_randr_query_provider_property_reply_t *R) +{ + return R->length; +} + +xcb_generic_iterator_t +xcb_randr_query_provider_property_valid_values_end (const xcb_randr_query_provider_property_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((int32_t *) (R + 1)) + (R->length); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_query_provider_property_reply_t * +xcb_randr_query_provider_property_reply (xcb_connection_t *c, + xcb_randr_query_provider_property_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_query_provider_property_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_randr_configure_provider_property_sizeof (const void *_buffer, + uint32_t values_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_randr_configure_provider_property_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* values */ + xcb_block_len += values_len * sizeof(int32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(int32_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_randr_configure_provider_property_checked (xcb_connection_t *c, + xcb_randr_provider_t provider, + xcb_atom_t property, + uint8_t pending, + uint8_t range, + uint32_t values_len, + const int32_t *values) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_CONFIGURE_PROVIDER_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_randr_configure_provider_property_request_t xcb_out; + + xcb_out.provider = provider; + xcb_out.property = property; + xcb_out.pending = pending; + xcb_out.range = range; + 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; + /* int32_t values */ + xcb_parts[4].iov_base = (char *) values; + xcb_parts[4].iov_len = values_len * sizeof(int32_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_randr_configure_provider_property (xcb_connection_t *c, + xcb_randr_provider_t provider, + xcb_atom_t property, + uint8_t pending, + uint8_t range, + uint32_t values_len, + const int32_t *values) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_CONFIGURE_PROVIDER_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_randr_configure_provider_property_request_t xcb_out; + + xcb_out.provider = provider; + xcb_out.property = property; + xcb_out.pending = pending; + xcb_out.range = range; + 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; + /* int32_t values */ + xcb_parts[4].iov_base = (char *) values; + xcb_parts[4].iov_len = values_len * sizeof(int32_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; +} + +int32_t * +xcb_randr_configure_provider_property_values (const xcb_randr_configure_provider_property_request_t *R) +{ + return (int32_t *) (R + 1); +} + +int +xcb_randr_configure_provider_property_values_length (const xcb_randr_configure_provider_property_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_randr_configure_provider_property_request_t))/sizeof(int32_t)); +} + +xcb_generic_iterator_t +xcb_randr_configure_provider_property_values_end (const xcb_randr_configure_provider_property_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((int32_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_randr_configure_provider_property_request_t))/sizeof(int32_t))); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_randr_change_provider_property_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_randr_change_provider_property_request_t *_aux = (xcb_randr_change_provider_property_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_randr_change_provider_property_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += (_aux->num_items * (_aux->format / 8)) * sizeof(char); + 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_randr_change_provider_property_checked (xcb_connection_t *c, + xcb_randr_provider_t provider, + xcb_atom_t property, + xcb_atom_t type, + uint8_t format, + uint8_t mode, + uint32_t num_items, + const void *data) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_CHANGE_PROVIDER_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_randr_change_provider_property_request_t xcb_out; + + xcb_out.provider = provider; + xcb_out.property = property; + xcb_out.type = type; + xcb_out.format = format; + xcb_out.mode = mode; + memset(xcb_out.pad0, 0, 2); + xcb_out.num_items = num_items; + + 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; + /* void data */ + xcb_parts[4].iov_base = (char *) data; + xcb_parts[4].iov_len = (num_items * (format / 8)) * 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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_randr_change_provider_property (xcb_connection_t *c, + xcb_randr_provider_t provider, + xcb_atom_t property, + xcb_atom_t type, + uint8_t format, + uint8_t mode, + uint32_t num_items, + const void *data) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_CHANGE_PROVIDER_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_randr_change_provider_property_request_t xcb_out; + + xcb_out.provider = provider; + xcb_out.property = property; + xcb_out.type = type; + xcb_out.format = format; + xcb_out.mode = mode; + memset(xcb_out.pad0, 0, 2); + xcb_out.num_items = num_items; + + 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; + /* void data */ + xcb_parts[4].iov_base = (char *) data; + xcb_parts[4].iov_len = (num_items * (format / 8)) * 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; +} + +void * +xcb_randr_change_provider_property_data (const xcb_randr_change_provider_property_request_t *R) +{ + return (void *) (R + 1); +} + +int +xcb_randr_change_provider_property_data_length (const xcb_randr_change_provider_property_request_t *R) +{ + return (R->num_items * (R->format / 8)); +} + +xcb_generic_iterator_t +xcb_randr_change_provider_property_data_end (const xcb_randr_change_provider_property_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + ((R->num_items * (R->format / 8))); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_randr_delete_provider_property_checked (xcb_connection_t *c, + xcb_randr_provider_t provider, + xcb_atom_t property) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_DELETE_PROVIDER_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_delete_provider_property_request_t xcb_out; + + xcb_out.provider = provider; + xcb_out.property = property; + + 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_randr_delete_provider_property (xcb_connection_t *c, + xcb_randr_provider_t provider, + xcb_atom_t property) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_DELETE_PROVIDER_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_delete_provider_property_request_t xcb_out; + + xcb_out.provider = provider; + xcb_out.property = property; + + 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_randr_get_provider_property_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_randr_get_provider_property_reply_t *_aux = (xcb_randr_get_provider_property_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_randr_get_provider_property_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += (_aux->num_items * (_aux->format / 8)) * sizeof(char); + 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_randr_get_provider_property_cookie_t +xcb_randr_get_provider_property (xcb_connection_t *c, + xcb_randr_provider_t provider, + xcb_atom_t property, + xcb_atom_t type, + uint32_t long_offset, + uint32_t long_length, + uint8_t _delete, + uint8_t pending) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_PROVIDER_PROPERTY, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_provider_property_cookie_t xcb_ret; + xcb_randr_get_provider_property_request_t xcb_out; + + xcb_out.provider = provider; + xcb_out.property = property; + xcb_out.type = type; + xcb_out.long_offset = long_offset; + xcb_out.long_length = long_length; + xcb_out._delete = _delete; + xcb_out.pending = pending; + 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_randr_get_provider_property_cookie_t +xcb_randr_get_provider_property_unchecked (xcb_connection_t *c, + xcb_randr_provider_t provider, + xcb_atom_t property, + xcb_atom_t type, + uint32_t long_offset, + uint32_t long_length, + uint8_t _delete, + uint8_t pending) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_PROVIDER_PROPERTY, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_provider_property_cookie_t xcb_ret; + xcb_randr_get_provider_property_request_t xcb_out; + + xcb_out.provider = provider; + xcb_out.property = property; + xcb_out.type = type; + xcb_out.long_offset = long_offset; + xcb_out.long_length = long_length; + xcb_out._delete = _delete; + xcb_out.pending = pending; + 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; +} + +void * +xcb_randr_get_provider_property_data (const xcb_randr_get_provider_property_reply_t *R) +{ + return (void *) (R + 1); +} + +int +xcb_randr_get_provider_property_data_length (const xcb_randr_get_provider_property_reply_t *R) +{ + return (R->num_items * (R->format / 8)); +} + +xcb_generic_iterator_t +xcb_randr_get_provider_property_data_end (const xcb_randr_get_provider_property_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + ((R->num_items * (R->format / 8))); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_get_provider_property_reply_t * +xcb_randr_get_provider_property_reply (xcb_connection_t *c, + xcb_randr_get_provider_property_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_get_provider_property_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +void +xcb_randr_crtc_change_next (xcb_randr_crtc_change_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_randr_crtc_change_t); +} + +xcb_generic_iterator_t +xcb_randr_crtc_change_end (xcb_randr_crtc_change_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; +} + +void +xcb_randr_output_change_next (xcb_randr_output_change_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_randr_output_change_t); +} + +xcb_generic_iterator_t +xcb_randr_output_change_end (xcb_randr_output_change_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; +} + +void +xcb_randr_output_property_next (xcb_randr_output_property_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_randr_output_property_t); +} + +xcb_generic_iterator_t +xcb_randr_output_property_end (xcb_randr_output_property_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; +} + +void +xcb_randr_provider_change_next (xcb_randr_provider_change_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_randr_provider_change_t); +} + +xcb_generic_iterator_t +xcb_randr_provider_change_end (xcb_randr_provider_change_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; +} + +void +xcb_randr_provider_property_next (xcb_randr_provider_property_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_randr_provider_property_t); +} + +xcb_generic_iterator_t +xcb_randr_provider_property_end (xcb_randr_provider_property_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; +} + +void +xcb_randr_resource_change_next (xcb_randr_resource_change_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_randr_resource_change_t); +} + +xcb_generic_iterator_t +xcb_randr_resource_change_end (xcb_randr_resource_change_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; +} + +int +xcb_randr_monitor_info_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_randr_monitor_info_t *_aux = (xcb_randr_monitor_info_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_randr_monitor_info_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* outputs */ + xcb_block_len += _aux->nOutput * sizeof(xcb_randr_output_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_randr_output_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_randr_output_t * +xcb_randr_monitor_info_outputs (const xcb_randr_monitor_info_t *R) +{ + return (xcb_randr_output_t *) (R + 1); +} + +int +xcb_randr_monitor_info_outputs_length (const xcb_randr_monitor_info_t *R) +{ + return R->nOutput; +} + +xcb_generic_iterator_t +xcb_randr_monitor_info_outputs_end (const xcb_randr_monitor_info_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_randr_output_t *) (R + 1)) + (R->nOutput); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_randr_monitor_info_next (xcb_randr_monitor_info_iterator_t *i) +{ + xcb_randr_monitor_info_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_randr_monitor_info_t *)(((char *)R) + xcb_randr_monitor_info_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_randr_monitor_info_t *) child.data; +} + +xcb_generic_iterator_t +xcb_randr_monitor_info_end (xcb_randr_monitor_info_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_randr_monitor_info_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_randr_get_monitors_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_randr_get_monitors_reply_t *_aux = (xcb_randr_get_monitors_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_randr_get_monitors_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* monitors */ + for(i=0; i<_aux->nMonitors; i++) { + xcb_tmp_len = xcb_randr_monitor_info_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_randr_monitor_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_randr_get_monitors_cookie_t +xcb_randr_get_monitors (xcb_connection_t *c, + xcb_window_t window, + uint8_t get_active) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_MONITORS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_monitors_cookie_t xcb_ret; + xcb_randr_get_monitors_request_t xcb_out; + + xcb_out.window = window; + xcb_out.get_active = get_active; + + 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_randr_get_monitors_cookie_t +xcb_randr_get_monitors_unchecked (xcb_connection_t *c, + xcb_window_t window, + uint8_t get_active) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_GET_MONITORS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_randr_get_monitors_cookie_t xcb_ret; + xcb_randr_get_monitors_request_t xcb_out; + + xcb_out.window = window; + xcb_out.get_active = get_active; + + 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_randr_get_monitors_monitors_length (const xcb_randr_get_monitors_reply_t *R) +{ + return R->nMonitors; +} + +xcb_randr_monitor_info_iterator_t +xcb_randr_get_monitors_monitors_iterator (const xcb_randr_get_monitors_reply_t *R) +{ + xcb_randr_monitor_info_iterator_t i; + i.data = (xcb_randr_monitor_info_t *) (R + 1); + i.rem = R->nMonitors; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_randr_get_monitors_reply_t * +xcb_randr_get_monitors_reply (xcb_connection_t *c, + xcb_randr_get_monitors_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_get_monitors_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_randr_set_monitor_sizeof (const void *_buffer) +{ + 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_randr_set_monitor_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* monitorinfo */ + xcb_block_len += xcb_randr_monitor_info_sizeof(xcb_tmp); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_randr_monitor_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_void_cookie_t +xcb_randr_set_monitor_checked (xcb_connection_t *c, + xcb_window_t window, + xcb_randr_monitor_info_t *monitorinfo) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_SET_MONITOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_randr_set_monitor_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_randr_monitor_info_t monitorinfo */ + xcb_parts[4].iov_base = (char *) monitorinfo; + xcb_parts[4].iov_len = + xcb_randr_monitor_info_sizeof (monitorinfo); + + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_randr_set_monitor (xcb_connection_t *c, + xcb_window_t window, + xcb_randr_monitor_info_t *monitorinfo) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_SET_MONITOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_randr_set_monitor_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_randr_monitor_info_t monitorinfo */ + xcb_parts[4].iov_base = (char *) monitorinfo; + xcb_parts[4].iov_len = + xcb_randr_monitor_info_sizeof (monitorinfo); + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_randr_monitor_info_t * +xcb_randr_set_monitor_monitorinfo (const xcb_randr_set_monitor_request_t *R) +{ + return (xcb_randr_monitor_info_t *) (R + 1); +} + +xcb_void_cookie_t +xcb_randr_delete_monitor_checked (xcb_connection_t *c, + xcb_window_t window, + xcb_atom_t name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_DELETE_MONITOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_delete_monitor_request_t xcb_out; + + xcb_out.window = window; + xcb_out.name = name; + + 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_randr_delete_monitor (xcb_connection_t *c, + xcb_window_t window, + xcb_atom_t name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_DELETE_MONITOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_delete_monitor_request_t xcb_out; + + xcb_out.window = window; + xcb_out.name = name; + + 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_randr_create_lease_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_randr_create_lease_request_t *_aux = (xcb_randr_create_lease_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_randr_create_lease_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* crtcs */ + xcb_block_len += _aux->num_crtcs * sizeof(xcb_randr_output_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_randr_crtc_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; + /* outputs */ + xcb_block_len += _aux->num_outputs * sizeof(xcb_randr_output_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_randr_output_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_randr_create_lease_cookie_t +xcb_randr_create_lease (xcb_connection_t *c, + xcb_window_t window, + xcb_randr_lease_t lid, + uint16_t num_crtcs, + uint16_t num_outputs, + const xcb_randr_crtc_t *crtcs, + const xcb_randr_output_t *outputs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_CREATE_LEASE, + .isvoid = 0 + }; + + struct iovec xcb_parts[8]; + xcb_randr_create_lease_cookie_t xcb_ret; + xcb_randr_create_lease_request_t xcb_out; + + xcb_out.window = window; + xcb_out.lid = lid; + xcb_out.num_crtcs = num_crtcs; + xcb_out.num_outputs = num_outputs; + + 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_randr_crtc_t crtcs */ + xcb_parts[4].iov_base = (char *) crtcs; + xcb_parts[4].iov_len = num_crtcs * sizeof(uint32_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_randr_output_t outputs */ + xcb_parts[6].iov_base = (char *) outputs; + xcb_parts[6].iov_len = num_outputs * sizeof(uint32_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED|XCB_REQUEST_REPLY_FDS, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_randr_create_lease_cookie_t +xcb_randr_create_lease_unchecked (xcb_connection_t *c, + xcb_window_t window, + xcb_randr_lease_t lid, + uint16_t num_crtcs, + uint16_t num_outputs, + const xcb_randr_crtc_t *crtcs, + const xcb_randr_output_t *outputs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_CREATE_LEASE, + .isvoid = 0 + }; + + struct iovec xcb_parts[8]; + xcb_randr_create_lease_cookie_t xcb_ret; + xcb_randr_create_lease_request_t xcb_out; + + xcb_out.window = window; + xcb_out.lid = lid; + xcb_out.num_crtcs = num_crtcs; + xcb_out.num_outputs = num_outputs; + + 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_randr_crtc_t crtcs */ + xcb_parts[4].iov_base = (char *) crtcs; + xcb_parts[4].iov_len = num_crtcs * sizeof(uint32_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_randr_output_t outputs */ + xcb_parts[6].iov_base = (char *) outputs; + xcb_parts[6].iov_len = num_outputs * sizeof(uint32_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_REPLY_FDS, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_randr_create_lease_reply_t * +xcb_randr_create_lease_reply (xcb_connection_t *c, + xcb_randr_create_lease_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_randr_create_lease_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int * +xcb_randr_create_lease_reply_fds (xcb_connection_t *c /**< */, + xcb_randr_create_lease_reply_t *reply) +{ + return xcb_get_reply_fds(c, reply, sizeof(xcb_randr_create_lease_reply_t) + 4 * reply->length); +} + +xcb_void_cookie_t +xcb_randr_free_lease_checked (xcb_connection_t *c, + xcb_randr_lease_t lid, + uint8_t terminate) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_FREE_LEASE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_free_lease_request_t xcb_out; + + xcb_out.lid = lid; + xcb_out.terminate = terminate; + + 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_randr_free_lease (xcb_connection_t *c, + xcb_randr_lease_t lid, + uint8_t terminate) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_randr_id, + .opcode = XCB_RANDR_FREE_LEASE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_randr_free_lease_request_t xcb_out; + + xcb_out.lid = lid; + xcb_out.terminate = terminate; + + 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_randr_lease_notify_next (xcb_randr_lease_notify_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_randr_lease_notify_t); +} + +xcb_generic_iterator_t +xcb_randr_lease_notify_end (xcb_randr_lease_notify_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; +} + +void +xcb_randr_notify_data_next (xcb_randr_notify_data_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_randr_notify_data_t); +} + +xcb_generic_iterator_t +xcb_randr_notify_data_end (xcb_randr_notify_data_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; +} + diff --git a/depends/libxcb/src/record.c b/depends/libxcb/src/record.c new file mode 100644 index 0000000..8c934d5 --- /dev/null +++ b/depends/libxcb/src/record.c @@ -0,0 +1,1093 @@ +/* + * This file generated automatically from record.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "record.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) + +xcb_extension_t xcb_record_id = { "RECORD", 0 }; + +void +xcb_record_context_next (xcb_record_context_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_record_context_t); +} + +xcb_generic_iterator_t +xcb_record_context_end (xcb_record_context_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; +} + +void +xcb_record_range_8_next (xcb_record_range_8_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_record_range_8_t); +} + +xcb_generic_iterator_t +xcb_record_range_8_end (xcb_record_range_8_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; +} + +void +xcb_record_range_16_next (xcb_record_range_16_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_record_range_16_t); +} + +xcb_generic_iterator_t +xcb_record_range_16_end (xcb_record_range_16_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; +} + +void +xcb_record_ext_range_next (xcb_record_ext_range_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_record_ext_range_t); +} + +xcb_generic_iterator_t +xcb_record_ext_range_end (xcb_record_ext_range_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; +} + +void +xcb_record_range_next (xcb_record_range_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_record_range_t); +} + +xcb_generic_iterator_t +xcb_record_range_end (xcb_record_range_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; +} + +void +xcb_record_element_header_next (xcb_record_element_header_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_record_element_header_t); +} + +xcb_generic_iterator_t +xcb_record_element_header_end (xcb_record_element_header_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; +} + +void +xcb_record_client_spec_next (xcb_record_client_spec_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_record_client_spec_t); +} + +xcb_generic_iterator_t +xcb_record_client_spec_end (xcb_record_client_spec_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; +} + +int +xcb_record_client_info_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_record_client_info_t *_aux = (xcb_record_client_info_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_record_client_info_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* ranges */ + xcb_block_len += _aux->num_ranges * sizeof(xcb_record_range_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_record_range_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_record_range_t * +xcb_record_client_info_ranges (const xcb_record_client_info_t *R) +{ + return (xcb_record_range_t *) (R + 1); +} + +int +xcb_record_client_info_ranges_length (const xcb_record_client_info_t *R) +{ + return R->num_ranges; +} + +xcb_record_range_iterator_t +xcb_record_client_info_ranges_iterator (const xcb_record_client_info_t *R) +{ + xcb_record_range_iterator_t i; + i.data = (xcb_record_range_t *) (R + 1); + i.rem = R->num_ranges; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_record_client_info_next (xcb_record_client_info_iterator_t *i) +{ + xcb_record_client_info_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_record_client_info_t *)(((char *)R) + xcb_record_client_info_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_record_client_info_t *) child.data; +} + +xcb_generic_iterator_t +xcb_record_client_info_end (xcb_record_client_info_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_record_client_info_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +xcb_record_query_version_cookie_t +xcb_record_query_version (xcb_connection_t *c, + uint16_t major_version, + uint16_t minor_version) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_record_id, + .opcode = XCB_RECORD_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_record_query_version_cookie_t xcb_ret; + xcb_record_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_record_query_version_cookie_t +xcb_record_query_version_unchecked (xcb_connection_t *c, + uint16_t major_version, + uint16_t minor_version) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_record_id, + .opcode = XCB_RECORD_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_record_query_version_cookie_t xcb_ret; + xcb_record_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_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); +} + +int +xcb_record_create_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_record_create_context_request_t *_aux = (xcb_record_create_context_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_record_create_context_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* client_specs */ + xcb_block_len += _aux->num_client_specs * sizeof(xcb_record_client_spec_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_record_client_spec_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; + /* ranges */ + xcb_block_len += _aux->num_ranges * sizeof(xcb_record_range_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_record_range_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_record_create_context_checked (xcb_connection_t *c, + xcb_record_context_t context, + xcb_record_element_header_t element_header, + uint32_t num_client_specs, + uint32_t num_ranges, + const xcb_record_client_spec_t *client_specs, + const xcb_record_range_t *ranges) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_record_id, + .opcode = XCB_RECORD_CREATE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[8]; + xcb_void_cookie_t xcb_ret; + xcb_record_create_context_request_t xcb_out; + + xcb_out.context = context; + xcb_out.element_header = element_header; + memset(xcb_out.pad0, 0, 3); + xcb_out.num_client_specs = num_client_specs; + xcb_out.num_ranges = num_ranges; + + 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_record_client_spec_t client_specs */ + xcb_parts[4].iov_base = (char *) client_specs; + xcb_parts[4].iov_len = num_client_specs * sizeof(xcb_record_client_spec_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_record_range_t ranges */ + xcb_parts[6].iov_base = (char *) ranges; + xcb_parts[6].iov_len = num_ranges * sizeof(xcb_record_range_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].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_record_create_context (xcb_connection_t *c, + xcb_record_context_t context, + xcb_record_element_header_t element_header, + uint32_t num_client_specs, + uint32_t num_ranges, + const xcb_record_client_spec_t *client_specs, + const xcb_record_range_t *ranges) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_record_id, + .opcode = XCB_RECORD_CREATE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[8]; + xcb_void_cookie_t xcb_ret; + xcb_record_create_context_request_t xcb_out; + + xcb_out.context = context; + xcb_out.element_header = element_header; + memset(xcb_out.pad0, 0, 3); + xcb_out.num_client_specs = num_client_specs; + xcb_out.num_ranges = num_ranges; + + 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_record_client_spec_t client_specs */ + xcb_parts[4].iov_base = (char *) client_specs; + xcb_parts[4].iov_len = num_client_specs * sizeof(xcb_record_client_spec_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_record_range_t ranges */ + xcb_parts[6].iov_base = (char *) ranges; + xcb_parts[6].iov_len = num_ranges * sizeof(xcb_record_range_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_record_client_spec_t * +xcb_record_create_context_client_specs (const xcb_record_create_context_request_t *R) +{ + return (xcb_record_client_spec_t *) (R + 1); +} + +int +xcb_record_create_context_client_specs_length (const xcb_record_create_context_request_t *R) +{ + return R->num_client_specs; +} + +xcb_generic_iterator_t +xcb_record_create_context_client_specs_end (const xcb_record_create_context_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_record_client_spec_t *) (R + 1)) + (R->num_client_specs); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_record_range_t * +xcb_record_create_context_ranges (const xcb_record_create_context_request_t *R) +{ + xcb_generic_iterator_t prev = xcb_record_create_context_client_specs_end(R); + return (xcb_record_range_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_record_range_t, prev.index) + 0); +} + +int +xcb_record_create_context_ranges_length (const xcb_record_create_context_request_t *R) +{ + return R->num_ranges; +} + +xcb_record_range_iterator_t +xcb_record_create_context_ranges_iterator (const xcb_record_create_context_request_t *R) +{ + xcb_record_range_iterator_t i; + xcb_generic_iterator_t prev = xcb_record_create_context_client_specs_end(R); + i.data = (xcb_record_range_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_record_range_t, prev.index)); + i.rem = R->num_ranges; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_record_register_clients_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_record_register_clients_request_t *_aux = (xcb_record_register_clients_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_record_register_clients_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* client_specs */ + xcb_block_len += _aux->num_client_specs * sizeof(xcb_record_client_spec_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_record_client_spec_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; + /* ranges */ + xcb_block_len += _aux->num_ranges * sizeof(xcb_record_range_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_record_range_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_record_register_clients_checked (xcb_connection_t *c, + xcb_record_context_t context, + xcb_record_element_header_t element_header, + uint32_t num_client_specs, + uint32_t num_ranges, + const xcb_record_client_spec_t *client_specs, + const xcb_record_range_t *ranges) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_record_id, + .opcode = XCB_RECORD_REGISTER_CLIENTS, + .isvoid = 1 + }; + + struct iovec xcb_parts[8]; + xcb_void_cookie_t xcb_ret; + xcb_record_register_clients_request_t xcb_out; + + xcb_out.context = context; + xcb_out.element_header = element_header; + memset(xcb_out.pad0, 0, 3); + xcb_out.num_client_specs = num_client_specs; + xcb_out.num_ranges = num_ranges; + + 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_record_client_spec_t client_specs */ + xcb_parts[4].iov_base = (char *) client_specs; + xcb_parts[4].iov_len = num_client_specs * sizeof(xcb_record_client_spec_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_record_range_t ranges */ + xcb_parts[6].iov_base = (char *) ranges; + xcb_parts[6].iov_len = num_ranges * sizeof(xcb_record_range_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].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_record_register_clients (xcb_connection_t *c, + xcb_record_context_t context, + xcb_record_element_header_t element_header, + uint32_t num_client_specs, + uint32_t num_ranges, + const xcb_record_client_spec_t *client_specs, + const xcb_record_range_t *ranges) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_record_id, + .opcode = XCB_RECORD_REGISTER_CLIENTS, + .isvoid = 1 + }; + + struct iovec xcb_parts[8]; + xcb_void_cookie_t xcb_ret; + xcb_record_register_clients_request_t xcb_out; + + xcb_out.context = context; + xcb_out.element_header = element_header; + memset(xcb_out.pad0, 0, 3); + xcb_out.num_client_specs = num_client_specs; + xcb_out.num_ranges = num_ranges; + + 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_record_client_spec_t client_specs */ + xcb_parts[4].iov_base = (char *) client_specs; + xcb_parts[4].iov_len = num_client_specs * sizeof(xcb_record_client_spec_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_record_range_t ranges */ + xcb_parts[6].iov_base = (char *) ranges; + xcb_parts[6].iov_len = num_ranges * sizeof(xcb_record_range_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_record_client_spec_t * +xcb_record_register_clients_client_specs (const xcb_record_register_clients_request_t *R) +{ + return (xcb_record_client_spec_t *) (R + 1); +} + +int +xcb_record_register_clients_client_specs_length (const xcb_record_register_clients_request_t *R) +{ + return R->num_client_specs; +} + +xcb_generic_iterator_t +xcb_record_register_clients_client_specs_end (const xcb_record_register_clients_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_record_client_spec_t *) (R + 1)) + (R->num_client_specs); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_record_range_t * +xcb_record_register_clients_ranges (const xcb_record_register_clients_request_t *R) +{ + xcb_generic_iterator_t prev = xcb_record_register_clients_client_specs_end(R); + return (xcb_record_range_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_record_range_t, prev.index) + 0); +} + +int +xcb_record_register_clients_ranges_length (const xcb_record_register_clients_request_t *R) +{ + return R->num_ranges; +} + +xcb_record_range_iterator_t +xcb_record_register_clients_ranges_iterator (const xcb_record_register_clients_request_t *R) +{ + xcb_record_range_iterator_t i; + xcb_generic_iterator_t prev = xcb_record_register_clients_client_specs_end(R); + i.data = (xcb_record_range_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_record_range_t, prev.index)); + i.rem = R->num_ranges; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_record_unregister_clients_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_record_unregister_clients_request_t *_aux = (xcb_record_unregister_clients_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_record_unregister_clients_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* client_specs */ + xcb_block_len += _aux->num_client_specs * sizeof(xcb_record_client_spec_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_record_client_spec_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_record_unregister_clients_checked (xcb_connection_t *c, + xcb_record_context_t context, + uint32_t num_client_specs, + const xcb_record_client_spec_t *client_specs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_record_id, + .opcode = XCB_RECORD_UNREGISTER_CLIENTS, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_record_unregister_clients_request_t xcb_out; + + xcb_out.context = context; + xcb_out.num_client_specs = num_client_specs; + + 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_record_client_spec_t client_specs */ + xcb_parts[4].iov_base = (char *) client_specs; + xcb_parts[4].iov_len = num_client_specs * sizeof(xcb_record_client_spec_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_record_unregister_clients (xcb_connection_t *c, + xcb_record_context_t context, + uint32_t num_client_specs, + const xcb_record_client_spec_t *client_specs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_record_id, + .opcode = XCB_RECORD_UNREGISTER_CLIENTS, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_record_unregister_clients_request_t xcb_out; + + xcb_out.context = context; + xcb_out.num_client_specs = num_client_specs; + + 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_record_client_spec_t client_specs */ + xcb_parts[4].iov_base = (char *) client_specs; + xcb_parts[4].iov_len = num_client_specs * sizeof(xcb_record_client_spec_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_record_client_spec_t * +xcb_record_unregister_clients_client_specs (const xcb_record_unregister_clients_request_t *R) +{ + return (xcb_record_client_spec_t *) (R + 1); +} + +int +xcb_record_unregister_clients_client_specs_length (const xcb_record_unregister_clients_request_t *R) +{ + return R->num_client_specs; +} + +xcb_generic_iterator_t +xcb_record_unregister_clients_client_specs_end (const xcb_record_unregister_clients_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_record_client_spec_t *) (R + 1)) + (R->num_client_specs); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_record_get_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_record_get_context_reply_t *_aux = (xcb_record_get_context_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_record_get_context_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* intercepted_clients */ + for(i=0; i<_aux->num_intercepted_clients; i++) { + xcb_tmp_len = xcb_record_client_info_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_record_client_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_record_get_context_cookie_t +xcb_record_get_context (xcb_connection_t *c, + xcb_record_context_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_record_id, + .opcode = XCB_RECORD_GET_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_record_get_context_cookie_t xcb_ret; + xcb_record_get_context_request_t xcb_out; + + xcb_out.context = context; + + 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_record_get_context_cookie_t +xcb_record_get_context_unchecked (xcb_connection_t *c, + xcb_record_context_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_record_id, + .opcode = XCB_RECORD_GET_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_record_get_context_cookie_t xcb_ret; + xcb_record_get_context_request_t xcb_out; + + xcb_out.context = context; + + 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_record_get_context_intercepted_clients_length (const xcb_record_get_context_reply_t *R) +{ + return R->num_intercepted_clients; +} + +xcb_record_client_info_iterator_t +xcb_record_get_context_intercepted_clients_iterator (const xcb_record_get_context_reply_t *R) +{ + xcb_record_client_info_iterator_t i; + i.data = (xcb_record_client_info_t *) (R + 1); + i.rem = R->num_intercepted_clients; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_record_get_context_reply_t * +xcb_record_get_context_reply (xcb_connection_t *c, + xcb_record_get_context_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_record_get_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_record_enable_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_record_enable_context_reply_t *_aux = (xcb_record_enable_context_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_record_enable_context_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += (_aux->length * 4) * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_record_enable_context_cookie_t +xcb_record_enable_context (xcb_connection_t *c, + xcb_record_context_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_record_id, + .opcode = XCB_RECORD_ENABLE_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_record_enable_context_cookie_t xcb_ret; + xcb_record_enable_context_request_t xcb_out; + + xcb_out.context = context; + + 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_record_enable_context_cookie_t +xcb_record_enable_context_unchecked (xcb_connection_t *c, + xcb_record_context_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_record_id, + .opcode = XCB_RECORD_ENABLE_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_record_enable_context_cookie_t xcb_ret; + xcb_record_enable_context_request_t xcb_out; + + xcb_out.context = context; + + 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; +} + +uint8_t * +xcb_record_enable_context_data (const xcb_record_enable_context_reply_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_record_enable_context_data_length (const xcb_record_enable_context_reply_t *R) +{ + return (R->length * 4); +} + +xcb_generic_iterator_t +xcb_record_enable_context_data_end (const xcb_record_enable_context_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((R->length * 4)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +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); +} + +xcb_void_cookie_t +xcb_record_disable_context_checked (xcb_connection_t *c, + xcb_record_context_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_record_id, + .opcode = XCB_RECORD_DISABLE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_record_disable_context_request_t xcb_out; + + xcb_out.context = context; + + 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_record_disable_context (xcb_connection_t *c, + xcb_record_context_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_record_id, + .opcode = XCB_RECORD_DISABLE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_record_disable_context_request_t xcb_out; + + xcb_out.context = context; + + 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_record_free_context_checked (xcb_connection_t *c, + xcb_record_context_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_record_id, + .opcode = XCB_RECORD_FREE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_record_free_context_request_t xcb_out; + + xcb_out.context = context; + + 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_record_free_context (xcb_connection_t *c, + xcb_record_context_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_record_id, + .opcode = XCB_RECORD_FREE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_record_free_context_request_t xcb_out; + + xcb_out.context = context; + + 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; +} + diff --git a/depends/libxcb/src/render.c b/depends/libxcb/src/render.c new file mode 100644 index 0000000..1f0d7fe --- /dev/null +++ b/depends/libxcb/src/render.c @@ -0,0 +1,4982 @@ +/* + * This file generated automatically from render.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "render.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) +#include "xproto.h" + +xcb_extension_t xcb_render_id = { "RENDER", 0 }; + +void +xcb_render_glyph_next (xcb_render_glyph_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_render_glyph_t); +} + +xcb_generic_iterator_t +xcb_render_glyph_end (xcb_render_glyph_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; +} + +void +xcb_render_glyphset_next (xcb_render_glyphset_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_render_glyphset_t); +} + +xcb_generic_iterator_t +xcb_render_glyphset_end (xcb_render_glyphset_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; +} + +void +xcb_render_picture_next (xcb_render_picture_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_render_picture_t); +} + +xcb_generic_iterator_t +xcb_render_picture_end (xcb_render_picture_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; +} + +void +xcb_render_pictformat_next (xcb_render_pictformat_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_render_pictformat_t); +} + +xcb_generic_iterator_t +xcb_render_pictformat_end (xcb_render_pictformat_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; +} + +void +xcb_render_fixed_next (xcb_render_fixed_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_render_fixed_t); +} + +xcb_generic_iterator_t +xcb_render_fixed_end (xcb_render_fixed_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; +} + +void +xcb_render_directformat_next (xcb_render_directformat_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_render_directformat_t); +} + +xcb_generic_iterator_t +xcb_render_directformat_end (xcb_render_directformat_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; +} + +void +xcb_render_pictforminfo_next (xcb_render_pictforminfo_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_render_pictforminfo_t); +} + +xcb_generic_iterator_t +xcb_render_pictforminfo_end (xcb_render_pictforminfo_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; +} + +void +xcb_render_pictvisual_next (xcb_render_pictvisual_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_render_pictvisual_t); +} + +xcb_generic_iterator_t +xcb_render_pictvisual_end (xcb_render_pictvisual_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; +} + +int +xcb_render_pictdepth_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_render_pictdepth_t *_aux = (xcb_render_pictdepth_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_render_pictdepth_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* visuals */ + xcb_block_len += _aux->num_visuals * sizeof(xcb_render_pictvisual_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_render_pictvisual_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_render_pictvisual_t * +xcb_render_pictdepth_visuals (const xcb_render_pictdepth_t *R) +{ + return (xcb_render_pictvisual_t *) (R + 1); +} + +int +xcb_render_pictdepth_visuals_length (const xcb_render_pictdepth_t *R) +{ + return R->num_visuals; +} + +xcb_render_pictvisual_iterator_t +xcb_render_pictdepth_visuals_iterator (const xcb_render_pictdepth_t *R) +{ + xcb_render_pictvisual_iterator_t i; + i.data = (xcb_render_pictvisual_t *) (R + 1); + i.rem = R->num_visuals; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_render_pictdepth_next (xcb_render_pictdepth_iterator_t *i) +{ + xcb_render_pictdepth_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_render_pictdepth_t *)(((char *)R) + xcb_render_pictdepth_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_render_pictdepth_t *) child.data; +} + +xcb_generic_iterator_t +xcb_render_pictdepth_end (xcb_render_pictdepth_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_render_pictdepth_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_render_pictscreen_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_render_pictscreen_t *_aux = (xcb_render_pictscreen_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_render_pictscreen_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* depths */ + for(i=0; i<_aux->num_depths; i++) { + xcb_tmp_len = xcb_render_pictdepth_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_render_pictdepth_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; +} + +int +xcb_render_pictscreen_depths_length (const xcb_render_pictscreen_t *R) +{ + return R->num_depths; +} + +xcb_render_pictdepth_iterator_t +xcb_render_pictscreen_depths_iterator (const xcb_render_pictscreen_t *R) +{ + xcb_render_pictdepth_iterator_t i; + i.data = (xcb_render_pictdepth_t *) (R + 1); + i.rem = R->num_depths; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_render_pictscreen_next (xcb_render_pictscreen_iterator_t *i) +{ + xcb_render_pictscreen_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_render_pictscreen_t *)(((char *)R) + xcb_render_pictscreen_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_render_pictscreen_t *) child.data; +} + +xcb_generic_iterator_t +xcb_render_pictscreen_end (xcb_render_pictscreen_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_render_pictscreen_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +void +xcb_render_indexvalue_next (xcb_render_indexvalue_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_render_indexvalue_t); +} + +xcb_generic_iterator_t +xcb_render_indexvalue_end (xcb_render_indexvalue_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; +} + +void +xcb_render_color_next (xcb_render_color_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_render_color_t); +} + +xcb_generic_iterator_t +xcb_render_color_end (xcb_render_color_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; +} + +void +xcb_render_pointfix_next (xcb_render_pointfix_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_render_pointfix_t); +} + +xcb_generic_iterator_t +xcb_render_pointfix_end (xcb_render_pointfix_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; +} + +void +xcb_render_linefix_next (xcb_render_linefix_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_render_linefix_t); +} + +xcb_generic_iterator_t +xcb_render_linefix_end (xcb_render_linefix_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; +} + +void +xcb_render_triangle_next (xcb_render_triangle_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_render_triangle_t); +} + +xcb_generic_iterator_t +xcb_render_triangle_end (xcb_render_triangle_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; +} + +void +xcb_render_trapezoid_next (xcb_render_trapezoid_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_render_trapezoid_t); +} + +xcb_generic_iterator_t +xcb_render_trapezoid_end (xcb_render_trapezoid_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; +} + +void +xcb_render_glyphinfo_next (xcb_render_glyphinfo_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_render_glyphinfo_t); +} + +xcb_generic_iterator_t +xcb_render_glyphinfo_end (xcb_render_glyphinfo_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_render_query_version_cookie_t +xcb_render_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_render_id, + .opcode = XCB_RENDER_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_render_query_version_cookie_t xcb_ret; + xcb_render_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_render_query_version_cookie_t +xcb_render_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_render_id, + .opcode = XCB_RENDER_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_render_query_version_cookie_t xcb_ret; + xcb_render_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_render_query_version_reply_t * +xcb_render_query_version_reply (xcb_connection_t *c, + xcb_render_query_version_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_render_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_render_query_pict_formats_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_render_query_pict_formats_reply_t *_aux = (xcb_render_query_pict_formats_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_render_query_pict_formats_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* formats */ + xcb_block_len += _aux->num_formats * sizeof(xcb_render_pictforminfo_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_render_pictforminfo_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; + /* screens */ + for(i=0; i<_aux->num_screens; i++) { + xcb_tmp_len = xcb_render_pictscreen_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_render_pictscreen_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; + /* subpixels */ + xcb_block_len += _aux->num_subpixel * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_render_query_pict_formats_cookie_t +xcb_render_query_pict_formats (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_QUERY_PICT_FORMATS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_render_query_pict_formats_cookie_t xcb_ret; + xcb_render_query_pict_formats_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_render_query_pict_formats_cookie_t +xcb_render_query_pict_formats_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_QUERY_PICT_FORMATS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_render_query_pict_formats_cookie_t xcb_ret; + xcb_render_query_pict_formats_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_render_pictforminfo_t * +xcb_render_query_pict_formats_formats (const xcb_render_query_pict_formats_reply_t *R) +{ + return (xcb_render_pictforminfo_t *) (R + 1); +} + +int +xcb_render_query_pict_formats_formats_length (const xcb_render_query_pict_formats_reply_t *R) +{ + return R->num_formats; +} + +xcb_render_pictforminfo_iterator_t +xcb_render_query_pict_formats_formats_iterator (const xcb_render_query_pict_formats_reply_t *R) +{ + xcb_render_pictforminfo_iterator_t i; + i.data = (xcb_render_pictforminfo_t *) (R + 1); + i.rem = R->num_formats; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_render_query_pict_formats_screens_length (const xcb_render_query_pict_formats_reply_t *R) +{ + return R->num_screens; +} + +xcb_render_pictscreen_iterator_t +xcb_render_query_pict_formats_screens_iterator (const xcb_render_query_pict_formats_reply_t *R) +{ + xcb_render_pictscreen_iterator_t i; + xcb_generic_iterator_t prev = xcb_render_pictforminfo_end(xcb_render_query_pict_formats_formats_iterator(R)); + i.data = (xcb_render_pictscreen_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_render_pictscreen_t, prev.index)); + i.rem = R->num_screens; + i.index = (char *) i.data - (char *) R; + return i; +} + +uint32_t * +xcb_render_query_pict_formats_subpixels (const xcb_render_query_pict_formats_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_render_pictscreen_end(xcb_render_query_pict_formats_screens_iterator(R)); + return (uint32_t *) ((char *) prev.data + XCB_TYPE_PAD(uint32_t, prev.index) + 0); +} + +int +xcb_render_query_pict_formats_subpixels_length (const xcb_render_query_pict_formats_reply_t *R) +{ + return R->num_subpixel; +} + +xcb_generic_iterator_t +xcb_render_query_pict_formats_subpixels_end (const xcb_render_query_pict_formats_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_render_pictscreen_end(xcb_render_query_pict_formats_screens_iterator(R)); + i.data = ((uint32_t *) ((char*) prev.data + XCB_TYPE_PAD(uint32_t, prev.index))) + (R->num_subpixel); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_render_query_pict_formats_reply_t * +xcb_render_query_pict_formats_reply (xcb_connection_t *c, + xcb_render_query_pict_formats_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_render_query_pict_formats_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_render_query_pict_index_values_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_render_query_pict_index_values_reply_t *_aux = (xcb_render_query_pict_index_values_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_render_query_pict_index_values_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* values */ + xcb_block_len += _aux->num_values * sizeof(xcb_render_indexvalue_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_render_indexvalue_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_render_query_pict_index_values_cookie_t +xcb_render_query_pict_index_values (xcb_connection_t *c, + xcb_render_pictformat_t format) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_QUERY_PICT_INDEX_VALUES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_render_query_pict_index_values_cookie_t xcb_ret; + xcb_render_query_pict_index_values_request_t xcb_out; + + xcb_out.format = format; + + 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_render_query_pict_index_values_cookie_t +xcb_render_query_pict_index_values_unchecked (xcb_connection_t *c, + xcb_render_pictformat_t format) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_QUERY_PICT_INDEX_VALUES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_render_query_pict_index_values_cookie_t xcb_ret; + xcb_render_query_pict_index_values_request_t xcb_out; + + xcb_out.format = format; + + 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_render_indexvalue_t * +xcb_render_query_pict_index_values_values (const xcb_render_query_pict_index_values_reply_t *R) +{ + return (xcb_render_indexvalue_t *) (R + 1); +} + +int +xcb_render_query_pict_index_values_values_length (const xcb_render_query_pict_index_values_reply_t *R) +{ + return R->num_values; +} + +xcb_render_indexvalue_iterator_t +xcb_render_query_pict_index_values_values_iterator (const xcb_render_query_pict_index_values_reply_t *R) +{ + xcb_render_indexvalue_iterator_t i; + i.data = (xcb_render_indexvalue_t *) (R + 1); + i.rem = R->num_values; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_render_query_pict_index_values_reply_t * +xcb_render_query_pict_index_values_reply (xcb_connection_t *c, + xcb_render_query_pict_index_values_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_render_query_pict_index_values_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_render_create_picture_value_list_serialize (void **_buffer, + uint32_t value_mask, + const xcb_render_create_picture_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[14]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(value_mask & XCB_RENDER_CP_REPEAT) { + /* xcb_render_create_picture_value_list_t.repeat */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->repeat; + 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_RENDER_CP_ALPHA_MAP) { + /* xcb_render_create_picture_value_list_t.alphamap */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->alphamap; + xcb_block_len += sizeof(xcb_render_picture_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_render_picture_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_render_picture_t); + } + if(value_mask & XCB_RENDER_CP_ALPHA_X_ORIGIN) { + /* xcb_render_create_picture_value_list_t.alphaxorigin */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->alphaxorigin; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_RENDER_CP_ALPHA_Y_ORIGIN) { + /* xcb_render_create_picture_value_list_t.alphayorigin */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->alphayorigin; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_RENDER_CP_CLIP_X_ORIGIN) { + /* xcb_render_create_picture_value_list_t.clipxorigin */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clipxorigin; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_RENDER_CP_CLIP_Y_ORIGIN) { + /* xcb_render_create_picture_value_list_t.clipyorigin */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clipyorigin; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_RENDER_CP_CLIP_MASK) { + /* xcb_render_create_picture_value_list_t.clipmask */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clipmask; + 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_RENDER_CP_GRAPHICS_EXPOSURE) { + /* xcb_render_create_picture_value_list_t.graphicsexposure */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->graphicsexposure; + 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_RENDER_CP_SUBWINDOW_MODE) { + /* xcb_render_create_picture_value_list_t.subwindowmode */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->subwindowmode; + 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_RENDER_CP_POLY_EDGE) { + /* xcb_render_create_picture_value_list_t.polyedge */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->polyedge; + 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_RENDER_CP_POLY_MODE) { + /* xcb_render_create_picture_value_list_t.polymode */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->polymode; + 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_RENDER_CP_DITHER) { + /* xcb_render_create_picture_value_list_t.dither */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->dither; + xcb_block_len += sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(value_mask & XCB_RENDER_CP_COMPONENT_ALPHA) { + /* xcb_render_create_picture_value_list_t.componentalpha */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->componentalpha; + 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); + } + /* 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_render_create_picture_value_list_unpack (const void *_buffer, + uint32_t value_mask, + xcb_render_create_picture_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_RENDER_CP_REPEAT) { + /* xcb_render_create_picture_value_list_t.repeat */ + _aux->repeat = *(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_RENDER_CP_ALPHA_MAP) { + /* xcb_render_create_picture_value_list_t.alphamap */ + _aux->alphamap = *(xcb_render_picture_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_render_picture_t); + xcb_tmp += sizeof(xcb_render_picture_t); + xcb_align_to = ALIGNOF(xcb_render_picture_t); + } + if(value_mask & XCB_RENDER_CP_ALPHA_X_ORIGIN) { + /* xcb_render_create_picture_value_list_t.alphaxorigin */ + _aux->alphaxorigin = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_RENDER_CP_ALPHA_Y_ORIGIN) { + /* xcb_render_create_picture_value_list_t.alphayorigin */ + _aux->alphayorigin = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_RENDER_CP_CLIP_X_ORIGIN) { + /* xcb_render_create_picture_value_list_t.clipxorigin */ + _aux->clipxorigin = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_RENDER_CP_CLIP_Y_ORIGIN) { + /* xcb_render_create_picture_value_list_t.clipyorigin */ + _aux->clipyorigin = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_RENDER_CP_CLIP_MASK) { + /* xcb_render_create_picture_value_list_t.clipmask */ + _aux->clipmask = *(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_RENDER_CP_GRAPHICS_EXPOSURE) { + /* xcb_render_create_picture_value_list_t.graphicsexposure */ + _aux->graphicsexposure = *(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_RENDER_CP_SUBWINDOW_MODE) { + /* xcb_render_create_picture_value_list_t.subwindowmode */ + _aux->subwindowmode = *(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_RENDER_CP_POLY_EDGE) { + /* xcb_render_create_picture_value_list_t.polyedge */ + _aux->polyedge = *(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_RENDER_CP_POLY_MODE) { + /* xcb_render_create_picture_value_list_t.polymode */ + _aux->polymode = *(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_RENDER_CP_DITHER) { + /* xcb_render_create_picture_value_list_t.dither */ + _aux->dither = *(xcb_atom_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_atom_t); + xcb_tmp += sizeof(xcb_atom_t); + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(value_mask & XCB_RENDER_CP_COMPONENT_ALPHA) { + /* xcb_render_create_picture_value_list_t.componentalpha */ + _aux->componentalpha = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_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_render_create_picture_value_list_sizeof (const void *_buffer, + uint32_t value_mask) +{ + xcb_render_create_picture_value_list_t _aux; + return xcb_render_create_picture_value_list_unpack(_buffer, value_mask, &_aux); +} + +int +xcb_render_create_picture_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_render_create_picture_request_t *_aux = (xcb_render_create_picture_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_render_create_picture_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* value_list */ + xcb_block_len += xcb_render_create_picture_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_render_create_picture_checked (xcb_connection_t *c, + xcb_render_picture_t pid, + xcb_drawable_t drawable, + xcb_render_pictformat_t format, + uint32_t value_mask, + const void *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_CREATE_PICTURE, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_render_create_picture_request_t xcb_out; + + xcb_out.pid = pid; + xcb_out.drawable = drawable; + xcb_out.format = format; + 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_render_create_picture_value_list_t value_list */ + xcb_parts[4].iov_base = (char *) value_list; + xcb_parts[4].iov_len = + xcb_render_create_picture_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_render_create_picture (xcb_connection_t *c, + xcb_render_picture_t pid, + xcb_drawable_t drawable, + xcb_render_pictformat_t format, + uint32_t value_mask, + const void *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_CREATE_PICTURE, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_render_create_picture_request_t xcb_out; + + xcb_out.pid = pid; + xcb_out.drawable = drawable; + xcb_out.format = format; + 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_render_create_picture_value_list_t value_list */ + xcb_parts[4].iov_base = (char *) value_list; + xcb_parts[4].iov_len = + xcb_render_create_picture_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_render_create_picture_aux_checked (xcb_connection_t *c, + xcb_render_picture_t pid, + xcb_drawable_t drawable, + xcb_render_pictformat_t format, + uint32_t value_mask, + const xcb_render_create_picture_value_list_t *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_CREATE_PICTURE, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_render_create_picture_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.pid = pid; + xcb_out.drawable = drawable; + xcb_out.format = format; + 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_render_create_picture_value_list_t value_list */ + xcb_parts[4].iov_len = + xcb_render_create_picture_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_render_create_picture_aux (xcb_connection_t *c, + xcb_render_picture_t pid, + xcb_drawable_t drawable, + xcb_render_pictformat_t format, + uint32_t value_mask, + const xcb_render_create_picture_value_list_t *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_CREATE_PICTURE, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_render_create_picture_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.pid = pid; + xcb_out.drawable = drawable; + xcb_out.format = format; + 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_render_create_picture_value_list_t value_list */ + xcb_parts[4].iov_len = + xcb_render_create_picture_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_render_create_picture_value_list (const xcb_render_create_picture_request_t *R) +{ + return (void *) (R + 1); +} + +int +xcb_render_change_picture_value_list_serialize (void **_buffer, + uint32_t value_mask, + const xcb_render_change_picture_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[14]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(value_mask & XCB_RENDER_CP_REPEAT) { + /* xcb_render_change_picture_value_list_t.repeat */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->repeat; + 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_RENDER_CP_ALPHA_MAP) { + /* xcb_render_change_picture_value_list_t.alphamap */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->alphamap; + xcb_block_len += sizeof(xcb_render_picture_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_render_picture_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_render_picture_t); + } + if(value_mask & XCB_RENDER_CP_ALPHA_X_ORIGIN) { + /* xcb_render_change_picture_value_list_t.alphaxorigin */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->alphaxorigin; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_RENDER_CP_ALPHA_Y_ORIGIN) { + /* xcb_render_change_picture_value_list_t.alphayorigin */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->alphayorigin; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_RENDER_CP_CLIP_X_ORIGIN) { + /* xcb_render_change_picture_value_list_t.clipxorigin */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clipxorigin; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_RENDER_CP_CLIP_Y_ORIGIN) { + /* xcb_render_change_picture_value_list_t.clipyorigin */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clipyorigin; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_RENDER_CP_CLIP_MASK) { + /* xcb_render_change_picture_value_list_t.clipmask */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clipmask; + 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_RENDER_CP_GRAPHICS_EXPOSURE) { + /* xcb_render_change_picture_value_list_t.graphicsexposure */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->graphicsexposure; + 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_RENDER_CP_SUBWINDOW_MODE) { + /* xcb_render_change_picture_value_list_t.subwindowmode */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->subwindowmode; + 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_RENDER_CP_POLY_EDGE) { + /* xcb_render_change_picture_value_list_t.polyedge */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->polyedge; + 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_RENDER_CP_POLY_MODE) { + /* xcb_render_change_picture_value_list_t.polymode */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->polymode; + 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_RENDER_CP_DITHER) { + /* xcb_render_change_picture_value_list_t.dither */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->dither; + xcb_block_len += sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(value_mask & XCB_RENDER_CP_COMPONENT_ALPHA) { + /* xcb_render_change_picture_value_list_t.componentalpha */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->componentalpha; + 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); + } + /* 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_render_change_picture_value_list_unpack (const void *_buffer, + uint32_t value_mask, + xcb_render_change_picture_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_RENDER_CP_REPEAT) { + /* xcb_render_change_picture_value_list_t.repeat */ + _aux->repeat = *(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_RENDER_CP_ALPHA_MAP) { + /* xcb_render_change_picture_value_list_t.alphamap */ + _aux->alphamap = *(xcb_render_picture_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_render_picture_t); + xcb_tmp += sizeof(xcb_render_picture_t); + xcb_align_to = ALIGNOF(xcb_render_picture_t); + } + if(value_mask & XCB_RENDER_CP_ALPHA_X_ORIGIN) { + /* xcb_render_change_picture_value_list_t.alphaxorigin */ + _aux->alphaxorigin = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_RENDER_CP_ALPHA_Y_ORIGIN) { + /* xcb_render_change_picture_value_list_t.alphayorigin */ + _aux->alphayorigin = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_RENDER_CP_CLIP_X_ORIGIN) { + /* xcb_render_change_picture_value_list_t.clipxorigin */ + _aux->clipxorigin = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_RENDER_CP_CLIP_Y_ORIGIN) { + /* xcb_render_change_picture_value_list_t.clipyorigin */ + _aux->clipyorigin = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_RENDER_CP_CLIP_MASK) { + /* xcb_render_change_picture_value_list_t.clipmask */ + _aux->clipmask = *(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_RENDER_CP_GRAPHICS_EXPOSURE) { + /* xcb_render_change_picture_value_list_t.graphicsexposure */ + _aux->graphicsexposure = *(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_RENDER_CP_SUBWINDOW_MODE) { + /* xcb_render_change_picture_value_list_t.subwindowmode */ + _aux->subwindowmode = *(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_RENDER_CP_POLY_EDGE) { + /* xcb_render_change_picture_value_list_t.polyedge */ + _aux->polyedge = *(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_RENDER_CP_POLY_MODE) { + /* xcb_render_change_picture_value_list_t.polymode */ + _aux->polymode = *(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_RENDER_CP_DITHER) { + /* xcb_render_change_picture_value_list_t.dither */ + _aux->dither = *(xcb_atom_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_atom_t); + xcb_tmp += sizeof(xcb_atom_t); + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(value_mask & XCB_RENDER_CP_COMPONENT_ALPHA) { + /* xcb_render_change_picture_value_list_t.componentalpha */ + _aux->componentalpha = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_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_render_change_picture_value_list_sizeof (const void *_buffer, + uint32_t value_mask) +{ + xcb_render_change_picture_value_list_t _aux; + return xcb_render_change_picture_value_list_unpack(_buffer, value_mask, &_aux); +} + +int +xcb_render_change_picture_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_render_change_picture_request_t *_aux = (xcb_render_change_picture_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_render_change_picture_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* value_list */ + xcb_block_len += xcb_render_change_picture_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_render_change_picture_checked (xcb_connection_t *c, + xcb_render_picture_t picture, + uint32_t value_mask, + const void *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_CHANGE_PICTURE, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_render_change_picture_request_t xcb_out; + + xcb_out.picture = picture; + 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_render_change_picture_value_list_t value_list */ + xcb_parts[4].iov_base = (char *) value_list; + xcb_parts[4].iov_len = + xcb_render_change_picture_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_render_change_picture (xcb_connection_t *c, + xcb_render_picture_t picture, + uint32_t value_mask, + const void *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_CHANGE_PICTURE, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_render_change_picture_request_t xcb_out; + + xcb_out.picture = picture; + 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_render_change_picture_value_list_t value_list */ + xcb_parts[4].iov_base = (char *) value_list; + xcb_parts[4].iov_len = + xcb_render_change_picture_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_render_change_picture_aux_checked (xcb_connection_t *c, + xcb_render_picture_t picture, + uint32_t value_mask, + const xcb_render_change_picture_value_list_t *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_CHANGE_PICTURE, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_render_change_picture_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.picture = picture; + 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_render_change_picture_value_list_t value_list */ + xcb_parts[4].iov_len = + xcb_render_change_picture_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_render_change_picture_aux (xcb_connection_t *c, + xcb_render_picture_t picture, + uint32_t value_mask, + const xcb_render_change_picture_value_list_t *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_CHANGE_PICTURE, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_render_change_picture_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.picture = picture; + 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_render_change_picture_value_list_t value_list */ + xcb_parts[4].iov_len = + xcb_render_change_picture_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_render_change_picture_value_list (const xcb_render_change_picture_request_t *R) +{ + return (void *) (R + 1); +} + +int +xcb_render_set_picture_clip_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_render_set_picture_clip_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_render_set_picture_clip_rectangles_checked (xcb_connection_t *c, + xcb_render_picture_t picture, + int16_t clip_x_origin, + int16_t clip_y_origin, + uint32_t rectangles_len, + const xcb_rectangle_t *rectangles) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_SET_PICTURE_CLIP_RECTANGLES, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_set_picture_clip_rectangles_request_t xcb_out; + + xcb_out.picture = picture; + xcb_out.clip_x_origin = clip_x_origin; + xcb_out.clip_y_origin = clip_y_origin; + + 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_render_set_picture_clip_rectangles (xcb_connection_t *c, + xcb_render_picture_t picture, + int16_t clip_x_origin, + int16_t clip_y_origin, + uint32_t rectangles_len, + const xcb_rectangle_t *rectangles) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_SET_PICTURE_CLIP_RECTANGLES, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_set_picture_clip_rectangles_request_t xcb_out; + + xcb_out.picture = picture; + xcb_out.clip_x_origin = clip_x_origin; + xcb_out.clip_y_origin = clip_y_origin; + + 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_render_set_picture_clip_rectangles_rectangles (const xcb_render_set_picture_clip_rectangles_request_t *R) +{ + return (xcb_rectangle_t *) (R + 1); +} + +int +xcb_render_set_picture_clip_rectangles_rectangles_length (const xcb_render_set_picture_clip_rectangles_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_render_set_picture_clip_rectangles_request_t))/sizeof(xcb_rectangle_t)); +} + +xcb_rectangle_iterator_t +xcb_render_set_picture_clip_rectangles_rectangles_iterator (const xcb_render_set_picture_clip_rectangles_request_t *R) +{ + xcb_rectangle_iterator_t i; + i.data = (xcb_rectangle_t *) (R + 1); + i.rem = (((R->length * 4) - sizeof(xcb_render_set_picture_clip_rectangles_request_t))/sizeof(xcb_rectangle_t)); + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_render_free_picture_checked (xcb_connection_t *c, + xcb_render_picture_t picture) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_FREE_PICTURE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_render_free_picture_request_t xcb_out; + + xcb_out.picture = picture; + + 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_render_free_picture (xcb_connection_t *c, + xcb_render_picture_t picture) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_FREE_PICTURE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_render_free_picture_request_t xcb_out; + + xcb_out.picture = picture; + + 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_render_composite_checked (xcb_connection_t *c, + uint8_t op, + xcb_render_picture_t src, + xcb_render_picture_t mask, + xcb_render_picture_t dst, + int16_t src_x, + int16_t src_y, + int16_t mask_x, + int16_t mask_y, + int16_t dst_x, + int16_t dst_y, + uint16_t width, + uint16_t height) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_COMPOSITE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_render_composite_request_t xcb_out; + + xcb_out.op = op; + memset(xcb_out.pad0, 0, 3); + xcb_out.src = src; + xcb_out.mask = mask; + xcb_out.dst = dst; + xcb_out.src_x = src_x; + xcb_out.src_y = src_y; + xcb_out.mask_x = mask_x; + xcb_out.mask_y = mask_y; + xcb_out.dst_x = dst_x; + xcb_out.dst_y = dst_y; + xcb_out.width = width; + xcb_out.height = height; + + 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_render_composite (xcb_connection_t *c, + uint8_t op, + xcb_render_picture_t src, + xcb_render_picture_t mask, + xcb_render_picture_t dst, + int16_t src_x, + int16_t src_y, + int16_t mask_x, + int16_t mask_y, + int16_t dst_x, + int16_t dst_y, + uint16_t width, + uint16_t height) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_COMPOSITE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_render_composite_request_t xcb_out; + + xcb_out.op = op; + memset(xcb_out.pad0, 0, 3); + xcb_out.src = src; + xcb_out.mask = mask; + xcb_out.dst = dst; + xcb_out.src_x = src_x; + xcb_out.src_y = src_y; + xcb_out.mask_x = mask_x; + xcb_out.mask_y = mask_y; + xcb_out.dst_x = dst_x; + xcb_out.dst_y = dst_y; + xcb_out.width = width; + xcb_out.height = height; + + 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_render_trapezoids_sizeof (const void *_buffer, + uint32_t traps_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_render_trapezoids_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* traps */ + xcb_block_len += traps_len * sizeof(xcb_render_trapezoid_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_render_trapezoid_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_render_trapezoids_checked (xcb_connection_t *c, + uint8_t op, + xcb_render_picture_t src, + xcb_render_picture_t dst, + xcb_render_pictformat_t mask_format, + int16_t src_x, + int16_t src_y, + uint32_t traps_len, + const xcb_render_trapezoid_t *traps) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_TRAPEZOIDS, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_trapezoids_request_t xcb_out; + + xcb_out.op = op; + memset(xcb_out.pad0, 0, 3); + xcb_out.src = src; + xcb_out.dst = dst; + xcb_out.mask_format = mask_format; + xcb_out.src_x = src_x; + xcb_out.src_y = src_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; + /* xcb_render_trapezoid_t traps */ + xcb_parts[4].iov_base = (char *) traps; + xcb_parts[4].iov_len = traps_len * sizeof(xcb_render_trapezoid_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_render_trapezoids (xcb_connection_t *c, + uint8_t op, + xcb_render_picture_t src, + xcb_render_picture_t dst, + xcb_render_pictformat_t mask_format, + int16_t src_x, + int16_t src_y, + uint32_t traps_len, + const xcb_render_trapezoid_t *traps) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_TRAPEZOIDS, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_trapezoids_request_t xcb_out; + + xcb_out.op = op; + memset(xcb_out.pad0, 0, 3); + xcb_out.src = src; + xcb_out.dst = dst; + xcb_out.mask_format = mask_format; + xcb_out.src_x = src_x; + xcb_out.src_y = src_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; + /* xcb_render_trapezoid_t traps */ + xcb_parts[4].iov_base = (char *) traps; + xcb_parts[4].iov_len = traps_len * sizeof(xcb_render_trapezoid_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_render_trapezoid_t * +xcb_render_trapezoids_traps (const xcb_render_trapezoids_request_t *R) +{ + return (xcb_render_trapezoid_t *) (R + 1); +} + +int +xcb_render_trapezoids_traps_length (const xcb_render_trapezoids_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_render_trapezoids_request_t))/sizeof(xcb_render_trapezoid_t)); +} + +xcb_render_trapezoid_iterator_t +xcb_render_trapezoids_traps_iterator (const xcb_render_trapezoids_request_t *R) +{ + xcb_render_trapezoid_iterator_t i; + i.data = (xcb_render_trapezoid_t *) (R + 1); + i.rem = (((R->length * 4) - sizeof(xcb_render_trapezoids_request_t))/sizeof(xcb_render_trapezoid_t)); + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_render_triangles_sizeof (const void *_buffer, + uint32_t triangles_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_render_triangles_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* triangles */ + xcb_block_len += triangles_len * sizeof(xcb_render_triangle_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_render_triangle_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_render_triangles_checked (xcb_connection_t *c, + uint8_t op, + xcb_render_picture_t src, + xcb_render_picture_t dst, + xcb_render_pictformat_t mask_format, + int16_t src_x, + int16_t src_y, + uint32_t triangles_len, + const xcb_render_triangle_t *triangles) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_TRIANGLES, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_triangles_request_t xcb_out; + + xcb_out.op = op; + memset(xcb_out.pad0, 0, 3); + xcb_out.src = src; + xcb_out.dst = dst; + xcb_out.mask_format = mask_format; + xcb_out.src_x = src_x; + xcb_out.src_y = src_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; + /* xcb_render_triangle_t triangles */ + xcb_parts[4].iov_base = (char *) triangles; + xcb_parts[4].iov_len = triangles_len * sizeof(xcb_render_triangle_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_render_triangles (xcb_connection_t *c, + uint8_t op, + xcb_render_picture_t src, + xcb_render_picture_t dst, + xcb_render_pictformat_t mask_format, + int16_t src_x, + int16_t src_y, + uint32_t triangles_len, + const xcb_render_triangle_t *triangles) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_TRIANGLES, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_triangles_request_t xcb_out; + + xcb_out.op = op; + memset(xcb_out.pad0, 0, 3); + xcb_out.src = src; + xcb_out.dst = dst; + xcb_out.mask_format = mask_format; + xcb_out.src_x = src_x; + xcb_out.src_y = src_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; + /* xcb_render_triangle_t triangles */ + xcb_parts[4].iov_base = (char *) triangles; + xcb_parts[4].iov_len = triangles_len * sizeof(xcb_render_triangle_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_render_triangle_t * +xcb_render_triangles_triangles (const xcb_render_triangles_request_t *R) +{ + return (xcb_render_triangle_t *) (R + 1); +} + +int +xcb_render_triangles_triangles_length (const xcb_render_triangles_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_render_triangles_request_t))/sizeof(xcb_render_triangle_t)); +} + +xcb_render_triangle_iterator_t +xcb_render_triangles_triangles_iterator (const xcb_render_triangles_request_t *R) +{ + xcb_render_triangle_iterator_t i; + i.data = (xcb_render_triangle_t *) (R + 1); + i.rem = (((R->length * 4) - sizeof(xcb_render_triangles_request_t))/sizeof(xcb_render_triangle_t)); + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_render_tri_strip_sizeof (const void *_buffer, + uint32_t points_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_render_tri_strip_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* points */ + xcb_block_len += points_len * sizeof(xcb_render_pointfix_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_render_pointfix_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_render_tri_strip_checked (xcb_connection_t *c, + uint8_t op, + xcb_render_picture_t src, + xcb_render_picture_t dst, + xcb_render_pictformat_t mask_format, + int16_t src_x, + int16_t src_y, + uint32_t points_len, + const xcb_render_pointfix_t *points) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_TRI_STRIP, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_tri_strip_request_t xcb_out; + + xcb_out.op = op; + memset(xcb_out.pad0, 0, 3); + xcb_out.src = src; + xcb_out.dst = dst; + xcb_out.mask_format = mask_format; + xcb_out.src_x = src_x; + xcb_out.src_y = src_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; + /* xcb_render_pointfix_t points */ + xcb_parts[4].iov_base = (char *) points; + xcb_parts[4].iov_len = points_len * sizeof(xcb_render_pointfix_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_render_tri_strip (xcb_connection_t *c, + uint8_t op, + xcb_render_picture_t src, + xcb_render_picture_t dst, + xcb_render_pictformat_t mask_format, + int16_t src_x, + int16_t src_y, + uint32_t points_len, + const xcb_render_pointfix_t *points) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_TRI_STRIP, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_tri_strip_request_t xcb_out; + + xcb_out.op = op; + memset(xcb_out.pad0, 0, 3); + xcb_out.src = src; + xcb_out.dst = dst; + xcb_out.mask_format = mask_format; + xcb_out.src_x = src_x; + xcb_out.src_y = src_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; + /* xcb_render_pointfix_t points */ + xcb_parts[4].iov_base = (char *) points; + xcb_parts[4].iov_len = points_len * sizeof(xcb_render_pointfix_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_render_pointfix_t * +xcb_render_tri_strip_points (const xcb_render_tri_strip_request_t *R) +{ + return (xcb_render_pointfix_t *) (R + 1); +} + +int +xcb_render_tri_strip_points_length (const xcb_render_tri_strip_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_render_tri_strip_request_t))/sizeof(xcb_render_pointfix_t)); +} + +xcb_render_pointfix_iterator_t +xcb_render_tri_strip_points_iterator (const xcb_render_tri_strip_request_t *R) +{ + xcb_render_pointfix_iterator_t i; + i.data = (xcb_render_pointfix_t *) (R + 1); + i.rem = (((R->length * 4) - sizeof(xcb_render_tri_strip_request_t))/sizeof(xcb_render_pointfix_t)); + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_render_tri_fan_sizeof (const void *_buffer, + uint32_t points_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_render_tri_fan_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* points */ + xcb_block_len += points_len * sizeof(xcb_render_pointfix_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_render_pointfix_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_render_tri_fan_checked (xcb_connection_t *c, + uint8_t op, + xcb_render_picture_t src, + xcb_render_picture_t dst, + xcb_render_pictformat_t mask_format, + int16_t src_x, + int16_t src_y, + uint32_t points_len, + const xcb_render_pointfix_t *points) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_TRI_FAN, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_tri_fan_request_t xcb_out; + + xcb_out.op = op; + memset(xcb_out.pad0, 0, 3); + xcb_out.src = src; + xcb_out.dst = dst; + xcb_out.mask_format = mask_format; + xcb_out.src_x = src_x; + xcb_out.src_y = src_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; + /* xcb_render_pointfix_t points */ + xcb_parts[4].iov_base = (char *) points; + xcb_parts[4].iov_len = points_len * sizeof(xcb_render_pointfix_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_render_tri_fan (xcb_connection_t *c, + uint8_t op, + xcb_render_picture_t src, + xcb_render_picture_t dst, + xcb_render_pictformat_t mask_format, + int16_t src_x, + int16_t src_y, + uint32_t points_len, + const xcb_render_pointfix_t *points) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_TRI_FAN, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_tri_fan_request_t xcb_out; + + xcb_out.op = op; + memset(xcb_out.pad0, 0, 3); + xcb_out.src = src; + xcb_out.dst = dst; + xcb_out.mask_format = mask_format; + xcb_out.src_x = src_x; + xcb_out.src_y = src_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; + /* xcb_render_pointfix_t points */ + xcb_parts[4].iov_base = (char *) points; + xcb_parts[4].iov_len = points_len * sizeof(xcb_render_pointfix_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_render_pointfix_t * +xcb_render_tri_fan_points (const xcb_render_tri_fan_request_t *R) +{ + return (xcb_render_pointfix_t *) (R + 1); +} + +int +xcb_render_tri_fan_points_length (const xcb_render_tri_fan_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_render_tri_fan_request_t))/sizeof(xcb_render_pointfix_t)); +} + +xcb_render_pointfix_iterator_t +xcb_render_tri_fan_points_iterator (const xcb_render_tri_fan_request_t *R) +{ + xcb_render_pointfix_iterator_t i; + i.data = (xcb_render_pointfix_t *) (R + 1); + i.rem = (((R->length * 4) - sizeof(xcb_render_tri_fan_request_t))/sizeof(xcb_render_pointfix_t)); + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_render_create_glyph_set_checked (xcb_connection_t *c, + xcb_render_glyphset_t gsid, + xcb_render_pictformat_t format) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_CREATE_GLYPH_SET, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_render_create_glyph_set_request_t xcb_out; + + xcb_out.gsid = gsid; + xcb_out.format = format; + + 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_render_create_glyph_set (xcb_connection_t *c, + xcb_render_glyphset_t gsid, + xcb_render_pictformat_t format) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_CREATE_GLYPH_SET, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_render_create_glyph_set_request_t xcb_out; + + xcb_out.gsid = gsid; + xcb_out.format = format; + + 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_render_reference_glyph_set_checked (xcb_connection_t *c, + xcb_render_glyphset_t gsid, + xcb_render_glyphset_t existing) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_REFERENCE_GLYPH_SET, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_render_reference_glyph_set_request_t xcb_out; + + xcb_out.gsid = gsid; + xcb_out.existing = existing; + + 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_render_reference_glyph_set (xcb_connection_t *c, + xcb_render_glyphset_t gsid, + xcb_render_glyphset_t existing) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_REFERENCE_GLYPH_SET, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_render_reference_glyph_set_request_t xcb_out; + + xcb_out.gsid = gsid; + xcb_out.existing = existing; + + 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_render_free_glyph_set_checked (xcb_connection_t *c, + xcb_render_glyphset_t glyphset) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_FREE_GLYPH_SET, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_render_free_glyph_set_request_t xcb_out; + + xcb_out.glyphset = glyphset; + + 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_render_free_glyph_set (xcb_connection_t *c, + xcb_render_glyphset_t glyphset) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_FREE_GLYPH_SET, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_render_free_glyph_set_request_t xcb_out; + + xcb_out.glyphset = glyphset; + + 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_render_add_glyphs_sizeof (const void *_buffer, + uint32_t data_len) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_render_add_glyphs_request_t *_aux = (xcb_render_add_glyphs_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_render_add_glyphs_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* glyphids */ + xcb_block_len += _aux->glyphs_len * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* glyphs */ + xcb_block_len += _aux->glyphs_len * sizeof(xcb_render_glyphinfo_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_render_glyphinfo_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; + /* data */ + xcb_block_len += data_len * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_render_add_glyphs_checked (xcb_connection_t *c, + xcb_render_glyphset_t glyphset, + uint32_t glyphs_len, + const uint32_t *glyphids, + const xcb_render_glyphinfo_t *glyphs, + uint32_t data_len, + const uint8_t *data) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 8, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_ADD_GLYPHS, + .isvoid = 1 + }; + + struct iovec xcb_parts[10]; + xcb_void_cookie_t xcb_ret; + xcb_render_add_glyphs_request_t xcb_out; + + xcb_out.glyphset = glyphset; + xcb_out.glyphs_len = glyphs_len; + + 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; + /* uint32_t glyphids */ + xcb_parts[4].iov_base = (char *) glyphids; + xcb_parts[4].iov_len = glyphs_len * sizeof(uint32_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_render_glyphinfo_t glyphs */ + xcb_parts[6].iov_base = (char *) glyphs; + xcb_parts[6].iov_len = glyphs_len * sizeof(xcb_render_glyphinfo_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + /* uint8_t data */ + xcb_parts[8].iov_base = (char *) data; + xcb_parts[8].iov_len = data_len * sizeof(uint8_t); + xcb_parts[9].iov_base = 0; + xcb_parts[9].iov_len = -xcb_parts[8].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_render_add_glyphs (xcb_connection_t *c, + xcb_render_glyphset_t glyphset, + uint32_t glyphs_len, + const uint32_t *glyphids, + const xcb_render_glyphinfo_t *glyphs, + uint32_t data_len, + const uint8_t *data) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 8, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_ADD_GLYPHS, + .isvoid = 1 + }; + + struct iovec xcb_parts[10]; + xcb_void_cookie_t xcb_ret; + xcb_render_add_glyphs_request_t xcb_out; + + xcb_out.glyphset = glyphset; + xcb_out.glyphs_len = glyphs_len; + + 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; + /* uint32_t glyphids */ + xcb_parts[4].iov_base = (char *) glyphids; + xcb_parts[4].iov_len = glyphs_len * sizeof(uint32_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_render_glyphinfo_t glyphs */ + xcb_parts[6].iov_base = (char *) glyphs; + xcb_parts[6].iov_len = glyphs_len * sizeof(xcb_render_glyphinfo_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + /* uint8_t data */ + xcb_parts[8].iov_base = (char *) data; + xcb_parts[8].iov_len = data_len * sizeof(uint8_t); + xcb_parts[9].iov_base = 0; + xcb_parts[9].iov_len = -xcb_parts[8].iov_len & 3; + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +uint32_t * +xcb_render_add_glyphs_glyphids (const xcb_render_add_glyphs_request_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_render_add_glyphs_glyphids_length (const xcb_render_add_glyphs_request_t *R) +{ + return R->glyphs_len; +} + +xcb_generic_iterator_t +xcb_render_add_glyphs_glyphids_end (const xcb_render_add_glyphs_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->glyphs_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_render_glyphinfo_t * +xcb_render_add_glyphs_glyphs (const xcb_render_add_glyphs_request_t *R) +{ + xcb_generic_iterator_t prev = xcb_render_add_glyphs_glyphids_end(R); + return (xcb_render_glyphinfo_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_render_glyphinfo_t, prev.index) + 0); +} + +int +xcb_render_add_glyphs_glyphs_length (const xcb_render_add_glyphs_request_t *R) +{ + return R->glyphs_len; +} + +xcb_render_glyphinfo_iterator_t +xcb_render_add_glyphs_glyphs_iterator (const xcb_render_add_glyphs_request_t *R) +{ + xcb_render_glyphinfo_iterator_t i; + xcb_generic_iterator_t prev = xcb_render_add_glyphs_glyphids_end(R); + i.data = (xcb_render_glyphinfo_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_render_glyphinfo_t, prev.index)); + i.rem = R->glyphs_len; + i.index = (char *) i.data - (char *) R; + return i; +} + +uint8_t * +xcb_render_add_glyphs_data (const xcb_render_add_glyphs_request_t *R) +{ + xcb_generic_iterator_t prev = xcb_render_glyphinfo_end(xcb_render_add_glyphs_glyphs_iterator(R)); + return (uint8_t *) ((char *) prev.data + XCB_TYPE_PAD(uint8_t, prev.index) + 0); +} + +int +xcb_render_add_glyphs_data_length (const xcb_render_add_glyphs_request_t *R) +{ + return ((((char*)R) + R->length * 4) - (char*)(xcb_render_add_glyphs_data(R))) / sizeof(uint8_t); +} + +xcb_generic_iterator_t +xcb_render_add_glyphs_data_end (const xcb_render_add_glyphs_request_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_render_glyphinfo_end(xcb_render_add_glyphs_glyphs_iterator(R)); + i.data = ((uint8_t *) ((char*) prev.data + XCB_TYPE_PAD(uint8_t, prev.index))) + (((((char*)R) + R->length * 4) - (char*)(xcb_render_add_glyphs_data(R))) / sizeof(uint8_t)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_render_free_glyphs_sizeof (const void *_buffer, + uint32_t glyphs_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_render_free_glyphs_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* glyphs */ + xcb_block_len += glyphs_len * sizeof(xcb_render_glyph_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_render_glyph_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_render_free_glyphs_checked (xcb_connection_t *c, + xcb_render_glyphset_t glyphset, + uint32_t glyphs_len, + const xcb_render_glyph_t *glyphs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_FREE_GLYPHS, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_free_glyphs_request_t xcb_out; + + xcb_out.glyphset = glyphset; + + 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_render_glyph_t glyphs */ + xcb_parts[4].iov_base = (char *) glyphs; + xcb_parts[4].iov_len = glyphs_len * sizeof(xcb_render_glyph_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_render_free_glyphs (xcb_connection_t *c, + xcb_render_glyphset_t glyphset, + uint32_t glyphs_len, + const xcb_render_glyph_t *glyphs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_FREE_GLYPHS, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_free_glyphs_request_t xcb_out; + + xcb_out.glyphset = glyphset; + + 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_render_glyph_t glyphs */ + xcb_parts[4].iov_base = (char *) glyphs; + xcb_parts[4].iov_len = glyphs_len * sizeof(xcb_render_glyph_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_render_glyph_t * +xcb_render_free_glyphs_glyphs (const xcb_render_free_glyphs_request_t *R) +{ + return (xcb_render_glyph_t *) (R + 1); +} + +int +xcb_render_free_glyphs_glyphs_length (const xcb_render_free_glyphs_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_render_free_glyphs_request_t))/sizeof(xcb_render_glyph_t)); +} + +xcb_generic_iterator_t +xcb_render_free_glyphs_glyphs_end (const xcb_render_free_glyphs_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_render_glyph_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_render_free_glyphs_request_t))/sizeof(xcb_render_glyph_t))); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_render_composite_glyphs_8_sizeof (const void *_buffer, + uint32_t glyphcmds_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_render_composite_glyphs_8_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* glyphcmds */ + xcb_block_len += glyphcmds_len * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_render_composite_glyphs_8_checked (xcb_connection_t *c, + uint8_t op, + xcb_render_picture_t src, + xcb_render_picture_t dst, + xcb_render_pictformat_t mask_format, + xcb_render_glyphset_t glyphset, + int16_t src_x, + int16_t src_y, + uint32_t glyphcmds_len, + const uint8_t *glyphcmds) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_COMPOSITE_GLYPHS_8, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_composite_glyphs_8_request_t xcb_out; + + xcb_out.op = op; + memset(xcb_out.pad0, 0, 3); + xcb_out.src = src; + xcb_out.dst = dst; + xcb_out.mask_format = mask_format; + xcb_out.glyphset = glyphset; + xcb_out.src_x = src_x; + xcb_out.src_y = src_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; + /* uint8_t glyphcmds */ + xcb_parts[4].iov_base = (char *) glyphcmds; + xcb_parts[4].iov_len = glyphcmds_len * sizeof(uint8_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_render_composite_glyphs_8 (xcb_connection_t *c, + uint8_t op, + xcb_render_picture_t src, + xcb_render_picture_t dst, + xcb_render_pictformat_t mask_format, + xcb_render_glyphset_t glyphset, + int16_t src_x, + int16_t src_y, + uint32_t glyphcmds_len, + const uint8_t *glyphcmds) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_COMPOSITE_GLYPHS_8, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_composite_glyphs_8_request_t xcb_out; + + xcb_out.op = op; + memset(xcb_out.pad0, 0, 3); + xcb_out.src = src; + xcb_out.dst = dst; + xcb_out.mask_format = mask_format; + xcb_out.glyphset = glyphset; + xcb_out.src_x = src_x; + xcb_out.src_y = src_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; + /* uint8_t glyphcmds */ + xcb_parts[4].iov_base = (char *) glyphcmds; + xcb_parts[4].iov_len = glyphcmds_len * sizeof(uint8_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; +} + +uint8_t * +xcb_render_composite_glyphs_8_glyphcmds (const xcb_render_composite_glyphs_8_request_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_render_composite_glyphs_8_glyphcmds_length (const xcb_render_composite_glyphs_8_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_render_composite_glyphs_8_request_t))/sizeof(uint8_t)); +} + +xcb_generic_iterator_t +xcb_render_composite_glyphs_8_glyphcmds_end (const xcb_render_composite_glyphs_8_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_render_composite_glyphs_8_request_t))/sizeof(uint8_t))); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_render_composite_glyphs_16_sizeof (const void *_buffer, + uint32_t glyphcmds_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_render_composite_glyphs_16_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* glyphcmds */ + xcb_block_len += glyphcmds_len * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_render_composite_glyphs_16_checked (xcb_connection_t *c, + uint8_t op, + xcb_render_picture_t src, + xcb_render_picture_t dst, + xcb_render_pictformat_t mask_format, + xcb_render_glyphset_t glyphset, + int16_t src_x, + int16_t src_y, + uint32_t glyphcmds_len, + const uint8_t *glyphcmds) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_COMPOSITE_GLYPHS_16, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_composite_glyphs_16_request_t xcb_out; + + xcb_out.op = op; + memset(xcb_out.pad0, 0, 3); + xcb_out.src = src; + xcb_out.dst = dst; + xcb_out.mask_format = mask_format; + xcb_out.glyphset = glyphset; + xcb_out.src_x = src_x; + xcb_out.src_y = src_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; + /* uint8_t glyphcmds */ + xcb_parts[4].iov_base = (char *) glyphcmds; + xcb_parts[4].iov_len = glyphcmds_len * sizeof(uint8_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_render_composite_glyphs_16 (xcb_connection_t *c, + uint8_t op, + xcb_render_picture_t src, + xcb_render_picture_t dst, + xcb_render_pictformat_t mask_format, + xcb_render_glyphset_t glyphset, + int16_t src_x, + int16_t src_y, + uint32_t glyphcmds_len, + const uint8_t *glyphcmds) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_COMPOSITE_GLYPHS_16, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_composite_glyphs_16_request_t xcb_out; + + xcb_out.op = op; + memset(xcb_out.pad0, 0, 3); + xcb_out.src = src; + xcb_out.dst = dst; + xcb_out.mask_format = mask_format; + xcb_out.glyphset = glyphset; + xcb_out.src_x = src_x; + xcb_out.src_y = src_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; + /* uint8_t glyphcmds */ + xcb_parts[4].iov_base = (char *) glyphcmds; + xcb_parts[4].iov_len = glyphcmds_len * sizeof(uint8_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; +} + +uint8_t * +xcb_render_composite_glyphs_16_glyphcmds (const xcb_render_composite_glyphs_16_request_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_render_composite_glyphs_16_glyphcmds_length (const xcb_render_composite_glyphs_16_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_render_composite_glyphs_16_request_t))/sizeof(uint8_t)); +} + +xcb_generic_iterator_t +xcb_render_composite_glyphs_16_glyphcmds_end (const xcb_render_composite_glyphs_16_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_render_composite_glyphs_16_request_t))/sizeof(uint8_t))); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_render_composite_glyphs_32_sizeof (const void *_buffer, + uint32_t glyphcmds_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_render_composite_glyphs_32_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* glyphcmds */ + xcb_block_len += glyphcmds_len * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_render_composite_glyphs_32_checked (xcb_connection_t *c, + uint8_t op, + xcb_render_picture_t src, + xcb_render_picture_t dst, + xcb_render_pictformat_t mask_format, + xcb_render_glyphset_t glyphset, + int16_t src_x, + int16_t src_y, + uint32_t glyphcmds_len, + const uint8_t *glyphcmds) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_COMPOSITE_GLYPHS_32, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_composite_glyphs_32_request_t xcb_out; + + xcb_out.op = op; + memset(xcb_out.pad0, 0, 3); + xcb_out.src = src; + xcb_out.dst = dst; + xcb_out.mask_format = mask_format; + xcb_out.glyphset = glyphset; + xcb_out.src_x = src_x; + xcb_out.src_y = src_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; + /* uint8_t glyphcmds */ + xcb_parts[4].iov_base = (char *) glyphcmds; + xcb_parts[4].iov_len = glyphcmds_len * sizeof(uint8_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_render_composite_glyphs_32 (xcb_connection_t *c, + uint8_t op, + xcb_render_picture_t src, + xcb_render_picture_t dst, + xcb_render_pictformat_t mask_format, + xcb_render_glyphset_t glyphset, + int16_t src_x, + int16_t src_y, + uint32_t glyphcmds_len, + const uint8_t *glyphcmds) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_COMPOSITE_GLYPHS_32, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_composite_glyphs_32_request_t xcb_out; + + xcb_out.op = op; + memset(xcb_out.pad0, 0, 3); + xcb_out.src = src; + xcb_out.dst = dst; + xcb_out.mask_format = mask_format; + xcb_out.glyphset = glyphset; + xcb_out.src_x = src_x; + xcb_out.src_y = src_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; + /* uint8_t glyphcmds */ + xcb_parts[4].iov_base = (char *) glyphcmds; + xcb_parts[4].iov_len = glyphcmds_len * sizeof(uint8_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; +} + +uint8_t * +xcb_render_composite_glyphs_32_glyphcmds (const xcb_render_composite_glyphs_32_request_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_render_composite_glyphs_32_glyphcmds_length (const xcb_render_composite_glyphs_32_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_render_composite_glyphs_32_request_t))/sizeof(uint8_t)); +} + +xcb_generic_iterator_t +xcb_render_composite_glyphs_32_glyphcmds_end (const xcb_render_composite_glyphs_32_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_render_composite_glyphs_32_request_t))/sizeof(uint8_t))); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_render_fill_rectangles_sizeof (const void *_buffer, + uint32_t rects_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_render_fill_rectangles_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* rects */ + xcb_block_len += rects_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_render_fill_rectangles_checked (xcb_connection_t *c, + uint8_t op, + xcb_render_picture_t dst, + xcb_render_color_t color, + uint32_t rects_len, + const xcb_rectangle_t *rects) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_FILL_RECTANGLES, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_fill_rectangles_request_t xcb_out; + + xcb_out.op = op; + memset(xcb_out.pad0, 0, 3); + xcb_out.dst = dst; + xcb_out.color = color; + + 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 rects */ + xcb_parts[4].iov_base = (char *) rects; + xcb_parts[4].iov_len = rects_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_render_fill_rectangles (xcb_connection_t *c, + uint8_t op, + xcb_render_picture_t dst, + xcb_render_color_t color, + uint32_t rects_len, + const xcb_rectangle_t *rects) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_FILL_RECTANGLES, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_fill_rectangles_request_t xcb_out; + + xcb_out.op = op; + memset(xcb_out.pad0, 0, 3); + xcb_out.dst = dst; + xcb_out.color = color; + + 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 rects */ + xcb_parts[4].iov_base = (char *) rects; + xcb_parts[4].iov_len = rects_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_render_fill_rectangles_rects (const xcb_render_fill_rectangles_request_t *R) +{ + return (xcb_rectangle_t *) (R + 1); +} + +int +xcb_render_fill_rectangles_rects_length (const xcb_render_fill_rectangles_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_render_fill_rectangles_request_t))/sizeof(xcb_rectangle_t)); +} + +xcb_rectangle_iterator_t +xcb_render_fill_rectangles_rects_iterator (const xcb_render_fill_rectangles_request_t *R) +{ + xcb_rectangle_iterator_t i; + i.data = (xcb_rectangle_t *) (R + 1); + i.rem = (((R->length * 4) - sizeof(xcb_render_fill_rectangles_request_t))/sizeof(xcb_rectangle_t)); + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_render_create_cursor_checked (xcb_connection_t *c, + xcb_cursor_t cid, + xcb_render_picture_t source, + uint16_t x, + uint16_t y) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_CREATE_CURSOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_render_create_cursor_request_t xcb_out; + + xcb_out.cid = cid; + xcb_out.source = source; + 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; + + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_render_create_cursor (xcb_connection_t *c, + xcb_cursor_t cid, + xcb_render_picture_t source, + uint16_t x, + uint16_t y) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_CREATE_CURSOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_render_create_cursor_request_t xcb_out; + + xcb_out.cid = cid; + xcb_out.source = source; + 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; + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +void +xcb_render_transform_next (xcb_render_transform_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_render_transform_t); +} + +xcb_generic_iterator_t +xcb_render_transform_end (xcb_render_transform_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_render_set_picture_transform_checked (xcb_connection_t *c, + xcb_render_picture_t picture, + xcb_render_transform_t transform) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_SET_PICTURE_TRANSFORM, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_render_set_picture_transform_request_t xcb_out; + + xcb_out.picture = picture; + xcb_out.transform = transform; + + 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_render_set_picture_transform (xcb_connection_t *c, + xcb_render_picture_t picture, + xcb_render_transform_t transform) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_SET_PICTURE_TRANSFORM, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_render_set_picture_transform_request_t xcb_out; + + xcb_out.picture = picture; + xcb_out.transform = transform; + + 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_render_query_filters_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_render_query_filters_reply_t *_aux = (xcb_render_query_filters_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_render_query_filters_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* aliases */ + xcb_block_len += _aux->num_aliases * sizeof(uint16_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint16_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; + /* filters */ + for(i=0; i<_aux->num_filters; i++) { + xcb_tmp_len = xcb_str_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_str_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_render_query_filters_cookie_t +xcb_render_query_filters (xcb_connection_t *c, + xcb_drawable_t drawable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_QUERY_FILTERS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_render_query_filters_cookie_t xcb_ret; + xcb_render_query_filters_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_render_query_filters_cookie_t +xcb_render_query_filters_unchecked (xcb_connection_t *c, + xcb_drawable_t drawable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_QUERY_FILTERS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_render_query_filters_cookie_t xcb_ret; + xcb_render_query_filters_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; +} + +uint16_t * +xcb_render_query_filters_aliases (const xcb_render_query_filters_reply_t *R) +{ + return (uint16_t *) (R + 1); +} + +int +xcb_render_query_filters_aliases_length (const xcb_render_query_filters_reply_t *R) +{ + return R->num_aliases; +} + +xcb_generic_iterator_t +xcb_render_query_filters_aliases_end (const xcb_render_query_filters_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint16_t *) (R + 1)) + (R->num_aliases); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_render_query_filters_filters_length (const xcb_render_query_filters_reply_t *R) +{ + return R->num_filters; +} + +xcb_str_iterator_t +xcb_render_query_filters_filters_iterator (const xcb_render_query_filters_reply_t *R) +{ + xcb_str_iterator_t i; + xcb_generic_iterator_t prev = xcb_render_query_filters_aliases_end(R); + i.data = (xcb_str_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_str_t, prev.index)); + i.rem = R->num_filters; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_render_query_filters_reply_t * +xcb_render_query_filters_reply (xcb_connection_t *c, + xcb_render_query_filters_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_render_query_filters_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_render_set_picture_filter_sizeof (const void *_buffer, + uint32_t values_len) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_render_set_picture_filter_request_t *_aux = (xcb_render_set_picture_filter_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_render_set_picture_filter_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* filter */ + xcb_block_len += _aux->filter_len * sizeof(char); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(char); + xcb_align_to = 4; + /* 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; + /* 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; + /* values */ + xcb_block_len += values_len * sizeof(xcb_render_fixed_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_render_fixed_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_render_set_picture_filter_checked (xcb_connection_t *c, + xcb_render_picture_t picture, + uint16_t filter_len, + const char *filter, + uint32_t values_len, + const xcb_render_fixed_t *values) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_SET_PICTURE_FILTER, + .isvoid = 1 + }; + + struct iovec xcb_parts[8]; + xcb_void_cookie_t xcb_ret; + xcb_render_set_picture_filter_request_t xcb_out; + + xcb_out.picture = picture; + xcb_out.filter_len = filter_len; + 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; + /* char filter */ + xcb_parts[4].iov_base = (char *) filter; + xcb_parts[4].iov_len = filter_len * sizeof(char); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_render_fixed_t values */ + xcb_parts[6].iov_base = (char *) values; + xcb_parts[6].iov_len = values_len * sizeof(xcb_render_fixed_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].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_render_set_picture_filter (xcb_connection_t *c, + xcb_render_picture_t picture, + uint16_t filter_len, + const char *filter, + uint32_t values_len, + const xcb_render_fixed_t *values) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_SET_PICTURE_FILTER, + .isvoid = 1 + }; + + struct iovec xcb_parts[8]; + xcb_void_cookie_t xcb_ret; + xcb_render_set_picture_filter_request_t xcb_out; + + xcb_out.picture = picture; + xcb_out.filter_len = filter_len; + 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; + /* char filter */ + xcb_parts[4].iov_base = (char *) filter; + xcb_parts[4].iov_len = filter_len * sizeof(char); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_render_fixed_t values */ + xcb_parts[6].iov_base = (char *) values; + xcb_parts[6].iov_len = values_len * sizeof(xcb_render_fixed_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +char * +xcb_render_set_picture_filter_filter (const xcb_render_set_picture_filter_request_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_render_set_picture_filter_filter_length (const xcb_render_set_picture_filter_request_t *R) +{ + return R->filter_len; +} + +xcb_generic_iterator_t +xcb_render_set_picture_filter_filter_end (const xcb_render_set_picture_filter_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->filter_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_render_fixed_t * +xcb_render_set_picture_filter_values (const xcb_render_set_picture_filter_request_t *R) +{ + xcb_generic_iterator_t prev = xcb_render_set_picture_filter_filter_end(R); + return (xcb_render_fixed_t *) ((char *) prev.data + ((-prev.index) & (4 - 1)) + 0); +} + +int +xcb_render_set_picture_filter_values_length (const xcb_render_set_picture_filter_request_t *R) +{ + return ((((char*)R) + R->length * 4) - (char*)(xcb_render_set_picture_filter_values(R))) / sizeof(xcb_render_fixed_t); +} + +xcb_generic_iterator_t +xcb_render_set_picture_filter_values_end (const xcb_render_set_picture_filter_request_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_render_set_picture_filter_filter_end(R); + i.data = ((xcb_render_fixed_t *) ((char*) prev.data + ((-prev.index) & (4 - 1)))) + (((((char*)R) + R->length * 4) - (char*)(xcb_render_set_picture_filter_values(R))) / sizeof(xcb_render_fixed_t)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_render_animcursorelt_next (xcb_render_animcursorelt_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_render_animcursorelt_t); +} + +xcb_generic_iterator_t +xcb_render_animcursorelt_end (xcb_render_animcursorelt_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; +} + +int +xcb_render_create_anim_cursor_sizeof (const void *_buffer, + uint32_t cursors_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_render_create_anim_cursor_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* cursors */ + xcb_block_len += cursors_len * sizeof(xcb_render_animcursorelt_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_render_animcursorelt_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_render_create_anim_cursor_checked (xcb_connection_t *c, + xcb_cursor_t cid, + uint32_t cursors_len, + const xcb_render_animcursorelt_t *cursors) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_CREATE_ANIM_CURSOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_create_anim_cursor_request_t xcb_out; + + xcb_out.cid = cid; + + 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_render_animcursorelt_t cursors */ + xcb_parts[4].iov_base = (char *) cursors; + xcb_parts[4].iov_len = cursors_len * sizeof(xcb_render_animcursorelt_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_render_create_anim_cursor (xcb_connection_t *c, + xcb_cursor_t cid, + uint32_t cursors_len, + const xcb_render_animcursorelt_t *cursors) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_CREATE_ANIM_CURSOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_create_anim_cursor_request_t xcb_out; + + xcb_out.cid = cid; + + 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_render_animcursorelt_t cursors */ + xcb_parts[4].iov_base = (char *) cursors; + xcb_parts[4].iov_len = cursors_len * sizeof(xcb_render_animcursorelt_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_render_animcursorelt_t * +xcb_render_create_anim_cursor_cursors (const xcb_render_create_anim_cursor_request_t *R) +{ + return (xcb_render_animcursorelt_t *) (R + 1); +} + +int +xcb_render_create_anim_cursor_cursors_length (const xcb_render_create_anim_cursor_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_render_create_anim_cursor_request_t))/sizeof(xcb_render_animcursorelt_t)); +} + +xcb_render_animcursorelt_iterator_t +xcb_render_create_anim_cursor_cursors_iterator (const xcb_render_create_anim_cursor_request_t *R) +{ + xcb_render_animcursorelt_iterator_t i; + i.data = (xcb_render_animcursorelt_t *) (R + 1); + i.rem = (((R->length * 4) - sizeof(xcb_render_create_anim_cursor_request_t))/sizeof(xcb_render_animcursorelt_t)); + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_render_spanfix_next (xcb_render_spanfix_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_render_spanfix_t); +} + +xcb_generic_iterator_t +xcb_render_spanfix_end (xcb_render_spanfix_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; +} + +void +xcb_render_trap_next (xcb_render_trap_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_render_trap_t); +} + +xcb_generic_iterator_t +xcb_render_trap_end (xcb_render_trap_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; +} + +int +xcb_render_add_traps_sizeof (const void *_buffer, + uint32_t traps_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_render_add_traps_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* traps */ + xcb_block_len += traps_len * sizeof(xcb_render_trap_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_render_trap_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_render_add_traps_checked (xcb_connection_t *c, + xcb_render_picture_t picture, + int16_t x_off, + int16_t y_off, + uint32_t traps_len, + const xcb_render_trap_t *traps) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_ADD_TRAPS, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_add_traps_request_t xcb_out; + + xcb_out.picture = picture; + xcb_out.x_off = x_off; + xcb_out.y_off = y_off; + + 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_render_trap_t traps */ + xcb_parts[4].iov_base = (char *) traps; + xcb_parts[4].iov_len = traps_len * sizeof(xcb_render_trap_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_render_add_traps (xcb_connection_t *c, + xcb_render_picture_t picture, + int16_t x_off, + int16_t y_off, + uint32_t traps_len, + const xcb_render_trap_t *traps) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_ADD_TRAPS, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_render_add_traps_request_t xcb_out; + + xcb_out.picture = picture; + xcb_out.x_off = x_off; + xcb_out.y_off = y_off; + + 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_render_trap_t traps */ + xcb_parts[4].iov_base = (char *) traps; + xcb_parts[4].iov_len = traps_len * sizeof(xcb_render_trap_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_render_trap_t * +xcb_render_add_traps_traps (const xcb_render_add_traps_request_t *R) +{ + return (xcb_render_trap_t *) (R + 1); +} + +int +xcb_render_add_traps_traps_length (const xcb_render_add_traps_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_render_add_traps_request_t))/sizeof(xcb_render_trap_t)); +} + +xcb_render_trap_iterator_t +xcb_render_add_traps_traps_iterator (const xcb_render_add_traps_request_t *R) +{ + xcb_render_trap_iterator_t i; + i.data = (xcb_render_trap_t *) (R + 1); + i.rem = (((R->length * 4) - sizeof(xcb_render_add_traps_request_t))/sizeof(xcb_render_trap_t)); + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_render_create_solid_fill_checked (xcb_connection_t *c, + xcb_render_picture_t picture, + xcb_render_color_t color) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_CREATE_SOLID_FILL, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_render_create_solid_fill_request_t xcb_out; + + xcb_out.picture = picture; + xcb_out.color = color; + + 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_render_create_solid_fill (xcb_connection_t *c, + xcb_render_picture_t picture, + xcb_render_color_t color) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_CREATE_SOLID_FILL, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_render_create_solid_fill_request_t xcb_out; + + xcb_out.picture = picture; + xcb_out.color = color; + + 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_render_create_linear_gradient_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_render_create_linear_gradient_request_t *_aux = (xcb_render_create_linear_gradient_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_render_create_linear_gradient_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* stops */ + xcb_block_len += _aux->num_stops * sizeof(xcb_render_fixed_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_render_fixed_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; + /* colors */ + xcb_block_len += _aux->num_stops * sizeof(xcb_render_color_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_render_color_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_render_create_linear_gradient_checked (xcb_connection_t *c, + xcb_render_picture_t picture, + xcb_render_pointfix_t p1, + xcb_render_pointfix_t p2, + uint32_t num_stops, + const xcb_render_fixed_t *stops, + const xcb_render_color_t *colors) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_CREATE_LINEAR_GRADIENT, + .isvoid = 1 + }; + + struct iovec xcb_parts[8]; + xcb_void_cookie_t xcb_ret; + xcb_render_create_linear_gradient_request_t xcb_out; + + xcb_out.picture = picture; + xcb_out.p1 = p1; + xcb_out.p2 = p2; + xcb_out.num_stops = num_stops; + + 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_render_fixed_t stops */ + xcb_parts[4].iov_base = (char *) stops; + xcb_parts[4].iov_len = num_stops * sizeof(xcb_render_fixed_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_render_color_t colors */ + xcb_parts[6].iov_base = (char *) colors; + xcb_parts[6].iov_len = num_stops * sizeof(xcb_render_color_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].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_render_create_linear_gradient (xcb_connection_t *c, + xcb_render_picture_t picture, + xcb_render_pointfix_t p1, + xcb_render_pointfix_t p2, + uint32_t num_stops, + const xcb_render_fixed_t *stops, + const xcb_render_color_t *colors) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_CREATE_LINEAR_GRADIENT, + .isvoid = 1 + }; + + struct iovec xcb_parts[8]; + xcb_void_cookie_t xcb_ret; + xcb_render_create_linear_gradient_request_t xcb_out; + + xcb_out.picture = picture; + xcb_out.p1 = p1; + xcb_out.p2 = p2; + xcb_out.num_stops = num_stops; + + 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_render_fixed_t stops */ + xcb_parts[4].iov_base = (char *) stops; + xcb_parts[4].iov_len = num_stops * sizeof(xcb_render_fixed_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_render_color_t colors */ + xcb_parts[6].iov_base = (char *) colors; + xcb_parts[6].iov_len = num_stops * sizeof(xcb_render_color_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_render_fixed_t * +xcb_render_create_linear_gradient_stops (const xcb_render_create_linear_gradient_request_t *R) +{ + return (xcb_render_fixed_t *) (R + 1); +} + +int +xcb_render_create_linear_gradient_stops_length (const xcb_render_create_linear_gradient_request_t *R) +{ + return R->num_stops; +} + +xcb_generic_iterator_t +xcb_render_create_linear_gradient_stops_end (const xcb_render_create_linear_gradient_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_render_fixed_t *) (R + 1)) + (R->num_stops); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_render_color_t * +xcb_render_create_linear_gradient_colors (const xcb_render_create_linear_gradient_request_t *R) +{ + xcb_generic_iterator_t prev = xcb_render_create_linear_gradient_stops_end(R); + return (xcb_render_color_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_render_color_t, prev.index) + 0); +} + +int +xcb_render_create_linear_gradient_colors_length (const xcb_render_create_linear_gradient_request_t *R) +{ + return R->num_stops; +} + +xcb_render_color_iterator_t +xcb_render_create_linear_gradient_colors_iterator (const xcb_render_create_linear_gradient_request_t *R) +{ + xcb_render_color_iterator_t i; + xcb_generic_iterator_t prev = xcb_render_create_linear_gradient_stops_end(R); + i.data = (xcb_render_color_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_render_color_t, prev.index)); + i.rem = R->num_stops; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_render_create_radial_gradient_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_render_create_radial_gradient_request_t *_aux = (xcb_render_create_radial_gradient_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_render_create_radial_gradient_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* stops */ + xcb_block_len += _aux->num_stops * sizeof(xcb_render_fixed_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_render_fixed_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; + /* colors */ + xcb_block_len += _aux->num_stops * sizeof(xcb_render_color_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_render_color_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_render_create_radial_gradient_checked (xcb_connection_t *c, + xcb_render_picture_t picture, + xcb_render_pointfix_t inner, + xcb_render_pointfix_t outer, + xcb_render_fixed_t inner_radius, + xcb_render_fixed_t outer_radius, + uint32_t num_stops, + const xcb_render_fixed_t *stops, + const xcb_render_color_t *colors) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_CREATE_RADIAL_GRADIENT, + .isvoid = 1 + }; + + struct iovec xcb_parts[8]; + xcb_void_cookie_t xcb_ret; + xcb_render_create_radial_gradient_request_t xcb_out; + + xcb_out.picture = picture; + xcb_out.inner = inner; + xcb_out.outer = outer; + xcb_out.inner_radius = inner_radius; + xcb_out.outer_radius = outer_radius; + xcb_out.num_stops = num_stops; + + 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_render_fixed_t stops */ + xcb_parts[4].iov_base = (char *) stops; + xcb_parts[4].iov_len = num_stops * sizeof(xcb_render_fixed_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_render_color_t colors */ + xcb_parts[6].iov_base = (char *) colors; + xcb_parts[6].iov_len = num_stops * sizeof(xcb_render_color_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].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_render_create_radial_gradient (xcb_connection_t *c, + xcb_render_picture_t picture, + xcb_render_pointfix_t inner, + xcb_render_pointfix_t outer, + xcb_render_fixed_t inner_radius, + xcb_render_fixed_t outer_radius, + uint32_t num_stops, + const xcb_render_fixed_t *stops, + const xcb_render_color_t *colors) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_CREATE_RADIAL_GRADIENT, + .isvoid = 1 + }; + + struct iovec xcb_parts[8]; + xcb_void_cookie_t xcb_ret; + xcb_render_create_radial_gradient_request_t xcb_out; + + xcb_out.picture = picture; + xcb_out.inner = inner; + xcb_out.outer = outer; + xcb_out.inner_radius = inner_radius; + xcb_out.outer_radius = outer_radius; + xcb_out.num_stops = num_stops; + + 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_render_fixed_t stops */ + xcb_parts[4].iov_base = (char *) stops; + xcb_parts[4].iov_len = num_stops * sizeof(xcb_render_fixed_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_render_color_t colors */ + xcb_parts[6].iov_base = (char *) colors; + xcb_parts[6].iov_len = num_stops * sizeof(xcb_render_color_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_render_fixed_t * +xcb_render_create_radial_gradient_stops (const xcb_render_create_radial_gradient_request_t *R) +{ + return (xcb_render_fixed_t *) (R + 1); +} + +int +xcb_render_create_radial_gradient_stops_length (const xcb_render_create_radial_gradient_request_t *R) +{ + return R->num_stops; +} + +xcb_generic_iterator_t +xcb_render_create_radial_gradient_stops_end (const xcb_render_create_radial_gradient_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_render_fixed_t *) (R + 1)) + (R->num_stops); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_render_color_t * +xcb_render_create_radial_gradient_colors (const xcb_render_create_radial_gradient_request_t *R) +{ + xcb_generic_iterator_t prev = xcb_render_create_radial_gradient_stops_end(R); + return (xcb_render_color_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_render_color_t, prev.index) + 0); +} + +int +xcb_render_create_radial_gradient_colors_length (const xcb_render_create_radial_gradient_request_t *R) +{ + return R->num_stops; +} + +xcb_render_color_iterator_t +xcb_render_create_radial_gradient_colors_iterator (const xcb_render_create_radial_gradient_request_t *R) +{ + xcb_render_color_iterator_t i; + xcb_generic_iterator_t prev = xcb_render_create_radial_gradient_stops_end(R); + i.data = (xcb_render_color_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_render_color_t, prev.index)); + i.rem = R->num_stops; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_render_create_conical_gradient_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_render_create_conical_gradient_request_t *_aux = (xcb_render_create_conical_gradient_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_render_create_conical_gradient_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* stops */ + xcb_block_len += _aux->num_stops * sizeof(xcb_render_fixed_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_render_fixed_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; + /* colors */ + xcb_block_len += _aux->num_stops * sizeof(xcb_render_color_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_render_color_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_render_create_conical_gradient_checked (xcb_connection_t *c, + xcb_render_picture_t picture, + xcb_render_pointfix_t center, + xcb_render_fixed_t angle, + uint32_t num_stops, + const xcb_render_fixed_t *stops, + const xcb_render_color_t *colors) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_CREATE_CONICAL_GRADIENT, + .isvoid = 1 + }; + + struct iovec xcb_parts[8]; + xcb_void_cookie_t xcb_ret; + xcb_render_create_conical_gradient_request_t xcb_out; + + xcb_out.picture = picture; + xcb_out.center = center; + xcb_out.angle = angle; + xcb_out.num_stops = num_stops; + + 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_render_fixed_t stops */ + xcb_parts[4].iov_base = (char *) stops; + xcb_parts[4].iov_len = num_stops * sizeof(xcb_render_fixed_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_render_color_t colors */ + xcb_parts[6].iov_base = (char *) colors; + xcb_parts[6].iov_len = num_stops * sizeof(xcb_render_color_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].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_render_create_conical_gradient (xcb_connection_t *c, + xcb_render_picture_t picture, + xcb_render_pointfix_t center, + xcb_render_fixed_t angle, + uint32_t num_stops, + const xcb_render_fixed_t *stops, + const xcb_render_color_t *colors) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_render_id, + .opcode = XCB_RENDER_CREATE_CONICAL_GRADIENT, + .isvoid = 1 + }; + + struct iovec xcb_parts[8]; + xcb_void_cookie_t xcb_ret; + xcb_render_create_conical_gradient_request_t xcb_out; + + xcb_out.picture = picture; + xcb_out.center = center; + xcb_out.angle = angle; + xcb_out.num_stops = num_stops; + + 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_render_fixed_t stops */ + xcb_parts[4].iov_base = (char *) stops; + xcb_parts[4].iov_len = num_stops * sizeof(xcb_render_fixed_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_render_color_t colors */ + xcb_parts[6].iov_base = (char *) colors; + xcb_parts[6].iov_len = num_stops * sizeof(xcb_render_color_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_render_fixed_t * +xcb_render_create_conical_gradient_stops (const xcb_render_create_conical_gradient_request_t *R) +{ + return (xcb_render_fixed_t *) (R + 1); +} + +int +xcb_render_create_conical_gradient_stops_length (const xcb_render_create_conical_gradient_request_t *R) +{ + return R->num_stops; +} + +xcb_generic_iterator_t +xcb_render_create_conical_gradient_stops_end (const xcb_render_create_conical_gradient_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_render_fixed_t *) (R + 1)) + (R->num_stops); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_render_color_t * +xcb_render_create_conical_gradient_colors (const xcb_render_create_conical_gradient_request_t *R) +{ + xcb_generic_iterator_t prev = xcb_render_create_conical_gradient_stops_end(R); + return (xcb_render_color_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_render_color_t, prev.index) + 0); +} + +int +xcb_render_create_conical_gradient_colors_length (const xcb_render_create_conical_gradient_request_t *R) +{ + return R->num_stops; +} + +xcb_render_color_iterator_t +xcb_render_create_conical_gradient_colors_iterator (const xcb_render_create_conical_gradient_request_t *R) +{ + xcb_render_color_iterator_t i; + xcb_generic_iterator_t prev = xcb_render_create_conical_gradient_stops_end(R); + i.data = (xcb_render_color_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_render_color_t, prev.index)); + i.rem = R->num_stops; + i.index = (char *) i.data - (char *) R; + return i; +} + diff --git a/depends/libxcb/src/res.c b/depends/libxcb/src/res.c new file mode 100644 index 0000000..5b5da81 --- /dev/null +++ b/depends/libxcb/src/res.c @@ -0,0 +1,850 @@ +/* + * This file generated automatically from res.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "res.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) +#include "xproto.h" + +xcb_extension_t xcb_res_id = { "X-Resource", 0 }; + +void +xcb_res_client_next (xcb_res_client_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_res_client_t); +} + +xcb_generic_iterator_t +xcb_res_client_end (xcb_res_client_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; +} + +void +xcb_res_type_next (xcb_res_type_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_res_type_t); +} + +xcb_generic_iterator_t +xcb_res_type_end (xcb_res_type_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; +} + +void +xcb_res_client_id_spec_next (xcb_res_client_id_spec_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_res_client_id_spec_t); +} + +xcb_generic_iterator_t +xcb_res_client_id_spec_end (xcb_res_client_id_spec_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; +} + +int +xcb_res_client_id_value_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_res_client_id_value_t *_aux = (xcb_res_client_id_value_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_res_client_id_value_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* value */ + xcb_block_len += (_aux->length / 4) * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; +} + +uint32_t * +xcb_res_client_id_value_value (const xcb_res_client_id_value_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_res_client_id_value_value_length (const xcb_res_client_id_value_t *R) +{ + return (R->length / 4); +} + +xcb_generic_iterator_t +xcb_res_client_id_value_value_end (const xcb_res_client_id_value_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + ((R->length / 4)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_res_client_id_value_next (xcb_res_client_id_value_iterator_t *i) +{ + xcb_res_client_id_value_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_res_client_id_value_t *)(((char *)R) + xcb_res_client_id_value_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_res_client_id_value_t *) child.data; +} + +xcb_generic_iterator_t +xcb_res_client_id_value_end (xcb_res_client_id_value_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_res_client_id_value_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +void +xcb_res_resource_id_spec_next (xcb_res_resource_id_spec_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_res_resource_id_spec_t); +} + +xcb_generic_iterator_t +xcb_res_resource_id_spec_end (xcb_res_resource_id_spec_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; +} + +void +xcb_res_resource_size_spec_next (xcb_res_resource_size_spec_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_res_resource_size_spec_t); +} + +xcb_generic_iterator_t +xcb_res_resource_size_spec_end (xcb_res_resource_size_spec_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; +} + +int +xcb_res_resource_size_value_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_res_resource_size_value_t *_aux = (xcb_res_resource_size_value_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_res_resource_size_value_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* cross_references */ + xcb_block_len += _aux->num_cross_references * sizeof(xcb_res_resource_size_spec_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_res_resource_size_spec_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_res_resource_size_spec_t * +xcb_res_resource_size_value_cross_references (const xcb_res_resource_size_value_t *R) +{ + return (xcb_res_resource_size_spec_t *) (R + 1); +} + +int +xcb_res_resource_size_value_cross_references_length (const xcb_res_resource_size_value_t *R) +{ + return R->num_cross_references; +} + +xcb_res_resource_size_spec_iterator_t +xcb_res_resource_size_value_cross_references_iterator (const xcb_res_resource_size_value_t *R) +{ + xcb_res_resource_size_spec_iterator_t i; + i.data = (xcb_res_resource_size_spec_t *) (R + 1); + i.rem = R->num_cross_references; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_res_resource_size_value_next (xcb_res_resource_size_value_iterator_t *i) +{ + xcb_res_resource_size_value_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_res_resource_size_value_t *)(((char *)R) + xcb_res_resource_size_value_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_res_resource_size_value_t *) child.data; +} + +xcb_generic_iterator_t +xcb_res_resource_size_value_end (xcb_res_resource_size_value_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_res_resource_size_value_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +xcb_res_query_version_cookie_t +xcb_res_query_version (xcb_connection_t *c, + uint8_t client_major, + uint8_t client_minor) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_res_id, + .opcode = XCB_RES_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_res_query_version_cookie_t xcb_ret; + xcb_res_query_version_request_t xcb_out; + + xcb_out.client_major = client_major; + xcb_out.client_minor = client_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_res_query_version_cookie_t +xcb_res_query_version_unchecked (xcb_connection_t *c, + uint8_t client_major, + uint8_t client_minor) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_res_id, + .opcode = XCB_RES_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_res_query_version_cookie_t xcb_ret; + xcb_res_query_version_request_t xcb_out; + + xcb_out.client_major = client_major; + xcb_out.client_minor = client_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_res_query_version_reply_t * +xcb_res_query_version_reply (xcb_connection_t *c, + xcb_res_query_version_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_res_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_res_query_clients_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_res_query_clients_reply_t *_aux = (xcb_res_query_clients_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_res_query_clients_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* clients */ + xcb_block_len += _aux->num_clients * sizeof(xcb_res_client_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_res_client_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_res_query_clients_cookie_t +xcb_res_query_clients (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_res_id, + .opcode = XCB_RES_QUERY_CLIENTS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_res_query_clients_cookie_t xcb_ret; + xcb_res_query_clients_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_res_query_clients_cookie_t +xcb_res_query_clients_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_res_id, + .opcode = XCB_RES_QUERY_CLIENTS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_res_query_clients_cookie_t xcb_ret; + xcb_res_query_clients_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_res_client_t * +xcb_res_query_clients_clients (const xcb_res_query_clients_reply_t *R) +{ + return (xcb_res_client_t *) (R + 1); +} + +int +xcb_res_query_clients_clients_length (const xcb_res_query_clients_reply_t *R) +{ + return R->num_clients; +} + +xcb_res_client_iterator_t +xcb_res_query_clients_clients_iterator (const xcb_res_query_clients_reply_t *R) +{ + xcb_res_client_iterator_t i; + i.data = (xcb_res_client_t *) (R + 1); + i.rem = R->num_clients; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_res_query_clients_reply_t * +xcb_res_query_clients_reply (xcb_connection_t *c, + xcb_res_query_clients_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_res_query_clients_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_res_query_client_resources_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_res_query_client_resources_reply_t *_aux = (xcb_res_query_client_resources_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_res_query_client_resources_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* types */ + xcb_block_len += _aux->num_types * sizeof(xcb_res_type_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_res_type_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_res_query_client_resources_cookie_t +xcb_res_query_client_resources (xcb_connection_t *c, + uint32_t xid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_res_id, + .opcode = XCB_RES_QUERY_CLIENT_RESOURCES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_res_query_client_resources_cookie_t xcb_ret; + xcb_res_query_client_resources_request_t xcb_out; + + xcb_out.xid = xid; + + 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_res_query_client_resources_cookie_t +xcb_res_query_client_resources_unchecked (xcb_connection_t *c, + uint32_t xid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_res_id, + .opcode = XCB_RES_QUERY_CLIENT_RESOURCES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_res_query_client_resources_cookie_t xcb_ret; + xcb_res_query_client_resources_request_t xcb_out; + + xcb_out.xid = xid; + + 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_res_type_t * +xcb_res_query_client_resources_types (const xcb_res_query_client_resources_reply_t *R) +{ + return (xcb_res_type_t *) (R + 1); +} + +int +xcb_res_query_client_resources_types_length (const xcb_res_query_client_resources_reply_t *R) +{ + return R->num_types; +} + +xcb_res_type_iterator_t +xcb_res_query_client_resources_types_iterator (const xcb_res_query_client_resources_reply_t *R) +{ + xcb_res_type_iterator_t i; + i.data = (xcb_res_type_t *) (R + 1); + i.rem = R->num_types; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_res_query_client_resources_reply_t * +xcb_res_query_client_resources_reply (xcb_connection_t *c, + xcb_res_query_client_resources_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_res_query_client_resources_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_res_query_client_pixmap_bytes_cookie_t +xcb_res_query_client_pixmap_bytes (xcb_connection_t *c, + uint32_t xid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_res_id, + .opcode = XCB_RES_QUERY_CLIENT_PIXMAP_BYTES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_res_query_client_pixmap_bytes_cookie_t xcb_ret; + xcb_res_query_client_pixmap_bytes_request_t xcb_out; + + xcb_out.xid = xid; + + 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_res_query_client_pixmap_bytes_cookie_t +xcb_res_query_client_pixmap_bytes_unchecked (xcb_connection_t *c, + uint32_t xid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_res_id, + .opcode = XCB_RES_QUERY_CLIENT_PIXMAP_BYTES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_res_query_client_pixmap_bytes_cookie_t xcb_ret; + xcb_res_query_client_pixmap_bytes_request_t xcb_out; + + xcb_out.xid = xid; + + 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_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); +} + +int +xcb_res_query_client_ids_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_res_query_client_ids_request_t *_aux = (xcb_res_query_client_ids_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_res_query_client_ids_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* specs */ + xcb_block_len += _aux->num_specs * sizeof(xcb_res_client_id_spec_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_res_client_id_spec_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_res_query_client_ids_cookie_t +xcb_res_query_client_ids (xcb_connection_t *c, + uint32_t num_specs, + const xcb_res_client_id_spec_t *specs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_res_id, + .opcode = XCB_RES_QUERY_CLIENT_IDS, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_res_query_client_ids_cookie_t xcb_ret; + xcb_res_query_client_ids_request_t xcb_out; + + xcb_out.num_specs = num_specs; + + 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_res_client_id_spec_t specs */ + xcb_parts[4].iov_base = (char *) specs; + xcb_parts[4].iov_len = num_specs * sizeof(xcb_res_client_id_spec_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_res_query_client_ids_cookie_t +xcb_res_query_client_ids_unchecked (xcb_connection_t *c, + uint32_t num_specs, + const xcb_res_client_id_spec_t *specs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_res_id, + .opcode = XCB_RES_QUERY_CLIENT_IDS, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_res_query_client_ids_cookie_t xcb_ret; + xcb_res_query_client_ids_request_t xcb_out; + + xcb_out.num_specs = num_specs; + + 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_res_client_id_spec_t specs */ + xcb_parts[4].iov_base = (char *) specs; + xcb_parts[4].iov_len = num_specs * sizeof(xcb_res_client_id_spec_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; +} + +int +xcb_res_query_client_ids_ids_length (const xcb_res_query_client_ids_reply_t *R) +{ + return R->num_ids; +} + +xcb_res_client_id_value_iterator_t +xcb_res_query_client_ids_ids_iterator (const xcb_res_query_client_ids_reply_t *R) +{ + xcb_res_client_id_value_iterator_t i; + i.data = (xcb_res_client_id_value_t *) (R + 1); + i.rem = R->num_ids; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_res_query_client_ids_reply_t * +xcb_res_query_client_ids_reply (xcb_connection_t *c, + xcb_res_query_client_ids_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_res_query_client_ids_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_res_query_resource_bytes_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_res_query_resource_bytes_request_t *_aux = (xcb_res_query_resource_bytes_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_res_query_resource_bytes_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* specs */ + xcb_block_len += _aux->num_specs * sizeof(xcb_res_resource_id_spec_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_res_resource_id_spec_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_res_query_resource_bytes_cookie_t +xcb_res_query_resource_bytes (xcb_connection_t *c, + uint32_t client, + uint32_t num_specs, + const xcb_res_resource_id_spec_t *specs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_res_id, + .opcode = XCB_RES_QUERY_RESOURCE_BYTES, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_res_query_resource_bytes_cookie_t xcb_ret; + xcb_res_query_resource_bytes_request_t xcb_out; + + xcb_out.client = client; + xcb_out.num_specs = num_specs; + + 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_res_resource_id_spec_t specs */ + xcb_parts[4].iov_base = (char *) specs; + xcb_parts[4].iov_len = num_specs * sizeof(xcb_res_resource_id_spec_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_res_query_resource_bytes_cookie_t +xcb_res_query_resource_bytes_unchecked (xcb_connection_t *c, + uint32_t client, + uint32_t num_specs, + const xcb_res_resource_id_spec_t *specs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_res_id, + .opcode = XCB_RES_QUERY_RESOURCE_BYTES, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_res_query_resource_bytes_cookie_t xcb_ret; + xcb_res_query_resource_bytes_request_t xcb_out; + + xcb_out.client = client; + xcb_out.num_specs = num_specs; + + 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_res_resource_id_spec_t specs */ + xcb_parts[4].iov_base = (char *) specs; + xcb_parts[4].iov_len = num_specs * sizeof(xcb_res_resource_id_spec_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; +} + +int +xcb_res_query_resource_bytes_sizes_length (const xcb_res_query_resource_bytes_reply_t *R) +{ + return R->num_sizes; +} + +xcb_res_resource_size_value_iterator_t +xcb_res_query_resource_bytes_sizes_iterator (const xcb_res_query_resource_bytes_reply_t *R) +{ + xcb_res_resource_size_value_iterator_t i; + i.data = (xcb_res_resource_size_value_t *) (R + 1); + i.rem = R->num_sizes; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_res_query_resource_bytes_reply_t * +xcb_res_query_resource_bytes_reply (xcb_connection_t *c, + xcb_res_query_resource_bytes_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_res_query_resource_bytes_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + diff --git a/depends/libxcb/src/screensaver.c b/depends/libxcb/src/screensaver.c new file mode 100644 index 0000000..9d84576 --- /dev/null +++ b/depends/libxcb/src/screensaver.c @@ -0,0 +1,849 @@ +/* + * This file generated automatically from screensaver.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "screensaver.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) +#include "xproto.h" + +xcb_extension_t xcb_screensaver_id = { "MIT-SCREEN-SAVER", 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, + uint32_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; + + 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, + uint32_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; + + 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; +} + diff --git a/depends/libxcb/src/shape.c b/depends/libxcb/src/shape.c new file mode 100644 index 0000000..df199f4 --- /dev/null +++ b/depends/libxcb/src/shape.c @@ -0,0 +1,768 @@ +/* + * This file generated automatically from shape.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "shape.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) +#include "xproto.h" + +xcb_extension_t xcb_shape_id = { "SHAPE", 0 }; + +void +xcb_shape_op_next (xcb_shape_op_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_shape_op_t); +} + +xcb_generic_iterator_t +xcb_shape_op_end (xcb_shape_op_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; +} + +void +xcb_shape_kind_next (xcb_shape_kind_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_shape_kind_t); +} + +xcb_generic_iterator_t +xcb_shape_kind_end (xcb_shape_kind_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_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); +} + diff --git a/depends/libxcb/src/shm.c b/depends/libxcb/src/shm.c new file mode 100644 index 0000000..f51c9e5 --- /dev/null +++ b/depends/libxcb/src/shm.c @@ -0,0 +1,633 @@ +/* + * This file generated automatically from shm.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "shm.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) +#include "xproto.h" + +xcb_extension_t xcb_shm_id = { "MIT-SHM", 0 }; + +void +xcb_shm_seg_next (xcb_shm_seg_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_shm_seg_t); +} + +xcb_generic_iterator_t +xcb_shm_seg_end (xcb_shm_seg_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_shm_query_version_cookie_t +xcb_shm_query_version (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_shm_id, + .opcode = XCB_SHM_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_shm_query_version_cookie_t xcb_ret; + xcb_shm_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_shm_query_version_cookie_t +xcb_shm_query_version_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_shm_id, + .opcode = XCB_SHM_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_shm_query_version_cookie_t xcb_ret; + xcb_shm_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_shm_query_version_reply_t * +xcb_shm_query_version_reply (xcb_connection_t *c, + xcb_shm_query_version_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_shm_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_shm_attach_checked (xcb_connection_t *c, + xcb_shm_seg_t shmseg, + uint32_t shmid, + uint8_t read_only) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_shm_id, + .opcode = XCB_SHM_ATTACH, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_shm_attach_request_t xcb_out; + + xcb_out.shmseg = shmseg; + xcb_out.shmid = shmid; + xcb_out.read_only = read_only; + 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_shm_attach (xcb_connection_t *c, + xcb_shm_seg_t shmseg, + uint32_t shmid, + uint8_t read_only) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_shm_id, + .opcode = XCB_SHM_ATTACH, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_shm_attach_request_t xcb_out; + + xcb_out.shmseg = shmseg; + xcb_out.shmid = shmid; + xcb_out.read_only = read_only; + 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_shm_detach_checked (xcb_connection_t *c, + xcb_shm_seg_t shmseg) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_shm_id, + .opcode = XCB_SHM_DETACH, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_shm_detach_request_t xcb_out; + + xcb_out.shmseg = shmseg; + + 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_shm_detach (xcb_connection_t *c, + xcb_shm_seg_t shmseg) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_shm_id, + .opcode = XCB_SHM_DETACH, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_shm_detach_request_t xcb_out; + + xcb_out.shmseg = shmseg; + + 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_shm_put_image_checked (xcb_connection_t *c, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + uint16_t total_width, + uint16_t total_height, + uint16_t src_x, + uint16_t src_y, + uint16_t src_width, + uint16_t src_height, + int16_t dst_x, + int16_t dst_y, + uint8_t depth, + uint8_t format, + uint8_t send_event, + xcb_shm_seg_t shmseg, + uint32_t offset) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_shm_id, + .opcode = XCB_SHM_PUT_IMAGE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_shm_put_image_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.gc = gc; + xcb_out.total_width = total_width; + xcb_out.total_height = total_height; + xcb_out.src_x = src_x; + xcb_out.src_y = src_y; + xcb_out.src_width = src_width; + xcb_out.src_height = src_height; + xcb_out.dst_x = dst_x; + xcb_out.dst_y = dst_y; + xcb_out.depth = depth; + xcb_out.format = format; + xcb_out.send_event = send_event; + xcb_out.pad0 = 0; + xcb_out.shmseg = shmseg; + xcb_out.offset = 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_shm_put_image (xcb_connection_t *c, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + uint16_t total_width, + uint16_t total_height, + uint16_t src_x, + uint16_t src_y, + uint16_t src_width, + uint16_t src_height, + int16_t dst_x, + int16_t dst_y, + uint8_t depth, + uint8_t format, + uint8_t send_event, + xcb_shm_seg_t shmseg, + uint32_t offset) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_shm_id, + .opcode = XCB_SHM_PUT_IMAGE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_shm_put_image_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.gc = gc; + xcb_out.total_width = total_width; + xcb_out.total_height = total_height; + xcb_out.src_x = src_x; + xcb_out.src_y = src_y; + xcb_out.src_width = src_width; + xcb_out.src_height = src_height; + xcb_out.dst_x = dst_x; + xcb_out.dst_y = dst_y; + xcb_out.depth = depth; + xcb_out.format = format; + xcb_out.send_event = send_event; + xcb_out.pad0 = 0; + xcb_out.shmseg = shmseg; + xcb_out.offset = 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_shm_get_image_cookie_t +xcb_shm_get_image (xcb_connection_t *c, + xcb_drawable_t drawable, + int16_t x, + int16_t y, + uint16_t width, + uint16_t height, + uint32_t plane_mask, + uint8_t format, + xcb_shm_seg_t shmseg, + uint32_t offset) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_shm_id, + .opcode = XCB_SHM_GET_IMAGE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_shm_get_image_cookie_t xcb_ret; + xcb_shm_get_image_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.plane_mask = plane_mask; + xcb_out.format = format; + memset(xcb_out.pad0, 0, 3); + xcb_out.shmseg = shmseg; + xcb_out.offset = 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_shm_get_image_cookie_t +xcb_shm_get_image_unchecked (xcb_connection_t *c, + xcb_drawable_t drawable, + int16_t x, + int16_t y, + uint16_t width, + uint16_t height, + uint32_t plane_mask, + uint8_t format, + xcb_shm_seg_t shmseg, + uint32_t offset) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_shm_id, + .opcode = XCB_SHM_GET_IMAGE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_shm_get_image_cookie_t xcb_ret; + xcb_shm_get_image_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.plane_mask = plane_mask; + xcb_out.format = format; + memset(xcb_out.pad0, 0, 3); + xcb_out.shmseg = shmseg; + xcb_out.offset = 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_shm_get_image_reply_t * +xcb_shm_get_image_reply (xcb_connection_t *c, + xcb_shm_get_image_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_shm_get_image_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_shm_create_pixmap_checked (xcb_connection_t *c, + xcb_pixmap_t pid, + xcb_drawable_t drawable, + uint16_t width, + uint16_t height, + uint8_t depth, + xcb_shm_seg_t shmseg, + uint32_t offset) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_shm_id, + .opcode = XCB_SHM_CREATE_PIXMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_shm_create_pixmap_request_t xcb_out; + + xcb_out.pid = pid; + xcb_out.drawable = drawable; + xcb_out.width = width; + xcb_out.height = height; + xcb_out.depth = depth; + memset(xcb_out.pad0, 0, 3); + xcb_out.shmseg = shmseg; + xcb_out.offset = 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_shm_create_pixmap (xcb_connection_t *c, + xcb_pixmap_t pid, + xcb_drawable_t drawable, + uint16_t width, + uint16_t height, + uint8_t depth, + xcb_shm_seg_t shmseg, + uint32_t offset) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_shm_id, + .opcode = XCB_SHM_CREATE_PIXMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_shm_create_pixmap_request_t xcb_out; + + xcb_out.pid = pid; + xcb_out.drawable = drawable; + xcb_out.width = width; + xcb_out.height = height; + xcb_out.depth = depth; + memset(xcb_out.pad0, 0, 3); + xcb_out.shmseg = shmseg; + xcb_out.offset = 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_void_cookie_t +xcb_shm_attach_fd_checked (xcb_connection_t *c, + xcb_shm_seg_t shmseg, + int32_t shm_fd, + uint8_t read_only) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_shm_id, + .opcode = XCB_SHM_ATTACH_FD, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_shm_attach_fd_request_t xcb_out; + int fds[1]; + int fd_index = 0; + + xcb_out.shmseg = shmseg; + xcb_out.read_only = read_only; + 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; + + fds[fd_index++] = shm_fd; + xcb_ret.sequence = xcb_send_request_with_fds(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req, 1, fds); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_shm_attach_fd (xcb_connection_t *c, + xcb_shm_seg_t shmseg, + int32_t shm_fd, + uint8_t read_only) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_shm_id, + .opcode = XCB_SHM_ATTACH_FD, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_shm_attach_fd_request_t xcb_out; + int fds[1]; + int fd_index = 0; + + xcb_out.shmseg = shmseg; + xcb_out.read_only = read_only; + 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; + + fds[fd_index++] = shm_fd; + xcb_ret.sequence = xcb_send_request_with_fds(c, 0, xcb_parts + 2, &xcb_req, 1, fds); + return xcb_ret; +} + +xcb_shm_create_segment_cookie_t +xcb_shm_create_segment (xcb_connection_t *c, + xcb_shm_seg_t shmseg, + uint32_t size, + uint8_t read_only) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_shm_id, + .opcode = XCB_SHM_CREATE_SEGMENT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_shm_create_segment_cookie_t xcb_ret; + xcb_shm_create_segment_request_t xcb_out; + + xcb_out.shmseg = shmseg; + xcb_out.size = size; + xcb_out.read_only = read_only; + 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_REQUEST_REPLY_FDS, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_shm_create_segment_cookie_t +xcb_shm_create_segment_unchecked (xcb_connection_t *c, + xcb_shm_seg_t shmseg, + uint32_t size, + uint8_t read_only) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_shm_id, + .opcode = XCB_SHM_CREATE_SEGMENT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_shm_create_segment_cookie_t xcb_ret; + xcb_shm_create_segment_request_t xcb_out; + + xcb_out.shmseg = shmseg; + xcb_out.size = size; + xcb_out.read_only = read_only; + 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_REPLY_FDS, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_shm_create_segment_reply_t * +xcb_shm_create_segment_reply (xcb_connection_t *c, + xcb_shm_create_segment_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_shm_create_segment_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int * +xcb_shm_create_segment_reply_fds (xcb_connection_t *c /**< */, + xcb_shm_create_segment_reply_t *reply) +{ + return xcb_get_reply_fds(c, reply, sizeof(xcb_shm_create_segment_reply_t) + 4 * reply->length); +} + diff --git a/depends/libxcb/src/sync.c b/depends/libxcb/src/sync.c new file mode 100644 index 0000000..c19e051 --- /dev/null +++ b/depends/libxcb/src/sync.c @@ -0,0 +1,2087 @@ +/* + * This file generated automatically from sync.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "sync.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) +#include "xproto.h" + +xcb_extension_t xcb_sync_id = { "SYNC", 0 }; + +void +xcb_sync_alarm_next (xcb_sync_alarm_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_sync_alarm_t); +} + +xcb_generic_iterator_t +xcb_sync_alarm_end (xcb_sync_alarm_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; +} + +void +xcb_sync_counter_next (xcb_sync_counter_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_sync_counter_t); +} + +xcb_generic_iterator_t +xcb_sync_counter_end (xcb_sync_counter_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; +} + +void +xcb_sync_fence_next (xcb_sync_fence_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_sync_fence_t); +} + +xcb_generic_iterator_t +xcb_sync_fence_end (xcb_sync_fence_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; +} + +void +xcb_sync_int64_next (xcb_sync_int64_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_sync_int64_t); +} + +xcb_generic_iterator_t +xcb_sync_int64_end (xcb_sync_int64_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; +} + +int +xcb_sync_systemcounter_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_sync_systemcounter_t *_aux = (xcb_sync_systemcounter_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_sync_systemcounter_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* name */ + xcb_block_len += _aux->name_len * sizeof(char); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(char); + xcb_align_to = 4; + /* 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; + /* 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; +} + +char * +xcb_sync_systemcounter_name (const xcb_sync_systemcounter_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_sync_systemcounter_name_length (const xcb_sync_systemcounter_t *R) +{ + return R->name_len; +} + +xcb_generic_iterator_t +xcb_sync_systemcounter_name_end (const xcb_sync_systemcounter_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->name_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_sync_systemcounter_next (xcb_sync_systemcounter_iterator_t *i) +{ + xcb_sync_systemcounter_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_sync_systemcounter_t *)(((char *)R) + xcb_sync_systemcounter_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_sync_systemcounter_t *) child.data; +} + +xcb_generic_iterator_t +xcb_sync_systemcounter_end (xcb_sync_systemcounter_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_sync_systemcounter_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +void +xcb_sync_trigger_next (xcb_sync_trigger_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_sync_trigger_t); +} + +xcb_generic_iterator_t +xcb_sync_trigger_end (xcb_sync_trigger_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; +} + +void +xcb_sync_waitcondition_next (xcb_sync_waitcondition_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_sync_waitcondition_t); +} + +xcb_generic_iterator_t +xcb_sync_waitcondition_end (xcb_sync_waitcondition_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_sync_initialize_cookie_t +xcb_sync_initialize (xcb_connection_t *c, + uint8_t desired_major_version, + uint8_t desired_minor_version) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_INITIALIZE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_sync_initialize_cookie_t xcb_ret; + xcb_sync_initialize_request_t xcb_out; + + xcb_out.desired_major_version = desired_major_version; + xcb_out.desired_minor_version = desired_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_sync_initialize_cookie_t +xcb_sync_initialize_unchecked (xcb_connection_t *c, + uint8_t desired_major_version, + uint8_t desired_minor_version) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_INITIALIZE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_sync_initialize_cookie_t xcb_ret; + xcb_sync_initialize_request_t xcb_out; + + xcb_out.desired_major_version = desired_major_version; + xcb_out.desired_minor_version = desired_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_sync_initialize_reply_t * +xcb_sync_initialize_reply (xcb_connection_t *c, + xcb_sync_initialize_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_sync_initialize_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_sync_list_system_counters_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_sync_list_system_counters_reply_t *_aux = (xcb_sync_list_system_counters_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_sync_list_system_counters_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* counters */ + for(i=0; i<_aux->counters_len; i++) { + xcb_tmp_len = xcb_sync_systemcounter_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_sync_systemcounter_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_sync_list_system_counters_cookie_t +xcb_sync_list_system_counters (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_LIST_SYSTEM_COUNTERS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_sync_list_system_counters_cookie_t xcb_ret; + xcb_sync_list_system_counters_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_sync_list_system_counters_cookie_t +xcb_sync_list_system_counters_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_LIST_SYSTEM_COUNTERS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_sync_list_system_counters_cookie_t xcb_ret; + xcb_sync_list_system_counters_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; +} + +int +xcb_sync_list_system_counters_counters_length (const xcb_sync_list_system_counters_reply_t *R) +{ + return R->counters_len; +} + +xcb_sync_systemcounter_iterator_t +xcb_sync_list_system_counters_counters_iterator (const xcb_sync_list_system_counters_reply_t *R) +{ + xcb_sync_systemcounter_iterator_t i; + i.data = (xcb_sync_systemcounter_t *) (R + 1); + i.rem = R->counters_len; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_sync_list_system_counters_reply_t * +xcb_sync_list_system_counters_reply (xcb_connection_t *c, + xcb_sync_list_system_counters_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_sync_list_system_counters_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_sync_create_counter_checked (xcb_connection_t *c, + xcb_sync_counter_t id, + xcb_sync_int64_t initial_value) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_CREATE_COUNTER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_sync_create_counter_request_t xcb_out; + + xcb_out.id = id; + xcb_out.initial_value = initial_value; + + 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_sync_create_counter (xcb_connection_t *c, + xcb_sync_counter_t id, + xcb_sync_int64_t initial_value) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_CREATE_COUNTER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_sync_create_counter_request_t xcb_out; + + xcb_out.id = id; + xcb_out.initial_value = initial_value; + + 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_sync_destroy_counter_checked (xcb_connection_t *c, + xcb_sync_counter_t counter) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_DESTROY_COUNTER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_sync_destroy_counter_request_t xcb_out; + + xcb_out.counter = counter; + + 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_sync_destroy_counter (xcb_connection_t *c, + xcb_sync_counter_t counter) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_DESTROY_COUNTER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_sync_destroy_counter_request_t xcb_out; + + xcb_out.counter = counter; + + 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_sync_query_counter_cookie_t +xcb_sync_query_counter (xcb_connection_t *c, + xcb_sync_counter_t counter) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_QUERY_COUNTER, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_sync_query_counter_cookie_t xcb_ret; + xcb_sync_query_counter_request_t xcb_out; + + xcb_out.counter = counter; + + 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_sync_query_counter_cookie_t +xcb_sync_query_counter_unchecked (xcb_connection_t *c, + xcb_sync_counter_t counter) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_QUERY_COUNTER, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_sync_query_counter_cookie_t xcb_ret; + xcb_sync_query_counter_request_t xcb_out; + + xcb_out.counter = counter; + + 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_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); +} + +int +xcb_sync_await_sizeof (const void *_buffer, + uint32_t wait_list_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_sync_await_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* wait_list */ + xcb_block_len += wait_list_len * sizeof(xcb_sync_waitcondition_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_sync_waitcondition_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_sync_await_checked (xcb_connection_t *c, + uint32_t wait_list_len, + const xcb_sync_waitcondition_t *wait_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_AWAIT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_sync_await_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_sync_waitcondition_t wait_list */ + xcb_parts[4].iov_base = (char *) wait_list; + xcb_parts[4].iov_len = wait_list_len * sizeof(xcb_sync_waitcondition_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_sync_await (xcb_connection_t *c, + uint32_t wait_list_len, + const xcb_sync_waitcondition_t *wait_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_AWAIT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_sync_await_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_sync_waitcondition_t wait_list */ + xcb_parts[4].iov_base = (char *) wait_list; + xcb_parts[4].iov_len = wait_list_len * sizeof(xcb_sync_waitcondition_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_sync_waitcondition_t * +xcb_sync_await_wait_list (const xcb_sync_await_request_t *R) +{ + return (xcb_sync_waitcondition_t *) (R + 1); +} + +int +xcb_sync_await_wait_list_length (const xcb_sync_await_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_sync_await_request_t))/sizeof(xcb_sync_waitcondition_t)); +} + +xcb_sync_waitcondition_iterator_t +xcb_sync_await_wait_list_iterator (const xcb_sync_await_request_t *R) +{ + xcb_sync_waitcondition_iterator_t i; + i.data = (xcb_sync_waitcondition_t *) (R + 1); + i.rem = (((R->length * 4) - sizeof(xcb_sync_await_request_t))/sizeof(xcb_sync_waitcondition_t)); + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_sync_change_counter_checked (xcb_connection_t *c, + xcb_sync_counter_t counter, + xcb_sync_int64_t amount) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_CHANGE_COUNTER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_sync_change_counter_request_t xcb_out; + + xcb_out.counter = counter; + xcb_out.amount = amount; + + 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_sync_change_counter (xcb_connection_t *c, + xcb_sync_counter_t counter, + xcb_sync_int64_t amount) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_CHANGE_COUNTER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_sync_change_counter_request_t xcb_out; + + xcb_out.counter = counter; + xcb_out.amount = amount; + + 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_sync_set_counter_checked (xcb_connection_t *c, + xcb_sync_counter_t counter, + xcb_sync_int64_t value) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_SET_COUNTER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_sync_set_counter_request_t xcb_out; + + xcb_out.counter = counter; + xcb_out.value = value; + + 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_sync_set_counter (xcb_connection_t *c, + xcb_sync_counter_t counter, + xcb_sync_int64_t value) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_SET_COUNTER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_sync_set_counter_request_t xcb_out; + + xcb_out.counter = counter; + xcb_out.value = value; + + 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_sync_create_alarm_value_list_serialize (void **_buffer, + uint32_t value_mask, + const xcb_sync_create_alarm_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[7]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(value_mask & XCB_SYNC_CA_COUNTER) { + /* xcb_sync_create_alarm_value_list_t.counter */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->counter; + xcb_block_len += sizeof(xcb_sync_counter_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_sync_counter_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_sync_counter_t); + } + if(value_mask & XCB_SYNC_CA_VALUE_TYPE) { + /* xcb_sync_create_alarm_value_list_t.valueType */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->valueType; + 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_SYNC_CA_VALUE) { + /* xcb_sync_create_alarm_value_list_t.value */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->value; + xcb_block_len += sizeof(xcb_sync_int64_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_sync_int64_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_sync_int64_t); + } + if(value_mask & XCB_SYNC_CA_TEST_TYPE) { + /* xcb_sync_create_alarm_value_list_t.testType */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->testType; + 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_SYNC_CA_DELTA) { + /* xcb_sync_create_alarm_value_list_t.delta */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->delta; + xcb_block_len += sizeof(xcb_sync_int64_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_sync_int64_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_sync_int64_t); + } + if(value_mask & XCB_SYNC_CA_EVENTS) { + /* xcb_sync_create_alarm_value_list_t.events */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->events; + 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); + } + /* 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_sync_create_alarm_value_list_unpack (const void *_buffer, + uint32_t value_mask, + xcb_sync_create_alarm_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_SYNC_CA_COUNTER) { + /* xcb_sync_create_alarm_value_list_t.counter */ + _aux->counter = *(xcb_sync_counter_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_sync_counter_t); + xcb_tmp += sizeof(xcb_sync_counter_t); + xcb_align_to = ALIGNOF(xcb_sync_counter_t); + } + if(value_mask & XCB_SYNC_CA_VALUE_TYPE) { + /* xcb_sync_create_alarm_value_list_t.valueType */ + _aux->valueType = *(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_SYNC_CA_VALUE) { + /* xcb_sync_create_alarm_value_list_t.value */ + _aux->value = *(xcb_sync_int64_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_sync_int64_t); + xcb_tmp += sizeof(xcb_sync_int64_t); + xcb_align_to = ALIGNOF(xcb_sync_int64_t); + } + if(value_mask & XCB_SYNC_CA_TEST_TYPE) { + /* xcb_sync_create_alarm_value_list_t.testType */ + _aux->testType = *(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_SYNC_CA_DELTA) { + /* xcb_sync_create_alarm_value_list_t.delta */ + _aux->delta = *(xcb_sync_int64_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_sync_int64_t); + xcb_tmp += sizeof(xcb_sync_int64_t); + xcb_align_to = ALIGNOF(xcb_sync_int64_t); + } + if(value_mask & XCB_SYNC_CA_EVENTS) { + /* xcb_sync_create_alarm_value_list_t.events */ + _aux->events = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_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_sync_create_alarm_value_list_sizeof (const void *_buffer, + uint32_t value_mask) +{ + xcb_sync_create_alarm_value_list_t _aux; + return xcb_sync_create_alarm_value_list_unpack(_buffer, value_mask, &_aux); +} + +int +xcb_sync_create_alarm_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_sync_create_alarm_request_t *_aux = (xcb_sync_create_alarm_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_sync_create_alarm_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* value_list */ + xcb_block_len += xcb_sync_create_alarm_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_sync_create_alarm_checked (xcb_connection_t *c, + xcb_sync_alarm_t id, + uint32_t value_mask, + const void *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_CREATE_ALARM, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_sync_create_alarm_request_t xcb_out; + + xcb_out.id = id; + 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_sync_create_alarm_value_list_t value_list */ + xcb_parts[4].iov_base = (char *) value_list; + xcb_parts[4].iov_len = + xcb_sync_create_alarm_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_sync_create_alarm (xcb_connection_t *c, + xcb_sync_alarm_t id, + uint32_t value_mask, + const void *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_CREATE_ALARM, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_sync_create_alarm_request_t xcb_out; + + xcb_out.id = id; + 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_sync_create_alarm_value_list_t value_list */ + xcb_parts[4].iov_base = (char *) value_list; + xcb_parts[4].iov_len = + xcb_sync_create_alarm_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_sync_create_alarm_aux_checked (xcb_connection_t *c, + xcb_sync_alarm_t id, + uint32_t value_mask, + const xcb_sync_create_alarm_value_list_t *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_CREATE_ALARM, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_sync_create_alarm_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.id = id; + 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_sync_create_alarm_value_list_t value_list */ + xcb_parts[4].iov_len = + xcb_sync_create_alarm_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_sync_create_alarm_aux (xcb_connection_t *c, + xcb_sync_alarm_t id, + uint32_t value_mask, + const xcb_sync_create_alarm_value_list_t *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_CREATE_ALARM, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_sync_create_alarm_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.id = id; + 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_sync_create_alarm_value_list_t value_list */ + xcb_parts[4].iov_len = + xcb_sync_create_alarm_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_sync_create_alarm_value_list (const xcb_sync_create_alarm_request_t *R) +{ + return (void *) (R + 1); +} + +int +xcb_sync_change_alarm_value_list_serialize (void **_buffer, + uint32_t value_mask, + const xcb_sync_change_alarm_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[7]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(value_mask & XCB_SYNC_CA_COUNTER) { + /* xcb_sync_change_alarm_value_list_t.counter */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->counter; + xcb_block_len += sizeof(xcb_sync_counter_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_sync_counter_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_sync_counter_t); + } + if(value_mask & XCB_SYNC_CA_VALUE_TYPE) { + /* xcb_sync_change_alarm_value_list_t.valueType */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->valueType; + 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_SYNC_CA_VALUE) { + /* xcb_sync_change_alarm_value_list_t.value */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->value; + xcb_block_len += sizeof(xcb_sync_int64_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_sync_int64_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_sync_int64_t); + } + if(value_mask & XCB_SYNC_CA_TEST_TYPE) { + /* xcb_sync_change_alarm_value_list_t.testType */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->testType; + 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_SYNC_CA_DELTA) { + /* xcb_sync_change_alarm_value_list_t.delta */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->delta; + xcb_block_len += sizeof(xcb_sync_int64_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_sync_int64_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_sync_int64_t); + } + if(value_mask & XCB_SYNC_CA_EVENTS) { + /* xcb_sync_change_alarm_value_list_t.events */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->events; + 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); + } + /* 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_sync_change_alarm_value_list_unpack (const void *_buffer, + uint32_t value_mask, + xcb_sync_change_alarm_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_SYNC_CA_COUNTER) { + /* xcb_sync_change_alarm_value_list_t.counter */ + _aux->counter = *(xcb_sync_counter_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_sync_counter_t); + xcb_tmp += sizeof(xcb_sync_counter_t); + xcb_align_to = ALIGNOF(xcb_sync_counter_t); + } + if(value_mask & XCB_SYNC_CA_VALUE_TYPE) { + /* xcb_sync_change_alarm_value_list_t.valueType */ + _aux->valueType = *(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_SYNC_CA_VALUE) { + /* xcb_sync_change_alarm_value_list_t.value */ + _aux->value = *(xcb_sync_int64_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_sync_int64_t); + xcb_tmp += sizeof(xcb_sync_int64_t); + xcb_align_to = ALIGNOF(xcb_sync_int64_t); + } + if(value_mask & XCB_SYNC_CA_TEST_TYPE) { + /* xcb_sync_change_alarm_value_list_t.testType */ + _aux->testType = *(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_SYNC_CA_DELTA) { + /* xcb_sync_change_alarm_value_list_t.delta */ + _aux->delta = *(xcb_sync_int64_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_sync_int64_t); + xcb_tmp += sizeof(xcb_sync_int64_t); + xcb_align_to = ALIGNOF(xcb_sync_int64_t); + } + if(value_mask & XCB_SYNC_CA_EVENTS) { + /* xcb_sync_change_alarm_value_list_t.events */ + _aux->events = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_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_sync_change_alarm_value_list_sizeof (const void *_buffer, + uint32_t value_mask) +{ + xcb_sync_change_alarm_value_list_t _aux; + return xcb_sync_change_alarm_value_list_unpack(_buffer, value_mask, &_aux); +} + +int +xcb_sync_change_alarm_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_sync_change_alarm_request_t *_aux = (xcb_sync_change_alarm_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_sync_change_alarm_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* value_list */ + xcb_block_len += xcb_sync_change_alarm_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_sync_change_alarm_checked (xcb_connection_t *c, + xcb_sync_alarm_t id, + uint32_t value_mask, + const void *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_CHANGE_ALARM, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_sync_change_alarm_request_t xcb_out; + + xcb_out.id = id; + 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_sync_change_alarm_value_list_t value_list */ + xcb_parts[4].iov_base = (char *) value_list; + xcb_parts[4].iov_len = + xcb_sync_change_alarm_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_sync_change_alarm (xcb_connection_t *c, + xcb_sync_alarm_t id, + uint32_t value_mask, + const void *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_CHANGE_ALARM, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_sync_change_alarm_request_t xcb_out; + + xcb_out.id = id; + 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_sync_change_alarm_value_list_t value_list */ + xcb_parts[4].iov_base = (char *) value_list; + xcb_parts[4].iov_len = + xcb_sync_change_alarm_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_sync_change_alarm_aux_checked (xcb_connection_t *c, + xcb_sync_alarm_t id, + uint32_t value_mask, + const xcb_sync_change_alarm_value_list_t *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_CHANGE_ALARM, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_sync_change_alarm_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.id = id; + 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_sync_change_alarm_value_list_t value_list */ + xcb_parts[4].iov_len = + xcb_sync_change_alarm_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_sync_change_alarm_aux (xcb_connection_t *c, + xcb_sync_alarm_t id, + uint32_t value_mask, + const xcb_sync_change_alarm_value_list_t *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_CHANGE_ALARM, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_sync_change_alarm_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.id = id; + 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_sync_change_alarm_value_list_t value_list */ + xcb_parts[4].iov_len = + xcb_sync_change_alarm_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_sync_change_alarm_value_list (const xcb_sync_change_alarm_request_t *R) +{ + return (void *) (R + 1); +} + +xcb_void_cookie_t +xcb_sync_destroy_alarm_checked (xcb_connection_t *c, + xcb_sync_alarm_t alarm) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_DESTROY_ALARM, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_sync_destroy_alarm_request_t xcb_out; + + xcb_out.alarm = alarm; + + 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_sync_destroy_alarm (xcb_connection_t *c, + xcb_sync_alarm_t alarm) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_DESTROY_ALARM, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_sync_destroy_alarm_request_t xcb_out; + + xcb_out.alarm = alarm; + + 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_sync_query_alarm_cookie_t +xcb_sync_query_alarm (xcb_connection_t *c, + xcb_sync_alarm_t alarm) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_QUERY_ALARM, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_sync_query_alarm_cookie_t xcb_ret; + xcb_sync_query_alarm_request_t xcb_out; + + xcb_out.alarm = alarm; + + 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_sync_query_alarm_cookie_t +xcb_sync_query_alarm_unchecked (xcb_connection_t *c, + xcb_sync_alarm_t alarm) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_QUERY_ALARM, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_sync_query_alarm_cookie_t xcb_ret; + xcb_sync_query_alarm_request_t xcb_out; + + xcb_out.alarm = alarm; + + 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_sync_query_alarm_reply_t * +xcb_sync_query_alarm_reply (xcb_connection_t *c, + xcb_sync_query_alarm_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_sync_query_alarm_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_sync_set_priority_checked (xcb_connection_t *c, + uint32_t id, + int32_t priority) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_SET_PRIORITY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_sync_set_priority_request_t xcb_out; + + xcb_out.id = id; + xcb_out.priority = priority; + + 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_sync_set_priority (xcb_connection_t *c, + uint32_t id, + int32_t priority) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_SET_PRIORITY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_sync_set_priority_request_t xcb_out; + + xcb_out.id = id; + xcb_out.priority = priority; + + 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_sync_get_priority_cookie_t +xcb_sync_get_priority (xcb_connection_t *c, + uint32_t id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_GET_PRIORITY, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_sync_get_priority_cookie_t xcb_ret; + xcb_sync_get_priority_request_t xcb_out; + + xcb_out.id = id; + + 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_sync_get_priority_cookie_t +xcb_sync_get_priority_unchecked (xcb_connection_t *c, + uint32_t id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_GET_PRIORITY, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_sync_get_priority_cookie_t xcb_ret; + xcb_sync_get_priority_request_t xcb_out; + + xcb_out.id = id; + + 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_sync_get_priority_reply_t * +xcb_sync_get_priority_reply (xcb_connection_t *c, + xcb_sync_get_priority_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_sync_get_priority_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_sync_create_fence_checked (xcb_connection_t *c, + xcb_drawable_t drawable, + xcb_sync_fence_t fence, + uint8_t initially_triggered) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_CREATE_FENCE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_sync_create_fence_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.fence = fence; + xcb_out.initially_triggered = initially_triggered; + + 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_sync_create_fence (xcb_connection_t *c, + xcb_drawable_t drawable, + xcb_sync_fence_t fence, + uint8_t initially_triggered) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_CREATE_FENCE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_sync_create_fence_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.fence = fence; + xcb_out.initially_triggered = initially_triggered; + + 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_sync_trigger_fence_checked (xcb_connection_t *c, + xcb_sync_fence_t fence) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_TRIGGER_FENCE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_sync_trigger_fence_request_t xcb_out; + + xcb_out.fence = fence; + + 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_sync_trigger_fence (xcb_connection_t *c, + xcb_sync_fence_t fence) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_TRIGGER_FENCE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_sync_trigger_fence_request_t xcb_out; + + xcb_out.fence = fence; + + 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_sync_reset_fence_checked (xcb_connection_t *c, + xcb_sync_fence_t fence) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_RESET_FENCE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_sync_reset_fence_request_t xcb_out; + + xcb_out.fence = fence; + + 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_sync_reset_fence (xcb_connection_t *c, + xcb_sync_fence_t fence) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_RESET_FENCE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_sync_reset_fence_request_t xcb_out; + + xcb_out.fence = fence; + + 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_sync_destroy_fence_checked (xcb_connection_t *c, + xcb_sync_fence_t fence) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_DESTROY_FENCE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_sync_destroy_fence_request_t xcb_out; + + xcb_out.fence = fence; + + 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_sync_destroy_fence (xcb_connection_t *c, + xcb_sync_fence_t fence) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_DESTROY_FENCE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_sync_destroy_fence_request_t xcb_out; + + xcb_out.fence = fence; + + 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_sync_query_fence_cookie_t +xcb_sync_query_fence (xcb_connection_t *c, + xcb_sync_fence_t fence) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_QUERY_FENCE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_sync_query_fence_cookie_t xcb_ret; + xcb_sync_query_fence_request_t xcb_out; + + xcb_out.fence = fence; + + 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_sync_query_fence_cookie_t +xcb_sync_query_fence_unchecked (xcb_connection_t *c, + xcb_sync_fence_t fence) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_QUERY_FENCE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_sync_query_fence_cookie_t xcb_ret; + xcb_sync_query_fence_request_t xcb_out; + + xcb_out.fence = fence; + + 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_sync_query_fence_reply_t * +xcb_sync_query_fence_reply (xcb_connection_t *c, + xcb_sync_query_fence_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_sync_query_fence_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_sync_await_fence_sizeof (const void *_buffer, + uint32_t fence_list_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_sync_await_fence_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* fence_list */ + xcb_block_len += fence_list_len * sizeof(xcb_sync_fence_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_sync_fence_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_sync_await_fence_checked (xcb_connection_t *c, + uint32_t fence_list_len, + const xcb_sync_fence_t *fence_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_AWAIT_FENCE, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_sync_await_fence_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_sync_fence_t fence_list */ + xcb_parts[4].iov_base = (char *) fence_list; + xcb_parts[4].iov_len = fence_list_len * sizeof(xcb_sync_fence_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_sync_await_fence (xcb_connection_t *c, + uint32_t fence_list_len, + const xcb_sync_fence_t *fence_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_sync_id, + .opcode = XCB_SYNC_AWAIT_FENCE, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_sync_await_fence_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_sync_fence_t fence_list */ + xcb_parts[4].iov_base = (char *) fence_list; + xcb_parts[4].iov_len = fence_list_len * sizeof(xcb_sync_fence_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_sync_fence_t * +xcb_sync_await_fence_fence_list (const xcb_sync_await_fence_request_t *R) +{ + return (xcb_sync_fence_t *) (R + 1); +} + +int +xcb_sync_await_fence_fence_list_length (const xcb_sync_await_fence_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_sync_await_fence_request_t))/sizeof(xcb_sync_fence_t)); +} + +xcb_generic_iterator_t +xcb_sync_await_fence_fence_list_end (const xcb_sync_await_fence_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_sync_fence_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_sync_await_fence_request_t))/sizeof(xcb_sync_fence_t))); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + diff --git a/depends/libxcb/src/xc_misc.c b/depends/libxcb/src/xc_misc.c new file mode 100644 index 0000000..2ce38b6 --- /dev/null +++ b/depends/libxcb/src/xc_misc.c @@ -0,0 +1,252 @@ +/* + * This file generated automatically from xc_misc.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "xc_misc.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) + +xcb_extension_t xcb_xc_misc_id = { "XC-MISC", 0 }; + +xcb_xc_misc_get_version_cookie_t +xcb_xc_misc_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_xc_misc_id, + .opcode = XCB_XC_MISC_GET_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xc_misc_get_version_cookie_t xcb_ret; + xcb_xc_misc_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_xc_misc_get_version_cookie_t +xcb_xc_misc_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_xc_misc_id, + .opcode = XCB_XC_MISC_GET_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xc_misc_get_version_cookie_t xcb_ret; + xcb_xc_misc_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_xc_misc_get_version_reply_t * +xcb_xc_misc_get_version_reply (xcb_connection_t *c, + xcb_xc_misc_get_version_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xc_misc_get_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_xc_misc_get_xid_range_cookie_t +xcb_xc_misc_get_xid_range (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xc_misc_id, + .opcode = XCB_XC_MISC_GET_XID_RANGE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xc_misc_get_xid_range_cookie_t xcb_ret; + xcb_xc_misc_get_xid_range_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_xc_misc_get_xid_range_cookie_t +xcb_xc_misc_get_xid_range_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xc_misc_id, + .opcode = XCB_XC_MISC_GET_XID_RANGE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xc_misc_get_xid_range_cookie_t xcb_ret; + xcb_xc_misc_get_xid_range_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_xc_misc_get_xid_range_reply_t * +xcb_xc_misc_get_xid_range_reply (xcb_connection_t *c, + xcb_xc_misc_get_xid_range_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xc_misc_get_xid_range_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_xc_misc_get_xid_list_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xc_misc_get_xid_list_reply_t *_aux = (xcb_xc_misc_get_xid_list_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_xc_misc_get_xid_list_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* ids */ + xcb_block_len += _aux->ids_len * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_xc_misc_get_xid_list_cookie_t +xcb_xc_misc_get_xid_list (xcb_connection_t *c, + uint32_t count) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xc_misc_id, + .opcode = XCB_XC_MISC_GET_XID_LIST, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xc_misc_get_xid_list_cookie_t xcb_ret; + xcb_xc_misc_get_xid_list_request_t xcb_out; + + xcb_out.count = count; + + 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_xc_misc_get_xid_list_cookie_t +xcb_xc_misc_get_xid_list_unchecked (xcb_connection_t *c, + uint32_t count) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xc_misc_id, + .opcode = XCB_XC_MISC_GET_XID_LIST, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xc_misc_get_xid_list_cookie_t xcb_ret; + xcb_xc_misc_get_xid_list_request_t xcb_out; + + xcb_out.count = count; + + 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; +} + +uint32_t * +xcb_xc_misc_get_xid_list_ids (const xcb_xc_misc_get_xid_list_reply_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_xc_misc_get_xid_list_ids_length (const xcb_xc_misc_get_xid_list_reply_t *R) +{ + return R->ids_len; +} + +xcb_generic_iterator_t +xcb_xc_misc_get_xid_list_ids_end (const xcb_xc_misc_get_xid_list_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->ids_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +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); +} + diff --git a/depends/libxcb/src/xcb_auth.c b/depends/libxcb/src/xcb_auth.c new file mode 100644 index 0000000..8ebe9a4 --- /dev/null +++ b/depends/libxcb/src/xcb_auth.c @@ -0,0 +1,388 @@ +/* Copyright (C) 2001-2004 Bart Massey and Jamey Sharp. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the names of the authors or their + * institutions shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the authors. + */ + +/* Authorization systems for the X protocol. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <assert.h> +#include <X11/Xauth.h> +#include <stdlib.h> +#include <time.h> + +#ifdef __INTERIX +/* _don't_ ask. interix has INADDR_LOOPBACK in here. */ +#include <rpc/types.h> +#endif + +#ifdef _WIN32 +#ifdef HASXDMAUTH +/* We must include the wrapped windows.h before any system header which includes + it unwrapped, to avoid conflicts with types defined in X headers */ +#include <X11/Xwindows.h> +#endif +#include "xcb_windefs.h" +#else +#include <sys/param.h> +#include <unistd.h> +#include <arpa/inet.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <sys/un.h> +#endif /* _WIN32 */ + +#include "xcb.h" +#include "xcbint.h" + +#ifdef HASXDMAUTH +#include <X11/Xdmcp.h> +#endif + +enum auth_protos { +#ifdef HASXDMAUTH + AUTH_XA1, +#endif + AUTH_MC1, + N_AUTH_PROTOS +}; + +#define AUTH_PROTO_XDM_AUTHORIZATION "XDM-AUTHORIZATION-1" +#define AUTH_PROTO_MIT_MAGIC_COOKIE "MIT-MAGIC-COOKIE-1" + +static char *authnames[N_AUTH_PROTOS] = { +#ifdef HASXDMAUTH + AUTH_PROTO_XDM_AUTHORIZATION, +#endif + AUTH_PROTO_MIT_MAGIC_COOKIE, +}; + +static int authnameslen[N_AUTH_PROTOS] = { +#ifdef HASXDMAUTH + sizeof(AUTH_PROTO_XDM_AUTHORIZATION) - 1, +#endif + sizeof(AUTH_PROTO_MIT_MAGIC_COOKIE) - 1, +}; + +static size_t memdup(char **dst, void *src, size_t len) +{ + if(len) + *dst = malloc(len); + else + *dst = 0; + if(!*dst) + return 0; + memcpy(*dst, src, len); + return len; +} + +static int authname_match(enum auth_protos kind, char *name, size_t namelen) +{ + if(authnameslen[kind] != namelen) + return 0; + if(memcmp(authnames[kind], name, namelen)) + return 0; + return 1; +} + +#define SIN6_ADDR(s) (&((struct sockaddr_in6 *)s)->sin6_addr) + +static Xauth *get_authptr(struct sockaddr *sockname, int display) +{ + char *addr = 0; + int addrlen = 0; + unsigned short family; + char hostnamebuf[256]; /* big enough for max hostname */ + char dispbuf[40]; /* big enough to hold more than 2^64 base 10 */ + int dispbuflen; + + family = FamilyLocal; /* 256 */ + switch(sockname->sa_family) + { +#ifdef AF_INET6 + case AF_INET6: + addr = (char *) SIN6_ADDR(sockname); + addrlen = sizeof(*SIN6_ADDR(sockname)); + if(!IN6_IS_ADDR_V4MAPPED(SIN6_ADDR(sockname))) + { + if(!IN6_IS_ADDR_LOOPBACK(SIN6_ADDR(sockname))) + family = XCB_FAMILY_INTERNET_6; + break; + } + addr += 12; + /* if v4-mapped, fall through. */ + XCB_ALLOW_FALLTHRU +#endif + case AF_INET: + if(!addr) + addr = (char *) &((struct sockaddr_in *)sockname)->sin_addr; + addrlen = sizeof(((struct sockaddr_in *)sockname)->sin_addr); + if(*(in_addr_t *) addr != htonl(INADDR_LOOPBACK)) + family = XCB_FAMILY_INTERNET; + break; + case AF_UNIX: + break; + default: + return 0; /* cannot authenticate this family */ + } + + dispbuflen = snprintf(dispbuf, sizeof(dispbuf), "%d", display); + if(dispbuflen < 0) + return 0; + /* snprintf may have truncate our text */ + dispbuflen = MIN(dispbuflen, sizeof(dispbuf) - 1); + + if (family == FamilyLocal) { + if (gethostname(hostnamebuf, sizeof(hostnamebuf)) == -1) + return 0; /* do not know own hostname */ + addr = hostnamebuf; + addrlen = strlen(addr); + } + + return XauGetBestAuthByAddr (family, + (unsigned short) addrlen, addr, + (unsigned short) dispbuflen, dispbuf, + N_AUTH_PROTOS, authnames, authnameslen); +} + +#ifdef HASXDMAUTH +static int next_nonce(void) +{ + static int nonce = 0; + static pthread_mutex_t nonce_mutex = PTHREAD_MUTEX_INITIALIZER; + int ret; + pthread_mutex_lock(&nonce_mutex); + ret = nonce++; + pthread_mutex_unlock(&nonce_mutex); + return ret; +} + +static void do_append(char *buf, int *idxp, void *val, size_t valsize) { + memcpy(buf + *idxp, val, valsize); + *idxp += valsize; +} +#endif + +static int compute_auth(xcb_auth_info_t *info, Xauth *authptr, struct sockaddr *sockname) +{ + if (authname_match(AUTH_MC1, authptr->name, authptr->name_length)) { + info->datalen = memdup(&info->data, authptr->data, authptr->data_length); + if(!info->datalen) + return 0; + return 1; + } +#ifdef HASXDMAUTH +#define APPEND(buf,idx,val) do_append((buf),&(idx),&(val),sizeof(val)) + if (authname_match(AUTH_XA1, authptr->name, authptr->name_length)) { + int j; + + info->data = malloc(192 / 8); + if(!info->data) + return 0; + + for (j = 0; j < 8; j++) + info->data[j] = authptr->data[j]; + switch(sockname->sa_family) { + case AF_INET: + /*block*/ { + struct sockaddr_in *si = (struct sockaddr_in *) sockname; + APPEND(info->data, j, si->sin_addr.s_addr); + APPEND(info->data, j, si->sin_port); + } + break; +#ifdef AF_INET6 + case AF_INET6: + /*block*/ { + struct sockaddr_in6 *si6 = (struct sockaddr_in6 *) sockname; + if(IN6_IS_ADDR_V4MAPPED(SIN6_ADDR(sockname))) + { + do_append(info->data, &j, &si6->sin6_addr.s6_addr[12], 4); + APPEND(info->data, j, si6->sin6_port); + } + else + { + /* XDM-AUTHORIZATION-1 does not handle IPv6 correctly. Do the + same thing Xlib does: use all zeroes for the 4-byte address + and 2-byte port number. */ + uint32_t fakeaddr = 0; + uint16_t fakeport = 0; + APPEND(info->data, j, fakeaddr); + APPEND(info->data, j, fakeport); + } + } + break; +#endif + case AF_UNIX: + /*block*/ { + uint32_t fakeaddr = htonl(0xffffffff - next_nonce()); + uint16_t fakeport = htons(getpid()); + APPEND(info->data, j, fakeaddr); + APPEND(info->data, j, fakeport); + } + break; + default: + free(info->data); + return 0; /* do not know how to build this */ + } + { + uint32_t now = htonl(time(0)); + APPEND(info->data, j, now); + } + assert(j <= 192 / 8); + while (j < 192 / 8) + info->data[j++] = 0; + info->datalen = j; + XdmcpWrap ((unsigned char *) info->data, (unsigned char *) authptr->data + 8, (unsigned char *) info->data, info->datalen); + return 1; + } +#undef APPEND +#endif + + return 0; /* Unknown authorization type */ +} + +/* `sockaddr_un.sun_path' typical size usually ranges between 92 and 108 */ +#define INITIAL_SOCKNAME_SLACK 108 + +/* Return a dynamically allocated socket address structure according + to the value returned by either getpeername() or getsockname() + (according to POSIX, applications should not assume a particular + length for `sockaddr_un.sun_path') */ +#ifdef _WIN32 +static struct sockaddr *get_peer_sock_name(int(_stdcall *socket_func)(SOCKET, + struct sockaddr *, + socklen_t *), + int fd) +#else +static struct sockaddr *get_peer_sock_name(int (*socket_func)(int, + struct sockaddr *, + socklen_t *), + int fd) +#endif +{ + socklen_t socknamelen = sizeof(struct sockaddr) + INITIAL_SOCKNAME_SLACK; + socklen_t actual_socknamelen = socknamelen; + struct sockaddr *sockname = malloc(socknamelen); + + if (sockname == NULL) + return NULL; + + /* Both getpeername() and getsockname() truncates sockname if + there is not enough space and set the required length in + actual_socknamelen */ + if (socket_func(fd, sockname, &actual_socknamelen) == -1) + goto sock_or_realloc_error; + + if (actual_socknamelen > socknamelen) + { + struct sockaddr *new_sockname = NULL; + socknamelen = actual_socknamelen; + + if ((new_sockname = realloc(sockname, actual_socknamelen)) == NULL) + goto sock_or_realloc_error; + + sockname = new_sockname; + + if (socket_func(fd, sockname, &actual_socknamelen) == -1 || + actual_socknamelen > socknamelen) + goto sock_or_realloc_error; + } + + return sockname; + + sock_or_realloc_error: + free(sockname); + return NULL; +} + +int _xcb_get_auth_info(int fd, xcb_auth_info_t *info, int display) +{ + /* code adapted from Xlib/ConnDis.c, xtrans/Xtranssocket.c, + xtrans/Xtransutils.c */ + struct sockaddr *sockname = NULL; + int gotsockname = 0; + Xauth *authptr = 0; + int ret = 1; + + /* Some systems like hpux or Hurd do not expose peer names + * for UNIX Domain Sockets, but this is irrelevant, + * since compute_auth() ignores the peer name in this + * case anyway.*/ + if ((sockname = get_peer_sock_name(getpeername, fd)) == NULL) + { + if ((sockname = get_peer_sock_name(getsockname, fd)) == NULL) + return 0; /* can only authenticate sockets */ + if (sockname->sa_family != AF_UNIX) + { + free(sockname); + return 0; /* except for AF_UNIX, sockets should have peernames */ + } + gotsockname = 1; + } + + authptr = get_authptr(sockname, display); + if (authptr == 0) + { + free(sockname); + return 0; /* cannot find good auth data */ + } + + info->namelen = memdup(&info->name, authptr->name, authptr->name_length); + if (!info->namelen) + goto no_auth; /* out of memory */ + + if (!gotsockname) + { + free(sockname); + + if ((sockname = get_peer_sock_name(getsockname, fd)) == NULL) + { + free(info->name); + goto no_auth; /* can only authenticate sockets */ + } + } + + ret = compute_auth(info, authptr, sockname); + if(!ret) + { + free(info->name); + goto no_auth; /* cannot build auth record */ + } + + free(sockname); + sockname = NULL; + + XauDisposeAuth(authptr); + return ret; + + no_auth: + free(sockname); + + info->name = 0; + info->namelen = 0; + XauDisposeAuth(authptr); + return 0; +} diff --git a/depends/libxcb/src/xcb_conn.c b/depends/libxcb/src/xcb_conn.c new file mode 100644 index 0000000..3084c18 --- /dev/null +++ b/depends/libxcb/src/xcb_conn.c @@ -0,0 +1,586 @@ +/* Copyright (C) 2001-2004 Bart Massey and Jamey Sharp. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the names of the authors or their + * institutions shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the authors. + */ + +/* Connection management: the core of XCB. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <assert.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <fcntl.h> +#include <errno.h> +#include <limits.h> + +#include "xcb.h" +#include "xcbint.h" +#if USE_POLL +#include <poll.h> +#elif !defined _WIN32 +#include <sys/select.h> +#endif + +#ifdef _WIN32 +#include "xcb_windefs.h" +#include <io.h> +#else +#include <unistd.h> +#include <sys/socket.h> +#include <netinet/in.h> +#endif /* _WIN32 */ + +/* SHUT_RDWR is fairly recent and is not available on all platforms */ +#if !defined(SHUT_RDWR) +#define SHUT_RDWR 2 +#endif + +typedef struct { + uint8_t status; + uint8_t pad0[5]; + uint16_t length; +} xcb_setup_generic_t; + +static const xcb_setup_t xcb_error_setup = { + 0, /* status: failed (but we wouldn't have a xcb_setup_t in this case) */ + 0, /* pad0 */ + 0, 0, /* protocol version, should be 11.0, but isn't */ + 0, /* length, invalid value */ + 0, /* release_number */ + 0, 0, /* resource_id_{base,mask} */ + 0, /* motion_buffer_size */ + 0, /* vendor_len */ + 0, /* maximum_request_length */ + 0, /* roots_len */ + 0, /* pixmap_formats_len */ + 0, /* image_byte_order */ + 0, /* bitmap_format_bit_order */ + 0, /* bitmap_format_scanline_unit */ + 0, /* bitmap_format_scanline_pad */ + 0, 0, /* {min,max}_keycode */ + { 0, 0, 0, 0 } /* pad1 */ +}; + +/* Keep this list in sync with is_static_error_conn()! */ +static const int xcb_con_error = XCB_CONN_ERROR; +static const int xcb_con_closed_mem_er = XCB_CONN_CLOSED_MEM_INSUFFICIENT; +static const int xcb_con_closed_parse_er = XCB_CONN_CLOSED_PARSE_ERR; +static const int xcb_con_closed_screen_er = XCB_CONN_CLOSED_INVALID_SCREEN; + +static int is_static_error_conn(xcb_connection_t *c) +{ + return c == (xcb_connection_t *) &xcb_con_error || + c == (xcb_connection_t *) &xcb_con_closed_mem_er || + c == (xcb_connection_t *) &xcb_con_closed_parse_er || + c == (xcb_connection_t *) &xcb_con_closed_screen_er; +} + +static int set_fd_flags(const int fd) +{ +/* Win32 doesn't have file descriptors and the fcntl function. This block sets the socket in non-blocking mode */ + +#ifdef _WIN32 + u_long iMode = 1; /* non-zero puts it in non-blocking mode, 0 in blocking mode */ + int ret = 0; + + ret = ioctlsocket(fd, FIONBIO, &iMode); + if(ret != 0) + return 0; + return 1; +#else + int flags = fcntl(fd, F_GETFL, 0); + if(flags == -1) + return 0; + flags |= O_NONBLOCK; + if(fcntl(fd, F_SETFL, flags) == -1) + return 0; + if(fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) + return 0; + return 1; +#endif /* _WIN32 */ +} + +static int write_setup(xcb_connection_t *c, xcb_auth_info_t *auth_info) +{ + static const char pad[3]; + xcb_setup_request_t out; + struct iovec parts[6]; + int count = 0; + static const uint32_t endian = 0x01020304; + int ret; + + memset(&out, 0, sizeof(out)); + + /* B = 0x42 = MSB first, l = 0x6c = LSB first */ + if(htonl(endian) == endian) + out.byte_order = 0x42; + else + out.byte_order = 0x6c; + out.protocol_major_version = X_PROTOCOL; + out.protocol_minor_version = X_PROTOCOL_REVISION; + out.authorization_protocol_name_len = 0; + out.authorization_protocol_data_len = 0; + parts[count].iov_len = sizeof(xcb_setup_request_t); + parts[count++].iov_base = &out; + parts[count].iov_len = XCB_PAD(sizeof(xcb_setup_request_t)); + parts[count++].iov_base = (char *) pad; + + if(auth_info) + { + parts[count].iov_len = out.authorization_protocol_name_len = auth_info->namelen; + parts[count++].iov_base = auth_info->name; + parts[count].iov_len = XCB_PAD(out.authorization_protocol_name_len); + parts[count++].iov_base = (char *) pad; + parts[count].iov_len = out.authorization_protocol_data_len = auth_info->datalen; + parts[count++].iov_base = auth_info->data; + parts[count].iov_len = XCB_PAD(out.authorization_protocol_data_len); + parts[count++].iov_base = (char *) pad; + } + assert(count <= (int) (sizeof(parts) / sizeof(*parts))); + + pthread_mutex_lock(&c->iolock); + ret = _xcb_out_send(c, parts, count); + pthread_mutex_unlock(&c->iolock); + return ret; +} + +static int read_setup(xcb_connection_t *c) +{ + const char newline = '\n'; + + /* Read the server response */ + c->setup = malloc(sizeof(xcb_setup_generic_t)); + if(!c->setup) + return 0; + + if(_xcb_in_read_block(c, c->setup, sizeof(xcb_setup_generic_t)) != sizeof(xcb_setup_generic_t)) + return 0; + + { + void *tmp = realloc(c->setup, c->setup->length * 4 + sizeof(xcb_setup_generic_t)); + if(!tmp) + return 0; + c->setup = tmp; + } + + if(_xcb_in_read_block(c, (char *) c->setup + sizeof(xcb_setup_generic_t), c->setup->length * 4) <= 0) + return 0; + + /* 0 = failed, 2 = authenticate, 1 = success */ + switch(c->setup->status) + { + case 0: /* failed */ + { + xcb_setup_failed_t *setup = (xcb_setup_failed_t *) c->setup; + write(STDERR_FILENO, xcb_setup_failed_reason(setup), xcb_setup_failed_reason_length(setup)); + write(STDERR_FILENO, &newline, 1); + return 0; + } + + case 2: /* authenticate */ + { + xcb_setup_authenticate_t *setup = (xcb_setup_authenticate_t *) c->setup; + write(STDERR_FILENO, xcb_setup_authenticate_reason(setup), xcb_setup_authenticate_reason_length(setup)); + write(STDERR_FILENO, &newline, 1); + return 0; + } + } + + return 1; +} + +/* precondition: there must be something for us to write. */ +static int write_vec(xcb_connection_t *c, struct iovec **vector, int *count) +{ +#ifndef _WIN32 + int n; +#endif + + assert(!c->out.queue_len); + +#ifdef _WIN32 + /* Could use the WSASend win32 function for scatter/gather i/o but setting up the WSABUF struct from + an iovec would require more work and I'm not sure of the benefit....works for now */ + while (*count) + { + struct iovec *vec = *vector; + if (vec->iov_len) + { + int ret = send(c->fd, vec->iov_base, vec->iov_len, 0); + if (ret == SOCKET_ERROR) + { + int err = WSAGetLastError(); + if (err == WSAEWOULDBLOCK) + { + return 1; + } + } + if (ret <= 0) + { + _xcb_conn_shutdown(c, XCB_CONN_ERROR); + return 0; + } + c->out.total_written += ret; + vec->iov_len -= ret; + vec->iov_base = (char *)vec->iov_base + ret; + } + if (vec->iov_len == 0) { + (*vector)++; + (*count)--; + } + } + + if (!*count) + *vector = 0; + +#else + n = *count; + if (n > IOV_MAX) + n = IOV_MAX; + +#if HAVE_SENDMSG + if (c->out.out_fd.nfd) { + union { + struct cmsghdr cmsghdr; + char buf[CMSG_SPACE(XCB_MAX_PASS_FD * sizeof(int))]; + } cmsgbuf; + struct msghdr msg = { + .msg_name = NULL, + .msg_namelen = 0, + .msg_iov = *vector, + .msg_iovlen = n, + .msg_control = cmsgbuf.buf, + .msg_controllen = CMSG_LEN(c->out.out_fd.nfd * sizeof (int)), + }; + int i; + struct cmsghdr *hdr = CMSG_FIRSTHDR(&msg); + + hdr->cmsg_len = msg.msg_controllen; + hdr->cmsg_level = SOL_SOCKET; + hdr->cmsg_type = SCM_RIGHTS; + memcpy(CMSG_DATA(hdr), c->out.out_fd.fd, c->out.out_fd.nfd * sizeof (int)); + + n = sendmsg(c->fd, &msg, 0); + if(n < 0 && errno == EAGAIN) + return 1; + for (i = 0; i < c->out.out_fd.nfd; i++) + close(c->out.out_fd.fd[i]); + c->out.out_fd.nfd = 0; + } else +#endif + { + n = writev(c->fd, *vector, n); + if(n < 0 && errno == EAGAIN) + return 1; + } + + if(n <= 0) + { + _xcb_conn_shutdown(c, XCB_CONN_ERROR); + return 0; + } + + c->out.total_written += n; + for(; *count; --*count, ++*vector) + { + int cur = (*vector)->iov_len; + if(cur > n) + cur = n; + (*vector)->iov_len -= cur; + (*vector)->iov_base = (char *) (*vector)->iov_base + cur; + n -= cur; + if((*vector)->iov_len) + break; + } + if(!*count) + *vector = 0; + assert(n == 0); + +#endif /* _WIN32 */ + + return 1; +} + +/* Public interface */ + +const xcb_setup_t *xcb_get_setup(xcb_connection_t *c) +{ + if(is_static_error_conn(c)) + return &xcb_error_setup; + /* doesn't need locking because it's never written to. */ + return c->setup; +} + +int xcb_get_file_descriptor(xcb_connection_t *c) +{ + if(is_static_error_conn(c)) + return -1; + /* doesn't need locking because it's never written to. */ + return c->fd; +} + +int xcb_connection_has_error(xcb_connection_t *c) +{ + /* doesn't need locking because it's read and written atomically. */ + return c->has_error; +} + +xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info) +{ + xcb_connection_t* c; + +#ifndef _WIN32 +#ifndef USE_POLL + if(fd >= FD_SETSIZE) /* would overflow in FD_SET */ + { + close(fd); + return _xcb_conn_ret_error(XCB_CONN_ERROR); + } +#endif +#endif /* !_WIN32*/ + + c = calloc(1, sizeof(xcb_connection_t)); + if(!c) { +#ifdef _WIN32 + closesocket(fd); +#else + close(fd); +#endif + return _xcb_conn_ret_error(XCB_CONN_CLOSED_MEM_INSUFFICIENT) ; + } + + c->fd = fd; + + if(!( + set_fd_flags(fd) && + pthread_mutex_init(&c->iolock, 0) == 0 && + _xcb_in_init(&c->in) && + _xcb_out_init(&c->out) && + write_setup(c, auth_info) && + read_setup(c) && + _xcb_ext_init(c) && + _xcb_xid_init(c) + )) + { + xcb_disconnect(c); + return _xcb_conn_ret_error(XCB_CONN_ERROR); + } + + return c; +} + +void xcb_disconnect(xcb_connection_t *c) +{ + if(c == NULL || is_static_error_conn(c)) + return; + + free(c->setup); + + /* disallow further sends and receives */ + shutdown(c->fd, SHUT_RDWR); +#ifdef _WIN32 + closesocket(c->fd); +#else + close(c->fd); +#endif + + pthread_mutex_destroy(&c->iolock); + _xcb_in_destroy(&c->in); + _xcb_out_destroy(&c->out); + + _xcb_ext_destroy(c); + _xcb_xid_destroy(c); + + free(c); + +#ifdef _WIN32 + WSACleanup(); +#endif +} + +/* Private interface */ + +void _xcb_conn_shutdown(xcb_connection_t *c, int err) +{ + c->has_error = err; +} + +/* Return connection error state. + * To make thread-safe, I need a seperate static + * variable for every possible error. + * has_error is the first field in xcb_connection_t, so just + * return a casted int here; checking has_error (and only + * has_error) will be safe. + */ +xcb_connection_t *_xcb_conn_ret_error(int err) +{ + + switch(err) + { + case XCB_CONN_CLOSED_MEM_INSUFFICIENT: + { + return (xcb_connection_t *) &xcb_con_closed_mem_er; + } + case XCB_CONN_CLOSED_PARSE_ERR: + { + return (xcb_connection_t *) &xcb_con_closed_parse_er; + } + case XCB_CONN_CLOSED_INVALID_SCREEN: + { + return (xcb_connection_t *) &xcb_con_closed_screen_er; + } + case XCB_CONN_ERROR: + default: + { + return (xcb_connection_t *) &xcb_con_error; + } + } +} + +int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vector, int *count) +{ + int ret; +#if USE_POLL + struct pollfd fd; +#else + fd_set rfds, wfds; +#endif + + /* If the thing I should be doing is already being done, wait for it. */ + if(count ? c->out.writing : c->in.reading) + { + pthread_cond_wait(cond, &c->iolock); + return 1; + } + +#if USE_POLL + memset(&fd, 0, sizeof(fd)); + fd.fd = c->fd; + fd.events = POLLIN; +#else + FD_ZERO(&rfds); + FD_SET(c->fd, &rfds); +#endif + ++c->in.reading; + +#if USE_POLL + if(count) + { + fd.events |= POLLOUT; + ++c->out.writing; + } +#else + FD_ZERO(&wfds); + if(count) + { + FD_SET(c->fd, &wfds); + ++c->out.writing; + } +#endif + + pthread_mutex_unlock(&c->iolock); + do { +#if USE_POLL + ret = poll(&fd, 1, -1); + /* If poll() returns an event we didn't expect, such as POLLNVAL, treat + * it as if it failed. */ + if(ret >= 0 && (fd.revents & ~fd.events)) + { + ret = -1; + break; + } +#else + ret = select(c->fd + 1, &rfds, &wfds, 0, 0); +#endif + } while (ret == -1 && errno == EINTR); + if(ret < 0) + { + _xcb_conn_shutdown(c, XCB_CONN_ERROR); + ret = 0; + } + pthread_mutex_lock(&c->iolock); + + if(ret) + { + /* The code allows two threads to call select()/poll() at the same time. + * First thread just wants to read, a second thread wants to write, too. + * We have to make sure that we don't steal the reading thread's reply + * and let it get stuck in select()/poll(). + * So a thread may read if either: + * - There is no other thread that wants to read (the above situation + * did not occur). + * - It is the reading thread (above situation occurred). + */ + int may_read = c->in.reading == 1 || !count; +#if USE_POLL + if(may_read && (fd.revents & POLLIN) != 0) +#else + if(may_read && FD_ISSET(c->fd, &rfds)) +#endif + ret = ret && _xcb_in_read(c); + +#if USE_POLL + if((fd.revents & POLLOUT) != 0) +#else + if(FD_ISSET(c->fd, &wfds)) +#endif + ret = ret && write_vec(c, vector, count); + } + + if(count) + --c->out.writing; + --c->in.reading; + + return ret; +} + +uint64_t xcb_total_read(xcb_connection_t *c) +{ + uint64_t n; + + if (xcb_connection_has_error(c)) + return 0; + + pthread_mutex_lock(&c->iolock); + n = c->in.total_read; + pthread_mutex_unlock(&c->iolock); + return n; +} + +uint64_t xcb_total_written(xcb_connection_t *c) +{ + uint64_t n; + + if (xcb_connection_has_error(c)) + return 0; + + pthread_mutex_lock(&c->iolock); + n = c->out.total_written; + pthread_mutex_unlock(&c->iolock); + + return n; +} diff --git a/depends/libxcb/src/xcb_ext.c b/depends/libxcb/src/xcb_ext.c new file mode 100644 index 0000000..831f283 --- /dev/null +++ b/depends/libxcb/src/xcb_ext.c @@ -0,0 +1,131 @@ +/* Copyright (C) 2001-2004 Bart Massey and Jamey Sharp. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the names of the authors or their + * institutions shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the authors. + */ + +/* A cache for QueryExtension results. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdlib.h> +#include <string.h> + +#include "xcb.h" +#include "xcbext.h" +#include "xcbint.h" + +typedef struct lazyreply { + enum lazy_reply_tag tag; + union { + xcb_query_extension_cookie_t cookie; + xcb_query_extension_reply_t *reply; + } value; +} lazyreply; + +static lazyreply *get_index(xcb_connection_t *c, int idx) +{ + if(idx > c->ext.extensions_size) + { + int new_size = idx << 1; + lazyreply *new_extensions = realloc(c->ext.extensions, sizeof(lazyreply) * new_size); + if(!new_extensions) + return 0; + memset(new_extensions + c->ext.extensions_size, 0, sizeof(lazyreply) * (new_size - c->ext.extensions_size)); + c->ext.extensions = new_extensions; + c->ext.extensions_size = new_size; + } + return c->ext.extensions + idx - 1; +} + +static lazyreply *get_lazyreply(xcb_connection_t *c, xcb_extension_t *ext) +{ + static pthread_mutex_t global_lock = PTHREAD_MUTEX_INITIALIZER; + static int next_global_id; + + lazyreply *data; + + pthread_mutex_lock(&global_lock); + if(!ext->global_id) + ext->global_id = ++next_global_id; + pthread_mutex_unlock(&global_lock); + + data = get_index(c, ext->global_id); + if(data && data->tag == LAZY_NONE) + { + /* cache miss: query the server */ + data->tag = LAZY_COOKIE; + data->value.cookie = xcb_query_extension(c, strlen(ext->name), ext->name); + } + return data; +} + +/* Public interface */ + +/* Do not free the returned xcb_query_extension_reply_t - on return, it's aliased + * from the cache. */ +const xcb_query_extension_reply_t *xcb_get_extension_data(xcb_connection_t *c, xcb_extension_t *ext) +{ + lazyreply *data; + if(c->has_error) + return 0; + + pthread_mutex_lock(&c->ext.lock); + data = get_lazyreply(c, ext); + if(data && data->tag == LAZY_COOKIE) + { + data->tag = LAZY_FORCED; + data->value.reply = xcb_query_extension_reply(c, data->value.cookie, 0); + } + pthread_mutex_unlock(&c->ext.lock); + + return data ? data->value.reply : 0; +} + +void xcb_prefetch_extension_data(xcb_connection_t *c, xcb_extension_t *ext) +{ + if(c->has_error) + return; + pthread_mutex_lock(&c->ext.lock); + get_lazyreply(c, ext); + pthread_mutex_unlock(&c->ext.lock); +} + +/* Private interface */ + +int _xcb_ext_init(xcb_connection_t *c) +{ + if(pthread_mutex_init(&c->ext.lock, 0)) + return 0; + return 1; +} + +void _xcb_ext_destroy(xcb_connection_t *c) +{ + pthread_mutex_destroy(&c->ext.lock); + while(c->ext.extensions_size-- > 0) + if(c->ext.extensions[c->ext.extensions_size].tag == LAZY_FORCED) + free(c->ext.extensions[c->ext.extensions_size].value.reply); + free(c->ext.extensions); +} diff --git a/depends/libxcb/src/xcb_in.c b/depends/libxcb/src/xcb_in.c new file mode 100644 index 0000000..c9a264d --- /dev/null +++ b/depends/libxcb/src/xcb_in.c @@ -0,0 +1,1096 @@ +/* Copyright (C) 2001-2004 Bart Massey and Jamey Sharp. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the names of the authors or their + * institutions shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the authors. + */ + +/* Stuff that reads stuff from the server. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <assert.h> +#include <string.h> +#include <stdlib.h> +#include <stdio.h> +#include <errno.h> + +#if USE_POLL +#include <poll.h> +#endif +#ifndef _WIN32 +#include <unistd.h> +#include <sys/select.h> +#include <sys/socket.h> +#endif + +#ifdef _WIN32 +#include "xcb_windefs.h" +#endif /* _WIN32 */ + +#include "xcb.h" +#include "xcbext.h" +#include "xcbint.h" + +#define XCB_ERROR 0 +#define XCB_REPLY 1 +#define XCB_XGE_EVENT 35 + +struct event_list { + xcb_generic_event_t *event; + struct event_list *next; +}; + +struct xcb_special_event { + + struct xcb_special_event *next; + + /* Match XGE events for the specific extension and event ID (the + * first 32 bit word after evtype) + */ + uint8_t extension; + uint32_t eid; + uint32_t *stamp; + + struct event_list *events; + struct event_list **events_tail; + + pthread_cond_t special_event_cond; +}; + +struct reply_list { + void *reply; + struct reply_list *next; +}; + +typedef struct pending_reply { + uint64_t first_request; + uint64_t last_request; + enum workarounds workaround; + int flags; + struct pending_reply *next; +} pending_reply; + +typedef struct reader_list { + uint64_t request; + pthread_cond_t *data; + struct reader_list *next; +} reader_list; + +typedef struct special_list { + xcb_special_event_t *se; + struct special_list *next; +} special_list; + +static void remove_finished_readers(reader_list **prev_reader, uint64_t completed) +{ + while(*prev_reader && XCB_SEQUENCE_COMPARE((*prev_reader)->request, <=, completed)) + { + /* If you don't have what you're looking for now, you never + * will. Wake up and leave me alone. */ + pthread_cond_signal((*prev_reader)->data); + *prev_reader = (*prev_reader)->next; + } +} + +#if HAVE_SENDMSG +static int read_fds(xcb_connection_t *c, int *fds, int nfd) +{ + int *ifds = &c->in.in_fd.fd[c->in.in_fd.ifd]; + int infd = c->in.in_fd.nfd - c->in.in_fd.ifd; + + if (nfd > infd) + return 0; + memcpy(fds, ifds, nfd * sizeof (int)); + c->in.in_fd.ifd += nfd; + return 1; +} +#endif + +typedef struct xcb_ge_special_event_t { + uint8_t response_type; /**< */ + uint8_t extension; /**< */ + uint16_t sequence; /**< */ + uint32_t length; /**< */ + uint16_t evtype; /**< */ + uint8_t pad0[2]; /**< */ + uint32_t eid; /**< */ + uint8_t pad1[16]; /**< */ +} xcb_ge_special_event_t; + +static int event_special(xcb_connection_t *c, + struct event_list *event) +{ + struct xcb_special_event *special_event; + struct xcb_ge_special_event_t *ges = (void *) event->event; + + /* Special events are always XGE events */ + if ((ges->response_type & 0x7f) != XCB_XGE_EVENT) + return 0; + + for (special_event = c->in.special_events; + special_event; + special_event = special_event->next) + { + if (ges->extension == special_event->extension && + ges->eid == special_event->eid) + { + *special_event->events_tail = event; + special_event->events_tail = &event->next; + if (special_event->stamp) + ++(*special_event->stamp); + pthread_cond_signal(&special_event->special_event_cond); + return 1; + } + } + + return 0; +} + +static int read_packet(xcb_connection_t *c) +{ + xcb_generic_reply_t genrep; + uint64_t length = 32; + uint64_t eventlength = 0; /* length after first 32 bytes for GenericEvents */ + int nfd = 0; /* Number of file descriptors attached to the reply */ + uint64_t bufsize; + void *buf; + pending_reply *pend = 0; + struct event_list *event; + + /* Wait for there to be enough data for us to read a whole packet */ + if(c->in.queue_len < length) + return 0; + + /* Get the response type, length, and sequence number. */ + memcpy(&genrep, c->in.queue, sizeof(genrep)); + + /* Compute 32-bit sequence number of this packet. */ + if((genrep.response_type & 0x7f) != XCB_KEYMAP_NOTIFY) + { + uint64_t lastread = c->in.request_read; + c->in.request_read = (lastread & UINT64_C(0xffffffffffff0000)) | genrep.sequence; + if(XCB_SEQUENCE_COMPARE(c->in.request_read, <, lastread)) + c->in.request_read += 0x10000; + if(XCB_SEQUENCE_COMPARE(c->in.request_read, >, c->in.request_expected)) + c->in.request_expected = c->in.request_read; + + if(c->in.request_read != lastread) + { + if(c->in.current_reply) + { + _xcb_map_put(c->in.replies, lastread, c->in.current_reply); + c->in.current_reply = 0; + c->in.current_reply_tail = &c->in.current_reply; + } + c->in.request_completed = c->in.request_read - 1; + } + + while(c->in.pending_replies && + c->in.pending_replies->workaround != WORKAROUND_EXTERNAL_SOCKET_OWNER && + XCB_SEQUENCE_COMPARE (c->in.pending_replies->last_request, <=, c->in.request_completed)) + { + pending_reply *oldpend = c->in.pending_replies; + c->in.pending_replies = oldpend->next; + if(!oldpend->next) + c->in.pending_replies_tail = &c->in.pending_replies; + free(oldpend); + } + + if(genrep.response_type == XCB_ERROR) + c->in.request_completed = c->in.request_read; + + remove_finished_readers(&c->in.readers, c->in.request_completed); + } + + if(genrep.response_type == XCB_ERROR || genrep.response_type == XCB_REPLY) + { + pend = c->in.pending_replies; + if(pend && + !(XCB_SEQUENCE_COMPARE(pend->first_request, <=, c->in.request_read) && + (pend->workaround == WORKAROUND_EXTERNAL_SOCKET_OWNER || + XCB_SEQUENCE_COMPARE(c->in.request_read, <=, pend->last_request)))) + pend = 0; + } + + /* For reply packets, check that the entire packet is available. */ + if(genrep.response_type == XCB_REPLY) + { + if(pend && pend->workaround == WORKAROUND_GLX_GET_FB_CONFIGS_BUG) + { + uint32_t *p = (uint32_t *) c->in.queue; + uint64_t new_length = ((uint64_t)p[2]) * ((uint64_t)p[3]); + if(new_length >= (UINT32_MAX / UINT32_C(16))) + { + _xcb_conn_shutdown(c, XCB_CONN_CLOSED_MEM_INSUFFICIENT); + return 0; + } + genrep.length = (uint32_t)(new_length * UINT64_C(2)); + } + length += genrep.length * UINT64_C(4); + + /* XXX a bit of a hack -- we "know" that all FD replys place + * the number of fds in the pad0 byte */ + if (pend && pend->flags & XCB_REQUEST_REPLY_FDS) + nfd = genrep.pad0; + } + + /* XGE events may have sizes > 32 */ + if ((genrep.response_type & 0x7f) == XCB_XGE_EVENT) + eventlength = genrep.length * UINT64_C(4); + + bufsize = length + eventlength + nfd * sizeof(int) + + (genrep.response_type == XCB_REPLY ? 0 : sizeof(uint32_t)); + if (bufsize < INT32_MAX) + buf = malloc((size_t) bufsize); + else + buf = NULL; + if(!buf) + { + _xcb_conn_shutdown(c, XCB_CONN_CLOSED_MEM_INSUFFICIENT); + return 0; + } + + if(_xcb_in_read_block(c, buf, length) <= 0) + { + free(buf); + return 0; + } + + /* pull in XGE event data if available, append after event struct */ + if (eventlength) + { + if(_xcb_in_read_block(c, &((xcb_generic_event_t*)buf)[1], eventlength) <= 0) + { + free(buf); + return 0; + } + } + +#if HAVE_SENDMSG + if (nfd) + { + if (!read_fds(c, (int *) &((char *) buf)[length], nfd)) + { + free(buf); + return 0; + } + } +#endif + + if(pend && (pend->flags & XCB_REQUEST_DISCARD_REPLY)) + { + free(buf); + return 1; + } + + if(genrep.response_type != XCB_REPLY) + ((xcb_generic_event_t *) buf)->full_sequence = c->in.request_read; + + /* reply, or checked error */ + if( genrep.response_type == XCB_REPLY || + (genrep.response_type == XCB_ERROR && pend && (pend->flags & XCB_REQUEST_CHECKED))) + { + struct reply_list *cur = malloc(sizeof(struct reply_list)); + if(!cur) + { + _xcb_conn_shutdown(c, XCB_CONN_CLOSED_MEM_INSUFFICIENT); + free(buf); + return 0; + } + cur->reply = buf; + cur->next = 0; + *c->in.current_reply_tail = cur; + c->in.current_reply_tail = &cur->next; + if(c->in.readers && c->in.readers->request == c->in.request_read) + pthread_cond_signal(c->in.readers->data); + return 1; + } + + /* event, or unchecked error */ + event = malloc(sizeof(struct event_list)); + if(!event) + { + _xcb_conn_shutdown(c, XCB_CONN_CLOSED_MEM_INSUFFICIENT); + free(buf); + return 0; + } + event->event = buf; + event->next = 0; + + if (!event_special(c, event)) { + *c->in.events_tail = event; + c->in.events_tail = &event->next; + pthread_cond_signal(&c->in.event_cond); + } + return 1; /* I have something for you... */ +} + +static xcb_generic_event_t *get_event(xcb_connection_t *c) +{ + struct event_list *cur = c->in.events; + xcb_generic_event_t *ret; + if(!c->in.events) + return 0; + ret = cur->event; + c->in.events = cur->next; + if(!cur->next) + c->in.events_tail = &c->in.events; + free(cur); + return ret; +} + +static void free_reply_list(struct reply_list *head) +{ + while(head) + { + struct reply_list *cur = head; + head = cur->next; + free(cur->reply); + free(cur); + } +} + +static int read_block(const int fd, void *buf, const intptr_t len) +{ + int done = 0; + while(done < len) + { + int ret = recv(fd, ((char *) buf) + done, len - done, 0); + if(ret > 0) + done += ret; +#ifndef _WIN32 + if(ret < 0 && errno == EAGAIN) +#else + if(ret == SOCKET_ERROR && WSAGetLastError() == WSAEWOULDBLOCK) +#endif /* !_Win32 */ + { +#if USE_POLL + struct pollfd pfd; + pfd.fd = fd; + pfd.events = POLLIN; + pfd.revents = 0; + do { + ret = poll(&pfd, 1, -1); + } while (ret == -1 && errno == EINTR); +#else + fd_set fds; + FD_ZERO(&fds); + FD_SET(fd, &fds); + + /* Initializing errno here makes sure that for Win32 this loop will execute only once */ + errno = 0; + do { + ret = select(fd + 1, &fds, 0, 0, 0); + } while (ret == -1 && errno == EINTR); +#endif /* USE_POLL */ + } + if(ret <= 0) + return ret; + } + return len; +} + +static int poll_for_reply(xcb_connection_t *c, uint64_t request, void **reply, xcb_generic_error_t **error) +{ + struct reply_list *head; + + /* If an error occurred when issuing the request, fail immediately. */ + if(!request) + head = 0; + /* We've read requests past the one we want, so if it has replies we have + * them all and they're in the replies map. */ + else if(XCB_SEQUENCE_COMPARE(request, <, c->in.request_read)) + { + head = _xcb_map_remove(c->in.replies, request); + if(head && head->next) + _xcb_map_put(c->in.replies, request, head->next); + } + /* We're currently processing the responses to the request we want, and we + * have a reply ready to return. So just return it without blocking. */ + else if(request == c->in.request_read && c->in.current_reply) + { + head = c->in.current_reply; + c->in.current_reply = head->next; + if(!head->next) + c->in.current_reply_tail = &c->in.current_reply; + } + /* We know this request can't have any more replies, and we've already + * established it doesn't have a reply now. Don't bother blocking. */ + else if(request == c->in.request_completed) + head = 0; + /* We may have more replies on the way for this request: block until we're + * sure. */ + else + return 0; + + if(error) + *error = 0; + *reply = 0; + + if(head) + { + if(((xcb_generic_reply_t *) head->reply)->response_type == XCB_ERROR) + { + if(error) + *error = head->reply; + else + free(head->reply); + } + else + *reply = head->reply; + + free(head); + } + + return 1; +} + +static void insert_reader(reader_list **prev_reader, reader_list *reader, uint64_t request, pthread_cond_t *cond) +{ + while(*prev_reader && XCB_SEQUENCE_COMPARE((*prev_reader)->request, <=, request)) + prev_reader = &(*prev_reader)->next; + reader->request = request; + reader->data = cond; + reader->next = *prev_reader; + *prev_reader = reader; +} + +static void remove_reader(reader_list **prev_reader, reader_list *reader) +{ + while(*prev_reader && XCB_SEQUENCE_COMPARE((*prev_reader)->request, <=, reader->request)) + if(*prev_reader == reader) + { + *prev_reader = (*prev_reader)->next; + break; + } +} + +static void insert_special(special_list **prev_special, special_list *special, xcb_special_event_t *se) +{ + special->se = se; + special->next = *prev_special; + *prev_special = special; +} + +static void remove_special(special_list **prev_special, special_list *special) +{ + while(*prev_special) + { + if(*prev_special == special) + { + *prev_special = (*prev_special)->next; + break; + } + prev_special = &(*prev_special)->next; + } +} + +static void *wait_for_reply(xcb_connection_t *c, uint64_t request, xcb_generic_error_t **e) +{ + void *ret = 0; + + /* If this request has not been written yet, write it. */ + if(c->out.return_socket || _xcb_out_flush_to(c, request)) + { + pthread_cond_t cond = PTHREAD_COND_INITIALIZER; + reader_list reader; + + insert_reader(&c->in.readers, &reader, request, &cond); + + while(!poll_for_reply(c, request, &ret, e)) + if(!_xcb_conn_wait(c, &cond, 0, 0)) + break; + + remove_reader(&c->in.readers, &reader); + pthread_cond_destroy(&cond); + } + + _xcb_in_wake_up_next_reader(c); + return ret; +} + +static uint64_t widen(xcb_connection_t *c, unsigned int request) +{ + uint64_t widened_request = (c->out.request & UINT64_C(0xffffffff00000000)) | request; + if(widened_request > c->out.request) + widened_request -= UINT64_C(1) << 32; + return widened_request; +} + +/* Public interface */ + +void *xcb_wait_for_reply(xcb_connection_t *c, unsigned int request, xcb_generic_error_t **e) +{ + void *ret; + if(e) + *e = 0; + if(c->has_error) + return 0; + + pthread_mutex_lock(&c->iolock); + ret = wait_for_reply(c, widen(c, request), e); + pthread_mutex_unlock(&c->iolock); + return ret; +} + +void *xcb_wait_for_reply64(xcb_connection_t *c, uint64_t request, xcb_generic_error_t **e) +{ + void *ret; + if(e) + *e = 0; + if(c->has_error) + return 0; + + pthread_mutex_lock(&c->iolock); + ret = wait_for_reply(c, request, e); + pthread_mutex_unlock(&c->iolock); + return ret; +} + +int *xcb_get_reply_fds(xcb_connection_t *c, void *reply, size_t reply_size) +{ + return (int *) (&((char *) reply)[reply_size]); +} + +static void insert_pending_discard(xcb_connection_t *c, pending_reply **prev_next, uint64_t seq) +{ + pending_reply *pend; + pend = malloc(sizeof(*pend)); + if(!pend) + { + _xcb_conn_shutdown(c, XCB_CONN_CLOSED_MEM_INSUFFICIENT); + return; + } + + pend->first_request = seq; + pend->last_request = seq; + pend->workaround = 0; + pend->flags = XCB_REQUEST_DISCARD_REPLY; + pend->next = *prev_next; + *prev_next = pend; + + if(!pend->next) + c->in.pending_replies_tail = &pend->next; +} + +static void discard_reply(xcb_connection_t *c, uint64_t request) +{ + void *reply; + pending_reply **prev_pend; + + /* Free any replies or errors that we've already read. Stop if + * xcb_wait_for_reply would block or we've run out of replies. */ + while(poll_for_reply(c, request, &reply, 0) && reply) + free(reply); + + /* If we've proven there are no more responses coming, we're done. */ + if(XCB_SEQUENCE_COMPARE(request, <=, c->in.request_completed)) + return; + + /* Walk the list of pending requests. Mark the first match for deletion. */ + for(prev_pend = &c->in.pending_replies; *prev_pend; prev_pend = &(*prev_pend)->next) + { + if(XCB_SEQUENCE_COMPARE((*prev_pend)->first_request, >, request)) + break; + + if((*prev_pend)->first_request == request) + { + /* Pending reply found. Mark for discard: */ + (*prev_pend)->flags |= XCB_REQUEST_DISCARD_REPLY; + return; + } + } + + /* Pending reply not found (likely due to _unchecked request). Create one: */ + insert_pending_discard(c, prev_pend, request); +} + +void xcb_discard_reply(xcb_connection_t *c, unsigned int sequence) +{ + if(c->has_error) + return; + + /* If an error occurred when issuing the request, fail immediately. */ + if(!sequence) + return; + + pthread_mutex_lock(&c->iolock); + discard_reply(c, widen(c, sequence)); + pthread_mutex_unlock(&c->iolock); +} + +void xcb_discard_reply64(xcb_connection_t *c, uint64_t sequence) +{ + if(c->has_error) + return; + + /* If an error occurred when issuing the request, fail immediately. */ + if(!sequence) + return; + + pthread_mutex_lock(&c->iolock); + discard_reply(c, sequence); + pthread_mutex_unlock(&c->iolock); +} + +int xcb_poll_for_reply(xcb_connection_t *c, unsigned int request, void **reply, xcb_generic_error_t **error) +{ + int ret; + if(c->has_error) + { + *reply = 0; + if(error) + *error = 0; + return 1; /* would not block */ + } + assert(reply != 0); + pthread_mutex_lock(&c->iolock); + ret = poll_for_reply(c, widen(c, request), reply, error); + if(!ret && c->in.reading == 0 && _xcb_in_read(c)) /* _xcb_in_read shuts down the connection on error */ + ret = poll_for_reply(c, widen(c, request), reply, error); + pthread_mutex_unlock(&c->iolock); + return ret; +} + +int xcb_poll_for_reply64(xcb_connection_t *c, uint64_t request, void **reply, xcb_generic_error_t **error) +{ + int ret; + if(c->has_error) + { + *reply = 0; + if(error) + *error = 0; + return 1; /* would not block */ + } + assert(reply != 0); + pthread_mutex_lock(&c->iolock); + ret = poll_for_reply(c, request, reply, error); + if(!ret && c->in.reading == 0 && _xcb_in_read(c)) /* _xcb_in_read shuts down the connection on error */ + ret = poll_for_reply(c, request, reply, error); + pthread_mutex_unlock(&c->iolock); + return ret; +} + +xcb_generic_event_t *xcb_wait_for_event(xcb_connection_t *c) +{ + xcb_generic_event_t *ret; + if(c->has_error) + return 0; + pthread_mutex_lock(&c->iolock); + /* get_event returns 0 on empty list. */ + while(!(ret = get_event(c))) + if(!_xcb_conn_wait(c, &c->in.event_cond, 0, 0)) + break; + + _xcb_in_wake_up_next_reader(c); + pthread_mutex_unlock(&c->iolock); + return ret; +} + +static xcb_generic_event_t *poll_for_next_event(xcb_connection_t *c, int queued) +{ + xcb_generic_event_t *ret = 0; + if(!c->has_error) + { + pthread_mutex_lock(&c->iolock); + /* FIXME: follow X meets Z architecture changes. */ + ret = get_event(c); + if(!ret && !queued && c->in.reading == 0 && _xcb_in_read(c)) /* _xcb_in_read shuts down the connection on error */ + ret = get_event(c); + pthread_mutex_unlock(&c->iolock); + } + return ret; +} + +xcb_generic_event_t *xcb_poll_for_event(xcb_connection_t *c) +{ + return poll_for_next_event(c, 0); +} + +xcb_generic_event_t *xcb_poll_for_queued_event(xcb_connection_t *c) +{ + return poll_for_next_event(c, 1); +} + +xcb_generic_error_t *xcb_request_check(xcb_connection_t *c, xcb_void_cookie_t cookie) +{ + uint64_t request; + xcb_generic_error_t *ret = 0; + void *reply; + if(c->has_error) + return 0; + pthread_mutex_lock(&c->iolock); + request = widen(c, cookie.sequence); + if (XCB_SEQUENCE_COMPARE(request, >, c->in.request_completed)) + { + if(XCB_SEQUENCE_COMPARE(request, >=, c->in.request_expected)) + { + _xcb_out_send_sync(c); + } + if (XCB_SEQUENCE_COMPARE(request, >=, c->out.request_expected_written)) + { + _xcb_out_flush_to(c, c->out.request); + } + } + reply = wait_for_reply(c, request, &ret); + assert(!reply); + pthread_mutex_unlock(&c->iolock); + return ret; +} + +static xcb_generic_event_t *get_special_event(xcb_connection_t *c, + xcb_special_event_t *se) +{ + xcb_generic_event_t *event = NULL; + struct event_list *events; + + if ((events = se->events) != NULL) { + event = events->event; + if (!(se->events = events->next)) + se->events_tail = &se->events; + free (events); + } + return event; +} + +xcb_generic_event_t *xcb_poll_for_special_event(xcb_connection_t *c, + xcb_special_event_t *se) +{ + xcb_generic_event_t *event; + + if(c->has_error) + return 0; + pthread_mutex_lock(&c->iolock); + event = get_special_event(c, se); + if(!event && c->in.reading == 0 && _xcb_in_read(c)) /* _xcb_in_read shuts down the connection on error */ + event = get_special_event(c, se); + pthread_mutex_unlock(&c->iolock); + return event; +} + +xcb_generic_event_t *xcb_wait_for_special_event(xcb_connection_t *c, + xcb_special_event_t *se) +{ + special_list special; + xcb_generic_event_t *event; + + if(c->has_error) + return 0; + pthread_mutex_lock(&c->iolock); + + insert_special(&c->in.special_waiters, &special, se); + + /* get_special_event returns 0 on empty list. */ + while(!(event = get_special_event(c, se))) + if(!_xcb_conn_wait(c, &se->special_event_cond, 0, 0)) + break; + + remove_special(&c->in.special_waiters, &special); + + _xcb_in_wake_up_next_reader(c); + pthread_mutex_unlock(&c->iolock); + return event; +} + +xcb_special_event_t * +xcb_register_for_special_xge(xcb_connection_t *c, + xcb_extension_t *ext, + uint32_t eid, + uint32_t *stamp) +{ + xcb_special_event_t *se; + const xcb_query_extension_reply_t *ext_reply; + + if(c->has_error) + return NULL; + ext_reply = xcb_get_extension_data(c, ext); + if (!ext_reply) + return NULL; + pthread_mutex_lock(&c->iolock); + for (se = c->in.special_events; se; se = se->next) { + if (se->extension == ext_reply->major_opcode && + se->eid == eid) { + pthread_mutex_unlock(&c->iolock); + return NULL; + } + } + se = calloc(1, sizeof(xcb_special_event_t)); + if (!se) { + pthread_mutex_unlock(&c->iolock); + return NULL; + } + + se->extension = ext_reply->major_opcode; + se->eid = eid; + + se->events = NULL; + se->events_tail = &se->events; + se->stamp = stamp; + + pthread_cond_init(&se->special_event_cond, 0); + + se->next = c->in.special_events; + c->in.special_events = se; + pthread_mutex_unlock(&c->iolock); + return se; +} + +void +xcb_unregister_for_special_event(xcb_connection_t *c, + xcb_special_event_t *se) +{ + xcb_special_event_t *s, **prev; + struct event_list *events, *next; + + if (!se) + return; + + if (c->has_error) + return; + + pthread_mutex_lock(&c->iolock); + + for (prev = &c->in.special_events; (s = *prev) != NULL; prev = &(s->next)) { + if (s == se) { + *prev = se->next; + for (events = se->events; events; events = next) { + next = events->next; + free (events->event); + free (events); + } + pthread_cond_destroy(&se->special_event_cond); + free (se); + break; + } + } + pthread_mutex_unlock(&c->iolock); +} + +/* Private interface */ + +int _xcb_in_init(_xcb_in *in) +{ + if(pthread_cond_init(&in->event_cond, 0)) + return 0; + in->reading = 0; + + in->queue_len = 0; + + in->request_read = 0; + in->request_completed = 0; + + in->replies = _xcb_map_new(); + if(!in->replies) + return 0; + + in->current_reply_tail = &in->current_reply; + in->events_tail = &in->events; + in->pending_replies_tail = &in->pending_replies; + + return 1; +} + +void _xcb_in_destroy(_xcb_in *in) +{ + pthread_cond_destroy(&in->event_cond); + free_reply_list(in->current_reply); + _xcb_map_delete(in->replies, (void (*)(void *)) free_reply_list); + while(in->events) + { + struct event_list *e = in->events; + in->events = e->next; + free(e->event); + free(e); + } + while(in->pending_replies) + { + pending_reply *pend = in->pending_replies; + in->pending_replies = pend->next; + free(pend); + } +} + +void _xcb_in_wake_up_next_reader(xcb_connection_t *c) +{ + int pthreadret; + if(c->in.readers) + pthreadret = pthread_cond_signal(c->in.readers->data); + else if(c->in.special_waiters) + pthreadret = pthread_cond_signal(&c->in.special_waiters->se->special_event_cond); + else + pthreadret = pthread_cond_signal(&c->in.event_cond); + assert(pthreadret == 0); +} + +int _xcb_in_expect_reply(xcb_connection_t *c, uint64_t request, enum workarounds workaround, int flags) +{ + pending_reply *pend = malloc(sizeof(pending_reply)); + assert(workaround != WORKAROUND_NONE || flags != 0); + if(!pend) + { + _xcb_conn_shutdown(c, XCB_CONN_CLOSED_MEM_INSUFFICIENT); + return 0; + } + pend->first_request = pend->last_request = request; + pend->workaround = workaround; + pend->flags = flags; + pend->next = 0; + *c->in.pending_replies_tail = pend; + c->in.pending_replies_tail = &pend->next; + return 1; +} + +void _xcb_in_replies_done(xcb_connection_t *c) +{ + struct pending_reply *pend; + if (c->in.pending_replies_tail != &c->in.pending_replies) + { + pend = container_of(c->in.pending_replies_tail, struct pending_reply, next); + if(pend->workaround == WORKAROUND_EXTERNAL_SOCKET_OWNER) + { + if (XCB_SEQUENCE_COMPARE(pend->first_request, <=, c->out.request)) { + pend->last_request = c->out.request; + pend->workaround = WORKAROUND_NONE; + } else { + /* The socket was taken, but no requests were actually sent + * so just discard the pending_reply that was created. + */ + struct pending_reply **prev_next = &c->in.pending_replies; + while (*prev_next != pend) + prev_next = &(*prev_next)->next; + *prev_next = NULL; + c->in.pending_replies_tail = prev_next; + free(pend); + } + } + } +} + +int _xcb_in_read(xcb_connection_t *c) +{ + int n; + +#if HAVE_SENDMSG + struct iovec iov = { + .iov_base = c->in.queue + c->in.queue_len, + .iov_len = sizeof(c->in.queue) - c->in.queue_len, + }; + union { + struct cmsghdr cmsghdr; + char buf[CMSG_SPACE(XCB_MAX_PASS_FD * sizeof(int))]; + } cmsgbuf; + struct msghdr msg = { + .msg_name = NULL, + .msg_namelen = 0, + .msg_iov = &iov, + .msg_iovlen = 1, + .msg_control = cmsgbuf.buf, + .msg_controllen = CMSG_SPACE(sizeof(int) * (XCB_MAX_PASS_FD - c->in.in_fd.nfd)), + }; + n = recvmsg(c->fd, &msg, 0); + + /* Check for truncation errors. Only MSG_CTRUNC is + * probably possible here, which would indicate that + * the sender tried to transmit more than XCB_MAX_PASS_FD + * file descriptors. + */ + if (msg.msg_flags & (MSG_TRUNC|MSG_CTRUNC)) { + _xcb_conn_shutdown(c, XCB_CONN_CLOSED_FDPASSING_FAILED); + return 0; + } +#else + n = recv(c->fd, c->in.queue + c->in.queue_len, sizeof(c->in.queue) - c->in.queue_len, 0); +#endif + if(n > 0) { +#if HAVE_SENDMSG + struct cmsghdr *hdr; + + if (msg.msg_controllen >= sizeof (struct cmsghdr)) { + for (hdr = CMSG_FIRSTHDR(&msg); hdr; hdr = CMSG_NXTHDR(&msg, hdr)) { + if (hdr->cmsg_level == SOL_SOCKET && hdr->cmsg_type == SCM_RIGHTS) { + int nfd = (hdr->cmsg_len - CMSG_LEN(0)) / sizeof (int); + memcpy(&c->in.in_fd.fd[c->in.in_fd.nfd], CMSG_DATA(hdr), nfd * sizeof (int)); + c->in.in_fd.nfd += nfd; + } + } + } +#endif + c->in.total_read += n; + c->in.queue_len += n; + } + while(read_packet(c)) + /* empty */; +#if HAVE_SENDMSG + if (c->in.in_fd.nfd) { + c->in.in_fd.nfd -= c->in.in_fd.ifd; + memmove(&c->in.in_fd.fd[0], + &c->in.in_fd.fd[c->in.in_fd.ifd], + c->in.in_fd.nfd * sizeof (int)); + c->in.in_fd.ifd = 0; + + /* If we have any left-over file descriptors after emptying + * the input buffer, then the server sent some that we weren't + * expecting. Close them and mark the connection as broken; + */ + if (c->in.queue_len == 0 && c->in.in_fd.nfd != 0) { + int i; + for (i = 0; i < c->in.in_fd.nfd; i++) + close(c->in.in_fd.fd[i]); + _xcb_conn_shutdown(c, XCB_CONN_CLOSED_FDPASSING_FAILED); + return 0; + } + } +#endif +#ifndef _WIN32 + if((n > 0) || (n < 0 && (errno == EAGAIN || errno == EINTR))) +#else + if((n > 0) || (n < 0 && WSAGetLastError() == WSAEWOULDBLOCK)) +#endif /* !_WIN32 */ + return 1; + _xcb_conn_shutdown(c, XCB_CONN_ERROR); + return 0; +} + +int _xcb_in_read_block(xcb_connection_t *c, void *buf, int len) +{ + int done = c->in.queue_len; + if(len < done) + done = len; + + memcpy(buf, c->in.queue, done); + c->in.queue_len -= done; + memmove(c->in.queue, c->in.queue + done, c->in.queue_len); + + if(len > done) + { + int ret = read_block(c->fd, (char *) buf + done, len - done); + if(ret <= 0) + { + _xcb_conn_shutdown(c, XCB_CONN_ERROR); + return ret; + } + } + + return len; +} diff --git a/depends/libxcb/src/xcb_list.c b/depends/libxcb/src/xcb_list.c new file mode 100644 index 0000000..bdd2d43 --- /dev/null +++ b/depends/libxcb/src/xcb_list.c @@ -0,0 +1,105 @@ +/* Copyright (C) 2001-2004 Bart Massey and Jamey Sharp. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the names of the authors or their + * institutions shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the authors. + */ + +/* A generic implementation of a list of void-pointers. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdlib.h> + +#include "xcb.h" +#include "xcbint.h" + +typedef struct node { + struct node *next; + uint64_t key; + void *data; +} node; + +struct _xcb_map { + node *head; + node **tail; +}; + +/* Private interface */ + +_xcb_map *_xcb_map_new(void) +{ + _xcb_map *list; + list = malloc(sizeof(_xcb_map)); + if(!list) + return 0; + list->head = 0; + list->tail = &list->head; + return list; +} + +void _xcb_map_delete(_xcb_map *list, xcb_list_free_func_t do_free) +{ + if(!list) + return; + while(list->head) + { + node *cur = list->head; + if(do_free) + do_free(cur->data); + list->head = cur->next; + free(cur); + } + free(list); +} + +int _xcb_map_put(_xcb_map *list, uint64_t key, void *data) +{ + node *cur = malloc(sizeof(node)); + if(!cur) + return 0; + cur->key = key; + cur->data = data; + cur->next = 0; + *list->tail = cur; + list->tail = &cur->next; + return 1; +} + +void *_xcb_map_remove(_xcb_map *list, uint64_t key) +{ + node **cur; + for(cur = &list->head; *cur; cur = &(*cur)->next) + if((*cur)->key == key) + { + node *tmp = *cur; + void *ret = (*cur)->data; + *cur = (*cur)->next; + if(!*cur) + list->tail = cur; + + free(tmp); + return ret; + } + return 0; +} diff --git a/depends/libxcb/src/xcb_out.c b/depends/libxcb/src/xcb_out.c new file mode 100644 index 0000000..a4fe823 --- /dev/null +++ b/depends/libxcb/src/xcb_out.c @@ -0,0 +1,501 @@ +/* Copyright (C) 2001-2004 Bart Massey and Jamey Sharp. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the names of the authors or their + * institutions shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the authors. + */ + +/* Stuff that sends stuff to the server. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <assert.h> +#include <stdlib.h> +#ifdef _WIN32 +#include <io.h> +#else +#include <unistd.h> +#endif +#include <string.h> + +#include "xcb.h" +#include "xcbext.h" +#include "xcbint.h" +#include "bigreq.h" + +static inline void send_request(xcb_connection_t *c, int isvoid, enum workarounds workaround, int flags, struct iovec *vector, int count) +{ + if(c->has_error) + return; + + ++c->out.request; + if(!isvoid) + c->in.request_expected = c->out.request; + if(workaround != WORKAROUND_NONE || flags != 0) + _xcb_in_expect_reply(c, c->out.request, workaround, flags); + + while(count && c->out.queue_len + vector[0].iov_len <= sizeof(c->out.queue)) + { + memcpy(c->out.queue + c->out.queue_len, vector[0].iov_base, vector[0].iov_len); + c->out.queue_len += vector[0].iov_len; + vector[0].iov_base = (char *) vector[0].iov_base + vector[0].iov_len; + vector[0].iov_len = 0; + ++vector, --count; + } + if(!count) + return; + + --vector, ++count; + vector[0].iov_base = c->out.queue; + vector[0].iov_len = c->out.queue_len; + c->out.queue_len = 0; + _xcb_out_send(c, vector, count); +} + +static void send_sync(xcb_connection_t *c) +{ + static const union { + struct { + uint8_t major; + uint8_t pad; + uint16_t len; + } fields; + uint32_t packet; + } sync_req = { { /* GetInputFocus */ 43, 0, 1 } }; + struct iovec vector[2]; + vector[1].iov_base = (char *) &sync_req; + vector[1].iov_len = sizeof(sync_req); + send_request(c, 0, WORKAROUND_NONE, XCB_REQUEST_DISCARD_REPLY, vector + 1, 1); +} + +static void get_socket_back(xcb_connection_t *c) +{ + while(c->out.return_socket && c->out.socket_moving) + pthread_cond_wait(&c->out.socket_cond, &c->iolock); + if(!c->out.return_socket) + return; + + c->out.socket_moving = 1; + pthread_mutex_unlock(&c->iolock); + c->out.return_socket(c->out.socket_closure); + pthread_mutex_lock(&c->iolock); + c->out.socket_moving = 0; + + pthread_cond_broadcast(&c->out.socket_cond); + c->out.return_socket = 0; + c->out.socket_closure = 0; + _xcb_in_replies_done(c); +} + +static void prepare_socket_request(xcb_connection_t *c) +{ + /* We're about to append data to out.queue, so we need to + * atomically test for an external socket owner *and* some other + * thread currently writing. + * + * If we have an external socket owner, we have to get the socket back + * before we can use it again. + * + * If some other thread is writing to the socket, we assume it's + * writing from out.queue, and so we can't stick data there. + * + * We satisfy this condition by first calling get_socket_back + * (which may drop the lock, but will return when XCB owns the + * socket again) and then checking for another writing thread and + * escaping the loop if we're ready to go. + */ + for (;;) { + if(c->has_error) + return; + get_socket_back(c); + if (!c->out.writing) + break; + pthread_cond_wait(&c->out.cond, &c->iolock); + } +} + +/* Public interface */ + +void xcb_prefetch_maximum_request_length(xcb_connection_t *c) +{ + if(c->has_error) + return; + pthread_mutex_lock(&c->out.reqlenlock); + if(c->out.maximum_request_length_tag == LAZY_NONE) + { + const xcb_query_extension_reply_t *ext; + ext = xcb_get_extension_data(c, &xcb_big_requests_id); + if(ext && ext->present) + { + c->out.maximum_request_length_tag = LAZY_COOKIE; + c->out.maximum_request_length.cookie = xcb_big_requests_enable(c); + } + else + { + c->out.maximum_request_length_tag = LAZY_FORCED; + c->out.maximum_request_length.value = c->setup->maximum_request_length; + } + } + pthread_mutex_unlock(&c->out.reqlenlock); +} + +uint32_t xcb_get_maximum_request_length(xcb_connection_t *c) +{ + if(c->has_error) + return 0; + xcb_prefetch_maximum_request_length(c); + pthread_mutex_lock(&c->out.reqlenlock); + if(c->out.maximum_request_length_tag == LAZY_COOKIE) + { + xcb_big_requests_enable_reply_t *r = xcb_big_requests_enable_reply(c, c->out.maximum_request_length.cookie, 0); + c->out.maximum_request_length_tag = LAZY_FORCED; + if(r) + { + c->out.maximum_request_length.value = r->maximum_request_length; + free(r); + } + else + c->out.maximum_request_length.value = c->setup->maximum_request_length; + } + pthread_mutex_unlock(&c->out.reqlenlock); + return c->out.maximum_request_length.value; +} + +static void close_fds(int *fds, unsigned int num_fds) +{ + for (unsigned int index = 0; index < num_fds; index++) + close(fds[index]); +} + +static void send_fds(xcb_connection_t *c, int *fds, unsigned int num_fds) +{ +#if HAVE_SENDMSG + /* Calling _xcb_out_flush_to() can drop the iolock and wait on a condition + * variable if another thread is currently writing (c->out.writing > 0). + * This call waits for writers to be done and thus _xcb_out_flush_to() will + * do the work itself (in which case we are a writer and + * prepare_socket_request() will wait for us to be done if another threads + * tries to send fds, too). Thanks to this, we can atomically write out FDs. + */ + prepare_socket_request(c); + + while (num_fds > 0) { + while (c->out.out_fd.nfd == XCB_MAX_PASS_FD && !c->has_error) { + /* XXX: if c->out.writing > 0, this releases the iolock and + * potentially allows other threads to interfere with their own fds. + */ + _xcb_out_flush_to(c, c->out.request); + + if (c->out.out_fd.nfd == XCB_MAX_PASS_FD) { + /* We need some request to send FDs with */ + _xcb_out_send_sync(c); + } + } + if (c->has_error) + break; + + c->out.out_fd.fd[c->out.out_fd.nfd++] = fds[0]; + fds++; + num_fds--; + } +#endif + close_fds(fds, num_fds); +} + +uint64_t xcb_send_request_with_fds64(xcb_connection_t *c, int flags, struct iovec *vector, + const xcb_protocol_request_t *req, unsigned int num_fds, int *fds) +{ + uint64_t request; + uint32_t prefix[2]; + int veclen = req->count; + enum workarounds workaround = WORKAROUND_NONE; + + if(c->has_error) { + close_fds(fds, num_fds); + return 0; + } + + assert(c != 0); + assert(vector != 0); + assert(req->count > 0); + + if(!(flags & XCB_REQUEST_RAW)) + { + static const char pad[3]; + unsigned int i; + uint16_t shortlen = 0; + size_t longlen = 0; + assert(vector[0].iov_len >= 4); + /* set the major opcode, and the minor opcode for extensions */ + if(req->ext) + { + const xcb_query_extension_reply_t *extension = xcb_get_extension_data(c, req->ext); + if(!(extension && extension->present)) + { + close_fds(fds, num_fds); + _xcb_conn_shutdown(c, XCB_CONN_CLOSED_EXT_NOTSUPPORTED); + return 0; + } + ((uint8_t *) vector[0].iov_base)[0] = extension->major_opcode; + ((uint8_t *) vector[0].iov_base)[1] = req->opcode; + } + else + ((uint8_t *) vector[0].iov_base)[0] = req->opcode; + + /* put together the length field, possibly using BIGREQUESTS */ + for(i = 0; i < req->count; ++i) + { + longlen += vector[i].iov_len; + if(!vector[i].iov_base) + { + vector[i].iov_base = (char *) pad; + assert(vector[i].iov_len <= sizeof(pad)); + } + } + assert((longlen & 3) == 0); + longlen >>= 2; + + if(longlen <= c->setup->maximum_request_length) + { + /* we don't need BIGREQUESTS. */ + shortlen = longlen; + longlen = 0; + } + else if(longlen > xcb_get_maximum_request_length(c)) + { + close_fds(fds, num_fds); + _xcb_conn_shutdown(c, XCB_CONN_CLOSED_REQ_LEN_EXCEED); + return 0; /* server can't take this; maybe need BIGREQUESTS? */ + } + + /* set the length field. */ + ((uint16_t *) vector[0].iov_base)[1] = shortlen; + if(!shortlen) + { + prefix[0] = ((uint32_t *) vector[0].iov_base)[0]; + prefix[1] = ++longlen; + vector[0].iov_base = (uint32_t *) vector[0].iov_base + 1; + vector[0].iov_len -= sizeof(uint32_t); + --vector, ++veclen; + vector[0].iov_base = prefix; + vector[0].iov_len = sizeof(prefix); + } + } + flags &= ~XCB_REQUEST_RAW; + + /* do we need to work around the X server bug described in glx.xml? */ + /* XXX: GetFBConfigs won't use BIG-REQUESTS in any sane + * configuration, but that should be handled here anyway. */ + if(req->ext && !req->isvoid && !strcmp(req->ext->name, "GLX") && + ((req->opcode == 17 && ((uint32_t *) vector[0].iov_base)[1] == 0x10004) || + req->opcode == 21)) + workaround = WORKAROUND_GLX_GET_FB_CONFIGS_BUG; + + /* get a sequence number and arrange for delivery. */ + pthread_mutex_lock(&c->iolock); + + /* send FDs before establishing a good request number, because this might + * call send_sync(), too + */ + send_fds(c, fds, num_fds); + + prepare_socket_request(c); + + /* send GetInputFocus (sync_req) when 64k-2 requests have been sent without + * a reply. + * Also send sync_req (could use NoOp) at 32-bit wrap to avoid having + * applications see sequence 0 as that is used to indicate + * an error in sending the request + */ + + while ((req->isvoid && c->out.request == c->in.request_expected + (1 << 16) - 2) || + (unsigned int) (c->out.request + 1) == 0) + { + send_sync(c); + prepare_socket_request(c); + } + + send_request(c, req->isvoid, workaround, flags, vector, veclen); + request = c->has_error ? 0 : c->out.request; + pthread_mutex_unlock(&c->iolock); + return request; +} + +/* request number are actually uint64_t internally but keep API compat with unsigned int */ +unsigned int xcb_send_request_with_fds(xcb_connection_t *c, int flags, struct iovec *vector, + const xcb_protocol_request_t *req, unsigned int num_fds, int *fds) +{ + return xcb_send_request_with_fds64(c, flags, vector, req, num_fds, fds); +} + +uint64_t xcb_send_request64(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *req) +{ + return xcb_send_request_with_fds64(c, flags, vector, req, 0, NULL); +} + +/* request number are actually uint64_t internally but keep API compat with unsigned int */ +unsigned int xcb_send_request(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *req) +{ + return xcb_send_request64(c, flags, vector, req); +} + +void +xcb_send_fd(xcb_connection_t *c, int fd) +{ + int fds[1] = { fd }; + + if (c->has_error) { + close(fd); + return; + } + pthread_mutex_lock(&c->iolock); + send_fds(c, &fds[0], 1); + pthread_mutex_unlock(&c->iolock); +} + +int xcb_take_socket(xcb_connection_t *c, void (*return_socket)(void *closure), void *closure, int flags, uint64_t *sent) +{ + int ret; + if(c->has_error) + return 0; + pthread_mutex_lock(&c->iolock); + get_socket_back(c); + + /* _xcb_out_flush may drop the iolock allowing other threads to + * write requests, so keep flushing until we're done + */ + do + ret = _xcb_out_flush_to(c, c->out.request); + while (ret && c->out.request != c->out.request_written); + if(ret) + { + c->out.return_socket = return_socket; + c->out.socket_closure = closure; + if(flags) { + /* c->out.request + 1 will be the first request sent by the external + * socket owner. If the socket is returned before this request is sent + * it will be detected in _xcb_in_replies_done and this pending_reply + * will be discarded. + */ + _xcb_in_expect_reply(c, c->out.request + 1, WORKAROUND_EXTERNAL_SOCKET_OWNER, flags); + } + assert(c->out.request == c->out.request_written); + *sent = c->out.request; + } + pthread_mutex_unlock(&c->iolock); + return ret; +} + +int xcb_writev(xcb_connection_t *c, struct iovec *vector, int count, uint64_t requests) +{ + int ret; + if(c->has_error) + return 0; + pthread_mutex_lock(&c->iolock); + c->out.request += requests; + ret = _xcb_out_send(c, vector, count); + pthread_mutex_unlock(&c->iolock); + return ret; +} + +int xcb_flush(xcb_connection_t *c) +{ + int ret; + if(c->has_error) + return 0; + pthread_mutex_lock(&c->iolock); + ret = _xcb_out_flush_to(c, c->out.request); + pthread_mutex_unlock(&c->iolock); + return ret; +} + +/* Private interface */ + +int _xcb_out_init(_xcb_out *out) +{ + if(pthread_cond_init(&out->socket_cond, 0)) + return 0; + out->return_socket = 0; + out->socket_closure = 0; + out->socket_moving = 0; + + if(pthread_cond_init(&out->cond, 0)) + return 0; + out->writing = 0; + + out->queue_len = 0; + + out->request = 0; + out->request_written = 0; + out->request_expected_written = 0; + + if(pthread_mutex_init(&out->reqlenlock, 0)) + return 0; + out->maximum_request_length_tag = LAZY_NONE; + + return 1; +} + +void _xcb_out_destroy(_xcb_out *out) +{ + pthread_mutex_destroy(&out->reqlenlock); + pthread_cond_destroy(&out->cond); + pthread_cond_destroy(&out->socket_cond); +} + +int _xcb_out_send(xcb_connection_t *c, struct iovec *vector, int count) +{ + int ret = 1; + while(ret && count) + ret = _xcb_conn_wait(c, &c->out.cond, &vector, &count); + c->out.request_written = c->out.request; + c->out.request_expected_written = c->in.request_expected; + pthread_cond_broadcast(&c->out.cond); + _xcb_in_wake_up_next_reader(c); + return ret; +} + +void _xcb_out_send_sync(xcb_connection_t *c) +{ + prepare_socket_request(c); + send_sync(c); +} + +int _xcb_out_flush_to(xcb_connection_t *c, uint64_t request) +{ + assert(XCB_SEQUENCE_COMPARE(request, <=, c->out.request)); + if(XCB_SEQUENCE_COMPARE(c->out.request_written, >=, request)) + return 1; + if(c->out.queue_len) + { + struct iovec vec; + vec.iov_base = c->out.queue; + vec.iov_len = c->out.queue_len; + c->out.queue_len = 0; + return _xcb_out_send(c, &vec, 1); + } + while(c->out.writing) + pthread_cond_wait(&c->out.cond, &c->iolock); + assert(XCB_SEQUENCE_COMPARE(c->out.request_written, >=, request)); + return 1; +} diff --git a/depends/libxcb/src/xcb_util.c b/depends/libxcb/src/xcb_util.c new file mode 100644 index 0000000..0296ce0 --- /dev/null +++ b/depends/libxcb/src/xcb_util.c @@ -0,0 +1,557 @@ +/* Copyright (C) 2001-2004 Bart Massey and Jamey Sharp. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the names of the authors or their + * institutions shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the authors. + */ + +/* Utility functions implementable using only public APIs. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <assert.h> +#include <sys/types.h> +#include <limits.h> +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <stddef.h> +#include <string.h> + +#ifdef _WIN32 +#include "xcb_windefs.h" +#else +#include <unistd.h> +#include <arpa/inet.h> +#include <sys/socket.h> +#include <sys/un.h> +#include <netinet/in.h> +#include <netinet/tcp.h> +#include <fcntl.h> +#include <netdb.h> +#endif /* _WIN32 */ + +#include "xcb.h" +#include "xcbext.h" +#include "xcbint.h" + +#if defined(HAVE_TSOL_LABEL_H) && defined(HAVE_IS_SYSTEM_LABELED) +# include <tsol/label.h> +# include <sys/stat.h> +#endif + +#ifdef HAVE_LAUNCHD +#include <sys/stat.h> +#endif + +int xcb_popcount(uint32_t mask) +{ + uint32_t y; + y = (mask >> 1) & 033333333333; + y = mask - y - ((y >> 1) & 033333333333); + return ((y + (y >> 3)) & 030707070707) % 077; +} + +int xcb_sumof(uint8_t *list, int len) +{ + int i, s = 0; + for(i=0; i<len; i++) { + s += *list; + list++; + } + return s; +} + +#ifdef HAVE_LAUNCHD +/* Return true and parse if name matches <path to socket>[.<screen>] + * Upon success: + * host = <path to socket> + * protocol = "unix" + * display = 0 + * screen = <screen> + */ +static int _xcb_parse_display_path_to_socket(const char *name, char **host, char **protocol, + int *displayp, int *screenp) +{ + struct stat sbuf; + char path[PATH_MAX]; + int _screen = 0; + + strlcpy(path, name, sizeof(path)); + if (0 != stat(path, &sbuf)) { + char *dot = strrchr(path, '.'); + if (!dot) + return 0; + *dot = '\0'; + + if (0 != stat(path, &sbuf)) + return 0; + + _screen = atoi(dot + 1); + } + + if (host) { + *host = strdup(path); + if (!*host) + return 0; + } + + if (protocol) { + *protocol = strdup("unix"); + if (!*protocol) { + if (host) + free(*host); + return 0; + } + } + + if (displayp) + *displayp = 0; + + if (screenp) + *screenp = _screen; + + return 1; +} +#endif + +static int _xcb_parse_display(const char *name, char **host, char **protocol, + int *displayp, int *screenp) +{ + int len, display, screen; + char *slash, *colon, *dot, *end; + + if(!name || !*name) + name = getenv("DISPLAY"); + if(!name) + return 0; + +#ifdef HAVE_LAUNCHD + /* First check for <path to socket>[.<screen>] */ + if (_xcb_parse_display_path_to_socket(name, host, protocol, displayp, screenp)) + return 1; +#endif + + slash = strrchr(name, '/'); + + if (slash) { + len = slash - name; + if (protocol) { + *protocol = malloc(len + 1); + if(!*protocol) + return 0; + memcpy(*protocol, name, len); + (*protocol)[len] = '\0'; + } + name = slash + 1; + } else + if (protocol) + *protocol = NULL; + + colon = strrchr(name, ':'); + if(!colon) + goto error_out; + len = colon - name; + ++colon; + display = strtoul(colon, &dot, 10); + if(dot == colon) + goto error_out; + if(*dot == '\0') + screen = 0; + else + { + if(*dot != '.') + goto error_out; + ++dot; + screen = strtoul(dot, &end, 10); + if(end == dot || *end != '\0') + goto error_out; + } + /* At this point, the display string is fully parsed and valid, but + * the caller's memory is untouched. */ + + *host = malloc(len + 1); + if(!*host) + goto error_out; + memcpy(*host, name, len); + (*host)[len] = '\0'; + *displayp = display; + if(screenp) + *screenp = screen; + return 1; + +error_out: + if (protocol) { + free(*protocol); + *protocol = NULL; + } + + return 0; +} + +int xcb_parse_display(const char *name, char **host, int *displayp, + int *screenp) +{ + return _xcb_parse_display(name, host, NULL, displayp, screenp); +} + +static int _xcb_open_tcp(const char *host, char *protocol, const unsigned short port); +#ifndef _WIN32 +static int _xcb_open_unix(char *protocol, const char *file); +#endif /* !WIN32 */ +#ifdef HAVE_ABSTRACT_SOCKETS +static int _xcb_open_abstract(char *protocol, const char *file, size_t filelen); +#endif + +static int _xcb_open(const char *host, char *protocol, const int display) +{ + int fd; +#ifdef __hpux + static const char unix_base[] = "/usr/spool/sockets/X11/"; +#else + static const char unix_base[] = "/tmp/.X11-unix/X"; +#endif + const char *base = unix_base; + size_t filelen; + char *file = NULL; + int actual_filelen; + + /* If protocol or host is "unix", fall through to Unix socket code below */ + if ((!protocol || (strcmp("unix",protocol) != 0)) && + (*host != '\0') && (strcmp("unix",host) != 0)) + { + /* display specifies TCP */ + unsigned short port = X_TCP_PORT + display; + return _xcb_open_tcp(host, protocol, port); + } + +#ifndef _WIN32 +#if defined(HAVE_TSOL_LABEL_H) && defined(HAVE_IS_SYSTEM_LABELED) + /* Check special path for Unix sockets under Solaris Trusted Extensions */ + if (is_system_labeled()) + { + struct stat sbuf; + const char *tsol_base = "/var/tsol/doors/.X11-unix/X"; + char tsol_socket[PATH_MAX]; + + snprintf(tsol_socket, sizeof(tsol_socket), "%s%d", tsol_base, display); + + if (stat(tsol_socket, &sbuf) == 0) + base = tsol_base; + } +#endif + +#ifdef HAVE_LAUNCHD + struct stat sbuf; + if (0 == stat(host, &sbuf)) { + file = strdup(host); + if(file == NULL) + return -1; + filelen = actual_filelen = strlen(file); + } else +#endif + { + filelen = strlen(base) + 1 + sizeof(display) * 3 + 1; + file = malloc(filelen); + if(file == NULL) + return -1; + + /* display specifies Unix socket */ + actual_filelen = snprintf(file, filelen, "%s%d", base, display); + } + + if(actual_filelen < 0) + { + free(file); + return -1; + } + /* snprintf may truncate the file */ + filelen = MIN(actual_filelen, filelen - 1); +#ifdef HAVE_ABSTRACT_SOCKETS + fd = _xcb_open_abstract(protocol, file, filelen); + if (fd >= 0 || (errno != ENOENT && errno != ECONNREFUSED)) + { + free(file); + return fd; + } + +#endif + fd = _xcb_open_unix(protocol, file); + free(file); + + if (fd < 0 && !protocol && *host == '\0') { + unsigned short port = X_TCP_PORT + display; + fd = _xcb_open_tcp(host, protocol, port); + } + + return fd; +#endif /* !_WIN32 */ + return -1; /* if control reaches here then something has gone wrong */ +} + +static int _xcb_socket(int family, int type, int proto) +{ + int fd; + +#ifdef SOCK_CLOEXEC + fd = socket(family, type | SOCK_CLOEXEC, proto); + if (fd == -1 && errno == EINVAL) +#endif + { + fd = socket(family, type, proto); +#ifndef _WIN32 + if (fd >= 0) + fcntl(fd, F_SETFD, FD_CLOEXEC); +#endif + } + return fd; +} + + +static int _xcb_do_connect(int fd, const struct sockaddr* addr, int addrlen) { + int on = 1; + + if(fd < 0) + return -1; + + setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)); + setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on)); + + return connect(fd, addr, addrlen); +} + +static int _xcb_open_tcp(const char *host, char *protocol, const unsigned short port) +{ + int fd = -1; +#if HAVE_GETADDRINFO + struct addrinfo hints; + char service[6]; /* "65535" with the trailing '\0' */ + struct addrinfo *results, *addr; + char *bracket; +#endif + + if (protocol && strcmp("tcp",protocol) && strcmp("inet",protocol) +#ifdef AF_INET6 + && strcmp("inet6",protocol) +#endif + ) + return -1; + + if (*host == '\0') + host = "localhost"; + +#if HAVE_GETADDRINFO + memset(&hints, 0, sizeof(hints)); +#ifdef AI_NUMERICSERV + hints.ai_flags |= AI_NUMERICSERV; +#endif + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + +#ifdef AF_INET6 + /* Allow IPv6 addresses enclosed in brackets. */ + if(host[0] == '[' && (bracket = strrchr(host, ']')) && bracket[1] == '\0') + { + *bracket = '\0'; + ++host; + hints.ai_flags |= AI_NUMERICHOST; + hints.ai_family = AF_INET6; + } +#endif + + snprintf(service, sizeof(service), "%hu", port); + if(getaddrinfo(host, service, &hints, &results)) + /* FIXME: use gai_strerror, and fill in error connection */ + return -1; + + for(addr = results; addr; addr = addr->ai_next) + { + fd = _xcb_socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol); + if (_xcb_do_connect(fd, addr->ai_addr, addr->ai_addrlen) >= 0) + break; + close(fd); + fd = -1; + } + freeaddrinfo(results); + return fd; +#else + { + struct hostent* _h; + struct sockaddr_in _s; + struct in_addr ** _c; + + if((_h = gethostbyname(host)) == NULL) + return -1; + + _c = (struct in_addr**)_h->h_addr_list; + fd = -1; + + while(*_c) { + _s.sin_family = AF_INET; + _s.sin_port = htons(port); + _s.sin_addr = *(*_c); + + fd = _xcb_socket(_s.sin_family, SOCK_STREAM, 0); + if(_xcb_do_connect(fd, (struct sockaddr*)&_s, sizeof(_s)) >= 0) + break; + +#ifdef _WIN32 + closesocket(fd); +#else + close(fd); +#endif + fd = -1; + ++_c; + } + + return fd; + } +#endif +} + +#ifndef _WIN32 +static int _xcb_open_unix(char *protocol, const char *file) +{ + int fd; + struct sockaddr_un addr; + socklen_t len = sizeof(int); + int val; + + if (protocol && strcmp("unix",protocol)) + return -1; + + strcpy(addr.sun_path, file); + addr.sun_family = AF_UNIX; +#ifdef HAVE_SOCKADDR_SUN_LEN + addr.sun_len = SUN_LEN(&addr); +#endif + fd = _xcb_socket(AF_UNIX, SOCK_STREAM, 0); + if(fd == -1) + return -1; + if(getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) == 0 && val < 64 * 1024) + { + val = 64 * 1024; + setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, sizeof(int)); + } + if(connect(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1) { + close(fd); + return -1; + } + return fd; +} +#endif /* !_WIN32 */ + +#ifdef HAVE_ABSTRACT_SOCKETS +static int _xcb_open_abstract(char *protocol, const char *file, size_t filelen) +{ + int fd; + struct sockaddr_un addr = {0}; + socklen_t namelen; + + if (protocol && strcmp("unix",protocol)) + return -1; + + strcpy(addr.sun_path + 1, file); + addr.sun_family = AF_UNIX; + namelen = offsetof(struct sockaddr_un, sun_path) + 1 + filelen; +#ifdef HAVE_SOCKADDR_SUN_LEN + addr.sun_len = 1 + filelen; +#endif + fd = _xcb_socket(AF_UNIX, SOCK_STREAM, 0); + if (fd == -1) + return -1; + if (connect(fd, (struct sockaddr *) &addr, namelen) == -1) { + close(fd); + return -1; + } + return fd; +} +#endif + +xcb_connection_t *xcb_connect(const char *displayname, int *screenp) +{ + return xcb_connect_to_display_with_auth_info(displayname, NULL, screenp); +} + +xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *displayname, xcb_auth_info_t *auth, int *screenp) +{ + int fd, display = 0; + char *host = NULL; + char *protocol = NULL; + xcb_auth_info_t ourauth; + xcb_connection_t *c; + + int parsed = _xcb_parse_display(displayname, &host, &protocol, &display, screenp); + + if(!parsed) { + c = _xcb_conn_ret_error(XCB_CONN_CLOSED_PARSE_ERR); + goto out; + } + +#ifdef _WIN32 + WSADATA wsaData; + if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) { + c = _xcb_conn_ret_error(XCB_CONN_ERROR); + goto out; + } +#endif + + fd = _xcb_open(host, protocol, display); + + if(fd == -1) { + c = _xcb_conn_ret_error(XCB_CONN_ERROR); +#ifdef _WIN32 + WSACleanup(); +#endif + goto out; + } + + if(auth) { + c = xcb_connect_to_fd(fd, auth); + goto out; + } + + if(_xcb_get_auth_info(fd, &ourauth, display)) + { + c = xcb_connect_to_fd(fd, &ourauth); + free(ourauth.name); + free(ourauth.data); + } + else + c = xcb_connect_to_fd(fd, 0); + + if(c->has_error) + goto out; + + /* Make sure requested screen number is in bounds for this server */ + if((screenp != NULL) && (*screenp >= (int) c->setup->roots_len)) { + xcb_disconnect(c); + c = _xcb_conn_ret_error(XCB_CONN_CLOSED_INVALID_SCREEN); + goto out; + } + +out: + free(host); + free(protocol); + return c; +} diff --git a/depends/libxcb/src/xcb_xid.c b/depends/libxcb/src/xcb_xid.c new file mode 100644 index 0000000..ebe41a1 --- /dev/null +++ b/depends/libxcb/src/xcb_xid.c @@ -0,0 +1,101 @@ +/* Copyright (C) 2001-2008 Bart Massey and Jamey Sharp. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the names of the authors or their + * institutions shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the authors. + */ + +/* XID allocators. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <assert.h> +#include <stdlib.h> +#include "xcb.h" +#include "xcbext.h" +#include "xcbint.h" +#include "xc_misc.h" + +/* Public interface */ + +uint32_t xcb_generate_id(xcb_connection_t *c) +{ + uint32_t ret; + if(c->has_error) + return -1; + pthread_mutex_lock(&c->xid.lock); + if(c->xid.last >= c->xid.max - c->xid.inc + 1) + { + xcb_xc_misc_get_xid_range_reply_t *range; + assert(c->xid.last == c->xid.max); + if (c->xid.last == 0) { + /* finish setting up initial range */ + c->xid.max = c->setup->resource_id_mask; + } else { + /* check for extension */ + const xcb_query_extension_reply_t *xc_misc_reply = + xcb_get_extension_data(c, &xcb_xc_misc_id); + if (!xc_misc_reply || !xc_misc_reply->present) { + pthread_mutex_unlock(&c->xid.lock); + return -1; + } + /* get new range */ + range = xcb_xc_misc_get_xid_range_reply(c, + xcb_xc_misc_get_xid_range(c), 0); + /* XXX The latter disjunct is what the server returns + when it is out of XIDs. Sweet. */ + if(!range || (range->start_id == 0 && range->count == 1)) + { + pthread_mutex_unlock(&c->xid.lock); + return -1; + } + assert(range->count > 0 && range->start_id > 0); + c->xid.last = range->start_id; + c->xid.max = range->start_id + (range->count - 1) * c->xid.inc; + free(range); + } + } else { + c->xid.last += c->xid.inc; + } + ret = c->xid.last | c->xid.base; + pthread_mutex_unlock(&c->xid.lock); + return ret; +} + +/* Private interface */ + +int _xcb_xid_init(xcb_connection_t *c) +{ + if(pthread_mutex_init(&c->xid.lock, 0)) + return 0; + c->xid.last = 0; + c->xid.max = 0; + c->xid.base = c->setup->resource_id_base; + c->xid.inc = c->setup->resource_id_mask & -(c->setup->resource_id_mask); + return 1; +} + +void _xcb_xid_destroy(xcb_connection_t *c) +{ + pthread_mutex_destroy(&c->xid.lock); +} diff --git a/depends/libxcb/src/xevie.c b/depends/libxcb/src/xevie.c new file mode 100644 index 0000000..0adbf03 --- /dev/null +++ b/depends/libxcb/src/xevie.c @@ -0,0 +1,347 @@ +/* + * This file generated automatically from xevie.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "xevie.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) + +xcb_extension_t xcb_xevie_id = { "XEVIE", 0 }; + +xcb_xevie_query_version_cookie_t +xcb_xevie_query_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_xevie_id, + .opcode = XCB_XEVIE_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xevie_query_version_cookie_t xcb_ret; + xcb_xevie_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_xevie_query_version_cookie_t +xcb_xevie_query_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_xevie_id, + .opcode = XCB_XEVIE_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xevie_query_version_cookie_t xcb_ret; + xcb_xevie_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_xevie_query_version_reply_t * +xcb_xevie_query_version_reply (xcb_connection_t *c, + xcb_xevie_query_version_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xevie_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_xevie_start_cookie_t +xcb_xevie_start (xcb_connection_t *c, + uint32_t screen) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xevie_id, + .opcode = XCB_XEVIE_START, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xevie_start_cookie_t xcb_ret; + xcb_xevie_start_request_t xcb_out; + + 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_xevie_start_cookie_t +xcb_xevie_start_unchecked (xcb_connection_t *c, + uint32_t screen) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xevie_id, + .opcode = XCB_XEVIE_START, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xevie_start_cookie_t xcb_ret; + xcb_xevie_start_request_t xcb_out; + + 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_xevie_start_reply_t * +xcb_xevie_start_reply (xcb_connection_t *c, + xcb_xevie_start_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xevie_start_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_xevie_end_cookie_t +xcb_xevie_end (xcb_connection_t *c, + uint32_t cmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xevie_id, + .opcode = XCB_XEVIE_END, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xevie_end_cookie_t xcb_ret; + xcb_xevie_end_request_t xcb_out; + + xcb_out.cmap = cmap; + + 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_xevie_end_cookie_t +xcb_xevie_end_unchecked (xcb_connection_t *c, + uint32_t cmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xevie_id, + .opcode = XCB_XEVIE_END, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xevie_end_cookie_t xcb_ret; + xcb_xevie_end_request_t xcb_out; + + xcb_out.cmap = cmap; + + 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_xevie_end_reply_t * +xcb_xevie_end_reply (xcb_connection_t *c, + xcb_xevie_end_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xevie_end_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +void +xcb_xevie_event_next (xcb_xevie_event_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xevie_event_t); +} + +xcb_generic_iterator_t +xcb_xevie_event_end (xcb_xevie_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_xevie_send_cookie_t +xcb_xevie_send (xcb_connection_t *c, + xcb_xevie_event_t event, + uint32_t data_type) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xevie_id, + .opcode = XCB_XEVIE_SEND, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xevie_send_cookie_t xcb_ret; + xcb_xevie_send_request_t xcb_out; + + xcb_out.event = event; + xcb_out.data_type = data_type; + memset(xcb_out.pad0, 0, 64); + + 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_xevie_send_cookie_t +xcb_xevie_send_unchecked (xcb_connection_t *c, + xcb_xevie_event_t event, + uint32_t data_type) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xevie_id, + .opcode = XCB_XEVIE_SEND, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xevie_send_cookie_t xcb_ret; + xcb_xevie_send_request_t xcb_out; + + xcb_out.event = event; + xcb_out.data_type = data_type; + memset(xcb_out.pad0, 0, 64); + + 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_xevie_send_reply_t * +xcb_xevie_send_reply (xcb_connection_t *c, + xcb_xevie_send_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xevie_send_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_xevie_select_input_cookie_t +xcb_xevie_select_input (xcb_connection_t *c, + uint32_t event_mask) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xevie_id, + .opcode = XCB_XEVIE_SELECT_INPUT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xevie_select_input_cookie_t xcb_ret; + xcb_xevie_select_input_request_t xcb_out; + + 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_xevie_select_input_cookie_t +xcb_xevie_select_input_unchecked (xcb_connection_t *c, + uint32_t event_mask) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xevie_id, + .opcode = XCB_XEVIE_SELECT_INPUT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xevie_select_input_cookie_t xcb_ret; + xcb_xevie_select_input_request_t xcb_out; + + 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_xevie_select_input_reply_t * +xcb_xevie_select_input_reply (xcb_connection_t *c, + xcb_xevie_select_input_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xevie_select_input_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + diff --git a/depends/libxcb/src/xf86dri.c b/depends/libxcb/src/xf86dri.c new file mode 100644 index 0000000..7d48d44 --- /dev/null +++ b/depends/libxcb/src/xf86dri.c @@ -0,0 +1,1005 @@ +/* + * This file generated automatically from xf86dri.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "xf86dri.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) + +xcb_extension_t xcb_xf86dri_id = { "XFree86-DRI", 0 }; + +void +xcb_xf86dri_drm_clip_rect_next (xcb_xf86dri_drm_clip_rect_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xf86dri_drm_clip_rect_t); +} + +xcb_generic_iterator_t +xcb_xf86dri_drm_clip_rect_end (xcb_xf86dri_drm_clip_rect_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_xf86dri_query_version_cookie_t +xcb_xf86dri_query_version (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xf86dri_query_version_cookie_t xcb_ret; + xcb_xf86dri_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_xf86dri_query_version_cookie_t +xcb_xf86dri_query_version_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xf86dri_query_version_cookie_t xcb_ret; + xcb_xf86dri_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_xf86dri_query_version_reply_t * +xcb_xf86dri_query_version_reply (xcb_connection_t *c, + xcb_xf86dri_query_version_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xf86dri_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_xf86dri_query_direct_rendering_capable_cookie_t +xcb_xf86dri_query_direct_rendering_capable (xcb_connection_t *c, + uint32_t screen) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_QUERY_DIRECT_RENDERING_CAPABLE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xf86dri_query_direct_rendering_capable_cookie_t xcb_ret; + xcb_xf86dri_query_direct_rendering_capable_request_t xcb_out; + + 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_xf86dri_query_direct_rendering_capable_cookie_t +xcb_xf86dri_query_direct_rendering_capable_unchecked (xcb_connection_t *c, + uint32_t screen) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_QUERY_DIRECT_RENDERING_CAPABLE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xf86dri_query_direct_rendering_capable_cookie_t xcb_ret; + xcb_xf86dri_query_direct_rendering_capable_request_t xcb_out; + + 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_xf86dri_query_direct_rendering_capable_reply_t * +xcb_xf86dri_query_direct_rendering_capable_reply (xcb_connection_t *c, + xcb_xf86dri_query_direct_rendering_capable_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xf86dri_query_direct_rendering_capable_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_xf86dri_open_connection_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xf86dri_open_connection_reply_t *_aux = (xcb_xf86dri_open_connection_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_xf86dri_open_connection_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* bus_id */ + xcb_block_len += _aux->bus_id_len * sizeof(char); + 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_xf86dri_open_connection_cookie_t +xcb_xf86dri_open_connection (xcb_connection_t *c, + uint32_t screen) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_OPEN_CONNECTION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xf86dri_open_connection_cookie_t xcb_ret; + xcb_xf86dri_open_connection_request_t xcb_out; + + 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_xf86dri_open_connection_cookie_t +xcb_xf86dri_open_connection_unchecked (xcb_connection_t *c, + uint32_t screen) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_OPEN_CONNECTION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xf86dri_open_connection_cookie_t xcb_ret; + xcb_xf86dri_open_connection_request_t xcb_out; + + 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; +} + +char * +xcb_xf86dri_open_connection_bus_id (const xcb_xf86dri_open_connection_reply_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_xf86dri_open_connection_bus_id_length (const xcb_xf86dri_open_connection_reply_t *R) +{ + return R->bus_id_len; +} + +xcb_generic_iterator_t +xcb_xf86dri_open_connection_bus_id_end (const xcb_xf86dri_open_connection_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->bus_id_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xf86dri_open_connection_reply_t * +xcb_xf86dri_open_connection_reply (xcb_connection_t *c, + xcb_xf86dri_open_connection_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xf86dri_open_connection_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_xf86dri_close_connection_checked (xcb_connection_t *c, + uint32_t screen) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_CLOSE_CONNECTION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xf86dri_close_connection_request_t xcb_out; + + 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_void_cookie_t +xcb_xf86dri_close_connection (xcb_connection_t *c, + uint32_t screen) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_CLOSE_CONNECTION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xf86dri_close_connection_request_t xcb_out; + + 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; +} + +int +xcb_xf86dri_get_client_driver_name_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xf86dri_get_client_driver_name_reply_t *_aux = (xcb_xf86dri_get_client_driver_name_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_xf86dri_get_client_driver_name_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* client_driver_name */ + xcb_block_len += _aux->client_driver_name_len * sizeof(char); + 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_xf86dri_get_client_driver_name_cookie_t +xcb_xf86dri_get_client_driver_name (xcb_connection_t *c, + uint32_t screen) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_GET_CLIENT_DRIVER_NAME, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xf86dri_get_client_driver_name_cookie_t xcb_ret; + xcb_xf86dri_get_client_driver_name_request_t xcb_out; + + 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_xf86dri_get_client_driver_name_cookie_t +xcb_xf86dri_get_client_driver_name_unchecked (xcb_connection_t *c, + uint32_t screen) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_GET_CLIENT_DRIVER_NAME, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xf86dri_get_client_driver_name_cookie_t xcb_ret; + xcb_xf86dri_get_client_driver_name_request_t xcb_out; + + 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; +} + +char * +xcb_xf86dri_get_client_driver_name_client_driver_name (const xcb_xf86dri_get_client_driver_name_reply_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_xf86dri_get_client_driver_name_client_driver_name_length (const xcb_xf86dri_get_client_driver_name_reply_t *R) +{ + return R->client_driver_name_len; +} + +xcb_generic_iterator_t +xcb_xf86dri_get_client_driver_name_client_driver_name_end (const xcb_xf86dri_get_client_driver_name_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->client_driver_name_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xf86dri_get_client_driver_name_reply_t * +xcb_xf86dri_get_client_driver_name_reply (xcb_connection_t *c, + xcb_xf86dri_get_client_driver_name_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xf86dri_get_client_driver_name_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_xf86dri_create_context_cookie_t +xcb_xf86dri_create_context (xcb_connection_t *c, + uint32_t screen, + uint32_t visual, + uint32_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_CREATE_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xf86dri_create_context_cookie_t xcb_ret; + xcb_xf86dri_create_context_request_t xcb_out; + + xcb_out.screen = screen; + xcb_out.visual = visual; + xcb_out.context = context; + + 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_xf86dri_create_context_cookie_t +xcb_xf86dri_create_context_unchecked (xcb_connection_t *c, + uint32_t screen, + uint32_t visual, + uint32_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_CREATE_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xf86dri_create_context_cookie_t xcb_ret; + xcb_xf86dri_create_context_request_t xcb_out; + + xcb_out.screen = screen; + xcb_out.visual = visual; + xcb_out.context = context; + + 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_xf86dri_create_context_reply_t * +xcb_xf86dri_create_context_reply (xcb_connection_t *c, + xcb_xf86dri_create_context_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xf86dri_create_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_xf86dri_destroy_context_checked (xcb_connection_t *c, + uint32_t screen, + uint32_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_DESTROY_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xf86dri_destroy_context_request_t xcb_out; + + xcb_out.screen = screen; + xcb_out.context = context; + + 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_xf86dri_destroy_context (xcb_connection_t *c, + uint32_t screen, + uint32_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_DESTROY_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xf86dri_destroy_context_request_t xcb_out; + + xcb_out.screen = screen; + xcb_out.context = context; + + 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_xf86dri_create_drawable_cookie_t +xcb_xf86dri_create_drawable (xcb_connection_t *c, + uint32_t screen, + uint32_t drawable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_CREATE_DRAWABLE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xf86dri_create_drawable_cookie_t xcb_ret; + xcb_xf86dri_create_drawable_request_t xcb_out; + + xcb_out.screen = screen; + 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_xf86dri_create_drawable_cookie_t +xcb_xf86dri_create_drawable_unchecked (xcb_connection_t *c, + uint32_t screen, + uint32_t drawable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_CREATE_DRAWABLE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xf86dri_create_drawable_cookie_t xcb_ret; + xcb_xf86dri_create_drawable_request_t xcb_out; + + xcb_out.screen = screen; + 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_xf86dri_create_drawable_reply_t * +xcb_xf86dri_create_drawable_reply (xcb_connection_t *c, + xcb_xf86dri_create_drawable_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xf86dri_create_drawable_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_xf86dri_destroy_drawable_checked (xcb_connection_t *c, + uint32_t screen, + uint32_t drawable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_DESTROY_DRAWABLE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xf86dri_destroy_drawable_request_t xcb_out; + + xcb_out.screen = screen; + 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_xf86dri_destroy_drawable (xcb_connection_t *c, + uint32_t screen, + uint32_t drawable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_DESTROY_DRAWABLE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xf86dri_destroy_drawable_request_t xcb_out; + + xcb_out.screen = screen; + 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; +} + +int +xcb_xf86dri_get_drawable_info_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xf86dri_get_drawable_info_reply_t *_aux = (xcb_xf86dri_get_drawable_info_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_xf86dri_get_drawable_info_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* clip_rects */ + xcb_block_len += _aux->num_clip_rects * sizeof(xcb_xf86dri_drm_clip_rect_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xf86dri_drm_clip_rect_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; + /* back_clip_rects */ + xcb_block_len += _aux->num_back_clip_rects * sizeof(xcb_xf86dri_drm_clip_rect_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xf86dri_drm_clip_rect_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_xf86dri_get_drawable_info_cookie_t +xcb_xf86dri_get_drawable_info (xcb_connection_t *c, + uint32_t screen, + uint32_t drawable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_GET_DRAWABLE_INFO, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xf86dri_get_drawable_info_cookie_t xcb_ret; + xcb_xf86dri_get_drawable_info_request_t xcb_out; + + xcb_out.screen = screen; + 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_xf86dri_get_drawable_info_cookie_t +xcb_xf86dri_get_drawable_info_unchecked (xcb_connection_t *c, + uint32_t screen, + uint32_t drawable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_GET_DRAWABLE_INFO, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xf86dri_get_drawable_info_cookie_t xcb_ret; + xcb_xf86dri_get_drawable_info_request_t xcb_out; + + xcb_out.screen = screen; + 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_xf86dri_drm_clip_rect_t * +xcb_xf86dri_get_drawable_info_clip_rects (const xcb_xf86dri_get_drawable_info_reply_t *R) +{ + return (xcb_xf86dri_drm_clip_rect_t *) (R + 1); +} + +int +xcb_xf86dri_get_drawable_info_clip_rects_length (const xcb_xf86dri_get_drawable_info_reply_t *R) +{ + return R->num_clip_rects; +} + +xcb_xf86dri_drm_clip_rect_iterator_t +xcb_xf86dri_get_drawable_info_clip_rects_iterator (const xcb_xf86dri_get_drawable_info_reply_t *R) +{ + xcb_xf86dri_drm_clip_rect_iterator_t i; + i.data = (xcb_xf86dri_drm_clip_rect_t *) (R + 1); + i.rem = R->num_clip_rects; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xf86dri_drm_clip_rect_t * +xcb_xf86dri_get_drawable_info_back_clip_rects (const xcb_xf86dri_get_drawable_info_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_xf86dri_drm_clip_rect_end(xcb_xf86dri_get_drawable_info_clip_rects_iterator(R)); + return (xcb_xf86dri_drm_clip_rect_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xf86dri_drm_clip_rect_t, prev.index) + 0); +} + +int +xcb_xf86dri_get_drawable_info_back_clip_rects_length (const xcb_xf86dri_get_drawable_info_reply_t *R) +{ + return R->num_back_clip_rects; +} + +xcb_xf86dri_drm_clip_rect_iterator_t +xcb_xf86dri_get_drawable_info_back_clip_rects_iterator (const xcb_xf86dri_get_drawable_info_reply_t *R) +{ + xcb_xf86dri_drm_clip_rect_iterator_t i; + xcb_generic_iterator_t prev = xcb_xf86dri_drm_clip_rect_end(xcb_xf86dri_get_drawable_info_clip_rects_iterator(R)); + i.data = (xcb_xf86dri_drm_clip_rect_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xf86dri_drm_clip_rect_t, prev.index)); + i.rem = R->num_back_clip_rects; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xf86dri_get_drawable_info_reply_t * +xcb_xf86dri_get_drawable_info_reply (xcb_connection_t *c, + xcb_xf86dri_get_drawable_info_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xf86dri_get_drawable_info_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_xf86dri_get_device_info_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xf86dri_get_device_info_reply_t *_aux = (xcb_xf86dri_get_device_info_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_xf86dri_get_device_info_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* device_private */ + xcb_block_len += _aux->device_private_size * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_xf86dri_get_device_info_cookie_t +xcb_xf86dri_get_device_info (xcb_connection_t *c, + uint32_t screen) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_GET_DEVICE_INFO, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xf86dri_get_device_info_cookie_t xcb_ret; + xcb_xf86dri_get_device_info_request_t xcb_out; + + 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_xf86dri_get_device_info_cookie_t +xcb_xf86dri_get_device_info_unchecked (xcb_connection_t *c, + uint32_t screen) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_GET_DEVICE_INFO, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xf86dri_get_device_info_cookie_t xcb_ret; + xcb_xf86dri_get_device_info_request_t xcb_out; + + 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; +} + +uint32_t * +xcb_xf86dri_get_device_info_device_private (const xcb_xf86dri_get_device_info_reply_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_xf86dri_get_device_info_device_private_length (const xcb_xf86dri_get_device_info_reply_t *R) +{ + return R->device_private_size; +} + +xcb_generic_iterator_t +xcb_xf86dri_get_device_info_device_private_end (const xcb_xf86dri_get_device_info_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->device_private_size); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xf86dri_get_device_info_reply_t * +xcb_xf86dri_get_device_info_reply (xcb_connection_t *c, + xcb_xf86dri_get_device_info_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xf86dri_get_device_info_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_xf86dri_auth_connection_cookie_t +xcb_xf86dri_auth_connection (xcb_connection_t *c, + uint32_t screen, + uint32_t magic) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_AUTH_CONNECTION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xf86dri_auth_connection_cookie_t xcb_ret; + xcb_xf86dri_auth_connection_request_t xcb_out; + + xcb_out.screen = screen; + xcb_out.magic = magic; + + 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_xf86dri_auth_connection_cookie_t +xcb_xf86dri_auth_connection_unchecked (xcb_connection_t *c, + uint32_t screen, + uint32_t magic) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xf86dri_id, + .opcode = XCB_XF86DRI_AUTH_CONNECTION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xf86dri_auth_connection_cookie_t xcb_ret; + xcb_xf86dri_auth_connection_request_t xcb_out; + + xcb_out.screen = screen; + xcb_out.magic = magic; + + 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_xf86dri_auth_connection_reply_t * +xcb_xf86dri_auth_connection_reply (xcb_connection_t *c, + xcb_xf86dri_auth_connection_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xf86dri_auth_connection_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + diff --git a/depends/libxcb/src/xfixes.c b/depends/libxcb/src/xfixes.c new file mode 100644 index 0000000..87b198d --- /dev/null +++ b/depends/libxcb/src/xfixes.c @@ -0,0 +1,2699 @@ +/* + * This file generated automatically from xfixes.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "xfixes.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) +#include "xproto.h" +#include "render.h" +#include "shape.h" + +xcb_extension_t xcb_xfixes_id = { "XFIXES", 0 }; + +xcb_xfixes_query_version_cookie_t +xcb_xfixes_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_xfixes_id, + .opcode = XCB_XFIXES_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xfixes_query_version_cookie_t xcb_ret; + xcb_xfixes_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_xfixes_query_version_cookie_t +xcb_xfixes_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_xfixes_id, + .opcode = XCB_XFIXES_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xfixes_query_version_cookie_t xcb_ret; + xcb_xfixes_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_xfixes_query_version_reply_t * +xcb_xfixes_query_version_reply (xcb_connection_t *c, + xcb_xfixes_query_version_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xfixes_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_xfixes_change_save_set_checked (xcb_connection_t *c, + uint8_t mode, + uint8_t target, + uint8_t map, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_CHANGE_SAVE_SET, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_change_save_set_request_t xcb_out; + + xcb_out.mode = mode; + xcb_out.target = target; + xcb_out.map = map; + xcb_out.pad0 = 0; + 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_xfixes_change_save_set (xcb_connection_t *c, + uint8_t mode, + uint8_t target, + uint8_t map, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_CHANGE_SAVE_SET, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_change_save_set_request_t xcb_out; + + xcb_out.mode = mode; + xcb_out.target = target; + xcb_out.map = map; + xcb_out.pad0 = 0; + 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_xfixes_select_selection_input_checked (xcb_connection_t *c, + xcb_window_t window, + xcb_atom_t selection, + uint32_t event_mask) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_SELECT_SELECTION_INPUT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_select_selection_input_request_t xcb_out; + + xcb_out.window = window; + xcb_out.selection = selection; + 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_xfixes_select_selection_input (xcb_connection_t *c, + xcb_window_t window, + xcb_atom_t selection, + uint32_t event_mask) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_SELECT_SELECTION_INPUT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_select_selection_input_request_t xcb_out; + + xcb_out.window = window; + xcb_out.selection = selection; + 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_void_cookie_t +xcb_xfixes_select_cursor_input_checked (xcb_connection_t *c, + xcb_window_t window, + uint32_t event_mask) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_SELECT_CURSOR_INPUT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_select_cursor_input_request_t xcb_out; + + 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_xfixes_select_cursor_input (xcb_connection_t *c, + xcb_window_t window, + uint32_t event_mask) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_SELECT_CURSOR_INPUT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_select_cursor_input_request_t xcb_out; + + 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; +} + +int +xcb_xfixes_get_cursor_image_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xfixes_get_cursor_image_reply_t *_aux = (xcb_xfixes_get_cursor_image_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_xfixes_get_cursor_image_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* cursor_image */ + xcb_block_len += (_aux->width * _aux->height) * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_xfixes_get_cursor_image_cookie_t +xcb_xfixes_get_cursor_image (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_GET_CURSOR_IMAGE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xfixes_get_cursor_image_cookie_t xcb_ret; + xcb_xfixes_get_cursor_image_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_xfixes_get_cursor_image_cookie_t +xcb_xfixes_get_cursor_image_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_GET_CURSOR_IMAGE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xfixes_get_cursor_image_cookie_t xcb_ret; + xcb_xfixes_get_cursor_image_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; +} + +uint32_t * +xcb_xfixes_get_cursor_image_cursor_image (const xcb_xfixes_get_cursor_image_reply_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_xfixes_get_cursor_image_cursor_image_length (const xcb_xfixes_get_cursor_image_reply_t *R) +{ + return (R->width * R->height); +} + +xcb_generic_iterator_t +xcb_xfixes_get_cursor_image_cursor_image_end (const xcb_xfixes_get_cursor_image_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + ((R->width * R->height)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xfixes_get_cursor_image_reply_t * +xcb_xfixes_get_cursor_image_reply (xcb_connection_t *c, + xcb_xfixes_get_cursor_image_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xfixes_get_cursor_image_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +void +xcb_xfixes_region_next (xcb_xfixes_region_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xfixes_region_t); +} + +xcb_generic_iterator_t +xcb_xfixes_region_end (xcb_xfixes_region_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; +} + +int +xcb_xfixes_create_region_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_xfixes_create_region_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_xfixes_create_region_checked (xcb_connection_t *c, + xcb_xfixes_region_t region, + uint32_t rectangles_len, + const xcb_rectangle_t *rectangles) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_CREATE_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_create_region_request_t xcb_out; + + xcb_out.region = region; + + 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_xfixes_create_region (xcb_connection_t *c, + xcb_xfixes_region_t region, + uint32_t rectangles_len, + const xcb_rectangle_t *rectangles) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_CREATE_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_create_region_request_t xcb_out; + + xcb_out.region = region; + + 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_xfixes_create_region_rectangles (const xcb_xfixes_create_region_request_t *R) +{ + return (xcb_rectangle_t *) (R + 1); +} + +int +xcb_xfixes_create_region_rectangles_length (const xcb_xfixes_create_region_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_xfixes_create_region_request_t))/sizeof(xcb_rectangle_t)); +} + +xcb_rectangle_iterator_t +xcb_xfixes_create_region_rectangles_iterator (const xcb_xfixes_create_region_request_t *R) +{ + xcb_rectangle_iterator_t i; + i.data = (xcb_rectangle_t *) (R + 1); + i.rem = (((R->length * 4) - sizeof(xcb_xfixes_create_region_request_t))/sizeof(xcb_rectangle_t)); + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_xfixes_create_region_from_bitmap_checked (xcb_connection_t *c, + xcb_xfixes_region_t region, + xcb_pixmap_t bitmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_CREATE_REGION_FROM_BITMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_create_region_from_bitmap_request_t xcb_out; + + xcb_out.region = region; + xcb_out.bitmap = 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_xfixes_create_region_from_bitmap (xcb_connection_t *c, + xcb_xfixes_region_t region, + xcb_pixmap_t bitmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_CREATE_REGION_FROM_BITMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_create_region_from_bitmap_request_t xcb_out; + + xcb_out.region = region; + xcb_out.bitmap = 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_xfixes_create_region_from_window_checked (xcb_connection_t *c, + xcb_xfixes_region_t region, + xcb_window_t window, + xcb_shape_kind_t kind) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_CREATE_REGION_FROM_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_create_region_from_window_request_t xcb_out; + + xcb_out.region = region; + xcb_out.window = window; + xcb_out.kind = 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_void_cookie_t +xcb_xfixes_create_region_from_window (xcb_connection_t *c, + xcb_xfixes_region_t region, + xcb_window_t window, + xcb_shape_kind_t kind) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_CREATE_REGION_FROM_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_create_region_from_window_request_t xcb_out; + + xcb_out.region = region; + xcb_out.window = window; + xcb_out.kind = 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_void_cookie_t +xcb_xfixes_create_region_from_gc_checked (xcb_connection_t *c, + xcb_xfixes_region_t region, + xcb_gcontext_t gc) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_CREATE_REGION_FROM_GC, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_create_region_from_gc_request_t xcb_out; + + xcb_out.region = region; + xcb_out.gc = gc; + + 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_xfixes_create_region_from_gc (xcb_connection_t *c, + xcb_xfixes_region_t region, + xcb_gcontext_t gc) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_CREATE_REGION_FROM_GC, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_create_region_from_gc_request_t xcb_out; + + xcb_out.region = region; + xcb_out.gc = gc; + + 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_xfixes_create_region_from_picture_checked (xcb_connection_t *c, + xcb_xfixes_region_t region, + xcb_render_picture_t picture) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_CREATE_REGION_FROM_PICTURE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_create_region_from_picture_request_t xcb_out; + + xcb_out.region = region; + xcb_out.picture = picture; + + 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_xfixes_create_region_from_picture (xcb_connection_t *c, + xcb_xfixes_region_t region, + xcb_render_picture_t picture) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_CREATE_REGION_FROM_PICTURE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_create_region_from_picture_request_t xcb_out; + + xcb_out.region = region; + xcb_out.picture = picture; + + 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_xfixes_destroy_region_checked (xcb_connection_t *c, + xcb_xfixes_region_t region) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_DESTROY_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_destroy_region_request_t xcb_out; + + xcb_out.region = region; + + 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_xfixes_destroy_region (xcb_connection_t *c, + xcb_xfixes_region_t region) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_DESTROY_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_destroy_region_request_t xcb_out; + + xcb_out.region = region; + + 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_xfixes_set_region_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_xfixes_set_region_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_xfixes_set_region_checked (xcb_connection_t *c, + xcb_xfixes_region_t region, + uint32_t rectangles_len, + const xcb_rectangle_t *rectangles) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_SET_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_set_region_request_t xcb_out; + + xcb_out.region = region; + + 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_xfixes_set_region (xcb_connection_t *c, + xcb_xfixes_region_t region, + uint32_t rectangles_len, + const xcb_rectangle_t *rectangles) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_SET_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_set_region_request_t xcb_out; + + xcb_out.region = region; + + 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_xfixes_set_region_rectangles (const xcb_xfixes_set_region_request_t *R) +{ + return (xcb_rectangle_t *) (R + 1); +} + +int +xcb_xfixes_set_region_rectangles_length (const xcb_xfixes_set_region_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_xfixes_set_region_request_t))/sizeof(xcb_rectangle_t)); +} + +xcb_rectangle_iterator_t +xcb_xfixes_set_region_rectangles_iterator (const xcb_xfixes_set_region_request_t *R) +{ + xcb_rectangle_iterator_t i; + i.data = (xcb_rectangle_t *) (R + 1); + i.rem = (((R->length * 4) - sizeof(xcb_xfixes_set_region_request_t))/sizeof(xcb_rectangle_t)); + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_xfixes_copy_region_checked (xcb_connection_t *c, + xcb_xfixes_region_t source, + xcb_xfixes_region_t destination) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_COPY_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_copy_region_request_t xcb_out; + + xcb_out.source = source; + xcb_out.destination = destination; + + 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_xfixes_copy_region (xcb_connection_t *c, + xcb_xfixes_region_t source, + xcb_xfixes_region_t destination) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_COPY_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_copy_region_request_t xcb_out; + + xcb_out.source = source; + xcb_out.destination = destination; + + 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_xfixes_union_region_checked (xcb_connection_t *c, + xcb_xfixes_region_t source1, + xcb_xfixes_region_t source2, + xcb_xfixes_region_t destination) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_UNION_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_union_region_request_t xcb_out; + + xcb_out.source1 = source1; + xcb_out.source2 = source2; + xcb_out.destination = destination; + + 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_xfixes_union_region (xcb_connection_t *c, + xcb_xfixes_region_t source1, + xcb_xfixes_region_t source2, + xcb_xfixes_region_t destination) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_UNION_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_union_region_request_t xcb_out; + + xcb_out.source1 = source1; + xcb_out.source2 = source2; + xcb_out.destination = destination; + + 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_xfixes_intersect_region_checked (xcb_connection_t *c, + xcb_xfixes_region_t source1, + xcb_xfixes_region_t source2, + xcb_xfixes_region_t destination) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_INTERSECT_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_intersect_region_request_t xcb_out; + + xcb_out.source1 = source1; + xcb_out.source2 = source2; + xcb_out.destination = destination; + + 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_xfixes_intersect_region (xcb_connection_t *c, + xcb_xfixes_region_t source1, + xcb_xfixes_region_t source2, + xcb_xfixes_region_t destination) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_INTERSECT_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_intersect_region_request_t xcb_out; + + xcb_out.source1 = source1; + xcb_out.source2 = source2; + xcb_out.destination = destination; + + 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_xfixes_subtract_region_checked (xcb_connection_t *c, + xcb_xfixes_region_t source1, + xcb_xfixes_region_t source2, + xcb_xfixes_region_t destination) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_SUBTRACT_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_subtract_region_request_t xcb_out; + + xcb_out.source1 = source1; + xcb_out.source2 = source2; + xcb_out.destination = destination; + + 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_xfixes_subtract_region (xcb_connection_t *c, + xcb_xfixes_region_t source1, + xcb_xfixes_region_t source2, + xcb_xfixes_region_t destination) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_SUBTRACT_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_subtract_region_request_t xcb_out; + + xcb_out.source1 = source1; + xcb_out.source2 = source2; + xcb_out.destination = destination; + + 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_xfixes_invert_region_checked (xcb_connection_t *c, + xcb_xfixes_region_t source, + xcb_rectangle_t bounds, + xcb_xfixes_region_t destination) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_INVERT_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_invert_region_request_t xcb_out; + + xcb_out.source = source; + xcb_out.bounds = bounds; + xcb_out.destination = destination; + + 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_xfixes_invert_region (xcb_connection_t *c, + xcb_xfixes_region_t source, + xcb_rectangle_t bounds, + xcb_xfixes_region_t destination) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_INVERT_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_invert_region_request_t xcb_out; + + xcb_out.source = source; + xcb_out.bounds = bounds; + xcb_out.destination = destination; + + 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_xfixes_translate_region_checked (xcb_connection_t *c, + xcb_xfixes_region_t region, + int16_t dx, + int16_t dy) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_TRANSLATE_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_translate_region_request_t xcb_out; + + xcb_out.region = region; + xcb_out.dx = dx; + xcb_out.dy = dy; + + 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_xfixes_translate_region (xcb_connection_t *c, + xcb_xfixes_region_t region, + int16_t dx, + int16_t dy) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_TRANSLATE_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_translate_region_request_t xcb_out; + + xcb_out.region = region; + xcb_out.dx = dx; + xcb_out.dy = dy; + + 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_xfixes_region_extents_checked (xcb_connection_t *c, + xcb_xfixes_region_t source, + xcb_xfixes_region_t destination) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_REGION_EXTENTS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_region_extents_request_t xcb_out; + + xcb_out.source = source; + xcb_out.destination = destination; + + 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_xfixes_region_extents (xcb_connection_t *c, + xcb_xfixes_region_t source, + xcb_xfixes_region_t destination) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_REGION_EXTENTS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_region_extents_request_t xcb_out; + + xcb_out.source = source; + xcb_out.destination = destination; + + 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_xfixes_fetch_region_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xfixes_fetch_region_reply_t *_aux = (xcb_xfixes_fetch_region_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_xfixes_fetch_region_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* rectangles */ + xcb_block_len += (_aux->length / 2) * 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_xfixes_fetch_region_cookie_t +xcb_xfixes_fetch_region (xcb_connection_t *c, + xcb_xfixes_region_t region) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_FETCH_REGION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xfixes_fetch_region_cookie_t xcb_ret; + xcb_xfixes_fetch_region_request_t xcb_out; + + xcb_out.region = region; + + 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_xfixes_fetch_region_cookie_t +xcb_xfixes_fetch_region_unchecked (xcb_connection_t *c, + xcb_xfixes_region_t region) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_FETCH_REGION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xfixes_fetch_region_cookie_t xcb_ret; + xcb_xfixes_fetch_region_request_t xcb_out; + + xcb_out.region = region; + + 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_xfixes_fetch_region_rectangles (const xcb_xfixes_fetch_region_reply_t *R) +{ + return (xcb_rectangle_t *) (R + 1); +} + +int +xcb_xfixes_fetch_region_rectangles_length (const xcb_xfixes_fetch_region_reply_t *R) +{ + return (R->length / 2); +} + +xcb_rectangle_iterator_t +xcb_xfixes_fetch_region_rectangles_iterator (const xcb_xfixes_fetch_region_reply_t *R) +{ + xcb_rectangle_iterator_t i; + i.data = (xcb_rectangle_t *) (R + 1); + i.rem = (R->length / 2); + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xfixes_fetch_region_reply_t * +xcb_xfixes_fetch_region_reply (xcb_connection_t *c, + xcb_xfixes_fetch_region_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xfixes_fetch_region_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_xfixes_set_gc_clip_region_checked (xcb_connection_t *c, + xcb_gcontext_t gc, + xcb_xfixes_region_t region, + int16_t x_origin, + int16_t y_origin) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_SET_GC_CLIP_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_set_gc_clip_region_request_t xcb_out; + + xcb_out.gc = gc; + xcb_out.region = region; + xcb_out.x_origin = x_origin; + xcb_out.y_origin = y_origin; + + 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_xfixes_set_gc_clip_region (xcb_connection_t *c, + xcb_gcontext_t gc, + xcb_xfixes_region_t region, + int16_t x_origin, + int16_t y_origin) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_SET_GC_CLIP_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_set_gc_clip_region_request_t xcb_out; + + xcb_out.gc = gc; + xcb_out.region = region; + xcb_out.x_origin = x_origin; + xcb_out.y_origin = y_origin; + + 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_xfixes_set_window_shape_region_checked (xcb_connection_t *c, + xcb_window_t dest, + xcb_shape_kind_t dest_kind, + int16_t x_offset, + int16_t y_offset, + xcb_xfixes_region_t region) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_SET_WINDOW_SHAPE_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_set_window_shape_region_request_t xcb_out; + + xcb_out.dest = dest; + xcb_out.dest_kind = dest_kind; + memset(xcb_out.pad0, 0, 3); + xcb_out.x_offset = x_offset; + xcb_out.y_offset = y_offset; + xcb_out.region = region; + + 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_xfixes_set_window_shape_region (xcb_connection_t *c, + xcb_window_t dest, + xcb_shape_kind_t dest_kind, + int16_t x_offset, + int16_t y_offset, + xcb_xfixes_region_t region) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_SET_WINDOW_SHAPE_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_set_window_shape_region_request_t xcb_out; + + xcb_out.dest = dest; + xcb_out.dest_kind = dest_kind; + memset(xcb_out.pad0, 0, 3); + xcb_out.x_offset = x_offset; + xcb_out.y_offset = y_offset; + xcb_out.region = region; + + 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_xfixes_set_picture_clip_region_checked (xcb_connection_t *c, + xcb_render_picture_t picture, + xcb_xfixes_region_t region, + int16_t x_origin, + int16_t y_origin) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_SET_PICTURE_CLIP_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_set_picture_clip_region_request_t xcb_out; + + xcb_out.picture = picture; + xcb_out.region = region; + xcb_out.x_origin = x_origin; + xcb_out.y_origin = y_origin; + + 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_xfixes_set_picture_clip_region (xcb_connection_t *c, + xcb_render_picture_t picture, + xcb_xfixes_region_t region, + int16_t x_origin, + int16_t y_origin) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_SET_PICTURE_CLIP_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_set_picture_clip_region_request_t xcb_out; + + xcb_out.picture = picture; + xcb_out.region = region; + xcb_out.x_origin = x_origin; + xcb_out.y_origin = y_origin; + + 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_xfixes_set_cursor_name_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xfixes_set_cursor_name_request_t *_aux = (xcb_xfixes_set_cursor_name_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_xfixes_set_cursor_name_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* name */ + xcb_block_len += _aux->nbytes * sizeof(char); + 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_xfixes_set_cursor_name_checked (xcb_connection_t *c, + xcb_cursor_t cursor, + uint16_t nbytes, + const char *name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_SET_CURSOR_NAME, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_set_cursor_name_request_t xcb_out; + + xcb_out.cursor = cursor; + xcb_out.nbytes = nbytes; + 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; + /* char name */ + xcb_parts[4].iov_base = (char *) name; + xcb_parts[4].iov_len = nbytes * 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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_xfixes_set_cursor_name (xcb_connection_t *c, + xcb_cursor_t cursor, + uint16_t nbytes, + const char *name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_SET_CURSOR_NAME, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_set_cursor_name_request_t xcb_out; + + xcb_out.cursor = cursor; + xcb_out.nbytes = nbytes; + 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; + /* char name */ + xcb_parts[4].iov_base = (char *) name; + xcb_parts[4].iov_len = nbytes * 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; +} + +char * +xcb_xfixes_set_cursor_name_name (const xcb_xfixes_set_cursor_name_request_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_xfixes_set_cursor_name_name_length (const xcb_xfixes_set_cursor_name_request_t *R) +{ + return R->nbytes; +} + +xcb_generic_iterator_t +xcb_xfixes_set_cursor_name_name_end (const xcb_xfixes_set_cursor_name_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->nbytes); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_xfixes_get_cursor_name_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xfixes_get_cursor_name_reply_t *_aux = (xcb_xfixes_get_cursor_name_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_xfixes_get_cursor_name_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* name */ + xcb_block_len += _aux->nbytes * sizeof(char); + 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_xfixes_get_cursor_name_cookie_t +xcb_xfixes_get_cursor_name (xcb_connection_t *c, + xcb_cursor_t cursor) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_GET_CURSOR_NAME, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xfixes_get_cursor_name_cookie_t xcb_ret; + xcb_xfixes_get_cursor_name_request_t xcb_out; + + xcb_out.cursor = cursor; + + 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_xfixes_get_cursor_name_cookie_t +xcb_xfixes_get_cursor_name_unchecked (xcb_connection_t *c, + xcb_cursor_t cursor) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_GET_CURSOR_NAME, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xfixes_get_cursor_name_cookie_t xcb_ret; + xcb_xfixes_get_cursor_name_request_t xcb_out; + + xcb_out.cursor = cursor; + + 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; +} + +char * +xcb_xfixes_get_cursor_name_name (const xcb_xfixes_get_cursor_name_reply_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_xfixes_get_cursor_name_name_length (const xcb_xfixes_get_cursor_name_reply_t *R) +{ + return R->nbytes; +} + +xcb_generic_iterator_t +xcb_xfixes_get_cursor_name_name_end (const xcb_xfixes_get_cursor_name_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->nbytes); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xfixes_get_cursor_name_reply_t * +xcb_xfixes_get_cursor_name_reply (xcb_connection_t *c, + xcb_xfixes_get_cursor_name_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xfixes_get_cursor_name_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_xfixes_get_cursor_image_and_name_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xfixes_get_cursor_image_and_name_reply_t *_aux = (xcb_xfixes_get_cursor_image_and_name_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_xfixes_get_cursor_image_and_name_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* cursor_image */ + xcb_block_len += (_aux->width * _aux->height) * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* name */ + xcb_block_len += _aux->nbytes * sizeof(char); + 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_xfixes_get_cursor_image_and_name_cookie_t +xcb_xfixes_get_cursor_image_and_name (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_GET_CURSOR_IMAGE_AND_NAME, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xfixes_get_cursor_image_and_name_cookie_t xcb_ret; + xcb_xfixes_get_cursor_image_and_name_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_xfixes_get_cursor_image_and_name_cookie_t +xcb_xfixes_get_cursor_image_and_name_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_GET_CURSOR_IMAGE_AND_NAME, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xfixes_get_cursor_image_and_name_cookie_t xcb_ret; + xcb_xfixes_get_cursor_image_and_name_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; +} + +uint32_t * +xcb_xfixes_get_cursor_image_and_name_cursor_image (const xcb_xfixes_get_cursor_image_and_name_reply_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_xfixes_get_cursor_image_and_name_cursor_image_length (const xcb_xfixes_get_cursor_image_and_name_reply_t *R) +{ + return (R->width * R->height); +} + +xcb_generic_iterator_t +xcb_xfixes_get_cursor_image_and_name_cursor_image_end (const xcb_xfixes_get_cursor_image_and_name_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + ((R->width * R->height)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +char * +xcb_xfixes_get_cursor_image_and_name_name (const xcb_xfixes_get_cursor_image_and_name_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_xfixes_get_cursor_image_and_name_cursor_image_end(R); + return (char *) ((char *) prev.data + XCB_TYPE_PAD(char, prev.index) + 0); +} + +int +xcb_xfixes_get_cursor_image_and_name_name_length (const xcb_xfixes_get_cursor_image_and_name_reply_t *R) +{ + return R->nbytes; +} + +xcb_generic_iterator_t +xcb_xfixes_get_cursor_image_and_name_name_end (const xcb_xfixes_get_cursor_image_and_name_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_xfixes_get_cursor_image_and_name_cursor_image_end(R); + i.data = ((char *) ((char*) prev.data + XCB_TYPE_PAD(char, prev.index))) + (R->nbytes); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xfixes_get_cursor_image_and_name_reply_t * +xcb_xfixes_get_cursor_image_and_name_reply (xcb_connection_t *c, + xcb_xfixes_get_cursor_image_and_name_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xfixes_get_cursor_image_and_name_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_xfixes_change_cursor_checked (xcb_connection_t *c, + xcb_cursor_t source, + xcb_cursor_t destination) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_CHANGE_CURSOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_change_cursor_request_t xcb_out; + + xcb_out.source = source; + xcb_out.destination = destination; + + 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_xfixes_change_cursor (xcb_connection_t *c, + xcb_cursor_t source, + xcb_cursor_t destination) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_CHANGE_CURSOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_change_cursor_request_t xcb_out; + + xcb_out.source = source; + xcb_out.destination = destination; + + 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_xfixes_change_cursor_by_name_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xfixes_change_cursor_by_name_request_t *_aux = (xcb_xfixes_change_cursor_by_name_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_xfixes_change_cursor_by_name_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* name */ + xcb_block_len += _aux->nbytes * sizeof(char); + 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_xfixes_change_cursor_by_name_checked (xcb_connection_t *c, + xcb_cursor_t src, + uint16_t nbytes, + const char *name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_CHANGE_CURSOR_BY_NAME, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_change_cursor_by_name_request_t xcb_out; + + xcb_out.src = src; + xcb_out.nbytes = nbytes; + 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; + /* char name */ + xcb_parts[4].iov_base = (char *) name; + xcb_parts[4].iov_len = nbytes * 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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_xfixes_change_cursor_by_name (xcb_connection_t *c, + xcb_cursor_t src, + uint16_t nbytes, + const char *name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_CHANGE_CURSOR_BY_NAME, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_change_cursor_by_name_request_t xcb_out; + + xcb_out.src = src; + xcb_out.nbytes = nbytes; + 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; + /* char name */ + xcb_parts[4].iov_base = (char *) name; + xcb_parts[4].iov_len = nbytes * 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; +} + +char * +xcb_xfixes_change_cursor_by_name_name (const xcb_xfixes_change_cursor_by_name_request_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_xfixes_change_cursor_by_name_name_length (const xcb_xfixes_change_cursor_by_name_request_t *R) +{ + return R->nbytes; +} + +xcb_generic_iterator_t +xcb_xfixes_change_cursor_by_name_name_end (const xcb_xfixes_change_cursor_by_name_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->nbytes); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_xfixes_expand_region_checked (xcb_connection_t *c, + xcb_xfixes_region_t source, + xcb_xfixes_region_t destination, + uint16_t left, + uint16_t right, + uint16_t top, + uint16_t bottom) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_EXPAND_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_expand_region_request_t xcb_out; + + xcb_out.source = source; + xcb_out.destination = destination; + xcb_out.left = left; + xcb_out.right = right; + xcb_out.top = top; + xcb_out.bottom = bottom; + + 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_xfixes_expand_region (xcb_connection_t *c, + xcb_xfixes_region_t source, + xcb_xfixes_region_t destination, + uint16_t left, + uint16_t right, + uint16_t top, + uint16_t bottom) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_EXPAND_REGION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_expand_region_request_t xcb_out; + + xcb_out.source = source; + xcb_out.destination = destination; + xcb_out.left = left; + xcb_out.right = right; + xcb_out.top = top; + xcb_out.bottom = bottom; + + 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_xfixes_hide_cursor_checked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_HIDE_CURSOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_hide_cursor_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_xfixes_hide_cursor (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_HIDE_CURSOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_hide_cursor_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_void_cookie_t +xcb_xfixes_show_cursor_checked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_SHOW_CURSOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_show_cursor_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_xfixes_show_cursor (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_SHOW_CURSOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_show_cursor_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; +} + +void +xcb_xfixes_barrier_next (xcb_xfixes_barrier_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xfixes_barrier_t); +} + +xcb_generic_iterator_t +xcb_xfixes_barrier_end (xcb_xfixes_barrier_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; +} + +int +xcb_xfixes_create_pointer_barrier_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xfixes_create_pointer_barrier_request_t *_aux = (xcb_xfixes_create_pointer_barrier_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_xfixes_create_pointer_barrier_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* devices */ + xcb_block_len += _aux->num_devices * sizeof(uint16_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint16_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_xfixes_create_pointer_barrier_checked (xcb_connection_t *c, + xcb_xfixes_barrier_t barrier, + xcb_window_t window, + uint16_t x1, + uint16_t y1, + uint16_t x2, + uint16_t y2, + uint32_t directions, + uint16_t num_devices, + const uint16_t *devices) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_CREATE_POINTER_BARRIER, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_create_pointer_barrier_request_t xcb_out; + + xcb_out.barrier = barrier; + xcb_out.window = window; + xcb_out.x1 = x1; + xcb_out.y1 = y1; + xcb_out.x2 = x2; + xcb_out.y2 = y2; + xcb_out.directions = directions; + memset(xcb_out.pad0, 0, 2); + xcb_out.num_devices = num_devices; + + 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; + /* uint16_t devices */ + xcb_parts[4].iov_base = (char *) devices; + xcb_parts[4].iov_len = num_devices * sizeof(uint16_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_xfixes_create_pointer_barrier (xcb_connection_t *c, + xcb_xfixes_barrier_t barrier, + xcb_window_t window, + uint16_t x1, + uint16_t y1, + uint16_t x2, + uint16_t y2, + uint32_t directions, + uint16_t num_devices, + const uint16_t *devices) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_CREATE_POINTER_BARRIER, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_create_pointer_barrier_request_t xcb_out; + + xcb_out.barrier = barrier; + xcb_out.window = window; + xcb_out.x1 = x1; + xcb_out.y1 = y1; + xcb_out.x2 = x2; + xcb_out.y2 = y2; + xcb_out.directions = directions; + memset(xcb_out.pad0, 0, 2); + xcb_out.num_devices = num_devices; + + 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; + /* uint16_t devices */ + xcb_parts[4].iov_base = (char *) devices; + xcb_parts[4].iov_len = num_devices * sizeof(uint16_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; +} + +uint16_t * +xcb_xfixes_create_pointer_barrier_devices (const xcb_xfixes_create_pointer_barrier_request_t *R) +{ + return (uint16_t *) (R + 1); +} + +int +xcb_xfixes_create_pointer_barrier_devices_length (const xcb_xfixes_create_pointer_barrier_request_t *R) +{ + return R->num_devices; +} + +xcb_generic_iterator_t +xcb_xfixes_create_pointer_barrier_devices_end (const xcb_xfixes_create_pointer_barrier_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint16_t *) (R + 1)) + (R->num_devices); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_xfixes_delete_pointer_barrier_checked (xcb_connection_t *c, + xcb_xfixes_barrier_t barrier) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_DELETE_POINTER_BARRIER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_delete_pointer_barrier_request_t xcb_out; + + xcb_out.barrier = barrier; + + 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_xfixes_delete_pointer_barrier (xcb_connection_t *c, + xcb_xfixes_barrier_t barrier) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_DELETE_POINTER_BARRIER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_delete_pointer_barrier_request_t xcb_out; + + xcb_out.barrier = barrier; + + 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_xfixes_set_client_disconnect_mode_checked (xcb_connection_t *c, + uint32_t disconnect_mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_SET_CLIENT_DISCONNECT_MODE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_set_client_disconnect_mode_request_t xcb_out; + + xcb_out.disconnect_mode = disconnect_mode; + + 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_xfixes_set_client_disconnect_mode (xcb_connection_t *c, + uint32_t disconnect_mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_SET_CLIENT_DISCONNECT_MODE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xfixes_set_client_disconnect_mode_request_t xcb_out; + + xcb_out.disconnect_mode = disconnect_mode; + + 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_xfixes_get_client_disconnect_mode_cookie_t +xcb_xfixes_get_client_disconnect_mode (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_GET_CLIENT_DISCONNECT_MODE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xfixes_get_client_disconnect_mode_cookie_t xcb_ret; + xcb_xfixes_get_client_disconnect_mode_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_xfixes_get_client_disconnect_mode_cookie_t +xcb_xfixes_get_client_disconnect_mode_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xfixes_id, + .opcode = XCB_XFIXES_GET_CLIENT_DISCONNECT_MODE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xfixes_get_client_disconnect_mode_cookie_t xcb_ret; + xcb_xfixes_get_client_disconnect_mode_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_xfixes_get_client_disconnect_mode_reply_t * +xcb_xfixes_get_client_disconnect_mode_reply (xcb_connection_t *c, + xcb_xfixes_get_client_disconnect_mode_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xfixes_get_client_disconnect_mode_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + diff --git a/depends/libxcb/src/xinerama.c b/depends/libxcb/src/xinerama.c new file mode 100644 index 0000000..2f23676 --- /dev/null +++ b/depends/libxcb/src/xinerama.c @@ -0,0 +1,451 @@ +/* + * This file generated automatically from xinerama.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "xinerama.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) +#include "xproto.h" + +xcb_extension_t xcb_xinerama_id = { "XINERAMA", 0 }; + +void +xcb_xinerama_screen_info_next (xcb_xinerama_screen_info_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xinerama_screen_info_t); +} + +xcb_generic_iterator_t +xcb_xinerama_screen_info_end (xcb_xinerama_screen_info_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_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); +} + diff --git a/depends/libxcb/src/xinput.c b/depends/libxcb/src/xinput.c new file mode 100644 index 0000000..38fc6c4 --- /dev/null +++ b/depends/libxcb/src/xinput.c @@ -0,0 +1,14513 @@ +/* + * This file generated automatically from xinput.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "xinput.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) +#include "xfixes.h" + +xcb_extension_t xcb_input_id = { "XInputExtension", 0 }; + +void +xcb_input_event_class_next (xcb_input_event_class_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_event_class_t); +} + +xcb_generic_iterator_t +xcb_input_event_class_end (xcb_input_event_class_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; +} + +void +xcb_input_key_code_next (xcb_input_key_code_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_key_code_t); +} + +xcb_generic_iterator_t +xcb_input_key_code_end (xcb_input_key_code_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; +} + +void +xcb_input_device_id_next (xcb_input_device_id_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_device_id_t); +} + +xcb_generic_iterator_t +xcb_input_device_id_end (xcb_input_device_id_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; +} + +void +xcb_input_fp1616_next (xcb_input_fp1616_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_fp1616_t); +} + +xcb_generic_iterator_t +xcb_input_fp1616_end (xcb_input_fp1616_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; +} + +void +xcb_input_fp3232_next (xcb_input_fp3232_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_fp3232_t); +} + +xcb_generic_iterator_t +xcb_input_fp3232_end (xcb_input_fp3232_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; +} + +int +xcb_input_get_extension_version_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_get_extension_version_request_t *_aux = (xcb_input_get_extension_version_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_input_get_extension_version_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* name */ + xcb_block_len += _aux->name_len * sizeof(char); + 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_input_get_extension_version_cookie_t +xcb_input_get_extension_version (xcb_connection_t *c, + uint16_t name_len, + const char *name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GET_EXTENSION_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_input_get_extension_version_cookie_t xcb_ret; + xcb_input_get_extension_version_request_t xcb_out; + + xcb_out.name_len = name_len; + 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; + /* char name */ + xcb_parts[4].iov_base = (char *) name; + xcb_parts[4].iov_len = name_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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_input_get_extension_version_cookie_t +xcb_input_get_extension_version_unchecked (xcb_connection_t *c, + uint16_t name_len, + const char *name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GET_EXTENSION_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_input_get_extension_version_cookie_t xcb_ret; + xcb_input_get_extension_version_request_t xcb_out; + + xcb_out.name_len = name_len; + 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; + /* char name */ + xcb_parts[4].iov_base = (char *) name; + xcb_parts[4].iov_len = name_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; +} + +xcb_input_get_extension_version_reply_t * +xcb_input_get_extension_version_reply (xcb_connection_t *c, + xcb_input_get_extension_version_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_get_extension_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +void +xcb_input_device_info_next (xcb_input_device_info_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_device_info_t); +} + +xcb_generic_iterator_t +xcb_input_device_info_end (xcb_input_device_info_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; +} + +void +xcb_input_key_info_next (xcb_input_key_info_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_key_info_t); +} + +xcb_generic_iterator_t +xcb_input_key_info_end (xcb_input_key_info_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; +} + +void +xcb_input_button_info_next (xcb_input_button_info_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_button_info_t); +} + +xcb_generic_iterator_t +xcb_input_button_info_end (xcb_input_button_info_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; +} + +void +xcb_input_axis_info_next (xcb_input_axis_info_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_axis_info_t); +} + +xcb_generic_iterator_t +xcb_input_axis_info_end (xcb_input_axis_info_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; +} + +int +xcb_input_valuator_info_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_valuator_info_t *_aux = (xcb_input_valuator_info_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_input_valuator_info_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* axes */ + xcb_block_len += _aux->axes_len * sizeof(xcb_input_axis_info_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_axis_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_input_axis_info_t * +xcb_input_valuator_info_axes (const xcb_input_valuator_info_t *R) +{ + return (xcb_input_axis_info_t *) (R + 1); +} + +int +xcb_input_valuator_info_axes_length (const xcb_input_valuator_info_t *R) +{ + return R->axes_len; +} + +xcb_input_axis_info_iterator_t +xcb_input_valuator_info_axes_iterator (const xcb_input_valuator_info_t *R) +{ + xcb_input_axis_info_iterator_t i; + i.data = (xcb_input_axis_info_t *) (R + 1); + i.rem = R->axes_len; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_input_valuator_info_next (xcb_input_valuator_info_iterator_t *i) +{ + xcb_input_valuator_info_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_input_valuator_info_t *)(((char *)R) + xcb_input_valuator_info_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_input_valuator_info_t *) child.data; +} + +xcb_generic_iterator_t +xcb_input_valuator_info_end (xcb_input_valuator_info_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_input_valuator_info_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +xcb_input_axis_info_t * +xcb_input_input_info_info_valuator_axes (const xcb_input_input_info_info_t *S) +{ + return S->valuator.axes; +} + +int +xcb_input_input_info_info_valuator_axes_length (const xcb_input_input_info_t *R, + const xcb_input_input_info_info_t *S) +{ + return S->valuator.axes_len; +} + +xcb_input_axis_info_iterator_t +xcb_input_input_info_info_valuator_axes_iterator (const xcb_input_input_info_t *R, + const xcb_input_input_info_info_t *S) +{ + xcb_input_axis_info_iterator_t i; + i.data = S->valuator.axes; + i.rem = S->valuator.axes_len; + i.index = (char *) i.data - (char *) S; + return i; +} + +int +xcb_input_input_info_info_serialize (void **_buffer, + uint8_t class_id, + const xcb_input_input_info_info_t *_aux) +{ + char *xcb_out = *_buffer; + unsigned int xcb_buffer_len = 0; + unsigned int xcb_align_to = 0; + unsigned int xcb_padding_offset = 2; + + unsigned int xcb_pad = 0; + char xcb_pad0[3] = {0, 0, 0}; + struct iovec xcb_parts[11]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(class_id == XCB_INPUT_INPUT_CLASS_KEY) { + /* xcb_input_input_info_info_t.key.min_keycode */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key.min_keycode; + xcb_block_len += sizeof(xcb_input_key_code_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_input_key_code_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_input_key_code_t); + /* xcb_input_input_info_info_t.key.max_keycode */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key.max_keycode; + xcb_block_len += sizeof(xcb_input_key_code_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_input_key_code_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_input_key_code_t); + /* xcb_input_input_info_info_t.key.num_keys */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key.num_keys; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_input_input_info_info_t.key.pad0 */ + xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; + xcb_block_len += sizeof(uint8_t)*2; + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t)*2; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + } + if(class_id == XCB_INPUT_INPUT_CLASS_BUTTON) { + /* xcb_input_input_info_info_t.button.num_buttons */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->button.num_buttons; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + } + if(class_id == XCB_INPUT_INPUT_CLASS_VALUATOR) { + /* xcb_input_input_info_info_t.valuator.axes_len */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->valuator.axes_len; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_input_info_info_t.valuator.mode */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->valuator.mode; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_input_info_info_t.valuator.motion_size */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->valuator.motion_size; + 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); + /* 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; + /* axes */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->valuator.axes; + xcb_block_len += _aux->valuator.axes_len * sizeof(xcb_input_axis_info_t); + xcb_parts[xcb_parts_idx].iov_len = _aux->valuator.axes_len * sizeof(xcb_input_axis_info_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_input_axis_info_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_input_input_info_info_unpack (const void *_buffer, + uint8_t class_id, + xcb_input_input_info_info_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 = 2; + + + if(class_id == XCB_INPUT_INPUT_CLASS_KEY) { + /* xcb_input_input_info_info_t.key.min_keycode */ + _aux->key.min_keycode = *(xcb_input_key_code_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_input_key_code_t); + xcb_tmp += sizeof(xcb_input_key_code_t); + xcb_align_to = ALIGNOF(xcb_input_key_code_t); + /* xcb_input_input_info_info_t.key.max_keycode */ + _aux->key.max_keycode = *(xcb_input_key_code_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_input_key_code_t); + xcb_tmp += sizeof(xcb_input_key_code_t); + xcb_align_to = ALIGNOF(xcb_input_key_code_t); + /* xcb_input_input_info_info_t.key.num_keys */ + _aux->key.num_keys = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_input_input_info_info_t.key.pad0 */ + _aux->key.pad0[0] = *(uint8_t *)xcb_tmp; + _aux->key.pad0[1] = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t) * 2; + xcb_tmp += sizeof(uint8_t) * 2; + xcb_align_to = ALIGNOF(uint8_t); + } + if(class_id == XCB_INPUT_INPUT_CLASS_BUTTON) { + /* xcb_input_input_info_info_t.button.num_buttons */ + _aux->button.num_buttons = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + } + if(class_id == XCB_INPUT_INPUT_CLASS_VALUATOR) { + /* xcb_input_input_info_info_t.valuator.axes_len */ + _aux->valuator.axes_len = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_input_info_info_t.valuator.mode */ + _aux->valuator.mode = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_input_info_info_t.valuator.motion_size */ + _aux->valuator.motion_size = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_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; + /* axes */ + _aux->valuator.axes = (xcb_input_axis_info_t *)xcb_tmp; + xcb_block_len += _aux->valuator.axes_len * sizeof(xcb_input_axis_info_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_axis_info_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_input_input_info_info_sizeof (const void *_buffer, + uint8_t class_id) +{ + xcb_input_input_info_info_t _aux; + return xcb_input_input_info_info_unpack(_buffer, class_id, &_aux); +} + +int +xcb_input_input_info_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_input_info_t *_aux = (xcb_input_input_info_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_input_input_info_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* info */ + xcb_block_len += xcb_input_input_info_info_sizeof(xcb_tmp, _aux->class_id); + 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; +} + +void * +xcb_input_input_info_info (const xcb_input_input_info_t *R) +{ + return (void *) (R + 1); +} + +void +xcb_input_input_info_next (xcb_input_input_info_iterator_t *i) +{ + xcb_input_input_info_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_input_input_info_t *)(((char *)R) + xcb_input_input_info_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_input_input_info_t *) child.data; +} + +xcb_generic_iterator_t +xcb_input_input_info_end (xcb_input_input_info_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_input_input_info_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_input_device_name_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_device_name_t *_aux = (xcb_input_device_name_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_input_device_name_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* string */ + xcb_block_len += _aux->len * sizeof(char); + 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; +} + +char * +xcb_input_device_name_string (const xcb_input_device_name_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_input_device_name_string_length (const xcb_input_device_name_t *R) +{ + return R->len; +} + +xcb_generic_iterator_t +xcb_input_device_name_string_end (const xcb_input_device_name_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_input_device_name_next (xcb_input_device_name_iterator_t *i) +{ + xcb_input_device_name_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_input_device_name_t *)(((char *)R) + xcb_input_device_name_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_input_device_name_t *) child.data; +} + +xcb_generic_iterator_t +xcb_input_device_name_end (xcb_input_device_name_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_input_device_name_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_input_list_input_devices_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_list_input_devices_reply_t *_aux = (xcb_input_list_input_devices_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; + + int xcb_pre_tmp_1; /* sumof length */ + int xcb_pre_tmp_2; /* sumof loop counter */ + int64_t xcb_pre_tmp_3; /* sumof sum */ + const xcb_input_device_info_t* xcb_pre_tmp_4; /* sumof list ptr */ + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_input_list_input_devices_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* devices */ + xcb_block_len += _aux->devices_len * sizeof(xcb_input_device_info_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_device_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; + /* infos */ + /* sumof start */ + xcb_pre_tmp_1 = _aux->devices_len; + xcb_pre_tmp_3 = 0; + xcb_pre_tmp_4 = xcb_input_list_input_devices_devices(_aux); + for (xcb_pre_tmp_2 = 0; xcb_pre_tmp_2 < xcb_pre_tmp_1; xcb_pre_tmp_2++) { + xcb_pre_tmp_3 += xcb_pre_tmp_4->num_class_info; + xcb_pre_tmp_4++; + } + /* sumof end. Result is in xcb_pre_tmp_3 */ + for(i=0; i<xcb_pre_tmp_3; i++) { + xcb_tmp_len = xcb_input_input_info_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_input_input_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; + /* names */ + for(i=0; i<_aux->devices_len; i++) { + xcb_tmp_len = xcb_str_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_str_t); + xcb_align_to = 4; + /* 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; + /* 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_input_list_input_devices_cookie_t +xcb_input_list_input_devices (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_LIST_INPUT_DEVICES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_list_input_devices_cookie_t xcb_ret; + xcb_input_list_input_devices_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_input_list_input_devices_cookie_t +xcb_input_list_input_devices_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_LIST_INPUT_DEVICES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_list_input_devices_cookie_t xcb_ret; + xcb_input_list_input_devices_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_input_device_info_t * +xcb_input_list_input_devices_devices (const xcb_input_list_input_devices_reply_t *R) +{ + return (xcb_input_device_info_t *) (R + 1); +} + +int +xcb_input_list_input_devices_devices_length (const xcb_input_list_input_devices_reply_t *R) +{ + return R->devices_len; +} + +xcb_input_device_info_iterator_t +xcb_input_list_input_devices_devices_iterator (const xcb_input_list_input_devices_reply_t *R) +{ + xcb_input_device_info_iterator_t i; + i.data = (xcb_input_device_info_t *) (R + 1); + i.rem = R->devices_len; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_input_list_input_devices_infos_length (const xcb_input_list_input_devices_reply_t *R) +{ + int xcb_pre_tmp_5; /* sumof length */ + int xcb_pre_tmp_6; /* sumof loop counter */ + int64_t xcb_pre_tmp_7; /* sumof sum */ + const xcb_input_device_info_t* xcb_pre_tmp_8; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_5 = R->devices_len; + xcb_pre_tmp_7 = 0; + xcb_pre_tmp_8 = xcb_input_list_input_devices_devices(R); + for (xcb_pre_tmp_6 = 0; xcb_pre_tmp_6 < xcb_pre_tmp_5; xcb_pre_tmp_6++) { + xcb_pre_tmp_7 += xcb_pre_tmp_8->num_class_info; + xcb_pre_tmp_8++; + } + /* sumof end. Result is in xcb_pre_tmp_7 */ + return xcb_pre_tmp_7; +} + +xcb_input_input_info_iterator_t +xcb_input_list_input_devices_infos_iterator (const xcb_input_list_input_devices_reply_t *R) +{ + xcb_input_input_info_iterator_t i; + xcb_generic_iterator_t prev = xcb_input_device_info_end(xcb_input_list_input_devices_devices_iterator(R)); + int xcb_pre_tmp_9; /* sumof length */ + int xcb_pre_tmp_10; /* sumof loop counter */ + int64_t xcb_pre_tmp_11; /* sumof sum */ + const xcb_input_device_info_t* xcb_pre_tmp_12; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_9 = R->devices_len; + xcb_pre_tmp_11 = 0; + xcb_pre_tmp_12 = xcb_input_list_input_devices_devices(R); + for (xcb_pre_tmp_10 = 0; xcb_pre_tmp_10 < xcb_pre_tmp_9; xcb_pre_tmp_10++) { + xcb_pre_tmp_11 += xcb_pre_tmp_12->num_class_info; + xcb_pre_tmp_12++; + } + /* sumof end. Result is in xcb_pre_tmp_11 */ + i.data = (xcb_input_input_info_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_input_input_info_t, prev.index)); + i.rem = xcb_pre_tmp_11; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_input_list_input_devices_names_length (const xcb_input_list_input_devices_reply_t *R) +{ + return R->devices_len; +} + +xcb_str_iterator_t +xcb_input_list_input_devices_names_iterator (const xcb_input_list_input_devices_reply_t *R) +{ + xcb_str_iterator_t i; + xcb_generic_iterator_t prev = xcb_input_input_info_end(xcb_input_list_input_devices_infos_iterator(R)); + i.data = (xcb_str_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_str_t, prev.index)); + i.rem = R->devices_len; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_list_input_devices_reply_t * +xcb_input_list_input_devices_reply (xcb_connection_t *c, + xcb_input_list_input_devices_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_list_input_devices_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +void +xcb_input_event_type_base_next (xcb_input_event_type_base_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_event_type_base_t); +} + +xcb_generic_iterator_t +xcb_input_event_type_base_end (xcb_input_event_type_base_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; +} + +void +xcb_input_input_class_info_next (xcb_input_input_class_info_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_input_class_info_t); +} + +xcb_generic_iterator_t +xcb_input_input_class_info_end (xcb_input_input_class_info_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; +} + +int +xcb_input_open_device_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_open_device_reply_t *_aux = (xcb_input_open_device_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_input_open_device_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* class_info */ + xcb_block_len += _aux->num_classes * sizeof(xcb_input_input_class_info_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_input_class_info_t); + xcb_align_to = 4; + /* 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; + /* 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_input_open_device_cookie_t +xcb_input_open_device (xcb_connection_t *c, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_OPEN_DEVICE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_open_device_cookie_t xcb_ret; + xcb_input_open_device_request_t xcb_out; + + xcb_out.device_id = device_id; + 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_input_open_device_cookie_t +xcb_input_open_device_unchecked (xcb_connection_t *c, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_OPEN_DEVICE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_open_device_cookie_t xcb_ret; + xcb_input_open_device_request_t xcb_out; + + xcb_out.device_id = device_id; + 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_input_input_class_info_t * +xcb_input_open_device_class_info (const xcb_input_open_device_reply_t *R) +{ + return (xcb_input_input_class_info_t *) (R + 1); +} + +int +xcb_input_open_device_class_info_length (const xcb_input_open_device_reply_t *R) +{ + return R->num_classes; +} + +xcb_input_input_class_info_iterator_t +xcb_input_open_device_class_info_iterator (const xcb_input_open_device_reply_t *R) +{ + xcb_input_input_class_info_iterator_t i; + i.data = (xcb_input_input_class_info_t *) (R + 1); + i.rem = R->num_classes; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_open_device_reply_t * +xcb_input_open_device_reply (xcb_connection_t *c, + xcb_input_open_device_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_open_device_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_input_close_device_checked (xcb_connection_t *c, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_CLOSE_DEVICE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_close_device_request_t xcb_out; + + xcb_out.device_id = device_id; + 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_input_close_device (xcb_connection_t *c, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_CLOSE_DEVICE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_close_device_request_t xcb_out; + + xcb_out.device_id = device_id; + 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_input_set_device_mode_cookie_t +xcb_input_set_device_mode (xcb_connection_t *c, + uint8_t device_id, + uint8_t mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_SET_DEVICE_MODE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_set_device_mode_cookie_t xcb_ret; + xcb_input_set_device_mode_request_t xcb_out; + + xcb_out.device_id = device_id; + xcb_out.mode = mode; + 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_input_set_device_mode_cookie_t +xcb_input_set_device_mode_unchecked (xcb_connection_t *c, + uint8_t device_id, + uint8_t mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_SET_DEVICE_MODE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_set_device_mode_cookie_t xcb_ret; + xcb_input_set_device_mode_request_t xcb_out; + + xcb_out.device_id = device_id; + xcb_out.mode = mode; + 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_input_set_device_mode_reply_t * +xcb_input_set_device_mode_reply (xcb_connection_t *c, + xcb_input_set_device_mode_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_set_device_mode_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_input_select_extension_event_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_select_extension_event_request_t *_aux = (xcb_input_select_extension_event_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_input_select_extension_event_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* classes */ + xcb_block_len += _aux->num_classes * sizeof(xcb_input_event_class_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_event_class_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_input_select_extension_event_checked (xcb_connection_t *c, + xcb_window_t window, + uint16_t num_classes, + const xcb_input_event_class_t *classes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_SELECT_EXTENSION_EVENT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_input_select_extension_event_request_t xcb_out; + + xcb_out.window = window; + xcb_out.num_classes = num_classes; + 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_input_event_class_t classes */ + xcb_parts[4].iov_base = (char *) classes; + xcb_parts[4].iov_len = num_classes * sizeof(xcb_input_event_class_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_input_select_extension_event (xcb_connection_t *c, + xcb_window_t window, + uint16_t num_classes, + const xcb_input_event_class_t *classes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_SELECT_EXTENSION_EVENT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_input_select_extension_event_request_t xcb_out; + + xcb_out.window = window; + xcb_out.num_classes = num_classes; + 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_input_event_class_t classes */ + xcb_parts[4].iov_base = (char *) classes; + xcb_parts[4].iov_len = num_classes * sizeof(xcb_input_event_class_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_input_event_class_t * +xcb_input_select_extension_event_classes (const xcb_input_select_extension_event_request_t *R) +{ + return (xcb_input_event_class_t *) (R + 1); +} + +int +xcb_input_select_extension_event_classes_length (const xcb_input_select_extension_event_request_t *R) +{ + return R->num_classes; +} + +xcb_generic_iterator_t +xcb_input_select_extension_event_classes_end (const xcb_input_select_extension_event_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_input_event_class_t *) (R + 1)) + (R->num_classes); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_input_get_selected_extension_events_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_get_selected_extension_events_reply_t *_aux = (xcb_input_get_selected_extension_events_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_input_get_selected_extension_events_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* this_classes */ + xcb_block_len += _aux->num_this_classes * sizeof(xcb_input_event_class_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_event_class_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; + /* all_classes */ + xcb_block_len += _aux->num_all_classes * sizeof(xcb_input_event_class_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_event_class_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_input_get_selected_extension_events_cookie_t +xcb_input_get_selected_extension_events (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GET_SELECTED_EXTENSION_EVENTS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_get_selected_extension_events_cookie_t xcb_ret; + xcb_input_get_selected_extension_events_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_input_get_selected_extension_events_cookie_t +xcb_input_get_selected_extension_events_unchecked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GET_SELECTED_EXTENSION_EVENTS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_get_selected_extension_events_cookie_t xcb_ret; + xcb_input_get_selected_extension_events_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_input_event_class_t * +xcb_input_get_selected_extension_events_this_classes (const xcb_input_get_selected_extension_events_reply_t *R) +{ + return (xcb_input_event_class_t *) (R + 1); +} + +int +xcb_input_get_selected_extension_events_this_classes_length (const xcb_input_get_selected_extension_events_reply_t *R) +{ + return R->num_this_classes; +} + +xcb_generic_iterator_t +xcb_input_get_selected_extension_events_this_classes_end (const xcb_input_get_selected_extension_events_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_input_event_class_t *) (R + 1)) + (R->num_this_classes); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_event_class_t * +xcb_input_get_selected_extension_events_all_classes (const xcb_input_get_selected_extension_events_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_input_get_selected_extension_events_this_classes_end(R); + return (xcb_input_event_class_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_input_event_class_t, prev.index) + 0); +} + +int +xcb_input_get_selected_extension_events_all_classes_length (const xcb_input_get_selected_extension_events_reply_t *R) +{ + return R->num_all_classes; +} + +xcb_generic_iterator_t +xcb_input_get_selected_extension_events_all_classes_end (const xcb_input_get_selected_extension_events_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_input_get_selected_extension_events_this_classes_end(R); + i.data = ((xcb_input_event_class_t *) ((char*) prev.data + XCB_TYPE_PAD(xcb_input_event_class_t, prev.index))) + (R->num_all_classes); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_get_selected_extension_events_reply_t * +xcb_input_get_selected_extension_events_reply (xcb_connection_t *c, + xcb_input_get_selected_extension_events_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_get_selected_extension_events_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_input_change_device_dont_propagate_list_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_change_device_dont_propagate_list_request_t *_aux = (xcb_input_change_device_dont_propagate_list_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_input_change_device_dont_propagate_list_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* classes */ + xcb_block_len += _aux->num_classes * sizeof(xcb_input_event_class_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_event_class_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_input_change_device_dont_propagate_list_checked (xcb_connection_t *c, + xcb_window_t window, + uint16_t num_classes, + uint8_t mode, + const xcb_input_event_class_t *classes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_CHANGE_DEVICE_DONT_PROPAGATE_LIST, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_input_change_device_dont_propagate_list_request_t xcb_out; + + xcb_out.window = window; + xcb_out.num_classes = num_classes; + xcb_out.mode = mode; + xcb_out.pad0 = 0; + + 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_input_event_class_t classes */ + xcb_parts[4].iov_base = (char *) classes; + xcb_parts[4].iov_len = num_classes * sizeof(xcb_input_event_class_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_input_change_device_dont_propagate_list (xcb_connection_t *c, + xcb_window_t window, + uint16_t num_classes, + uint8_t mode, + const xcb_input_event_class_t *classes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_CHANGE_DEVICE_DONT_PROPAGATE_LIST, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_input_change_device_dont_propagate_list_request_t xcb_out; + + xcb_out.window = window; + xcb_out.num_classes = num_classes; + xcb_out.mode = mode; + xcb_out.pad0 = 0; + + 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_input_event_class_t classes */ + xcb_parts[4].iov_base = (char *) classes; + xcb_parts[4].iov_len = num_classes * sizeof(xcb_input_event_class_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_input_event_class_t * +xcb_input_change_device_dont_propagate_list_classes (const xcb_input_change_device_dont_propagate_list_request_t *R) +{ + return (xcb_input_event_class_t *) (R + 1); +} + +int +xcb_input_change_device_dont_propagate_list_classes_length (const xcb_input_change_device_dont_propagate_list_request_t *R) +{ + return R->num_classes; +} + +xcb_generic_iterator_t +xcb_input_change_device_dont_propagate_list_classes_end (const xcb_input_change_device_dont_propagate_list_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_input_event_class_t *) (R + 1)) + (R->num_classes); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_input_get_device_dont_propagate_list_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_get_device_dont_propagate_list_reply_t *_aux = (xcb_input_get_device_dont_propagate_list_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_input_get_device_dont_propagate_list_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* classes */ + xcb_block_len += _aux->num_classes * sizeof(xcb_input_event_class_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_event_class_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_input_get_device_dont_propagate_list_cookie_t +xcb_input_get_device_dont_propagate_list (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GET_DEVICE_DONT_PROPAGATE_LIST, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_get_device_dont_propagate_list_cookie_t xcb_ret; + xcb_input_get_device_dont_propagate_list_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_input_get_device_dont_propagate_list_cookie_t +xcb_input_get_device_dont_propagate_list_unchecked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GET_DEVICE_DONT_PROPAGATE_LIST, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_get_device_dont_propagate_list_cookie_t xcb_ret; + xcb_input_get_device_dont_propagate_list_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_input_event_class_t * +xcb_input_get_device_dont_propagate_list_classes (const xcb_input_get_device_dont_propagate_list_reply_t *R) +{ + return (xcb_input_event_class_t *) (R + 1); +} + +int +xcb_input_get_device_dont_propagate_list_classes_length (const xcb_input_get_device_dont_propagate_list_reply_t *R) +{ + return R->num_classes; +} + +xcb_generic_iterator_t +xcb_input_get_device_dont_propagate_list_classes_end (const xcb_input_get_device_dont_propagate_list_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_input_event_class_t *) (R + 1)) + (R->num_classes); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_get_device_dont_propagate_list_reply_t * +xcb_input_get_device_dont_propagate_list_reply (xcb_connection_t *c, + xcb_input_get_device_dont_propagate_list_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_get_device_dont_propagate_list_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_input_device_time_coord_sizeof (const void *_buffer, + uint8_t num_axes) +{ + 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_input_device_time_coord_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* axisvalues */ + xcb_block_len += num_axes * sizeof(int32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(int32_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; +} + +int32_t * +xcb_input_device_time_coord_axisvalues (const xcb_input_device_time_coord_t *R) +{ + return (int32_t *) (R + 1); +} + +int +xcb_input_device_time_coord_axisvalues_length (const xcb_input_device_time_coord_t *R, + uint8_t num_axes) +{ + return num_axes; +} + +xcb_generic_iterator_t +xcb_input_device_time_coord_axisvalues_end (const xcb_input_device_time_coord_t *R, + uint8_t num_axes) +{ + xcb_generic_iterator_t i; + i.data = ((int32_t *) (R + 1)) + (num_axes); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_input_device_time_coord_next (xcb_input_device_time_coord_iterator_t *i) +{ + xcb_input_device_time_coord_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_input_device_time_coord_t *)(((char *)R) + xcb_input_device_time_coord_sizeof(R, i->num_axes)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_input_device_time_coord_t *) child.data; +} + +xcb_generic_iterator_t +xcb_input_device_time_coord_end (xcb_input_device_time_coord_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_input_device_time_coord_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_input_get_device_motion_events_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_get_device_motion_events_reply_t *_aux = (xcb_input_get_device_motion_events_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_input_get_device_motion_events_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* events */ + for(i=0; i<_aux->num_events; i++) { + xcb_tmp_len = xcb_input_device_time_coord_sizeof(xcb_tmp, _aux->num_axes); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_input_device_time_coord_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_input_get_device_motion_events_cookie_t +xcb_input_get_device_motion_events (xcb_connection_t *c, + xcb_timestamp_t start, + xcb_timestamp_t stop, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GET_DEVICE_MOTION_EVENTS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_get_device_motion_events_cookie_t xcb_ret; + xcb_input_get_device_motion_events_request_t xcb_out; + + xcb_out.start = start; + xcb_out.stop = stop; + xcb_out.device_id = device_id; + 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_input_get_device_motion_events_cookie_t +xcb_input_get_device_motion_events_unchecked (xcb_connection_t *c, + xcb_timestamp_t start, + xcb_timestamp_t stop, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GET_DEVICE_MOTION_EVENTS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_get_device_motion_events_cookie_t xcb_ret; + xcb_input_get_device_motion_events_request_t xcb_out; + + xcb_out.start = start; + xcb_out.stop = stop; + xcb_out.device_id = device_id; + 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; +} + +int +xcb_input_get_device_motion_events_events_length (const xcb_input_get_device_motion_events_reply_t *R) +{ + return R->num_events; +} + +xcb_input_device_time_coord_iterator_t +xcb_input_get_device_motion_events_events_iterator (const xcb_input_get_device_motion_events_reply_t *R) +{ + xcb_input_device_time_coord_iterator_t i; + i.data = (xcb_input_device_time_coord_t *) (R + 1); + i.rem = R->num_events; + i.index = (char *) i.data - (char *) R; + i.num_axes = R->num_axes; + return i; +} + +xcb_input_get_device_motion_events_reply_t * +xcb_input_get_device_motion_events_reply (xcb_connection_t *c, + xcb_input_get_device_motion_events_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_get_device_motion_events_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_input_change_keyboard_device_cookie_t +xcb_input_change_keyboard_device (xcb_connection_t *c, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_CHANGE_KEYBOARD_DEVICE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_change_keyboard_device_cookie_t xcb_ret; + xcb_input_change_keyboard_device_request_t xcb_out; + + xcb_out.device_id = device_id; + 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_input_change_keyboard_device_cookie_t +xcb_input_change_keyboard_device_unchecked (xcb_connection_t *c, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_CHANGE_KEYBOARD_DEVICE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_change_keyboard_device_cookie_t xcb_ret; + xcb_input_change_keyboard_device_request_t xcb_out; + + xcb_out.device_id = device_id; + 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_input_change_keyboard_device_reply_t * +xcb_input_change_keyboard_device_reply (xcb_connection_t *c, + xcb_input_change_keyboard_device_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_change_keyboard_device_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_input_change_pointer_device_cookie_t +xcb_input_change_pointer_device (xcb_connection_t *c, + uint8_t x_axis, + uint8_t y_axis, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_CHANGE_POINTER_DEVICE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_change_pointer_device_cookie_t xcb_ret; + xcb_input_change_pointer_device_request_t xcb_out; + + xcb_out.x_axis = x_axis; + xcb_out.y_axis = y_axis; + xcb_out.device_id = device_id; + xcb_out.pad0 = 0; + + 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_input_change_pointer_device_cookie_t +xcb_input_change_pointer_device_unchecked (xcb_connection_t *c, + uint8_t x_axis, + uint8_t y_axis, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_CHANGE_POINTER_DEVICE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_change_pointer_device_cookie_t xcb_ret; + xcb_input_change_pointer_device_request_t xcb_out; + + xcb_out.x_axis = x_axis; + xcb_out.y_axis = y_axis; + xcb_out.device_id = device_id; + xcb_out.pad0 = 0; + + 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_input_change_pointer_device_reply_t * +xcb_input_change_pointer_device_reply (xcb_connection_t *c, + xcb_input_change_pointer_device_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_change_pointer_device_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_input_grab_device_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_grab_device_request_t *_aux = (xcb_input_grab_device_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_input_grab_device_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* classes */ + xcb_block_len += _aux->num_classes * sizeof(xcb_input_event_class_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_event_class_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_input_grab_device_cookie_t +xcb_input_grab_device (xcb_connection_t *c, + xcb_window_t grab_window, + xcb_timestamp_t time, + uint16_t num_classes, + uint8_t this_device_mode, + uint8_t other_device_mode, + uint8_t owner_events, + uint8_t device_id, + const xcb_input_event_class_t *classes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GRAB_DEVICE, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_input_grab_device_cookie_t xcb_ret; + xcb_input_grab_device_request_t xcb_out; + + xcb_out.grab_window = grab_window; + xcb_out.time = time; + xcb_out.num_classes = num_classes; + xcb_out.this_device_mode = this_device_mode; + xcb_out.other_device_mode = other_device_mode; + xcb_out.owner_events = owner_events; + xcb_out.device_id = device_id; + 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_input_event_class_t classes */ + xcb_parts[4].iov_base = (char *) classes; + xcb_parts[4].iov_len = num_classes * sizeof(uint32_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_input_grab_device_cookie_t +xcb_input_grab_device_unchecked (xcb_connection_t *c, + xcb_window_t grab_window, + xcb_timestamp_t time, + uint16_t num_classes, + uint8_t this_device_mode, + uint8_t other_device_mode, + uint8_t owner_events, + uint8_t device_id, + const xcb_input_event_class_t *classes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GRAB_DEVICE, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_input_grab_device_cookie_t xcb_ret; + xcb_input_grab_device_request_t xcb_out; + + xcb_out.grab_window = grab_window; + xcb_out.time = time; + xcb_out.num_classes = num_classes; + xcb_out.this_device_mode = this_device_mode; + xcb_out.other_device_mode = other_device_mode; + xcb_out.owner_events = owner_events; + xcb_out.device_id = device_id; + 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_input_event_class_t classes */ + xcb_parts[4].iov_base = (char *) classes; + xcb_parts[4].iov_len = num_classes * sizeof(uint32_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_input_grab_device_reply_t * +xcb_input_grab_device_reply (xcb_connection_t *c, + xcb_input_grab_device_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_grab_device_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_input_ungrab_device_checked (xcb_connection_t *c, + xcb_timestamp_t time, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_UNGRAB_DEVICE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_ungrab_device_request_t xcb_out; + + xcb_out.time = time; + xcb_out.device_id = device_id; + 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_input_ungrab_device (xcb_connection_t *c, + xcb_timestamp_t time, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_UNGRAB_DEVICE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_ungrab_device_request_t xcb_out; + + xcb_out.time = time; + xcb_out.device_id = device_id; + 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; +} + +int +xcb_input_grab_device_key_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_grab_device_key_request_t *_aux = (xcb_input_grab_device_key_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_input_grab_device_key_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* classes */ + xcb_block_len += _aux->num_classes * sizeof(xcb_input_event_class_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_event_class_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_input_grab_device_key_checked (xcb_connection_t *c, + xcb_window_t grab_window, + uint16_t num_classes, + uint16_t modifiers, + uint8_t modifier_device, + uint8_t grabbed_device, + uint8_t key, + uint8_t this_device_mode, + uint8_t other_device_mode, + uint8_t owner_events, + const xcb_input_event_class_t *classes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GRAB_DEVICE_KEY, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_input_grab_device_key_request_t xcb_out; + + xcb_out.grab_window = grab_window; + xcb_out.num_classes = num_classes; + xcb_out.modifiers = modifiers; + xcb_out.modifier_device = modifier_device; + xcb_out.grabbed_device = grabbed_device; + xcb_out.key = key; + xcb_out.this_device_mode = this_device_mode; + xcb_out.other_device_mode = other_device_mode; + xcb_out.owner_events = owner_events; + 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_input_event_class_t classes */ + xcb_parts[4].iov_base = (char *) classes; + xcb_parts[4].iov_len = num_classes * sizeof(xcb_input_event_class_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_input_grab_device_key (xcb_connection_t *c, + xcb_window_t grab_window, + uint16_t num_classes, + uint16_t modifiers, + uint8_t modifier_device, + uint8_t grabbed_device, + uint8_t key, + uint8_t this_device_mode, + uint8_t other_device_mode, + uint8_t owner_events, + const xcb_input_event_class_t *classes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GRAB_DEVICE_KEY, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_input_grab_device_key_request_t xcb_out; + + xcb_out.grab_window = grab_window; + xcb_out.num_classes = num_classes; + xcb_out.modifiers = modifiers; + xcb_out.modifier_device = modifier_device; + xcb_out.grabbed_device = grabbed_device; + xcb_out.key = key; + xcb_out.this_device_mode = this_device_mode; + xcb_out.other_device_mode = other_device_mode; + xcb_out.owner_events = owner_events; + 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_input_event_class_t classes */ + xcb_parts[4].iov_base = (char *) classes; + xcb_parts[4].iov_len = num_classes * sizeof(xcb_input_event_class_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_input_event_class_t * +xcb_input_grab_device_key_classes (const xcb_input_grab_device_key_request_t *R) +{ + return (xcb_input_event_class_t *) (R + 1); +} + +int +xcb_input_grab_device_key_classes_length (const xcb_input_grab_device_key_request_t *R) +{ + return R->num_classes; +} + +xcb_generic_iterator_t +xcb_input_grab_device_key_classes_end (const xcb_input_grab_device_key_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_input_event_class_t *) (R + 1)) + (R->num_classes); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_input_ungrab_device_key_checked (xcb_connection_t *c, + xcb_window_t grabWindow, + uint16_t modifiers, + uint8_t modifier_device, + uint8_t key, + uint8_t grabbed_device) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_UNGRAB_DEVICE_KEY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_ungrab_device_key_request_t xcb_out; + + xcb_out.grabWindow = grabWindow; + xcb_out.modifiers = modifiers; + xcb_out.modifier_device = modifier_device; + xcb_out.key = key; + xcb_out.grabbed_device = grabbed_device; + + 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_input_ungrab_device_key (xcb_connection_t *c, + xcb_window_t grabWindow, + uint16_t modifiers, + uint8_t modifier_device, + uint8_t key, + uint8_t grabbed_device) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_UNGRAB_DEVICE_KEY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_ungrab_device_key_request_t xcb_out; + + xcb_out.grabWindow = grabWindow; + xcb_out.modifiers = modifiers; + xcb_out.modifier_device = modifier_device; + xcb_out.key = key; + xcb_out.grabbed_device = grabbed_device; + + 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_input_grab_device_button_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_grab_device_button_request_t *_aux = (xcb_input_grab_device_button_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_input_grab_device_button_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* classes */ + xcb_block_len += _aux->num_classes * sizeof(xcb_input_event_class_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_event_class_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_input_grab_device_button_checked (xcb_connection_t *c, + xcb_window_t grab_window, + uint8_t grabbed_device, + uint8_t modifier_device, + uint16_t num_classes, + uint16_t modifiers, + uint8_t this_device_mode, + uint8_t other_device_mode, + uint8_t button, + uint8_t owner_events, + const xcb_input_event_class_t *classes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GRAB_DEVICE_BUTTON, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_input_grab_device_button_request_t xcb_out; + + xcb_out.grab_window = grab_window; + xcb_out.grabbed_device = grabbed_device; + xcb_out.modifier_device = modifier_device; + xcb_out.num_classes = num_classes; + xcb_out.modifiers = modifiers; + xcb_out.this_device_mode = this_device_mode; + xcb_out.other_device_mode = other_device_mode; + xcb_out.button = button; + xcb_out.owner_events = owner_events; + 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_input_event_class_t classes */ + xcb_parts[4].iov_base = (char *) classes; + xcb_parts[4].iov_len = num_classes * sizeof(xcb_input_event_class_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_input_grab_device_button (xcb_connection_t *c, + xcb_window_t grab_window, + uint8_t grabbed_device, + uint8_t modifier_device, + uint16_t num_classes, + uint16_t modifiers, + uint8_t this_device_mode, + uint8_t other_device_mode, + uint8_t button, + uint8_t owner_events, + const xcb_input_event_class_t *classes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GRAB_DEVICE_BUTTON, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_input_grab_device_button_request_t xcb_out; + + xcb_out.grab_window = grab_window; + xcb_out.grabbed_device = grabbed_device; + xcb_out.modifier_device = modifier_device; + xcb_out.num_classes = num_classes; + xcb_out.modifiers = modifiers; + xcb_out.this_device_mode = this_device_mode; + xcb_out.other_device_mode = other_device_mode; + xcb_out.button = button; + xcb_out.owner_events = owner_events; + 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_input_event_class_t classes */ + xcb_parts[4].iov_base = (char *) classes; + xcb_parts[4].iov_len = num_classes * sizeof(xcb_input_event_class_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_input_event_class_t * +xcb_input_grab_device_button_classes (const xcb_input_grab_device_button_request_t *R) +{ + return (xcb_input_event_class_t *) (R + 1); +} + +int +xcb_input_grab_device_button_classes_length (const xcb_input_grab_device_button_request_t *R) +{ + return R->num_classes; +} + +xcb_generic_iterator_t +xcb_input_grab_device_button_classes_end (const xcb_input_grab_device_button_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_input_event_class_t *) (R + 1)) + (R->num_classes); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_input_ungrab_device_button_checked (xcb_connection_t *c, + xcb_window_t grab_window, + uint16_t modifiers, + uint8_t modifier_device, + uint8_t button, + uint8_t grabbed_device) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_UNGRAB_DEVICE_BUTTON, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_ungrab_device_button_request_t xcb_out; + + xcb_out.grab_window = grab_window; + xcb_out.modifiers = modifiers; + xcb_out.modifier_device = modifier_device; + xcb_out.button = button; + xcb_out.grabbed_device = grabbed_device; + 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_input_ungrab_device_button (xcb_connection_t *c, + xcb_window_t grab_window, + uint16_t modifiers, + uint8_t modifier_device, + uint8_t button, + uint8_t grabbed_device) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_UNGRAB_DEVICE_BUTTON, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_ungrab_device_button_request_t xcb_out; + + xcb_out.grab_window = grab_window; + xcb_out.modifiers = modifiers; + xcb_out.modifier_device = modifier_device; + xcb_out.button = button; + xcb_out.grabbed_device = grabbed_device; + 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_input_allow_device_events_checked (xcb_connection_t *c, + xcb_timestamp_t time, + uint8_t mode, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_ALLOW_DEVICE_EVENTS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_allow_device_events_request_t xcb_out; + + xcb_out.time = time; + xcb_out.mode = mode; + xcb_out.device_id = device_id; + 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_void_cookie_t +xcb_input_allow_device_events (xcb_connection_t *c, + xcb_timestamp_t time, + uint8_t mode, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_ALLOW_DEVICE_EVENTS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_allow_device_events_request_t xcb_out; + + xcb_out.time = time; + xcb_out.mode = mode; + xcb_out.device_id = device_id; + 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_input_get_device_focus_cookie_t +xcb_input_get_device_focus (xcb_connection_t *c, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GET_DEVICE_FOCUS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_get_device_focus_cookie_t xcb_ret; + xcb_input_get_device_focus_request_t xcb_out; + + xcb_out.device_id = device_id; + 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_input_get_device_focus_cookie_t +xcb_input_get_device_focus_unchecked (xcb_connection_t *c, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GET_DEVICE_FOCUS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_get_device_focus_cookie_t xcb_ret; + xcb_input_get_device_focus_request_t xcb_out; + + xcb_out.device_id = device_id; + 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_input_get_device_focus_reply_t * +xcb_input_get_device_focus_reply (xcb_connection_t *c, + xcb_input_get_device_focus_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_get_device_focus_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_input_set_device_focus_checked (xcb_connection_t *c, + xcb_window_t focus, + xcb_timestamp_t time, + uint8_t revert_to, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_SET_DEVICE_FOCUS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_set_device_focus_request_t xcb_out; + + xcb_out.focus = focus; + xcb_out.time = time; + xcb_out.revert_to = revert_to; + xcb_out.device_id = device_id; + 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_void_cookie_t +xcb_input_set_device_focus (xcb_connection_t *c, + xcb_window_t focus, + xcb_timestamp_t time, + uint8_t revert_to, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_SET_DEVICE_FOCUS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_set_device_focus_request_t xcb_out; + + xcb_out.focus = focus; + xcb_out.time = time; + xcb_out.revert_to = revert_to; + xcb_out.device_id = device_id; + 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; +} + +void +xcb_input_kbd_feedback_state_next (xcb_input_kbd_feedback_state_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_kbd_feedback_state_t); +} + +xcb_generic_iterator_t +xcb_input_kbd_feedback_state_end (xcb_input_kbd_feedback_state_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; +} + +void +xcb_input_ptr_feedback_state_next (xcb_input_ptr_feedback_state_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_ptr_feedback_state_t); +} + +xcb_generic_iterator_t +xcb_input_ptr_feedback_state_end (xcb_input_ptr_feedback_state_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; +} + +void +xcb_input_integer_feedback_state_next (xcb_input_integer_feedback_state_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_integer_feedback_state_t); +} + +xcb_generic_iterator_t +xcb_input_integer_feedback_state_end (xcb_input_integer_feedback_state_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; +} + +int +xcb_input_string_feedback_state_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_string_feedback_state_t *_aux = (xcb_input_string_feedback_state_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_input_string_feedback_state_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* keysyms */ + xcb_block_len += _aux->num_keysyms * sizeof(xcb_keysym_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_keysym_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_keysym_t * +xcb_input_string_feedback_state_keysyms (const xcb_input_string_feedback_state_t *R) +{ + return (xcb_keysym_t *) (R + 1); +} + +int +xcb_input_string_feedback_state_keysyms_length (const xcb_input_string_feedback_state_t *R) +{ + return R->num_keysyms; +} + +xcb_generic_iterator_t +xcb_input_string_feedback_state_keysyms_end (const xcb_input_string_feedback_state_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_keysym_t *) (R + 1)) + (R->num_keysyms); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_input_string_feedback_state_next (xcb_input_string_feedback_state_iterator_t *i) +{ + xcb_input_string_feedback_state_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_input_string_feedback_state_t *)(((char *)R) + xcb_input_string_feedback_state_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_input_string_feedback_state_t *) child.data; +} + +xcb_generic_iterator_t +xcb_input_string_feedback_state_end (xcb_input_string_feedback_state_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_input_string_feedback_state_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +void +xcb_input_bell_feedback_state_next (xcb_input_bell_feedback_state_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_bell_feedback_state_t); +} + +xcb_generic_iterator_t +xcb_input_bell_feedback_state_end (xcb_input_bell_feedback_state_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; +} + +void +xcb_input_led_feedback_state_next (xcb_input_led_feedback_state_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_led_feedback_state_t); +} + +xcb_generic_iterator_t +xcb_input_led_feedback_state_end (xcb_input_led_feedback_state_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_keysym_t * +xcb_input_feedback_state_data_string_keysyms (const xcb_input_feedback_state_data_t *S) +{ + return S->string.keysyms; +} + +int +xcb_input_feedback_state_data_string_keysyms_length (const xcb_input_feedback_state_t *R, + const xcb_input_feedback_state_data_t *S) +{ + return S->string.num_keysyms; +} + +xcb_generic_iterator_t +xcb_input_feedback_state_data_string_keysyms_end (const xcb_input_feedback_state_t *R, + const xcb_input_feedback_state_data_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->string.keysyms + S->string.num_keysyms; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +int +xcb_input_feedback_state_data_serialize (void **_buffer, + uint8_t class_id, + const xcb_input_feedback_state_data_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[27]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(class_id == XCB_INPUT_FEEDBACK_CLASS_KEYBOARD) { + /* xcb_input_feedback_state_data_t.keyboard.pitch */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->keyboard.pitch; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_input_feedback_state_data_t.keyboard.duration */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->keyboard.duration; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_input_feedback_state_data_t.keyboard.led_mask */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->keyboard.led_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); + /* xcb_input_feedback_state_data_t.keyboard.led_values */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->keyboard.led_values; + 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); + /* xcb_input_feedback_state_data_t.keyboard.global_auto_repeat */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->keyboard.global_auto_repeat; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_feedback_state_data_t.keyboard.click */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->keyboard.click; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_feedback_state_data_t.keyboard.percent */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->keyboard.percent; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_feedback_state_data_t.keyboard.pad0 */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &xcb_pad; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_feedback_state_data_t.keyboard.auto_repeats */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->keyboard.auto_repeats; + xcb_block_len += 32; + xcb_parts[xcb_parts_idx].iov_len = 32; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + } + if(class_id == XCB_INPUT_FEEDBACK_CLASS_POINTER) { + /* xcb_input_feedback_state_data_t.pointer.pad1 */ + xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; + xcb_block_len += sizeof(uint8_t)*2; + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t)*2; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_feedback_state_data_t.pointer.accel_num */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->pointer.accel_num; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_input_feedback_state_data_t.pointer.accel_denom */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->pointer.accel_denom; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_input_feedback_state_data_t.pointer.threshold */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->pointer.threshold; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + } + if(class_id == XCB_INPUT_FEEDBACK_CLASS_STRING) { + /* xcb_input_feedback_state_data_t.string.max_symbols */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->string.max_symbols; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_input_feedback_state_data_t.string.num_keysyms */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->string.num_keysyms; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_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; + /* keysyms */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->string.keysyms; + xcb_block_len += _aux->string.num_keysyms * sizeof(uint32_t); + xcb_parts[xcb_parts_idx].iov_len = _aux->string.num_keysyms * sizeof(uint32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_keysym_t); + } + if(class_id == XCB_INPUT_FEEDBACK_CLASS_INTEGER) { + /* xcb_input_feedback_state_data_t.integer.resolution */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->integer.resolution; + 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); + /* xcb_input_feedback_state_data_t.integer.min_value */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->integer.min_value; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_feedback_state_data_t.integer.max_value */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->integer.max_value; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(class_id == XCB_INPUT_FEEDBACK_CLASS_LED) { + /* xcb_input_feedback_state_data_t.led.led_mask */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->led.led_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); + /* xcb_input_feedback_state_data_t.led.led_values */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->led.led_values; + 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(class_id == XCB_INPUT_FEEDBACK_CLASS_BELL) { + /* xcb_input_feedback_state_data_t.bell.percent */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->bell.percent; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_feedback_state_data_t.bell.pad2 */ + xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; + xcb_block_len += sizeof(uint8_t)*3; + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t)*3; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_feedback_state_data_t.bell.pitch */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->bell.pitch; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_input_feedback_state_data_t.bell.duration */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->bell.duration; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_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_input_feedback_state_data_unpack (const void *_buffer, + uint8_t class_id, + xcb_input_feedback_state_data_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(class_id == XCB_INPUT_FEEDBACK_CLASS_KEYBOARD) { + /* xcb_input_feedback_state_data_t.keyboard.pitch */ + _aux->keyboard.pitch = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_input_feedback_state_data_t.keyboard.duration */ + _aux->keyboard.duration = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_input_feedback_state_data_t.keyboard.led_mask */ + _aux->keyboard.led_mask = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_input_feedback_state_data_t.keyboard.led_values */ + _aux->keyboard.led_values = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_input_feedback_state_data_t.keyboard.global_auto_repeat */ + _aux->keyboard.global_auto_repeat = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_feedback_state_data_t.keyboard.click */ + _aux->keyboard.click = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_feedback_state_data_t.keyboard.percent */ + _aux->keyboard.percent = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_feedback_state_data_t.keyboard.pad0 */ + _aux->keyboard.pad0 = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_feedback_state_data_t.keyboard.auto_repeats */ + memcpy(_aux->keyboard.auto_repeats, xcb_tmp, sizeof(uint8_t) * 32); + xcb_block_len += sizeof(uint8_t) * 32; + xcb_tmp += sizeof(uint8_t) * 32; + xcb_align_to = ALIGNOF(uint8_t); + } + if(class_id == XCB_INPUT_FEEDBACK_CLASS_POINTER) { + /* xcb_input_feedback_state_data_t.pointer.pad1 */ + _aux->pointer.pad1[0] = *(uint8_t *)xcb_tmp; + _aux->pointer.pad1[1] = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t) * 2; + xcb_tmp += sizeof(uint8_t) * 2; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_feedback_state_data_t.pointer.accel_num */ + _aux->pointer.accel_num = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_input_feedback_state_data_t.pointer.accel_denom */ + _aux->pointer.accel_denom = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_input_feedback_state_data_t.pointer.threshold */ + _aux->pointer.threshold = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + } + if(class_id == XCB_INPUT_FEEDBACK_CLASS_STRING) { + /* xcb_input_feedback_state_data_t.string.max_symbols */ + _aux->string.max_symbols = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_input_feedback_state_data_t.string.num_keysyms */ + _aux->string.num_keysyms = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_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; + /* keysyms */ + _aux->string.keysyms = (xcb_keysym_t *)xcb_tmp; + xcb_block_len += _aux->string.num_keysyms * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_keysym_t); + } + if(class_id == XCB_INPUT_FEEDBACK_CLASS_INTEGER) { + /* xcb_input_feedback_state_data_t.integer.resolution */ + _aux->integer.resolution = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_input_feedback_state_data_t.integer.min_value */ + _aux->integer.min_value = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_feedback_state_data_t.integer.max_value */ + _aux->integer.max_value = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(class_id == XCB_INPUT_FEEDBACK_CLASS_LED) { + /* xcb_input_feedback_state_data_t.led.led_mask */ + _aux->led.led_mask = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_input_feedback_state_data_t.led.led_values */ + _aux->led.led_values = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + } + if(class_id == XCB_INPUT_FEEDBACK_CLASS_BELL) { + /* xcb_input_feedback_state_data_t.bell.percent */ + _aux->bell.percent = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_feedback_state_data_t.bell.pad2 */ + _aux->bell.pad2[0] = *(uint8_t *)xcb_tmp; + _aux->bell.pad2[1] = *(uint8_t *)xcb_tmp; + _aux->bell.pad2[2] = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t) * 3; + xcb_tmp += sizeof(uint8_t) * 3; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_feedback_state_data_t.bell.pitch */ + _aux->bell.pitch = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_input_feedback_state_data_t.bell.duration */ + _aux->bell.duration = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_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_input_feedback_state_data_sizeof (const void *_buffer, + uint8_t class_id) +{ + xcb_input_feedback_state_data_t _aux; + return xcb_input_feedback_state_data_unpack(_buffer, class_id, &_aux); +} + +int +xcb_input_feedback_state_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_feedback_state_t *_aux = (xcb_input_feedback_state_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_input_feedback_state_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += xcb_input_feedback_state_data_sizeof(xcb_tmp, _aux->class_id); + 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; +} + +void * +xcb_input_feedback_state_data (const xcb_input_feedback_state_t *R) +{ + return (void *) (R + 1); +} + +void +xcb_input_feedback_state_next (xcb_input_feedback_state_iterator_t *i) +{ + xcb_input_feedback_state_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_input_feedback_state_t *)(((char *)R) + xcb_input_feedback_state_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_input_feedback_state_t *) child.data; +} + +xcb_generic_iterator_t +xcb_input_feedback_state_end (xcb_input_feedback_state_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_input_feedback_state_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_input_get_feedback_control_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_get_feedback_control_reply_t *_aux = (xcb_input_get_feedback_control_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_input_get_feedback_control_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* feedbacks */ + for(i=0; i<_aux->num_feedbacks; i++) { + xcb_tmp_len = xcb_input_feedback_state_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_input_feedback_state_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_input_get_feedback_control_cookie_t +xcb_input_get_feedback_control (xcb_connection_t *c, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GET_FEEDBACK_CONTROL, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_get_feedback_control_cookie_t xcb_ret; + xcb_input_get_feedback_control_request_t xcb_out; + + xcb_out.device_id = device_id; + 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_input_get_feedback_control_cookie_t +xcb_input_get_feedback_control_unchecked (xcb_connection_t *c, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GET_FEEDBACK_CONTROL, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_get_feedback_control_cookie_t xcb_ret; + xcb_input_get_feedback_control_request_t xcb_out; + + xcb_out.device_id = device_id; + 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; +} + +int +xcb_input_get_feedback_control_feedbacks_length (const xcb_input_get_feedback_control_reply_t *R) +{ + return R->num_feedbacks; +} + +xcb_input_feedback_state_iterator_t +xcb_input_get_feedback_control_feedbacks_iterator (const xcb_input_get_feedback_control_reply_t *R) +{ + xcb_input_feedback_state_iterator_t i; + i.data = (xcb_input_feedback_state_t *) (R + 1); + i.rem = R->num_feedbacks; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_get_feedback_control_reply_t * +xcb_input_get_feedback_control_reply (xcb_connection_t *c, + xcb_input_get_feedback_control_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_get_feedback_control_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +void +xcb_input_kbd_feedback_ctl_next (xcb_input_kbd_feedback_ctl_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_kbd_feedback_ctl_t); +} + +xcb_generic_iterator_t +xcb_input_kbd_feedback_ctl_end (xcb_input_kbd_feedback_ctl_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; +} + +void +xcb_input_ptr_feedback_ctl_next (xcb_input_ptr_feedback_ctl_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_ptr_feedback_ctl_t); +} + +xcb_generic_iterator_t +xcb_input_ptr_feedback_ctl_end (xcb_input_ptr_feedback_ctl_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; +} + +void +xcb_input_integer_feedback_ctl_next (xcb_input_integer_feedback_ctl_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_integer_feedback_ctl_t); +} + +xcb_generic_iterator_t +xcb_input_integer_feedback_ctl_end (xcb_input_integer_feedback_ctl_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; +} + +int +xcb_input_string_feedback_ctl_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_string_feedback_ctl_t *_aux = (xcb_input_string_feedback_ctl_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_input_string_feedback_ctl_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* keysyms */ + xcb_block_len += _aux->num_keysyms * sizeof(xcb_keysym_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_keysym_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_keysym_t * +xcb_input_string_feedback_ctl_keysyms (const xcb_input_string_feedback_ctl_t *R) +{ + return (xcb_keysym_t *) (R + 1); +} + +int +xcb_input_string_feedback_ctl_keysyms_length (const xcb_input_string_feedback_ctl_t *R) +{ + return R->num_keysyms; +} + +xcb_generic_iterator_t +xcb_input_string_feedback_ctl_keysyms_end (const xcb_input_string_feedback_ctl_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_keysym_t *) (R + 1)) + (R->num_keysyms); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_input_string_feedback_ctl_next (xcb_input_string_feedback_ctl_iterator_t *i) +{ + xcb_input_string_feedback_ctl_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_input_string_feedback_ctl_t *)(((char *)R) + xcb_input_string_feedback_ctl_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_input_string_feedback_ctl_t *) child.data; +} + +xcb_generic_iterator_t +xcb_input_string_feedback_ctl_end (xcb_input_string_feedback_ctl_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_input_string_feedback_ctl_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +void +xcb_input_bell_feedback_ctl_next (xcb_input_bell_feedback_ctl_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_bell_feedback_ctl_t); +} + +xcb_generic_iterator_t +xcb_input_bell_feedback_ctl_end (xcb_input_bell_feedback_ctl_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; +} + +void +xcb_input_led_feedback_ctl_next (xcb_input_led_feedback_ctl_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_led_feedback_ctl_t); +} + +xcb_generic_iterator_t +xcb_input_led_feedback_ctl_end (xcb_input_led_feedback_ctl_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_keysym_t * +xcb_input_feedback_ctl_data_string_keysyms (const xcb_input_feedback_ctl_data_t *S) +{ + return S->string.keysyms; +} + +int +xcb_input_feedback_ctl_data_string_keysyms_length (const xcb_input_feedback_ctl_t *R, + const xcb_input_feedback_ctl_data_t *S) +{ + return S->string.num_keysyms; +} + +xcb_generic_iterator_t +xcb_input_feedback_ctl_data_string_keysyms_end (const xcb_input_feedback_ctl_t *R, + const xcb_input_feedback_ctl_data_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->string.keysyms + S->string.num_keysyms; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +int +xcb_input_feedback_ctl_data_serialize (void **_buffer, + uint8_t class_id, + const xcb_input_feedback_ctl_data_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[24]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(class_id == XCB_INPUT_FEEDBACK_CLASS_KEYBOARD) { + /* xcb_input_feedback_ctl_data_t.keyboard.key */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->keyboard.key; + xcb_block_len += sizeof(xcb_input_key_code_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_input_key_code_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_input_key_code_t); + /* xcb_input_feedback_ctl_data_t.keyboard.auto_repeat_mode */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->keyboard.auto_repeat_mode; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_feedback_ctl_data_t.keyboard.key_click_percent */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->keyboard.key_click_percent; + xcb_block_len += sizeof(int8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int8_t); + /* xcb_input_feedback_ctl_data_t.keyboard.bell_percent */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->keyboard.bell_percent; + xcb_block_len += sizeof(int8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int8_t); + /* xcb_input_feedback_ctl_data_t.keyboard.bell_pitch */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->keyboard.bell_pitch; + xcb_block_len += sizeof(int16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int16_t); + /* xcb_input_feedback_ctl_data_t.keyboard.bell_duration */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->keyboard.bell_duration; + xcb_block_len += sizeof(int16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int16_t); + /* xcb_input_feedback_ctl_data_t.keyboard.led_mask */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->keyboard.led_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); + /* xcb_input_feedback_ctl_data_t.keyboard.led_values */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->keyboard.led_values; + 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(class_id == XCB_INPUT_FEEDBACK_CLASS_POINTER) { + /* xcb_input_feedback_ctl_data_t.pointer.pad0 */ + xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; + xcb_block_len += sizeof(uint8_t)*2; + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t)*2; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_feedback_ctl_data_t.pointer.num */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->pointer.num; + xcb_block_len += sizeof(int16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int16_t); + /* xcb_input_feedback_ctl_data_t.pointer.denom */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->pointer.denom; + xcb_block_len += sizeof(int16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int16_t); + /* xcb_input_feedback_ctl_data_t.pointer.threshold */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->pointer.threshold; + xcb_block_len += sizeof(int16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int16_t); + } + if(class_id == XCB_INPUT_FEEDBACK_CLASS_STRING) { + /* xcb_input_feedback_ctl_data_t.string.pad1 */ + xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; + xcb_block_len += sizeof(uint8_t)*2; + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t)*2; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_feedback_ctl_data_t.string.num_keysyms */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->string.num_keysyms; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_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; + /* keysyms */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->string.keysyms; + xcb_block_len += _aux->string.num_keysyms * sizeof(uint32_t); + xcb_parts[xcb_parts_idx].iov_len = _aux->string.num_keysyms * sizeof(uint32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_keysym_t); + } + if(class_id == XCB_INPUT_FEEDBACK_CLASS_INTEGER) { + /* xcb_input_feedback_ctl_data_t.integer.int_to_display */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->integer.int_to_display; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(class_id == XCB_INPUT_FEEDBACK_CLASS_LED) { + /* xcb_input_feedback_ctl_data_t.led.led_mask */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->led.led_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); + /* xcb_input_feedback_ctl_data_t.led.led_values */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->led.led_values; + 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(class_id == XCB_INPUT_FEEDBACK_CLASS_BELL) { + /* xcb_input_feedback_ctl_data_t.bell.percent */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->bell.percent; + xcb_block_len += sizeof(int8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int8_t); + /* xcb_input_feedback_ctl_data_t.bell.pad2 */ + xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; + xcb_block_len += sizeof(uint8_t)*3; + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t)*3; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_feedback_ctl_data_t.bell.pitch */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->bell.pitch; + xcb_block_len += sizeof(int16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int16_t); + /* xcb_input_feedback_ctl_data_t.bell.duration */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->bell.duration; + xcb_block_len += sizeof(int16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int16_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_input_feedback_ctl_data_unpack (const void *_buffer, + uint8_t class_id, + xcb_input_feedback_ctl_data_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(class_id == XCB_INPUT_FEEDBACK_CLASS_KEYBOARD) { + /* xcb_input_feedback_ctl_data_t.keyboard.key */ + _aux->keyboard.key = *(xcb_input_key_code_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_input_key_code_t); + xcb_tmp += sizeof(xcb_input_key_code_t); + xcb_align_to = ALIGNOF(xcb_input_key_code_t); + /* xcb_input_feedback_ctl_data_t.keyboard.auto_repeat_mode */ + _aux->keyboard.auto_repeat_mode = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_feedback_ctl_data_t.keyboard.key_click_percent */ + _aux->keyboard.key_click_percent = *(int8_t *)xcb_tmp; + xcb_block_len += sizeof(int8_t); + xcb_tmp += sizeof(int8_t); + xcb_align_to = ALIGNOF(int8_t); + /* xcb_input_feedback_ctl_data_t.keyboard.bell_percent */ + _aux->keyboard.bell_percent = *(int8_t *)xcb_tmp; + xcb_block_len += sizeof(int8_t); + xcb_tmp += sizeof(int8_t); + xcb_align_to = ALIGNOF(int8_t); + /* xcb_input_feedback_ctl_data_t.keyboard.bell_pitch */ + _aux->keyboard.bell_pitch = *(int16_t *)xcb_tmp; + xcb_block_len += sizeof(int16_t); + xcb_tmp += sizeof(int16_t); + xcb_align_to = ALIGNOF(int16_t); + /* xcb_input_feedback_ctl_data_t.keyboard.bell_duration */ + _aux->keyboard.bell_duration = *(int16_t *)xcb_tmp; + xcb_block_len += sizeof(int16_t); + xcb_tmp += sizeof(int16_t); + xcb_align_to = ALIGNOF(int16_t); + /* xcb_input_feedback_ctl_data_t.keyboard.led_mask */ + _aux->keyboard.led_mask = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_input_feedback_ctl_data_t.keyboard.led_values */ + _aux->keyboard.led_values = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + } + if(class_id == XCB_INPUT_FEEDBACK_CLASS_POINTER) { + /* xcb_input_feedback_ctl_data_t.pointer.pad0 */ + _aux->pointer.pad0[0] = *(uint8_t *)xcb_tmp; + _aux->pointer.pad0[1] = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t) * 2; + xcb_tmp += sizeof(uint8_t) * 2; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_feedback_ctl_data_t.pointer.num */ + _aux->pointer.num = *(int16_t *)xcb_tmp; + xcb_block_len += sizeof(int16_t); + xcb_tmp += sizeof(int16_t); + xcb_align_to = ALIGNOF(int16_t); + /* xcb_input_feedback_ctl_data_t.pointer.denom */ + _aux->pointer.denom = *(int16_t *)xcb_tmp; + xcb_block_len += sizeof(int16_t); + xcb_tmp += sizeof(int16_t); + xcb_align_to = ALIGNOF(int16_t); + /* xcb_input_feedback_ctl_data_t.pointer.threshold */ + _aux->pointer.threshold = *(int16_t *)xcb_tmp; + xcb_block_len += sizeof(int16_t); + xcb_tmp += sizeof(int16_t); + xcb_align_to = ALIGNOF(int16_t); + } + if(class_id == XCB_INPUT_FEEDBACK_CLASS_STRING) { + /* xcb_input_feedback_ctl_data_t.string.pad1 */ + _aux->string.pad1[0] = *(uint8_t *)xcb_tmp; + _aux->string.pad1[1] = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t) * 2; + xcb_tmp += sizeof(uint8_t) * 2; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_feedback_ctl_data_t.string.num_keysyms */ + _aux->string.num_keysyms = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_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; + /* keysyms */ + _aux->string.keysyms = (xcb_keysym_t *)xcb_tmp; + xcb_block_len += _aux->string.num_keysyms * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_keysym_t); + } + if(class_id == XCB_INPUT_FEEDBACK_CLASS_INTEGER) { + /* xcb_input_feedback_ctl_data_t.integer.int_to_display */ + _aux->integer.int_to_display = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(class_id == XCB_INPUT_FEEDBACK_CLASS_LED) { + /* xcb_input_feedback_ctl_data_t.led.led_mask */ + _aux->led.led_mask = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_input_feedback_ctl_data_t.led.led_values */ + _aux->led.led_values = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + } + if(class_id == XCB_INPUT_FEEDBACK_CLASS_BELL) { + /* xcb_input_feedback_ctl_data_t.bell.percent */ + _aux->bell.percent = *(int8_t *)xcb_tmp; + xcb_block_len += sizeof(int8_t); + xcb_tmp += sizeof(int8_t); + xcb_align_to = ALIGNOF(int8_t); + /* xcb_input_feedback_ctl_data_t.bell.pad2 */ + _aux->bell.pad2[0] = *(uint8_t *)xcb_tmp; + _aux->bell.pad2[1] = *(uint8_t *)xcb_tmp; + _aux->bell.pad2[2] = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t) * 3; + xcb_tmp += sizeof(uint8_t) * 3; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_feedback_ctl_data_t.bell.pitch */ + _aux->bell.pitch = *(int16_t *)xcb_tmp; + xcb_block_len += sizeof(int16_t); + xcb_tmp += sizeof(int16_t); + xcb_align_to = ALIGNOF(int16_t); + /* xcb_input_feedback_ctl_data_t.bell.duration */ + _aux->bell.duration = *(int16_t *)xcb_tmp; + xcb_block_len += sizeof(int16_t); + xcb_tmp += sizeof(int16_t); + xcb_align_to = ALIGNOF(int16_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_input_feedback_ctl_data_sizeof (const void *_buffer, + uint8_t class_id) +{ + xcb_input_feedback_ctl_data_t _aux; + return xcb_input_feedback_ctl_data_unpack(_buffer, class_id, &_aux); +} + +int +xcb_input_feedback_ctl_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_feedback_ctl_t *_aux = (xcb_input_feedback_ctl_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_input_feedback_ctl_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += xcb_input_feedback_ctl_data_sizeof(xcb_tmp, _aux->class_id); + 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; +} + +void * +xcb_input_feedback_ctl_data (const xcb_input_feedback_ctl_t *R) +{ + return (void *) (R + 1); +} + +void +xcb_input_feedback_ctl_next (xcb_input_feedback_ctl_iterator_t *i) +{ + xcb_input_feedback_ctl_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_input_feedback_ctl_t *)(((char *)R) + xcb_input_feedback_ctl_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_input_feedback_ctl_t *) child.data; +} + +xcb_generic_iterator_t +xcb_input_feedback_ctl_end (xcb_input_feedback_ctl_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_input_feedback_ctl_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_input_change_feedback_control_sizeof (const void *_buffer) +{ + 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_input_change_feedback_control_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* feedback */ + xcb_block_len += xcb_input_feedback_ctl_sizeof(xcb_tmp); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_feedback_ctl_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_input_change_feedback_control_checked (xcb_connection_t *c, + uint32_t mask, + uint8_t device_id, + uint8_t feedback_id, + xcb_input_feedback_ctl_t *feedback) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_CHANGE_FEEDBACK_CONTROL, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_input_change_feedback_control_request_t xcb_out; + + xcb_out.mask = mask; + xcb_out.device_id = device_id; + xcb_out.feedback_id = feedback_id; + 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_input_feedback_ctl_t feedback */ + xcb_parts[4].iov_base = (char *) feedback; + xcb_parts[4].iov_len = + xcb_input_feedback_ctl_sizeof (feedback); + + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_input_change_feedback_control (xcb_connection_t *c, + uint32_t mask, + uint8_t device_id, + uint8_t feedback_id, + xcb_input_feedback_ctl_t *feedback) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_CHANGE_FEEDBACK_CONTROL, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_input_change_feedback_control_request_t xcb_out; + + xcb_out.mask = mask; + xcb_out.device_id = device_id; + xcb_out.feedback_id = feedback_id; + 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_input_feedback_ctl_t feedback */ + xcb_parts[4].iov_base = (char *) feedback; + xcb_parts[4].iov_len = + xcb_input_feedback_ctl_sizeof (feedback); + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_input_feedback_ctl_t * +xcb_input_change_feedback_control_feedback (const xcb_input_change_feedback_control_request_t *R) +{ + return (xcb_input_feedback_ctl_t *) (R + 1); +} + +int +xcb_input_get_device_key_mapping_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_get_device_key_mapping_reply_t *_aux = (xcb_input_get_device_key_mapping_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_input_get_device_key_mapping_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* keysyms */ + xcb_block_len += _aux->length * sizeof(xcb_keysym_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_keysym_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_input_get_device_key_mapping_cookie_t +xcb_input_get_device_key_mapping (xcb_connection_t *c, + uint8_t device_id, + xcb_input_key_code_t first_keycode, + uint8_t count) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GET_DEVICE_KEY_MAPPING, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_get_device_key_mapping_cookie_t xcb_ret; + xcb_input_get_device_key_mapping_request_t xcb_out; + + xcb_out.device_id = device_id; + xcb_out.first_keycode = first_keycode; + xcb_out.count = count; + xcb_out.pad0 = 0; + + 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_input_get_device_key_mapping_cookie_t +xcb_input_get_device_key_mapping_unchecked (xcb_connection_t *c, + uint8_t device_id, + xcb_input_key_code_t first_keycode, + uint8_t count) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GET_DEVICE_KEY_MAPPING, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_get_device_key_mapping_cookie_t xcb_ret; + xcb_input_get_device_key_mapping_request_t xcb_out; + + xcb_out.device_id = device_id; + xcb_out.first_keycode = first_keycode; + xcb_out.count = count; + xcb_out.pad0 = 0; + + 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_keysym_t * +xcb_input_get_device_key_mapping_keysyms (const xcb_input_get_device_key_mapping_reply_t *R) +{ + return (xcb_keysym_t *) (R + 1); +} + +int +xcb_input_get_device_key_mapping_keysyms_length (const xcb_input_get_device_key_mapping_reply_t *R) +{ + return R->length; +} + +xcb_generic_iterator_t +xcb_input_get_device_key_mapping_keysyms_end (const xcb_input_get_device_key_mapping_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_keysym_t *) (R + 1)) + (R->length); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_get_device_key_mapping_reply_t * +xcb_input_get_device_key_mapping_reply (xcb_connection_t *c, + xcb_input_get_device_key_mapping_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_get_device_key_mapping_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_input_change_device_key_mapping_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_change_device_key_mapping_request_t *_aux = (xcb_input_change_device_key_mapping_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_input_change_device_key_mapping_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* keysyms */ + xcb_block_len += (_aux->keycode_count * _aux->keysyms_per_keycode) * sizeof(xcb_keysym_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_keysym_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_input_change_device_key_mapping_checked (xcb_connection_t *c, + uint8_t device_id, + xcb_input_key_code_t first_keycode, + uint8_t keysyms_per_keycode, + uint8_t keycode_count, + const xcb_keysym_t *keysyms) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_CHANGE_DEVICE_KEY_MAPPING, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_input_change_device_key_mapping_request_t xcb_out; + + xcb_out.device_id = device_id; + xcb_out.first_keycode = first_keycode; + xcb_out.keysyms_per_keycode = keysyms_per_keycode; + xcb_out.keycode_count = keycode_count; + + 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_keysym_t keysyms */ + xcb_parts[4].iov_base = (char *) keysyms; + xcb_parts[4].iov_len = (keycode_count * keysyms_per_keycode) * sizeof(xcb_keysym_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_input_change_device_key_mapping (xcb_connection_t *c, + uint8_t device_id, + xcb_input_key_code_t first_keycode, + uint8_t keysyms_per_keycode, + uint8_t keycode_count, + const xcb_keysym_t *keysyms) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_CHANGE_DEVICE_KEY_MAPPING, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_input_change_device_key_mapping_request_t xcb_out; + + xcb_out.device_id = device_id; + xcb_out.first_keycode = first_keycode; + xcb_out.keysyms_per_keycode = keysyms_per_keycode; + xcb_out.keycode_count = keycode_count; + + 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_keysym_t keysyms */ + xcb_parts[4].iov_base = (char *) keysyms; + xcb_parts[4].iov_len = (keycode_count * keysyms_per_keycode) * sizeof(xcb_keysym_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_keysym_t * +xcb_input_change_device_key_mapping_keysyms (const xcb_input_change_device_key_mapping_request_t *R) +{ + return (xcb_keysym_t *) (R + 1); +} + +int +xcb_input_change_device_key_mapping_keysyms_length (const xcb_input_change_device_key_mapping_request_t *R) +{ + return (R->keycode_count * R->keysyms_per_keycode); +} + +xcb_generic_iterator_t +xcb_input_change_device_key_mapping_keysyms_end (const xcb_input_change_device_key_mapping_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_keysym_t *) (R + 1)) + ((R->keycode_count * R->keysyms_per_keycode)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_input_get_device_modifier_mapping_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_get_device_modifier_mapping_reply_t *_aux = (xcb_input_get_device_modifier_mapping_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_input_get_device_modifier_mapping_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* keymaps */ + xcb_block_len += (_aux->keycodes_per_modifier * 8) * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_input_get_device_modifier_mapping_cookie_t +xcb_input_get_device_modifier_mapping (xcb_connection_t *c, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GET_DEVICE_MODIFIER_MAPPING, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_get_device_modifier_mapping_cookie_t xcb_ret; + xcb_input_get_device_modifier_mapping_request_t xcb_out; + + xcb_out.device_id = device_id; + 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_input_get_device_modifier_mapping_cookie_t +xcb_input_get_device_modifier_mapping_unchecked (xcb_connection_t *c, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GET_DEVICE_MODIFIER_MAPPING, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_get_device_modifier_mapping_cookie_t xcb_ret; + xcb_input_get_device_modifier_mapping_request_t xcb_out; + + xcb_out.device_id = device_id; + 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; +} + +uint8_t * +xcb_input_get_device_modifier_mapping_keymaps (const xcb_input_get_device_modifier_mapping_reply_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_input_get_device_modifier_mapping_keymaps_length (const xcb_input_get_device_modifier_mapping_reply_t *R) +{ + return (R->keycodes_per_modifier * 8); +} + +xcb_generic_iterator_t +xcb_input_get_device_modifier_mapping_keymaps_end (const xcb_input_get_device_modifier_mapping_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((R->keycodes_per_modifier * 8)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_get_device_modifier_mapping_reply_t * +xcb_input_get_device_modifier_mapping_reply (xcb_connection_t *c, + xcb_input_get_device_modifier_mapping_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_get_device_modifier_mapping_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_input_set_device_modifier_mapping_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_set_device_modifier_mapping_request_t *_aux = (xcb_input_set_device_modifier_mapping_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_input_set_device_modifier_mapping_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* keymaps */ + xcb_block_len += (_aux->keycodes_per_modifier * 8) * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_input_set_device_modifier_mapping_cookie_t +xcb_input_set_device_modifier_mapping (xcb_connection_t *c, + uint8_t device_id, + uint8_t keycodes_per_modifier, + const uint8_t *keymaps) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_SET_DEVICE_MODIFIER_MAPPING, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_input_set_device_modifier_mapping_cookie_t xcb_ret; + xcb_input_set_device_modifier_mapping_request_t xcb_out; + + xcb_out.device_id = device_id; + xcb_out.keycodes_per_modifier = keycodes_per_modifier; + 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; + /* uint8_t keymaps */ + xcb_parts[4].iov_base = (char *) keymaps; + xcb_parts[4].iov_len = (keycodes_per_modifier * 8) * sizeof(uint8_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_input_set_device_modifier_mapping_cookie_t +xcb_input_set_device_modifier_mapping_unchecked (xcb_connection_t *c, + uint8_t device_id, + uint8_t keycodes_per_modifier, + const uint8_t *keymaps) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_SET_DEVICE_MODIFIER_MAPPING, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_input_set_device_modifier_mapping_cookie_t xcb_ret; + xcb_input_set_device_modifier_mapping_request_t xcb_out; + + xcb_out.device_id = device_id; + xcb_out.keycodes_per_modifier = keycodes_per_modifier; + 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; + /* uint8_t keymaps */ + xcb_parts[4].iov_base = (char *) keymaps; + xcb_parts[4].iov_len = (keycodes_per_modifier * 8) * sizeof(uint8_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_input_set_device_modifier_mapping_reply_t * +xcb_input_set_device_modifier_mapping_reply (xcb_connection_t *c, + xcb_input_set_device_modifier_mapping_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_set_device_modifier_mapping_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_input_get_device_button_mapping_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_get_device_button_mapping_reply_t *_aux = (xcb_input_get_device_button_mapping_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_input_get_device_button_mapping_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* map */ + xcb_block_len += _aux->map_size * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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; + /* 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_input_get_device_button_mapping_cookie_t +xcb_input_get_device_button_mapping (xcb_connection_t *c, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GET_DEVICE_BUTTON_MAPPING, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_get_device_button_mapping_cookie_t xcb_ret; + xcb_input_get_device_button_mapping_request_t xcb_out; + + xcb_out.device_id = device_id; + 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_input_get_device_button_mapping_cookie_t +xcb_input_get_device_button_mapping_unchecked (xcb_connection_t *c, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GET_DEVICE_BUTTON_MAPPING, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_get_device_button_mapping_cookie_t xcb_ret; + xcb_input_get_device_button_mapping_request_t xcb_out; + + xcb_out.device_id = device_id; + 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; +} + +uint8_t * +xcb_input_get_device_button_mapping_map (const xcb_input_get_device_button_mapping_reply_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_input_get_device_button_mapping_map_length (const xcb_input_get_device_button_mapping_reply_t *R) +{ + return R->map_size; +} + +xcb_generic_iterator_t +xcb_input_get_device_button_mapping_map_end (const xcb_input_get_device_button_mapping_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + (R->map_size); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_get_device_button_mapping_reply_t * +xcb_input_get_device_button_mapping_reply (xcb_connection_t *c, + xcb_input_get_device_button_mapping_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_get_device_button_mapping_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_input_set_device_button_mapping_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_set_device_button_mapping_request_t *_aux = (xcb_input_set_device_button_mapping_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_input_set_device_button_mapping_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* map */ + xcb_block_len += _aux->map_size * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_input_set_device_button_mapping_cookie_t +xcb_input_set_device_button_mapping (xcb_connection_t *c, + uint8_t device_id, + uint8_t map_size, + const uint8_t *map) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_SET_DEVICE_BUTTON_MAPPING, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_input_set_device_button_mapping_cookie_t xcb_ret; + xcb_input_set_device_button_mapping_request_t xcb_out; + + xcb_out.device_id = device_id; + xcb_out.map_size = map_size; + 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; + /* uint8_t map */ + xcb_parts[4].iov_base = (char *) map; + xcb_parts[4].iov_len = map_size * sizeof(uint8_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_input_set_device_button_mapping_cookie_t +xcb_input_set_device_button_mapping_unchecked (xcb_connection_t *c, + uint8_t device_id, + uint8_t map_size, + const uint8_t *map) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_SET_DEVICE_BUTTON_MAPPING, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_input_set_device_button_mapping_cookie_t xcb_ret; + xcb_input_set_device_button_mapping_request_t xcb_out; + + xcb_out.device_id = device_id; + xcb_out.map_size = map_size; + 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; + /* uint8_t map */ + xcb_parts[4].iov_base = (char *) map; + xcb_parts[4].iov_len = map_size * sizeof(uint8_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_input_set_device_button_mapping_reply_t * +xcb_input_set_device_button_mapping_reply (xcb_connection_t *c, + xcb_input_set_device_button_mapping_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_set_device_button_mapping_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +void +xcb_input_key_state_next (xcb_input_key_state_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_key_state_t); +} + +xcb_generic_iterator_t +xcb_input_key_state_end (xcb_input_key_state_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; +} + +void +xcb_input_button_state_next (xcb_input_button_state_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_button_state_t); +} + +xcb_generic_iterator_t +xcb_input_button_state_end (xcb_input_button_state_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; +} + +int +xcb_input_valuator_state_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_valuator_state_t *_aux = (xcb_input_valuator_state_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_input_valuator_state_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* valuators */ + xcb_block_len += _aux->num_valuators * sizeof(int32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(int32_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; +} + +int32_t * +xcb_input_valuator_state_valuators (const xcb_input_valuator_state_t *R) +{ + return (int32_t *) (R + 1); +} + +int +xcb_input_valuator_state_valuators_length (const xcb_input_valuator_state_t *R) +{ + return R->num_valuators; +} + +xcb_generic_iterator_t +xcb_input_valuator_state_valuators_end (const xcb_input_valuator_state_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((int32_t *) (R + 1)) + (R->num_valuators); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_input_valuator_state_next (xcb_input_valuator_state_iterator_t *i) +{ + xcb_input_valuator_state_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_input_valuator_state_t *)(((char *)R) + xcb_input_valuator_state_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_input_valuator_state_t *) child.data; +} + +xcb_generic_iterator_t +xcb_input_valuator_state_end (xcb_input_valuator_state_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_input_valuator_state_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int32_t * +xcb_input_input_state_data_valuator_valuators (const xcb_input_input_state_data_t *S) +{ + return S->valuator.valuators; +} + +int +xcb_input_input_state_data_valuator_valuators_length (const xcb_input_input_state_t *R, + const xcb_input_input_state_data_t *S) +{ + return S->valuator.num_valuators; +} + +xcb_generic_iterator_t +xcb_input_input_state_data_valuator_valuators_end (const xcb_input_input_state_t *R, + const xcb_input_input_state_data_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->valuator.valuators + S->valuator.num_valuators; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +int +xcb_input_input_state_data_serialize (void **_buffer, + uint8_t class_id, + const xcb_input_input_state_data_t *_aux) +{ + char *xcb_out = *_buffer; + unsigned int xcb_buffer_len = 0; + unsigned int xcb_align_to = 0; + unsigned int xcb_padding_offset = 2; + + unsigned int xcb_pad = 0; + char xcb_pad0[3] = {0, 0, 0}; + struct iovec xcb_parts[11]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(class_id == XCB_INPUT_INPUT_CLASS_KEY) { + /* xcb_input_input_state_data_t.key.num_keys */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key.num_keys; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_input_state_data_t.key.pad0 */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &xcb_pad; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_input_state_data_t.key.keys */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->key.keys; + xcb_block_len += 32; + xcb_parts[xcb_parts_idx].iov_len = 32; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + } + if(class_id == XCB_INPUT_INPUT_CLASS_BUTTON) { + /* xcb_input_input_state_data_t.button.num_buttons */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->button.num_buttons; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_input_state_data_t.button.pad1 */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &xcb_pad; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_input_state_data_t.button.buttons */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->button.buttons; + xcb_block_len += 32; + xcb_parts[xcb_parts_idx].iov_len = 32; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + } + if(class_id == XCB_INPUT_INPUT_CLASS_VALUATOR) { + /* xcb_input_input_state_data_t.valuator.num_valuators */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->valuator.num_valuators; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_input_state_data_t.valuator.mode */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->valuator.mode; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_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; + /* valuators */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->valuator.valuators; + xcb_block_len += _aux->valuator.num_valuators * sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = _aux->valuator.num_valuators * sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_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_input_input_state_data_unpack (const void *_buffer, + uint8_t class_id, + xcb_input_input_state_data_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 = 2; + + + if(class_id == XCB_INPUT_INPUT_CLASS_KEY) { + /* xcb_input_input_state_data_t.key.num_keys */ + _aux->key.num_keys = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_input_state_data_t.key.pad0 */ + _aux->key.pad0 = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_input_state_data_t.key.keys */ + memcpy(_aux->key.keys, xcb_tmp, sizeof(uint8_t) * 32); + xcb_block_len += sizeof(uint8_t) * 32; + xcb_tmp += sizeof(uint8_t) * 32; + xcb_align_to = ALIGNOF(uint8_t); + } + if(class_id == XCB_INPUT_INPUT_CLASS_BUTTON) { + /* xcb_input_input_state_data_t.button.num_buttons */ + _aux->button.num_buttons = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_input_state_data_t.button.pad1 */ + _aux->button.pad1 = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_input_state_data_t.button.buttons */ + memcpy(_aux->button.buttons, xcb_tmp, sizeof(uint8_t) * 32); + xcb_block_len += sizeof(uint8_t) * 32; + xcb_tmp += sizeof(uint8_t) * 32; + xcb_align_to = ALIGNOF(uint8_t); + } + if(class_id == XCB_INPUT_INPUT_CLASS_VALUATOR) { + /* xcb_input_input_state_data_t.valuator.num_valuators */ + _aux->valuator.num_valuators = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_input_state_data_t.valuator.mode */ + _aux->valuator.mode = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_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; + /* valuators */ + _aux->valuator.valuators = (int32_t *)xcb_tmp; + xcb_block_len += _aux->valuator.num_valuators * sizeof(int32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(int32_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_input_input_state_data_sizeof (const void *_buffer, + uint8_t class_id) +{ + xcb_input_input_state_data_t _aux; + return xcb_input_input_state_data_unpack(_buffer, class_id, &_aux); +} + +int +xcb_input_input_state_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_input_state_t *_aux = (xcb_input_input_state_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_input_input_state_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += xcb_input_input_state_data_sizeof(xcb_tmp, _aux->class_id); + 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; +} + +void * +xcb_input_input_state_data (const xcb_input_input_state_t *R) +{ + return (void *) (R + 1); +} + +void +xcb_input_input_state_next (xcb_input_input_state_iterator_t *i) +{ + xcb_input_input_state_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_input_input_state_t *)(((char *)R) + xcb_input_input_state_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_input_input_state_t *) child.data; +} + +xcb_generic_iterator_t +xcb_input_input_state_end (xcb_input_input_state_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_input_input_state_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_input_query_device_state_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_query_device_state_reply_t *_aux = (xcb_input_query_device_state_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_input_query_device_state_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* classes */ + for(i=0; i<_aux->num_classes; i++) { + xcb_tmp_len = xcb_input_input_state_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_input_input_state_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_input_query_device_state_cookie_t +xcb_input_query_device_state (xcb_connection_t *c, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_QUERY_DEVICE_STATE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_query_device_state_cookie_t xcb_ret; + xcb_input_query_device_state_request_t xcb_out; + + xcb_out.device_id = device_id; + 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_input_query_device_state_cookie_t +xcb_input_query_device_state_unchecked (xcb_connection_t *c, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_QUERY_DEVICE_STATE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_query_device_state_cookie_t xcb_ret; + xcb_input_query_device_state_request_t xcb_out; + + xcb_out.device_id = device_id; + 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; +} + +int +xcb_input_query_device_state_classes_length (const xcb_input_query_device_state_reply_t *R) +{ + return R->num_classes; +} + +xcb_input_input_state_iterator_t +xcb_input_query_device_state_classes_iterator (const xcb_input_query_device_state_reply_t *R) +{ + xcb_input_input_state_iterator_t i; + i.data = (xcb_input_input_state_t *) (R + 1); + i.rem = R->num_classes; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_query_device_state_reply_t * +xcb_input_query_device_state_reply (xcb_connection_t *c, + xcb_input_query_device_state_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_query_device_state_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_input_device_bell_checked (xcb_connection_t *c, + uint8_t device_id, + uint8_t feedback_id, + uint8_t feedback_class, + int8_t percent) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_DEVICE_BELL, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_device_bell_request_t xcb_out; + + xcb_out.device_id = device_id; + xcb_out.feedback_id = feedback_id; + xcb_out.feedback_class = feedback_class; + xcb_out.percent = percent; + + 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_input_device_bell (xcb_connection_t *c, + uint8_t device_id, + uint8_t feedback_id, + uint8_t feedback_class, + int8_t percent) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_DEVICE_BELL, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_device_bell_request_t xcb_out; + + xcb_out.device_id = device_id; + xcb_out.feedback_id = feedback_id; + xcb_out.feedback_class = feedback_class; + xcb_out.percent = percent; + + 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_input_set_device_valuators_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_set_device_valuators_request_t *_aux = (xcb_input_set_device_valuators_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_input_set_device_valuators_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* valuators */ + xcb_block_len += _aux->num_valuators * sizeof(int32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(int32_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_input_set_device_valuators_cookie_t +xcb_input_set_device_valuators (xcb_connection_t *c, + uint8_t device_id, + uint8_t first_valuator, + uint8_t num_valuators, + const int32_t *valuators) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_SET_DEVICE_VALUATORS, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_input_set_device_valuators_cookie_t xcb_ret; + xcb_input_set_device_valuators_request_t xcb_out; + + xcb_out.device_id = device_id; + xcb_out.first_valuator = first_valuator; + xcb_out.num_valuators = num_valuators; + xcb_out.pad0 = 0; + + 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; + /* int32_t valuators */ + xcb_parts[4].iov_base = (char *) valuators; + xcb_parts[4].iov_len = num_valuators * sizeof(int32_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_input_set_device_valuators_cookie_t +xcb_input_set_device_valuators_unchecked (xcb_connection_t *c, + uint8_t device_id, + uint8_t first_valuator, + uint8_t num_valuators, + const int32_t *valuators) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_SET_DEVICE_VALUATORS, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_input_set_device_valuators_cookie_t xcb_ret; + xcb_input_set_device_valuators_request_t xcb_out; + + xcb_out.device_id = device_id; + xcb_out.first_valuator = first_valuator; + xcb_out.num_valuators = num_valuators; + xcb_out.pad0 = 0; + + 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; + /* int32_t valuators */ + xcb_parts[4].iov_base = (char *) valuators; + xcb_parts[4].iov_len = num_valuators * sizeof(int32_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_input_set_device_valuators_reply_t * +xcb_input_set_device_valuators_reply (xcb_connection_t *c, + xcb_input_set_device_valuators_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_set_device_valuators_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_input_device_resolution_state_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_device_resolution_state_t *_aux = (xcb_input_device_resolution_state_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_input_device_resolution_state_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* resolution_values */ + xcb_block_len += _aux->num_valuators * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* resolution_min */ + xcb_block_len += _aux->num_valuators * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* resolution_max */ + xcb_block_len += _aux->num_valuators * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; +} + +uint32_t * +xcb_input_device_resolution_state_resolution_values (const xcb_input_device_resolution_state_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_input_device_resolution_state_resolution_values_length (const xcb_input_device_resolution_state_t *R) +{ + return R->num_valuators; +} + +xcb_generic_iterator_t +xcb_input_device_resolution_state_resolution_values_end (const xcb_input_device_resolution_state_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->num_valuators); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +uint32_t * +xcb_input_device_resolution_state_resolution_min (const xcb_input_device_resolution_state_t *R) +{ + xcb_generic_iterator_t prev = xcb_input_device_resolution_state_resolution_values_end(R); + return (uint32_t *) ((char *) prev.data + XCB_TYPE_PAD(uint32_t, prev.index) + 0); +} + +int +xcb_input_device_resolution_state_resolution_min_length (const xcb_input_device_resolution_state_t *R) +{ + return R->num_valuators; +} + +xcb_generic_iterator_t +xcb_input_device_resolution_state_resolution_min_end (const xcb_input_device_resolution_state_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_input_device_resolution_state_resolution_values_end(R); + i.data = ((uint32_t *) ((char*) prev.data + XCB_TYPE_PAD(uint32_t, prev.index))) + (R->num_valuators); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +uint32_t * +xcb_input_device_resolution_state_resolution_max (const xcb_input_device_resolution_state_t *R) +{ + xcb_generic_iterator_t prev = xcb_input_device_resolution_state_resolution_min_end(R); + return (uint32_t *) ((char *) prev.data + XCB_TYPE_PAD(uint32_t, prev.index) + 0); +} + +int +xcb_input_device_resolution_state_resolution_max_length (const xcb_input_device_resolution_state_t *R) +{ + return R->num_valuators; +} + +xcb_generic_iterator_t +xcb_input_device_resolution_state_resolution_max_end (const xcb_input_device_resolution_state_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_input_device_resolution_state_resolution_min_end(R); + i.data = ((uint32_t *) ((char*) prev.data + XCB_TYPE_PAD(uint32_t, prev.index))) + (R->num_valuators); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_input_device_resolution_state_next (xcb_input_device_resolution_state_iterator_t *i) +{ + xcb_input_device_resolution_state_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_input_device_resolution_state_t *)(((char *)R) + xcb_input_device_resolution_state_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_input_device_resolution_state_t *) child.data; +} + +xcb_generic_iterator_t +xcb_input_device_resolution_state_end (xcb_input_device_resolution_state_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_input_device_resolution_state_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +void +xcb_input_device_abs_calib_state_next (xcb_input_device_abs_calib_state_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_device_abs_calib_state_t); +} + +xcb_generic_iterator_t +xcb_input_device_abs_calib_state_end (xcb_input_device_abs_calib_state_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; +} + +void +xcb_input_device_abs_area_state_next (xcb_input_device_abs_area_state_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_device_abs_area_state_t); +} + +xcb_generic_iterator_t +xcb_input_device_abs_area_state_end (xcb_input_device_abs_area_state_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; +} + +void +xcb_input_device_core_state_next (xcb_input_device_core_state_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_device_core_state_t); +} + +xcb_generic_iterator_t +xcb_input_device_core_state_end (xcb_input_device_core_state_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; +} + +void +xcb_input_device_enable_state_next (xcb_input_device_enable_state_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_device_enable_state_t); +} + +xcb_generic_iterator_t +xcb_input_device_enable_state_end (xcb_input_device_enable_state_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; +} + +uint32_t * +xcb_input_device_state_data_resolution_resolution_values (const xcb_input_device_state_data_t *S) +{ + return S->resolution.resolution_values; +} + +int +xcb_input_device_state_data_resolution_resolution_values_length (const xcb_input_device_state_t *R, + const xcb_input_device_state_data_t *S) +{ + return S->resolution.num_valuators; +} + +xcb_generic_iterator_t +xcb_input_device_state_data_resolution_resolution_values_end (const xcb_input_device_state_t *R, + const xcb_input_device_state_data_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->resolution.resolution_values + S->resolution.num_valuators; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +uint32_t * +xcb_input_device_state_data_resolution_resolution_min (const xcb_input_device_state_data_t *S) +{ + return S->resolution.resolution_min; +} + +int +xcb_input_device_state_data_resolution_resolution_min_length (const xcb_input_device_state_t *R, + const xcb_input_device_state_data_t *S) +{ + return S->resolution.num_valuators; +} + +xcb_generic_iterator_t +xcb_input_device_state_data_resolution_resolution_min_end (const xcb_input_device_state_t *R, + const xcb_input_device_state_data_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->resolution.resolution_min + S->resolution.num_valuators; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +uint32_t * +xcb_input_device_state_data_resolution_resolution_max (const xcb_input_device_state_data_t *S) +{ + return S->resolution.resolution_max; +} + +int +xcb_input_device_state_data_resolution_resolution_max_length (const xcb_input_device_state_t *R, + const xcb_input_device_state_data_t *S) +{ + return S->resolution.num_valuators; +} + +xcb_generic_iterator_t +xcb_input_device_state_data_resolution_resolution_max_end (const xcb_input_device_state_t *R, + const xcb_input_device_state_data_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->resolution.resolution_max + S->resolution.num_valuators; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +int +xcb_input_device_state_data_serialize (void **_buffer, + uint16_t control_id, + const xcb_input_device_state_data_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[27]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(control_id == XCB_INPUT_DEVICE_CONTROL_RESOLUTION) { + /* xcb_input_device_state_data_t.resolution.num_valuators */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->resolution.num_valuators; + 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); + /* 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; + /* resolution_values */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->resolution.resolution_values; + xcb_block_len += _aux->resolution.num_valuators * sizeof(uint32_t); + xcb_parts[xcb_parts_idx].iov_len = _aux->resolution.num_valuators * sizeof(uint32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint32_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; + /* resolution_min */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->resolution.resolution_min; + xcb_block_len += _aux->resolution.num_valuators * sizeof(uint32_t); + xcb_parts[xcb_parts_idx].iov_len = _aux->resolution.num_valuators * sizeof(uint32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint32_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; + /* resolution_max */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->resolution.resolution_max; + xcb_block_len += _aux->resolution.num_valuators * sizeof(uint32_t); + xcb_parts[xcb_parts_idx].iov_len = _aux->resolution.num_valuators * sizeof(uint32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint32_t); + } + if(control_id == XCB_INPUT_DEVICE_CONTROL_ABS_CALIB) { + /* xcb_input_device_state_data_t.abs_calib.min_x */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_calib.min_x; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_device_state_data_t.abs_calib.max_x */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_calib.max_x; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_device_state_data_t.abs_calib.min_y */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_calib.min_y; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_device_state_data_t.abs_calib.max_y */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_calib.max_y; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_device_state_data_t.abs_calib.flip_x */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_calib.flip_x; + 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); + /* xcb_input_device_state_data_t.abs_calib.flip_y */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_calib.flip_y; + 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); + /* xcb_input_device_state_data_t.abs_calib.rotation */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_calib.rotation; + 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); + /* xcb_input_device_state_data_t.abs_calib.button_threshold */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_calib.button_threshold; + 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(control_id == XCB_INPUT_DEVICE_CONTROL_CORE) { + /* xcb_input_device_state_data_t.core.status */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->core.status; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_device_state_data_t.core.iscore */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->core.iscore; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_device_state_data_t.core.pad0 */ + xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; + xcb_block_len += sizeof(uint8_t)*2; + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t)*2; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + } + if(control_id == XCB_INPUT_DEVICE_CONTROL_ENABLE) { + /* xcb_input_device_state_data_t.enable.enable */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->enable.enable; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_device_state_data_t.enable.pad1 */ + xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; + xcb_block_len += sizeof(uint8_t)*3; + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t)*3; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + } + if(control_id == XCB_INPUT_DEVICE_CONTROL_ABS_AREA) { + /* xcb_input_device_state_data_t.abs_area.offset_x */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_area.offset_x; + 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); + /* xcb_input_device_state_data_t.abs_area.offset_y */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_area.offset_y; + 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); + /* xcb_input_device_state_data_t.abs_area.width */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_area.width; + 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); + /* xcb_input_device_state_data_t.abs_area.height */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_area.height; + 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); + /* xcb_input_device_state_data_t.abs_area.screen */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_area.screen; + 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); + /* xcb_input_device_state_data_t.abs_area.following */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_area.following; + 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); + } + /* 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_input_device_state_data_unpack (const void *_buffer, + uint16_t control_id, + xcb_input_device_state_data_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(control_id == XCB_INPUT_DEVICE_CONTROL_RESOLUTION) { + /* xcb_input_device_state_data_t.resolution.num_valuators */ + _aux->resolution.num_valuators = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_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; + /* resolution_values */ + _aux->resolution.resolution_values = (uint32_t *)xcb_tmp; + xcb_block_len += _aux->resolution.num_valuators * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* resolution_min */ + _aux->resolution.resolution_min = (uint32_t *)xcb_tmp; + xcb_block_len += _aux->resolution.num_valuators * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* resolution_max */ + _aux->resolution.resolution_max = (uint32_t *)xcb_tmp; + xcb_block_len += _aux->resolution.num_valuators * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_t); + } + if(control_id == XCB_INPUT_DEVICE_CONTROL_ABS_CALIB) { + /* xcb_input_device_state_data_t.abs_calib.min_x */ + _aux->abs_calib.min_x = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_device_state_data_t.abs_calib.max_x */ + _aux->abs_calib.max_x = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_device_state_data_t.abs_calib.min_y */ + _aux->abs_calib.min_y = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_device_state_data_t.abs_calib.max_y */ + _aux->abs_calib.max_y = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_device_state_data_t.abs_calib.flip_x */ + _aux->abs_calib.flip_x = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_input_device_state_data_t.abs_calib.flip_y */ + _aux->abs_calib.flip_y = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_input_device_state_data_t.abs_calib.rotation */ + _aux->abs_calib.rotation = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_input_device_state_data_t.abs_calib.button_threshold */ + _aux->abs_calib.button_threshold = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + } + if(control_id == XCB_INPUT_DEVICE_CONTROL_CORE) { + /* xcb_input_device_state_data_t.core.status */ + _aux->core.status = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_device_state_data_t.core.iscore */ + _aux->core.iscore = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_device_state_data_t.core.pad0 */ + _aux->core.pad0[0] = *(uint8_t *)xcb_tmp; + _aux->core.pad0[1] = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t) * 2; + xcb_tmp += sizeof(uint8_t) * 2; + xcb_align_to = ALIGNOF(uint8_t); + } + if(control_id == XCB_INPUT_DEVICE_CONTROL_ENABLE) { + /* xcb_input_device_state_data_t.enable.enable */ + _aux->enable.enable = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_device_state_data_t.enable.pad1 */ + _aux->enable.pad1[0] = *(uint8_t *)xcb_tmp; + _aux->enable.pad1[1] = *(uint8_t *)xcb_tmp; + _aux->enable.pad1[2] = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t) * 3; + xcb_tmp += sizeof(uint8_t) * 3; + xcb_align_to = ALIGNOF(uint8_t); + } + if(control_id == XCB_INPUT_DEVICE_CONTROL_ABS_AREA) { + /* xcb_input_device_state_data_t.abs_area.offset_x */ + _aux->abs_area.offset_x = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_input_device_state_data_t.abs_area.offset_y */ + _aux->abs_area.offset_y = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_input_device_state_data_t.abs_area.width */ + _aux->abs_area.width = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_input_device_state_data_t.abs_area.height */ + _aux->abs_area.height = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_input_device_state_data_t.abs_area.screen */ + _aux->abs_area.screen = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_input_device_state_data_t.abs_area.following */ + _aux->abs_area.following = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_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_input_device_state_data_sizeof (const void *_buffer, + uint16_t control_id) +{ + xcb_input_device_state_data_t _aux; + return xcb_input_device_state_data_unpack(_buffer, control_id, &_aux); +} + +int +xcb_input_device_state_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_device_state_t *_aux = (xcb_input_device_state_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_input_device_state_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += xcb_input_device_state_data_sizeof(xcb_tmp, _aux->control_id); + 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; +} + +void * +xcb_input_device_state_data (const xcb_input_device_state_t *R) +{ + return (void *) (R + 1); +} + +void +xcb_input_device_state_next (xcb_input_device_state_iterator_t *i) +{ + xcb_input_device_state_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_input_device_state_t *)(((char *)R) + xcb_input_device_state_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_input_device_state_t *) child.data; +} + +xcb_generic_iterator_t +xcb_input_device_state_end (xcb_input_device_state_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_input_device_state_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_input_get_device_control_sizeof (const void *_buffer) +{ + 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_input_get_device_control_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* control */ + xcb_block_len += xcb_input_device_state_sizeof(xcb_tmp); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_device_state_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_input_get_device_control_cookie_t +xcb_input_get_device_control (xcb_connection_t *c, + uint16_t control_id, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GET_DEVICE_CONTROL, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_get_device_control_cookie_t xcb_ret; + xcb_input_get_device_control_request_t xcb_out; + + xcb_out.control_id = control_id; + xcb_out.device_id = device_id; + xcb_out.pad0 = 0; + + 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_input_get_device_control_cookie_t +xcb_input_get_device_control_unchecked (xcb_connection_t *c, + uint16_t control_id, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GET_DEVICE_CONTROL, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_get_device_control_cookie_t xcb_ret; + xcb_input_get_device_control_request_t xcb_out; + + xcb_out.control_id = control_id; + xcb_out.device_id = device_id; + xcb_out.pad0 = 0; + + 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_input_device_state_t * +xcb_input_get_device_control_control (const xcb_input_get_device_control_reply_t *R) +{ + return (xcb_input_device_state_t *) (R + 1); +} + +xcb_input_get_device_control_reply_t * +xcb_input_get_device_control_reply (xcb_connection_t *c, + xcb_input_get_device_control_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_get_device_control_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_input_device_resolution_ctl_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_device_resolution_ctl_t *_aux = (xcb_input_device_resolution_ctl_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_input_device_resolution_ctl_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* resolution_values */ + xcb_block_len += _aux->num_valuators * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; +} + +uint32_t * +xcb_input_device_resolution_ctl_resolution_values (const xcb_input_device_resolution_ctl_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_input_device_resolution_ctl_resolution_values_length (const xcb_input_device_resolution_ctl_t *R) +{ + return R->num_valuators; +} + +xcb_generic_iterator_t +xcb_input_device_resolution_ctl_resolution_values_end (const xcb_input_device_resolution_ctl_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->num_valuators); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_input_device_resolution_ctl_next (xcb_input_device_resolution_ctl_iterator_t *i) +{ + xcb_input_device_resolution_ctl_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_input_device_resolution_ctl_t *)(((char *)R) + xcb_input_device_resolution_ctl_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_input_device_resolution_ctl_t *) child.data; +} + +xcb_generic_iterator_t +xcb_input_device_resolution_ctl_end (xcb_input_device_resolution_ctl_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_input_device_resolution_ctl_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +void +xcb_input_device_abs_calib_ctl_next (xcb_input_device_abs_calib_ctl_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_device_abs_calib_ctl_t); +} + +xcb_generic_iterator_t +xcb_input_device_abs_calib_ctl_end (xcb_input_device_abs_calib_ctl_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; +} + +void +xcb_input_device_abs_area_ctrl_next (xcb_input_device_abs_area_ctrl_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_device_abs_area_ctrl_t); +} + +xcb_generic_iterator_t +xcb_input_device_abs_area_ctrl_end (xcb_input_device_abs_area_ctrl_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; +} + +void +xcb_input_device_core_ctrl_next (xcb_input_device_core_ctrl_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_device_core_ctrl_t); +} + +xcb_generic_iterator_t +xcb_input_device_core_ctrl_end (xcb_input_device_core_ctrl_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; +} + +void +xcb_input_device_enable_ctrl_next (xcb_input_device_enable_ctrl_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_device_enable_ctrl_t); +} + +xcb_generic_iterator_t +xcb_input_device_enable_ctrl_end (xcb_input_device_enable_ctrl_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; +} + +uint32_t * +xcb_input_device_ctl_data_resolution_resolution_values (const xcb_input_device_ctl_data_t *S) +{ + return S->resolution.resolution_values; +} + +int +xcb_input_device_ctl_data_resolution_resolution_values_length (const xcb_input_device_ctl_t *R, + const xcb_input_device_ctl_data_t *S) +{ + return S->resolution.num_valuators; +} + +xcb_generic_iterator_t +xcb_input_device_ctl_data_resolution_resolution_values_end (const xcb_input_device_ctl_t *R, + const xcb_input_device_ctl_data_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->resolution.resolution_values + S->resolution.num_valuators; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +int +xcb_input_device_ctl_data_serialize (void **_buffer, + uint16_t control_id, + const xcb_input_device_ctl_data_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[24]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(control_id == XCB_INPUT_DEVICE_CONTROL_RESOLUTION) { + /* xcb_input_device_ctl_data_t.resolution.first_valuator */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->resolution.first_valuator; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_device_ctl_data_t.resolution.num_valuators */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->resolution.num_valuators; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_device_ctl_data_t.resolution.pad0 */ + xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; + xcb_block_len += sizeof(uint8_t)*2; + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t)*2; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_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; + /* resolution_values */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->resolution.resolution_values; + xcb_block_len += _aux->resolution.num_valuators * sizeof(uint32_t); + xcb_parts[xcb_parts_idx].iov_len = _aux->resolution.num_valuators * sizeof(uint32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint32_t); + } + if(control_id == XCB_INPUT_DEVICE_CONTROL_ABS_CALIB) { + /* xcb_input_device_ctl_data_t.abs_calib.min_x */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_calib.min_x; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_device_ctl_data_t.abs_calib.max_x */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_calib.max_x; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_device_ctl_data_t.abs_calib.min_y */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_calib.min_y; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_device_ctl_data_t.abs_calib.max_y */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_calib.max_y; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_device_ctl_data_t.abs_calib.flip_x */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_calib.flip_x; + 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); + /* xcb_input_device_ctl_data_t.abs_calib.flip_y */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_calib.flip_y; + 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); + /* xcb_input_device_ctl_data_t.abs_calib.rotation */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_calib.rotation; + 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); + /* xcb_input_device_ctl_data_t.abs_calib.button_threshold */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_calib.button_threshold; + 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(control_id == XCB_INPUT_DEVICE_CONTROL_CORE) { + /* xcb_input_device_ctl_data_t.core.status */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->core.status; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_device_ctl_data_t.core.pad1 */ + xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; + xcb_block_len += sizeof(uint8_t)*3; + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t)*3; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + } + if(control_id == XCB_INPUT_DEVICE_CONTROL_ENABLE) { + /* xcb_input_device_ctl_data_t.enable.enable */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->enable.enable; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_device_ctl_data_t.enable.pad2 */ + xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; + xcb_block_len += sizeof(uint8_t)*3; + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t)*3; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + } + if(control_id == XCB_INPUT_DEVICE_CONTROL_ABS_AREA) { + /* xcb_input_device_ctl_data_t.abs_area.offset_x */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_area.offset_x; + 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); + /* xcb_input_device_ctl_data_t.abs_area.offset_y */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_area.offset_y; + 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); + /* xcb_input_device_ctl_data_t.abs_area.width */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_area.width; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_device_ctl_data_t.abs_area.height */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_area.height; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_device_ctl_data_t.abs_area.screen */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_area.screen; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_device_ctl_data_t.abs_area.following */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->abs_area.following; + 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); + } + /* 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_input_device_ctl_data_unpack (const void *_buffer, + uint16_t control_id, + xcb_input_device_ctl_data_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(control_id == XCB_INPUT_DEVICE_CONTROL_RESOLUTION) { + /* xcb_input_device_ctl_data_t.resolution.first_valuator */ + _aux->resolution.first_valuator = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_device_ctl_data_t.resolution.num_valuators */ + _aux->resolution.num_valuators = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_device_ctl_data_t.resolution.pad0 */ + _aux->resolution.pad0[0] = *(uint8_t *)xcb_tmp; + _aux->resolution.pad0[1] = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t) * 2; + xcb_tmp += sizeof(uint8_t) * 2; + xcb_align_to = ALIGNOF(uint8_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; + /* resolution_values */ + _aux->resolution.resolution_values = (uint32_t *)xcb_tmp; + xcb_block_len += _aux->resolution.num_valuators * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_t); + } + if(control_id == XCB_INPUT_DEVICE_CONTROL_ABS_CALIB) { + /* xcb_input_device_ctl_data_t.abs_calib.min_x */ + _aux->abs_calib.min_x = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_device_ctl_data_t.abs_calib.max_x */ + _aux->abs_calib.max_x = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_device_ctl_data_t.abs_calib.min_y */ + _aux->abs_calib.min_y = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_device_ctl_data_t.abs_calib.max_y */ + _aux->abs_calib.max_y = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_device_ctl_data_t.abs_calib.flip_x */ + _aux->abs_calib.flip_x = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_input_device_ctl_data_t.abs_calib.flip_y */ + _aux->abs_calib.flip_y = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_input_device_ctl_data_t.abs_calib.rotation */ + _aux->abs_calib.rotation = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_input_device_ctl_data_t.abs_calib.button_threshold */ + _aux->abs_calib.button_threshold = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + } + if(control_id == XCB_INPUT_DEVICE_CONTROL_CORE) { + /* xcb_input_device_ctl_data_t.core.status */ + _aux->core.status = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_device_ctl_data_t.core.pad1 */ + _aux->core.pad1[0] = *(uint8_t *)xcb_tmp; + _aux->core.pad1[1] = *(uint8_t *)xcb_tmp; + _aux->core.pad1[2] = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t) * 3; + xcb_tmp += sizeof(uint8_t) * 3; + xcb_align_to = ALIGNOF(uint8_t); + } + if(control_id == XCB_INPUT_DEVICE_CONTROL_ENABLE) { + /* xcb_input_device_ctl_data_t.enable.enable */ + _aux->enable.enable = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_device_ctl_data_t.enable.pad2 */ + _aux->enable.pad2[0] = *(uint8_t *)xcb_tmp; + _aux->enable.pad2[1] = *(uint8_t *)xcb_tmp; + _aux->enable.pad2[2] = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t) * 3; + xcb_tmp += sizeof(uint8_t) * 3; + xcb_align_to = ALIGNOF(uint8_t); + } + if(control_id == XCB_INPUT_DEVICE_CONTROL_ABS_AREA) { + /* xcb_input_device_ctl_data_t.abs_area.offset_x */ + _aux->abs_area.offset_x = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_input_device_ctl_data_t.abs_area.offset_y */ + _aux->abs_area.offset_y = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_input_device_ctl_data_t.abs_area.width */ + _aux->abs_area.width = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_device_ctl_data_t.abs_area.height */ + _aux->abs_area.height = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_device_ctl_data_t.abs_area.screen */ + _aux->abs_area.screen = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + /* xcb_input_device_ctl_data_t.abs_area.following */ + _aux->abs_area.following = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_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_input_device_ctl_data_sizeof (const void *_buffer, + uint16_t control_id) +{ + xcb_input_device_ctl_data_t _aux; + return xcb_input_device_ctl_data_unpack(_buffer, control_id, &_aux); +} + +int +xcb_input_device_ctl_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_device_ctl_t *_aux = (xcb_input_device_ctl_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_input_device_ctl_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += xcb_input_device_ctl_data_sizeof(xcb_tmp, _aux->control_id); + 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; +} + +void * +xcb_input_device_ctl_data (const xcb_input_device_ctl_t *R) +{ + return (void *) (R + 1); +} + +void +xcb_input_device_ctl_next (xcb_input_device_ctl_iterator_t *i) +{ + xcb_input_device_ctl_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_input_device_ctl_t *)(((char *)R) + xcb_input_device_ctl_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_input_device_ctl_t *) child.data; +} + +xcb_generic_iterator_t +xcb_input_device_ctl_end (xcb_input_device_ctl_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_input_device_ctl_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_input_change_device_control_sizeof (const void *_buffer) +{ + 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_input_change_device_control_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* control */ + xcb_block_len += xcb_input_device_ctl_sizeof(xcb_tmp); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_device_ctl_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_input_change_device_control_cookie_t +xcb_input_change_device_control (xcb_connection_t *c, + uint16_t control_id, + uint8_t device_id, + xcb_input_device_ctl_t *control) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_CHANGE_DEVICE_CONTROL, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_input_change_device_control_cookie_t xcb_ret; + xcb_input_change_device_control_request_t xcb_out; + + xcb_out.control_id = control_id; + xcb_out.device_id = device_id; + xcb_out.pad0 = 0; + + 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_input_device_ctl_t control */ + xcb_parts[4].iov_base = (char *) control; + xcb_parts[4].iov_len = + xcb_input_device_ctl_sizeof (control); + + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_input_change_device_control_cookie_t +xcb_input_change_device_control_unchecked (xcb_connection_t *c, + uint16_t control_id, + uint8_t device_id, + xcb_input_device_ctl_t *control) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_CHANGE_DEVICE_CONTROL, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_input_change_device_control_cookie_t xcb_ret; + xcb_input_change_device_control_request_t xcb_out; + + xcb_out.control_id = control_id; + xcb_out.device_id = device_id; + xcb_out.pad0 = 0; + + 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_input_device_ctl_t control */ + xcb_parts[4].iov_base = (char *) control; + xcb_parts[4].iov_len = + xcb_input_device_ctl_sizeof (control); + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_input_change_device_control_reply_t * +xcb_input_change_device_control_reply (xcb_connection_t *c, + xcb_input_change_device_control_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_change_device_control_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_input_list_device_properties_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_list_device_properties_reply_t *_aux = (xcb_input_list_device_properties_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_input_list_device_properties_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* atoms */ + xcb_block_len += _aux->num_atoms * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_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_input_list_device_properties_cookie_t +xcb_input_list_device_properties (xcb_connection_t *c, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_LIST_DEVICE_PROPERTIES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_list_device_properties_cookie_t xcb_ret; + xcb_input_list_device_properties_request_t xcb_out; + + xcb_out.device_id = device_id; + 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_input_list_device_properties_cookie_t +xcb_input_list_device_properties_unchecked (xcb_connection_t *c, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_LIST_DEVICE_PROPERTIES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_list_device_properties_cookie_t xcb_ret; + xcb_input_list_device_properties_request_t xcb_out; + + xcb_out.device_id = device_id; + 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_atom_t * +xcb_input_list_device_properties_atoms (const xcb_input_list_device_properties_reply_t *R) +{ + return (xcb_atom_t *) (R + 1); +} + +int +xcb_input_list_device_properties_atoms_length (const xcb_input_list_device_properties_reply_t *R) +{ + return R->num_atoms; +} + +xcb_generic_iterator_t +xcb_input_list_device_properties_atoms_end (const xcb_input_list_device_properties_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_atom_t *) (R + 1)) + (R->num_atoms); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_list_device_properties_reply_t * +xcb_input_list_device_properties_reply (xcb_connection_t *c, + xcb_input_list_device_properties_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_list_device_properties_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +uint8_t * +xcb_input_change_device_property_items_data_8 (const xcb_input_change_device_property_items_t *S) +{ + return S->data8; +} + +int +xcb_input_change_device_property_items_data_8_length (const xcb_input_change_device_property_request_t *R, + const xcb_input_change_device_property_items_t *S) +{ + return R->num_items; +} + +xcb_generic_iterator_t +xcb_input_change_device_property_items_data_8_end (const xcb_input_change_device_property_request_t *R, + const xcb_input_change_device_property_items_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->data8 + R->num_items; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +uint16_t * +xcb_input_change_device_property_items_data_16 (const xcb_input_change_device_property_items_t *S) +{ + return S->data16; +} + +int +xcb_input_change_device_property_items_data_16_length (const xcb_input_change_device_property_request_t *R, + const xcb_input_change_device_property_items_t *S) +{ + return R->num_items; +} + +xcb_generic_iterator_t +xcb_input_change_device_property_items_data_16_end (const xcb_input_change_device_property_request_t *R, + const xcb_input_change_device_property_items_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->data16 + R->num_items; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +uint32_t * +xcb_input_change_device_property_items_data_32 (const xcb_input_change_device_property_items_t *S) +{ + return S->data32; +} + +int +xcb_input_change_device_property_items_data_32_length (const xcb_input_change_device_property_request_t *R, + const xcb_input_change_device_property_items_t *S) +{ + return R->num_items; +} + +xcb_generic_iterator_t +xcb_input_change_device_property_items_data_32_end (const xcb_input_change_device_property_request_t *R, + const xcb_input_change_device_property_items_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->data32 + R->num_items; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +int +xcb_input_change_device_property_items_serialize (void **_buffer, + uint32_t num_items, + uint8_t format, + const xcb_input_change_device_property_items_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[9]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(format == XCB_INPUT_PROPERTY_FORMAT_8_BITS) { + /* 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; + /* data8 */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->data8; + xcb_block_len += num_items * sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = num_items * sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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(format == XCB_INPUT_PROPERTY_FORMAT_16_BITS) { + /* 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; + /* data16 */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->data16; + xcb_block_len += num_items * sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = num_items * sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + xcb_align_to = 4; + /* 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(format == XCB_INPUT_PROPERTY_FORMAT_32_BITS) { + /* 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; + /* data32 */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->data32; + xcb_block_len += num_items * sizeof(uint32_t); + xcb_parts[xcb_parts_idx].iov_len = num_items * sizeof(uint32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint32_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_input_change_device_property_items_unpack (const void *_buffer, + uint32_t num_items, + uint8_t format, + xcb_input_change_device_property_items_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(format == XCB_INPUT_PROPERTY_FORMAT_8_BITS) { + /* 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; + /* data8 */ + _aux->data8 = (uint8_t *)xcb_tmp; + xcb_block_len += num_items * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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; + } + if(format == XCB_INPUT_PROPERTY_FORMAT_16_BITS) { + /* 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; + /* data16 */ + _aux->data16 = (uint16_t *)xcb_tmp; + xcb_block_len += num_items * sizeof(uint16_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint16_t); + xcb_align_to = 4; + /* 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; + } + if(format == XCB_INPUT_PROPERTY_FORMAT_32_BITS) { + /* 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; + /* data32 */ + _aux->data32 = (uint32_t *)xcb_tmp; + xcb_block_len += num_items * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_input_change_device_property_items_sizeof (const void *_buffer, + uint32_t num_items, + uint8_t format) +{ + xcb_input_change_device_property_items_t _aux; + return xcb_input_change_device_property_items_unpack(_buffer, num_items, format, &_aux); +} + +int +xcb_input_change_device_property_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_change_device_property_request_t *_aux = (xcb_input_change_device_property_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_input_change_device_property_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* items */ + xcb_block_len += xcb_input_change_device_property_items_sizeof(xcb_tmp, _aux->num_items, _aux->format); + 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_input_change_device_property_checked (xcb_connection_t *c, + xcb_atom_t property, + xcb_atom_t type, + uint8_t device_id, + uint8_t format, + uint8_t mode, + uint32_t num_items, + const void *items) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_CHANGE_DEVICE_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_input_change_device_property_request_t xcb_out; + + xcb_out.property = property; + xcb_out.type = type; + xcb_out.device_id = device_id; + xcb_out.format = format; + xcb_out.mode = mode; + xcb_out.pad0 = 0; + xcb_out.num_items = num_items; + + 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_input_change_device_property_items_t items */ + xcb_parts[4].iov_base = (char *) items; + xcb_parts[4].iov_len = + xcb_input_change_device_property_items_sizeof (items, num_items, format); + + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_input_change_device_property (xcb_connection_t *c, + xcb_atom_t property, + xcb_atom_t type, + uint8_t device_id, + uint8_t format, + uint8_t mode, + uint32_t num_items, + const void *items) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_CHANGE_DEVICE_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_input_change_device_property_request_t xcb_out; + + xcb_out.property = property; + xcb_out.type = type; + xcb_out.device_id = device_id; + xcb_out.format = format; + xcb_out.mode = mode; + xcb_out.pad0 = 0; + xcb_out.num_items = num_items; + + 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_input_change_device_property_items_t items */ + xcb_parts[4].iov_base = (char *) items; + xcb_parts[4].iov_len = + xcb_input_change_device_property_items_sizeof (items, num_items, format); + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_input_change_device_property_aux_checked (xcb_connection_t *c, + xcb_atom_t property, + xcb_atom_t type, + uint8_t device_id, + uint8_t format, + uint8_t mode, + uint32_t num_items, + const xcb_input_change_device_property_items_t *items) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_CHANGE_DEVICE_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_input_change_device_property_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.property = property; + xcb_out.type = type; + xcb_out.device_id = device_id; + xcb_out.format = format; + xcb_out.mode = mode; + xcb_out.pad0 = 0; + xcb_out.num_items = num_items; + + 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_input_change_device_property_items_t items */ + xcb_parts[4].iov_len = + xcb_input_change_device_property_items_serialize (&xcb_aux0, num_items, format, items); + 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_input_change_device_property_aux (xcb_connection_t *c, + xcb_atom_t property, + xcb_atom_t type, + uint8_t device_id, + uint8_t format, + uint8_t mode, + uint32_t num_items, + const xcb_input_change_device_property_items_t *items) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_CHANGE_DEVICE_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_input_change_device_property_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.property = property; + xcb_out.type = type; + xcb_out.device_id = device_id; + xcb_out.format = format; + xcb_out.mode = mode; + xcb_out.pad0 = 0; + xcb_out.num_items = num_items; + + 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_input_change_device_property_items_t items */ + xcb_parts[4].iov_len = + xcb_input_change_device_property_items_serialize (&xcb_aux0, num_items, format, items); + 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_input_change_device_property_items (const xcb_input_change_device_property_request_t *R) +{ + return (void *) (R + 1); +} + +xcb_void_cookie_t +xcb_input_delete_device_property_checked (xcb_connection_t *c, + xcb_atom_t property, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_DELETE_DEVICE_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_delete_device_property_request_t xcb_out; + + xcb_out.property = property; + xcb_out.device_id = device_id; + 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_input_delete_device_property (xcb_connection_t *c, + xcb_atom_t property, + uint8_t device_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_DELETE_DEVICE_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_delete_device_property_request_t xcb_out; + + xcb_out.property = property; + xcb_out.device_id = device_id; + 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; +} + +uint8_t * +xcb_input_get_device_property_items_data_8 (const xcb_input_get_device_property_items_t *S) +{ + return S->data8; +} + +int +xcb_input_get_device_property_items_data_8_length (const xcb_input_get_device_property_reply_t *R, + const xcb_input_get_device_property_items_t *S) +{ + return R->num_items; +} + +xcb_generic_iterator_t +xcb_input_get_device_property_items_data_8_end (const xcb_input_get_device_property_reply_t *R, + const xcb_input_get_device_property_items_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->data8 + R->num_items; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +uint16_t * +xcb_input_get_device_property_items_data_16 (const xcb_input_get_device_property_items_t *S) +{ + return S->data16; +} + +int +xcb_input_get_device_property_items_data_16_length (const xcb_input_get_device_property_reply_t *R, + const xcb_input_get_device_property_items_t *S) +{ + return R->num_items; +} + +xcb_generic_iterator_t +xcb_input_get_device_property_items_data_16_end (const xcb_input_get_device_property_reply_t *R, + const xcb_input_get_device_property_items_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->data16 + R->num_items; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +uint32_t * +xcb_input_get_device_property_items_data_32 (const xcb_input_get_device_property_items_t *S) +{ + return S->data32; +} + +int +xcb_input_get_device_property_items_data_32_length (const xcb_input_get_device_property_reply_t *R, + const xcb_input_get_device_property_items_t *S) +{ + return R->num_items; +} + +xcb_generic_iterator_t +xcb_input_get_device_property_items_data_32_end (const xcb_input_get_device_property_reply_t *R, + const xcb_input_get_device_property_items_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->data32 + R->num_items; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +int +xcb_input_get_device_property_items_serialize (void **_buffer, + uint32_t num_items, + uint8_t format, + const xcb_input_get_device_property_items_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[9]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(format == XCB_INPUT_PROPERTY_FORMAT_8_BITS) { + /* 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; + /* data8 */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->data8; + xcb_block_len += num_items * sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = num_items * sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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(format == XCB_INPUT_PROPERTY_FORMAT_16_BITS) { + /* 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; + /* data16 */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->data16; + xcb_block_len += num_items * sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = num_items * sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + xcb_align_to = 4; + /* 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(format == XCB_INPUT_PROPERTY_FORMAT_32_BITS) { + /* 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; + /* data32 */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->data32; + xcb_block_len += num_items * sizeof(uint32_t); + xcb_parts[xcb_parts_idx].iov_len = num_items * sizeof(uint32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint32_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_input_get_device_property_items_unpack (const void *_buffer, + uint32_t num_items, + uint8_t format, + xcb_input_get_device_property_items_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(format == XCB_INPUT_PROPERTY_FORMAT_8_BITS) { + /* 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; + /* data8 */ + _aux->data8 = (uint8_t *)xcb_tmp; + xcb_block_len += num_items * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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; + } + if(format == XCB_INPUT_PROPERTY_FORMAT_16_BITS) { + /* 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; + /* data16 */ + _aux->data16 = (uint16_t *)xcb_tmp; + xcb_block_len += num_items * sizeof(uint16_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint16_t); + xcb_align_to = 4; + /* 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; + } + if(format == XCB_INPUT_PROPERTY_FORMAT_32_BITS) { + /* 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; + /* data32 */ + _aux->data32 = (uint32_t *)xcb_tmp; + xcb_block_len += num_items * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_input_get_device_property_items_sizeof (const void *_buffer, + uint32_t num_items, + uint8_t format) +{ + xcb_input_get_device_property_items_t _aux; + return xcb_input_get_device_property_items_unpack(_buffer, num_items, format, &_aux); +} + +int +xcb_input_get_device_property_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_get_device_property_reply_t *_aux = (xcb_input_get_device_property_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_input_get_device_property_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* items */ + xcb_block_len += xcb_input_get_device_property_items_sizeof(xcb_tmp, _aux->num_items, _aux->format); + 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_input_get_device_property_cookie_t +xcb_input_get_device_property (xcb_connection_t *c, + xcb_atom_t property, + xcb_atom_t type, + uint32_t offset, + uint32_t len, + uint8_t device_id, + uint8_t _delete) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GET_DEVICE_PROPERTY, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_get_device_property_cookie_t xcb_ret; + xcb_input_get_device_property_request_t xcb_out; + + xcb_out.property = property; + xcb_out.type = type; + xcb_out.offset = offset; + xcb_out.len = len; + xcb_out.device_id = device_id; + xcb_out._delete = _delete; + 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_input_get_device_property_cookie_t +xcb_input_get_device_property_unchecked (xcb_connection_t *c, + xcb_atom_t property, + xcb_atom_t type, + uint32_t offset, + uint32_t len, + uint8_t device_id, + uint8_t _delete) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_GET_DEVICE_PROPERTY, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_get_device_property_cookie_t xcb_ret; + xcb_input_get_device_property_request_t xcb_out; + + xcb_out.property = property; + xcb_out.type = type; + xcb_out.offset = offset; + xcb_out.len = len; + xcb_out.device_id = device_id; + xcb_out._delete = _delete; + 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; +} + +void * +xcb_input_get_device_property_items (const xcb_input_get_device_property_reply_t *R) +{ + return (void *) (R + 1); +} + +xcb_input_get_device_property_reply_t * +xcb_input_get_device_property_reply (xcb_connection_t *c, + xcb_input_get_device_property_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_get_device_property_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +void +xcb_input_group_info_next (xcb_input_group_info_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_group_info_t); +} + +xcb_generic_iterator_t +xcb_input_group_info_end (xcb_input_group_info_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; +} + +void +xcb_input_modifier_info_next (xcb_input_modifier_info_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_modifier_info_t); +} + +xcb_generic_iterator_t +xcb_input_modifier_info_end (xcb_input_modifier_info_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; +} + +int +xcb_input_xi_query_pointer_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_xi_query_pointer_reply_t *_aux = (xcb_input_xi_query_pointer_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_input_xi_query_pointer_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* buttons */ + xcb_block_len += _aux->buttons_len * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_input_xi_query_pointer_cookie_t +xcb_input_xi_query_pointer (xcb_connection_t *c, + xcb_window_t window, + xcb_input_device_id_t deviceid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_QUERY_POINTER, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_xi_query_pointer_cookie_t xcb_ret; + xcb_input_xi_query_pointer_request_t xcb_out; + + xcb_out.window = window; + xcb_out.deviceid = deviceid; + 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_input_xi_query_pointer_cookie_t +xcb_input_xi_query_pointer_unchecked (xcb_connection_t *c, + xcb_window_t window, + xcb_input_device_id_t deviceid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_QUERY_POINTER, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_xi_query_pointer_cookie_t xcb_ret; + xcb_input_xi_query_pointer_request_t xcb_out; + + xcb_out.window = window; + xcb_out.deviceid = deviceid; + 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; +} + +uint32_t * +xcb_input_xi_query_pointer_buttons (const xcb_input_xi_query_pointer_reply_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_input_xi_query_pointer_buttons_length (const xcb_input_xi_query_pointer_reply_t *R) +{ + return R->buttons_len; +} + +xcb_generic_iterator_t +xcb_input_xi_query_pointer_buttons_end (const xcb_input_xi_query_pointer_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->buttons_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_xi_query_pointer_reply_t * +xcb_input_xi_query_pointer_reply (xcb_connection_t *c, + xcb_input_xi_query_pointer_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_xi_query_pointer_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_input_xi_warp_pointer_checked (xcb_connection_t *c, + xcb_window_t src_win, + xcb_window_t dst_win, + xcb_input_fp1616_t src_x, + xcb_input_fp1616_t src_y, + uint16_t src_width, + uint16_t src_height, + xcb_input_fp1616_t dst_x, + xcb_input_fp1616_t dst_y, + xcb_input_device_id_t deviceid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_WARP_POINTER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_warp_pointer_request_t xcb_out; + + xcb_out.src_win = src_win; + xcb_out.dst_win = dst_win; + xcb_out.src_x = src_x; + xcb_out.src_y = src_y; + xcb_out.src_width = src_width; + xcb_out.src_height = src_height; + xcb_out.dst_x = dst_x; + xcb_out.dst_y = dst_y; + xcb_out.deviceid = deviceid; + 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_void_cookie_t +xcb_input_xi_warp_pointer (xcb_connection_t *c, + xcb_window_t src_win, + xcb_window_t dst_win, + xcb_input_fp1616_t src_x, + xcb_input_fp1616_t src_y, + uint16_t src_width, + uint16_t src_height, + xcb_input_fp1616_t dst_x, + xcb_input_fp1616_t dst_y, + xcb_input_device_id_t deviceid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_WARP_POINTER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_warp_pointer_request_t xcb_out; + + xcb_out.src_win = src_win; + xcb_out.dst_win = dst_win; + xcb_out.src_x = src_x; + xcb_out.src_y = src_y; + xcb_out.src_width = src_width; + xcb_out.src_height = src_height; + xcb_out.dst_x = dst_x; + xcb_out.dst_y = dst_y; + xcb_out.deviceid = deviceid; + 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_void_cookie_t +xcb_input_xi_change_cursor_checked (xcb_connection_t *c, + xcb_window_t window, + xcb_cursor_t cursor, + xcb_input_device_id_t deviceid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_CHANGE_CURSOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_change_cursor_request_t xcb_out; + + xcb_out.window = window; + xcb_out.cursor = cursor; + xcb_out.deviceid = deviceid; + 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_void_cookie_t +xcb_input_xi_change_cursor (xcb_connection_t *c, + xcb_window_t window, + xcb_cursor_t cursor, + xcb_input_device_id_t deviceid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_CHANGE_CURSOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_change_cursor_request_t xcb_out; + + xcb_out.window = window; + xcb_out.cursor = cursor; + xcb_out.deviceid = deviceid; + 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; +} + +int +xcb_input_add_master_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_add_master_t *_aux = (xcb_input_add_master_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_input_add_master_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* name */ + xcb_block_len += _aux->name_len * sizeof(char); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(char); + xcb_align_to = 4; + /* 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; + /* 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; +} + +char * +xcb_input_add_master_name (const xcb_input_add_master_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_input_add_master_name_length (const xcb_input_add_master_t *R) +{ + return R->name_len; +} + +xcb_generic_iterator_t +xcb_input_add_master_name_end (const xcb_input_add_master_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->name_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_input_add_master_next (xcb_input_add_master_iterator_t *i) +{ + xcb_input_add_master_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_input_add_master_t *)(((char *)R) + xcb_input_add_master_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_input_add_master_t *) child.data; +} + +xcb_generic_iterator_t +xcb_input_add_master_end (xcb_input_add_master_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_input_add_master_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +void +xcb_input_remove_master_next (xcb_input_remove_master_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_remove_master_t); +} + +xcb_generic_iterator_t +xcb_input_remove_master_end (xcb_input_remove_master_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; +} + +void +xcb_input_attach_slave_next (xcb_input_attach_slave_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_attach_slave_t); +} + +xcb_generic_iterator_t +xcb_input_attach_slave_end (xcb_input_attach_slave_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; +} + +void +xcb_input_detach_slave_next (xcb_input_detach_slave_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_detach_slave_t); +} + +xcb_generic_iterator_t +xcb_input_detach_slave_end (xcb_input_detach_slave_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; +} + +char * +xcb_input_hierarchy_change_data_add_master_name (const xcb_input_hierarchy_change_data_t *S) +{ + return S->add_master.name; +} + +int +xcb_input_hierarchy_change_data_add_master_name_length (const xcb_input_hierarchy_change_t *R, + const xcb_input_hierarchy_change_data_t *S) +{ + return S->add_master.name_len; +} + +xcb_generic_iterator_t +xcb_input_hierarchy_change_data_add_master_name_end (const xcb_input_hierarchy_change_t *R, + const xcb_input_hierarchy_change_data_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->add_master.name + S->add_master.name_len; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +int +xcb_input_hierarchy_change_data_serialize (void **_buffer, + uint16_t type, + const xcb_input_hierarchy_change_data_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(type == XCB_INPUT_HIERARCHY_CHANGE_TYPE_ADD_MASTER) { + /* xcb_input_hierarchy_change_data_t.add_master.name_len */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->add_master.name_len; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_input_hierarchy_change_data_t.add_master.send_core */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->add_master.send_core; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_hierarchy_change_data_t.add_master.enable */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->add_master.enable; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_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; + /* name */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->add_master.name; + xcb_block_len += _aux->add_master.name_len * sizeof(char); + xcb_parts[xcb_parts_idx].iov_len = _aux->add_master.name_len * sizeof(char); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(char); + xcb_align_to = 4; + /* 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(type == XCB_INPUT_HIERARCHY_CHANGE_TYPE_REMOVE_MASTER) { + /* xcb_input_hierarchy_change_data_t.remove_master.deviceid */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->remove_master.deviceid; + xcb_block_len += sizeof(xcb_input_device_id_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_input_device_id_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_input_device_id_t); + /* xcb_input_hierarchy_change_data_t.remove_master.return_mode */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->remove_master.return_mode; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_hierarchy_change_data_t.remove_master.pad1 */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &xcb_pad; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_hierarchy_change_data_t.remove_master.return_pointer */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->remove_master.return_pointer; + xcb_block_len += sizeof(xcb_input_device_id_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_input_device_id_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_input_device_id_t); + /* xcb_input_hierarchy_change_data_t.remove_master.return_keyboard */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->remove_master.return_keyboard; + xcb_block_len += sizeof(xcb_input_device_id_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_input_device_id_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_input_device_id_t); + } + if(type == XCB_INPUT_HIERARCHY_CHANGE_TYPE_ATTACH_SLAVE) { + /* xcb_input_hierarchy_change_data_t.attach_slave.deviceid */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->attach_slave.deviceid; + xcb_block_len += sizeof(xcb_input_device_id_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_input_device_id_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_input_device_id_t); + /* xcb_input_hierarchy_change_data_t.attach_slave.master */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->attach_slave.master; + xcb_block_len += sizeof(xcb_input_device_id_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_input_device_id_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_input_device_id_t); + } + if(type == XCB_INPUT_HIERARCHY_CHANGE_TYPE_DETACH_SLAVE) { + /* xcb_input_hierarchy_change_data_t.detach_slave.deviceid */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->detach_slave.deviceid; + xcb_block_len += sizeof(xcb_input_device_id_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_input_device_id_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_input_device_id_t); + /* xcb_input_hierarchy_change_data_t.detach_slave.pad2 */ + xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; + xcb_block_len += sizeof(uint8_t)*2; + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t)*2; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_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_input_hierarchy_change_data_unpack (const void *_buffer, + uint16_t type, + xcb_input_hierarchy_change_data_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(type == XCB_INPUT_HIERARCHY_CHANGE_TYPE_ADD_MASTER) { + /* xcb_input_hierarchy_change_data_t.add_master.name_len */ + _aux->add_master.name_len = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_input_hierarchy_change_data_t.add_master.send_core */ + _aux->add_master.send_core = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_hierarchy_change_data_t.add_master.enable */ + _aux->add_master.enable = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_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; + /* name */ + _aux->add_master.name = (char *)xcb_tmp; + xcb_block_len += _aux->add_master.name_len * sizeof(char); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(char); + xcb_align_to = 4; + /* 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; + } + if(type == XCB_INPUT_HIERARCHY_CHANGE_TYPE_REMOVE_MASTER) { + /* xcb_input_hierarchy_change_data_t.remove_master.deviceid */ + _aux->remove_master.deviceid = *(xcb_input_device_id_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_input_device_id_t); + xcb_tmp += sizeof(xcb_input_device_id_t); + xcb_align_to = ALIGNOF(xcb_input_device_id_t); + /* xcb_input_hierarchy_change_data_t.remove_master.return_mode */ + _aux->remove_master.return_mode = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_hierarchy_change_data_t.remove_master.pad1 */ + _aux->remove_master.pad1 = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_hierarchy_change_data_t.remove_master.return_pointer */ + _aux->remove_master.return_pointer = *(xcb_input_device_id_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_input_device_id_t); + xcb_tmp += sizeof(xcb_input_device_id_t); + xcb_align_to = ALIGNOF(xcb_input_device_id_t); + /* xcb_input_hierarchy_change_data_t.remove_master.return_keyboard */ + _aux->remove_master.return_keyboard = *(xcb_input_device_id_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_input_device_id_t); + xcb_tmp += sizeof(xcb_input_device_id_t); + xcb_align_to = ALIGNOF(xcb_input_device_id_t); + } + if(type == XCB_INPUT_HIERARCHY_CHANGE_TYPE_ATTACH_SLAVE) { + /* xcb_input_hierarchy_change_data_t.attach_slave.deviceid */ + _aux->attach_slave.deviceid = *(xcb_input_device_id_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_input_device_id_t); + xcb_tmp += sizeof(xcb_input_device_id_t); + xcb_align_to = ALIGNOF(xcb_input_device_id_t); + /* xcb_input_hierarchy_change_data_t.attach_slave.master */ + _aux->attach_slave.master = *(xcb_input_device_id_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_input_device_id_t); + xcb_tmp += sizeof(xcb_input_device_id_t); + xcb_align_to = ALIGNOF(xcb_input_device_id_t); + } + if(type == XCB_INPUT_HIERARCHY_CHANGE_TYPE_DETACH_SLAVE) { + /* xcb_input_hierarchy_change_data_t.detach_slave.deviceid */ + _aux->detach_slave.deviceid = *(xcb_input_device_id_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_input_device_id_t); + xcb_tmp += sizeof(xcb_input_device_id_t); + xcb_align_to = ALIGNOF(xcb_input_device_id_t); + /* xcb_input_hierarchy_change_data_t.detach_slave.pad2 */ + _aux->detach_slave.pad2[0] = *(uint8_t *)xcb_tmp; + _aux->detach_slave.pad2[1] = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t) * 2; + xcb_tmp += sizeof(uint8_t) * 2; + xcb_align_to = ALIGNOF(uint8_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_input_hierarchy_change_data_sizeof (const void *_buffer, + uint16_t type) +{ + xcb_input_hierarchy_change_data_t _aux; + return xcb_input_hierarchy_change_data_unpack(_buffer, type, &_aux); +} + +int +xcb_input_hierarchy_change_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_hierarchy_change_t *_aux = (xcb_input_hierarchy_change_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_input_hierarchy_change_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += xcb_input_hierarchy_change_data_sizeof(xcb_tmp, _aux->type); + 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; +} + +void * +xcb_input_hierarchy_change_data (const xcb_input_hierarchy_change_t *R) +{ + return (void *) (R + 1); +} + +void +xcb_input_hierarchy_change_next (xcb_input_hierarchy_change_iterator_t *i) +{ + xcb_input_hierarchy_change_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_input_hierarchy_change_t *)(((char *)R) + xcb_input_hierarchy_change_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_input_hierarchy_change_t *) child.data; +} + +xcb_generic_iterator_t +xcb_input_hierarchy_change_end (xcb_input_hierarchy_change_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_input_hierarchy_change_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_input_xi_change_hierarchy_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_xi_change_hierarchy_request_t *_aux = (xcb_input_xi_change_hierarchy_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_input_xi_change_hierarchy_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* changes */ + for(i=0; i<_aux->num_changes; i++) { + xcb_tmp_len = xcb_input_hierarchy_change_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_input_hierarchy_change_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_input_xi_change_hierarchy_checked (xcb_connection_t *c, + uint8_t num_changes, + const xcb_input_hierarchy_change_t *changes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_CHANGE_HIERARCHY, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_change_hierarchy_request_t xcb_out; + unsigned int xcb_tmp_len; + char *xcb_tmp; + unsigned int i; + + xcb_out.num_changes = num_changes; + 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_input_hierarchy_change_t changes */ + xcb_parts[4].iov_base = (char *) changes; + xcb_parts[4].iov_len = 0; + xcb_tmp = (char *)changes; + for(i=0; i<num_changes; i++) { + xcb_tmp_len = xcb_input_hierarchy_change_sizeof(xcb_tmp); + xcb_parts[4].iov_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + 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_input_xi_change_hierarchy (xcb_connection_t *c, + uint8_t num_changes, + const xcb_input_hierarchy_change_t *changes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_CHANGE_HIERARCHY, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_change_hierarchy_request_t xcb_out; + unsigned int xcb_tmp_len; + char *xcb_tmp; + unsigned int i; + + xcb_out.num_changes = num_changes; + 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_input_hierarchy_change_t changes */ + xcb_parts[4].iov_base = (char *) changes; + xcb_parts[4].iov_len = 0; + xcb_tmp = (char *)changes; + for(i=0; i<num_changes; i++) { + xcb_tmp_len = xcb_input_hierarchy_change_sizeof(xcb_tmp); + xcb_parts[4].iov_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + 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; +} + +int +xcb_input_xi_change_hierarchy_changes_length (const xcb_input_xi_change_hierarchy_request_t *R) +{ + return R->num_changes; +} + +xcb_input_hierarchy_change_iterator_t +xcb_input_xi_change_hierarchy_changes_iterator (const xcb_input_xi_change_hierarchy_request_t *R) +{ + xcb_input_hierarchy_change_iterator_t i; + i.data = (xcb_input_hierarchy_change_t *) (R + 1); + i.rem = R->num_changes; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_input_xi_set_client_pointer_checked (xcb_connection_t *c, + xcb_window_t window, + xcb_input_device_id_t deviceid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_SET_CLIENT_POINTER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_set_client_pointer_request_t xcb_out; + + xcb_out.window = window; + xcb_out.deviceid = deviceid; + 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_void_cookie_t +xcb_input_xi_set_client_pointer (xcb_connection_t *c, + xcb_window_t window, + xcb_input_device_id_t deviceid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_SET_CLIENT_POINTER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_set_client_pointer_request_t xcb_out; + + xcb_out.window = window; + xcb_out.deviceid = deviceid; + 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_input_xi_get_client_pointer_cookie_t +xcb_input_xi_get_client_pointer (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_GET_CLIENT_POINTER, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_xi_get_client_pointer_cookie_t xcb_ret; + xcb_input_xi_get_client_pointer_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_input_xi_get_client_pointer_cookie_t +xcb_input_xi_get_client_pointer_unchecked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_GET_CLIENT_POINTER, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_xi_get_client_pointer_cookie_t xcb_ret; + xcb_input_xi_get_client_pointer_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_input_xi_get_client_pointer_reply_t * +xcb_input_xi_get_client_pointer_reply (xcb_connection_t *c, + xcb_input_xi_get_client_pointer_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_xi_get_client_pointer_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_input_event_mask_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_event_mask_t *_aux = (xcb_input_event_mask_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_input_event_mask_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* mask */ + xcb_block_len += _aux->mask_len * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; +} + +uint32_t * +xcb_input_event_mask_mask (const xcb_input_event_mask_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_input_event_mask_mask_length (const xcb_input_event_mask_t *R) +{ + return R->mask_len; +} + +xcb_generic_iterator_t +xcb_input_event_mask_mask_end (const xcb_input_event_mask_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->mask_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_input_event_mask_next (xcb_input_event_mask_iterator_t *i) +{ + xcb_input_event_mask_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_input_event_mask_t *)(((char *)R) + xcb_input_event_mask_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_input_event_mask_t *) child.data; +} + +xcb_generic_iterator_t +xcb_input_event_mask_end (xcb_input_event_mask_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_input_event_mask_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_input_xi_select_events_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_xi_select_events_request_t *_aux = (xcb_input_xi_select_events_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_input_xi_select_events_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* masks */ + for(i=0; i<_aux->num_mask; i++) { + xcb_tmp_len = xcb_input_event_mask_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_input_event_mask_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_input_xi_select_events_checked (xcb_connection_t *c, + xcb_window_t window, + uint16_t num_mask, + const xcb_input_event_mask_t *masks) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_SELECT_EVENTS, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_select_events_request_t xcb_out; + unsigned int xcb_tmp_len; + char *xcb_tmp; + unsigned int i; + + xcb_out.window = window; + xcb_out.num_mask = num_mask; + 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_input_event_mask_t masks */ + xcb_parts[4].iov_base = (char *) masks; + xcb_parts[4].iov_len = 0; + xcb_tmp = (char *)masks; + for(i=0; i<num_mask; i++) { + xcb_tmp_len = xcb_input_event_mask_sizeof(xcb_tmp); + xcb_parts[4].iov_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + 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_input_xi_select_events (xcb_connection_t *c, + xcb_window_t window, + uint16_t num_mask, + const xcb_input_event_mask_t *masks) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_SELECT_EVENTS, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_select_events_request_t xcb_out; + unsigned int xcb_tmp_len; + char *xcb_tmp; + unsigned int i; + + xcb_out.window = window; + xcb_out.num_mask = num_mask; + 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_input_event_mask_t masks */ + xcb_parts[4].iov_base = (char *) masks; + xcb_parts[4].iov_len = 0; + xcb_tmp = (char *)masks; + for(i=0; i<num_mask; i++) { + xcb_tmp_len = xcb_input_event_mask_sizeof(xcb_tmp); + xcb_parts[4].iov_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + 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; +} + +int +xcb_input_xi_select_events_masks_length (const xcb_input_xi_select_events_request_t *R) +{ + return R->num_mask; +} + +xcb_input_event_mask_iterator_t +xcb_input_xi_select_events_masks_iterator (const xcb_input_xi_select_events_request_t *R) +{ + xcb_input_event_mask_iterator_t i; + i.data = (xcb_input_event_mask_t *) (R + 1); + i.rem = R->num_mask; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_xi_query_version_cookie_t +xcb_input_xi_query_version (xcb_connection_t *c, + uint16_t major_version, + uint16_t minor_version) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_xi_query_version_cookie_t xcb_ret; + xcb_input_xi_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_input_xi_query_version_cookie_t +xcb_input_xi_query_version_unchecked (xcb_connection_t *c, + uint16_t major_version, + uint16_t minor_version) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_xi_query_version_cookie_t xcb_ret; + xcb_input_xi_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_input_xi_query_version_reply_t * +xcb_input_xi_query_version_reply (xcb_connection_t *c, + xcb_input_xi_query_version_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_xi_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_input_button_class_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_button_class_t *_aux = (xcb_input_button_class_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_input_button_class_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* state */ + xcb_block_len += ((_aux->num_buttons + 31) / 32) * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* labels */ + xcb_block_len += _aux->num_buttons * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_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; +} + +uint32_t * +xcb_input_button_class_state (const xcb_input_button_class_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_input_button_class_state_length (const xcb_input_button_class_t *R) +{ + return ((R->num_buttons + 31) / 32); +} + +xcb_generic_iterator_t +xcb_input_button_class_state_end (const xcb_input_button_class_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (((R->num_buttons + 31) / 32)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_atom_t * +xcb_input_button_class_labels (const xcb_input_button_class_t *R) +{ + xcb_generic_iterator_t prev = xcb_input_button_class_state_end(R); + return (xcb_atom_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_atom_t, prev.index) + 0); +} + +int +xcb_input_button_class_labels_length (const xcb_input_button_class_t *R) +{ + return R->num_buttons; +} + +xcb_generic_iterator_t +xcb_input_button_class_labels_end (const xcb_input_button_class_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_input_button_class_state_end(R); + i.data = ((xcb_atom_t *) ((char*) prev.data + XCB_TYPE_PAD(xcb_atom_t, prev.index))) + (R->num_buttons); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_input_button_class_next (xcb_input_button_class_iterator_t *i) +{ + xcb_input_button_class_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_input_button_class_t *)(((char *)R) + xcb_input_button_class_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_input_button_class_t *) child.data; +} + +xcb_generic_iterator_t +xcb_input_button_class_end (xcb_input_button_class_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_input_button_class_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_input_key_class_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_key_class_t *_aux = (xcb_input_key_class_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_input_key_class_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* keys */ + xcb_block_len += _aux->num_keys * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; +} + +uint32_t * +xcb_input_key_class_keys (const xcb_input_key_class_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_input_key_class_keys_length (const xcb_input_key_class_t *R) +{ + return R->num_keys; +} + +xcb_generic_iterator_t +xcb_input_key_class_keys_end (const xcb_input_key_class_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->num_keys); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_input_key_class_next (xcb_input_key_class_iterator_t *i) +{ + xcb_input_key_class_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_input_key_class_t *)(((char *)R) + xcb_input_key_class_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_input_key_class_t *) child.data; +} + +xcb_generic_iterator_t +xcb_input_key_class_end (xcb_input_key_class_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_input_key_class_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +void +xcb_input_scroll_class_next (xcb_input_scroll_class_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_scroll_class_t); +} + +xcb_generic_iterator_t +xcb_input_scroll_class_end (xcb_input_scroll_class_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; +} + +void +xcb_input_touch_class_next (xcb_input_touch_class_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_touch_class_t); +} + +xcb_generic_iterator_t +xcb_input_touch_class_end (xcb_input_touch_class_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; +} + +void +xcb_input_gesture_class_next (xcb_input_gesture_class_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_gesture_class_t); +} + +xcb_generic_iterator_t +xcb_input_gesture_class_end (xcb_input_gesture_class_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; +} + +void +xcb_input_valuator_class_next (xcb_input_valuator_class_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_valuator_class_t); +} + +xcb_generic_iterator_t +xcb_input_valuator_class_end (xcb_input_valuator_class_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; +} + +uint32_t * +xcb_input_device_class_data_key_keys (const xcb_input_device_class_data_t *S) +{ + return S->key.keys; +} + +int +xcb_input_device_class_data_key_keys_length (const xcb_input_device_class_t *R, + const xcb_input_device_class_data_t *S) +{ + return S->key.num_keys; +} + +xcb_generic_iterator_t +xcb_input_device_class_data_key_keys_end (const xcb_input_device_class_t *R, + const xcb_input_device_class_data_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->key.keys + S->key.num_keys; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +uint32_t * +xcb_input_device_class_data_button_state (const xcb_input_device_class_data_t *S) +{ + return S->button.state; +} + +int +xcb_input_device_class_data_button_state_length (const xcb_input_device_class_t *R, + const xcb_input_device_class_data_t *S) +{ + return ((S->button.num_buttons + 31) / 32); +} + +xcb_generic_iterator_t +xcb_input_device_class_data_button_state_end (const xcb_input_device_class_t *R, + const xcb_input_device_class_data_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->button.state + ((S->button.num_buttons + 31) / 32); + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_atom_t * +xcb_input_device_class_data_button_labels (const xcb_input_device_class_data_t *S) +{ + return S->button.labels; +} + +int +xcb_input_device_class_data_button_labels_length (const xcb_input_device_class_t *R, + const xcb_input_device_class_data_t *S) +{ + return S->button.num_buttons; +} + +xcb_generic_iterator_t +xcb_input_device_class_data_button_labels_end (const xcb_input_device_class_t *R, + const xcb_input_device_class_data_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->button.labels + S->button.num_buttons; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +int +xcb_input_device_class_data_serialize (void **_buffer, + uint16_t type, + const xcb_input_device_class_data_t *_aux) +{ + char *xcb_out = *_buffer; + unsigned int xcb_buffer_len = 0; + unsigned int xcb_align_to = 0; + unsigned int xcb_padding_offset = 2; + + unsigned int xcb_pad = 0; + char xcb_pad0[3] = {0, 0, 0}; + struct iovec xcb_parts[26]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(type == XCB_INPUT_DEVICE_CLASS_TYPE_KEY) { + /* xcb_input_device_class_data_t.key.num_keys */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key.num_keys; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_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; + /* keys */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->key.keys; + xcb_block_len += _aux->key.num_keys * sizeof(uint32_t); + xcb_parts[xcb_parts_idx].iov_len = _aux->key.num_keys * sizeof(uint32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint32_t); + } + if(type == XCB_INPUT_DEVICE_CLASS_TYPE_BUTTON) { + /* xcb_input_device_class_data_t.button.num_buttons */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->button.num_buttons; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_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; + /* state */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->button.state; + xcb_block_len += ((_aux->button.num_buttons + 31) / 32) * sizeof(uint32_t); + xcb_parts[xcb_parts_idx].iov_len = ((_aux->button.num_buttons + 31) / 32) * sizeof(uint32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint32_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; + /* labels */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->button.labels; + xcb_block_len += _aux->button.num_buttons * sizeof(uint32_t); + xcb_parts[xcb_parts_idx].iov_len = _aux->button.num_buttons * sizeof(uint32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(type == XCB_INPUT_DEVICE_CLASS_TYPE_VALUATOR) { + /* xcb_input_device_class_data_t.valuator.number */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->valuator.number; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_input_device_class_data_t.valuator.label */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->valuator.label; + xcb_block_len += sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + /* xcb_input_device_class_data_t.valuator.min */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->valuator.min; + xcb_block_len += sizeof(xcb_input_fp3232_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_input_fp3232_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_input_fp3232_t); + /* xcb_input_device_class_data_t.valuator.max */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->valuator.max; + xcb_block_len += sizeof(xcb_input_fp3232_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_input_fp3232_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_input_fp3232_t); + /* xcb_input_device_class_data_t.valuator.value */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->valuator.value; + xcb_block_len += sizeof(xcb_input_fp3232_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_input_fp3232_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_input_fp3232_t); + /* xcb_input_device_class_data_t.valuator.resolution */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->valuator.resolution; + 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); + /* xcb_input_device_class_data_t.valuator.mode */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->valuator.mode; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_device_class_data_t.valuator.pad0 */ + xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; + xcb_block_len += sizeof(uint8_t)*3; + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t)*3; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + } + if(type == XCB_INPUT_DEVICE_CLASS_TYPE_SCROLL) { + /* xcb_input_device_class_data_t.scroll.number */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->scroll.number; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_input_device_class_data_t.scroll.scroll_type */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->scroll.scroll_type; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_input_device_class_data_t.scroll.pad1 */ + xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; + xcb_block_len += sizeof(uint8_t)*2; + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t)*2; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_device_class_data_t.scroll.flags */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->scroll.flags; + 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); + /* xcb_input_device_class_data_t.scroll.increment */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->scroll.increment; + xcb_block_len += sizeof(xcb_input_fp3232_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_input_fp3232_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_input_fp3232_t); + } + if(type == XCB_INPUT_DEVICE_CLASS_TYPE_TOUCH) { + /* xcb_input_device_class_data_t.touch.mode */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->touch.mode; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_device_class_data_t.touch.num_touches */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->touch.num_touches; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + } + if(type == XCB_INPUT_DEVICE_CLASS_TYPE_GESTURE) { + /* xcb_input_device_class_data_t.gesture.num_touches */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->gesture.num_touches; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_device_class_data_t.gesture.pad2 */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &xcb_pad; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_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_input_device_class_data_unpack (const void *_buffer, + uint16_t type, + xcb_input_device_class_data_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 = 2; + + + if(type == XCB_INPUT_DEVICE_CLASS_TYPE_KEY) { + /* xcb_input_device_class_data_t.key.num_keys */ + _aux->key.num_keys = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_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; + /* keys */ + _aux->key.keys = (uint32_t *)xcb_tmp; + xcb_block_len += _aux->key.num_keys * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_t); + } + if(type == XCB_INPUT_DEVICE_CLASS_TYPE_BUTTON) { + /* xcb_input_device_class_data_t.button.num_buttons */ + _aux->button.num_buttons = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_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; + /* state */ + _aux->button.state = (uint32_t *)xcb_tmp; + xcb_block_len += ((_aux->button.num_buttons + 31) / 32) * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* labels */ + _aux->button.labels = (xcb_atom_t *)xcb_tmp; + xcb_block_len += _aux->button.num_buttons * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(type == XCB_INPUT_DEVICE_CLASS_TYPE_VALUATOR) { + /* xcb_input_device_class_data_t.valuator.number */ + _aux->valuator.number = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_input_device_class_data_t.valuator.label */ + _aux->valuator.label = *(xcb_atom_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_atom_t); + xcb_tmp += sizeof(xcb_atom_t); + xcb_align_to = ALIGNOF(xcb_atom_t); + /* xcb_input_device_class_data_t.valuator.min */ + _aux->valuator.min = *(xcb_input_fp3232_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_input_fp3232_t); + xcb_tmp += sizeof(xcb_input_fp3232_t); + xcb_align_to = ALIGNOF(xcb_input_fp3232_t); + /* xcb_input_device_class_data_t.valuator.max */ + _aux->valuator.max = *(xcb_input_fp3232_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_input_fp3232_t); + xcb_tmp += sizeof(xcb_input_fp3232_t); + xcb_align_to = ALIGNOF(xcb_input_fp3232_t); + /* xcb_input_device_class_data_t.valuator.value */ + _aux->valuator.value = *(xcb_input_fp3232_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_input_fp3232_t); + xcb_tmp += sizeof(xcb_input_fp3232_t); + xcb_align_to = ALIGNOF(xcb_input_fp3232_t); + /* xcb_input_device_class_data_t.valuator.resolution */ + _aux->valuator.resolution = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_input_device_class_data_t.valuator.mode */ + _aux->valuator.mode = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_device_class_data_t.valuator.pad0 */ + _aux->valuator.pad0[0] = *(uint8_t *)xcb_tmp; + _aux->valuator.pad0[1] = *(uint8_t *)xcb_tmp; + _aux->valuator.pad0[2] = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t) * 3; + xcb_tmp += sizeof(uint8_t) * 3; + xcb_align_to = ALIGNOF(uint8_t); + } + if(type == XCB_INPUT_DEVICE_CLASS_TYPE_SCROLL) { + /* xcb_input_device_class_data_t.scroll.number */ + _aux->scroll.number = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_input_device_class_data_t.scroll.scroll_type */ + _aux->scroll.scroll_type = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_input_device_class_data_t.scroll.pad1 */ + _aux->scroll.pad1[0] = *(uint8_t *)xcb_tmp; + _aux->scroll.pad1[1] = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t) * 2; + xcb_tmp += sizeof(uint8_t) * 2; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_device_class_data_t.scroll.flags */ + _aux->scroll.flags = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_input_device_class_data_t.scroll.increment */ + _aux->scroll.increment = *(xcb_input_fp3232_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_input_fp3232_t); + xcb_tmp += sizeof(xcb_input_fp3232_t); + xcb_align_to = ALIGNOF(xcb_input_fp3232_t); + } + if(type == XCB_INPUT_DEVICE_CLASS_TYPE_TOUCH) { + /* xcb_input_device_class_data_t.touch.mode */ + _aux->touch.mode = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_device_class_data_t.touch.num_touches */ + _aux->touch.num_touches = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + } + if(type == XCB_INPUT_DEVICE_CLASS_TYPE_GESTURE) { + /* xcb_input_device_class_data_t.gesture.num_touches */ + _aux->gesture.num_touches = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_input_device_class_data_t.gesture.pad2 */ + _aux->gesture.pad2 = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_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_input_device_class_data_sizeof (const void *_buffer, + uint16_t type) +{ + xcb_input_device_class_data_t _aux; + return xcb_input_device_class_data_unpack(_buffer, type, &_aux); +} + +int +xcb_input_device_class_sizeof (const void *_buffer) +{ + const xcb_input_device_class_t *_aux = (xcb_input_device_class_t *)_buffer; + return (_aux->len * 4); +} + +void * +xcb_input_device_class_data (const xcb_input_device_class_t *R) +{ + return (void *) (R + 1); +} + +void +xcb_input_device_class_next (xcb_input_device_class_iterator_t *i) +{ + xcb_input_device_class_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_input_device_class_t *)(((char *)R) + xcb_input_device_class_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_input_device_class_t *) child.data; +} + +xcb_generic_iterator_t +xcb_input_device_class_end (xcb_input_device_class_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_input_device_class_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_input_xi_device_info_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_xi_device_info_t *_aux = (xcb_input_xi_device_info_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_input_xi_device_info_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* name */ + xcb_block_len += _aux->name_len * sizeof(char); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(char); + xcb_align_to = 4; + /* 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; + /* 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; + /* classes */ + for(i=0; i<_aux->num_classes; i++) { + xcb_tmp_len = xcb_input_device_class_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_input_device_class_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; +} + +char * +xcb_input_xi_device_info_name (const xcb_input_xi_device_info_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_input_xi_device_info_name_length (const xcb_input_xi_device_info_t *R) +{ + return R->name_len; +} + +xcb_generic_iterator_t +xcb_input_xi_device_info_name_end (const xcb_input_xi_device_info_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->name_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_input_xi_device_info_classes_length (const xcb_input_xi_device_info_t *R) +{ + return R->num_classes; +} + +xcb_input_device_class_iterator_t +xcb_input_xi_device_info_classes_iterator (const xcb_input_xi_device_info_t *R) +{ + xcb_input_device_class_iterator_t i; + xcb_generic_iterator_t prev = xcb_input_xi_device_info_name_end(R); + i.data = (xcb_input_device_class_t *) ((char *) prev.data + ((-prev.index) & (4 - 1))); + i.rem = R->num_classes; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_input_xi_device_info_next (xcb_input_xi_device_info_iterator_t *i) +{ + xcb_input_xi_device_info_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_input_xi_device_info_t *)(((char *)R) + xcb_input_xi_device_info_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_input_xi_device_info_t *) child.data; +} + +xcb_generic_iterator_t +xcb_input_xi_device_info_end (xcb_input_xi_device_info_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_input_xi_device_info_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_input_xi_query_device_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_xi_query_device_reply_t *_aux = (xcb_input_xi_query_device_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_input_xi_query_device_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* infos */ + for(i=0; i<_aux->num_infos; i++) { + xcb_tmp_len = xcb_input_xi_device_info_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_input_xi_device_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_input_xi_query_device_cookie_t +xcb_input_xi_query_device (xcb_connection_t *c, + xcb_input_device_id_t deviceid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_QUERY_DEVICE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_xi_query_device_cookie_t xcb_ret; + xcb_input_xi_query_device_request_t xcb_out; + + xcb_out.deviceid = deviceid; + 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_input_xi_query_device_cookie_t +xcb_input_xi_query_device_unchecked (xcb_connection_t *c, + xcb_input_device_id_t deviceid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_QUERY_DEVICE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_xi_query_device_cookie_t xcb_ret; + xcb_input_xi_query_device_request_t xcb_out; + + xcb_out.deviceid = deviceid; + 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; +} + +int +xcb_input_xi_query_device_infos_length (const xcb_input_xi_query_device_reply_t *R) +{ + return R->num_infos; +} + +xcb_input_xi_device_info_iterator_t +xcb_input_xi_query_device_infos_iterator (const xcb_input_xi_query_device_reply_t *R) +{ + xcb_input_xi_device_info_iterator_t i; + i.data = (xcb_input_xi_device_info_t *) (R + 1); + i.rem = R->num_infos; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_xi_query_device_reply_t * +xcb_input_xi_query_device_reply (xcb_connection_t *c, + xcb_input_xi_query_device_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_xi_query_device_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_input_xi_set_focus_checked (xcb_connection_t *c, + xcb_window_t window, + xcb_timestamp_t time, + xcb_input_device_id_t deviceid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_SET_FOCUS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_set_focus_request_t xcb_out; + + xcb_out.window = window; + xcb_out.time = time; + xcb_out.deviceid = deviceid; + 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_void_cookie_t +xcb_input_xi_set_focus (xcb_connection_t *c, + xcb_window_t window, + xcb_timestamp_t time, + xcb_input_device_id_t deviceid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_SET_FOCUS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_set_focus_request_t xcb_out; + + xcb_out.window = window; + xcb_out.time = time; + xcb_out.deviceid = deviceid; + 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_input_xi_get_focus_cookie_t +xcb_input_xi_get_focus (xcb_connection_t *c, + xcb_input_device_id_t deviceid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_GET_FOCUS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_xi_get_focus_cookie_t xcb_ret; + xcb_input_xi_get_focus_request_t xcb_out; + + xcb_out.deviceid = deviceid; + 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_input_xi_get_focus_cookie_t +xcb_input_xi_get_focus_unchecked (xcb_connection_t *c, + xcb_input_device_id_t deviceid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_GET_FOCUS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_xi_get_focus_cookie_t xcb_ret; + xcb_input_xi_get_focus_request_t xcb_out; + + xcb_out.deviceid = deviceid; + 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_input_xi_get_focus_reply_t * +xcb_input_xi_get_focus_reply (xcb_connection_t *c, + xcb_input_xi_get_focus_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_xi_get_focus_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_input_xi_grab_device_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_xi_grab_device_request_t *_aux = (xcb_input_xi_grab_device_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_input_xi_grab_device_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* mask */ + xcb_block_len += _aux->mask_len * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_input_xi_grab_device_cookie_t +xcb_input_xi_grab_device (xcb_connection_t *c, + xcb_window_t window, + xcb_timestamp_t time, + xcb_cursor_t cursor, + xcb_input_device_id_t deviceid, + uint8_t mode, + uint8_t paired_device_mode, + uint8_t owner_events, + uint16_t mask_len, + const uint32_t *mask) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_GRAB_DEVICE, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_input_xi_grab_device_cookie_t xcb_ret; + xcb_input_xi_grab_device_request_t xcb_out; + + xcb_out.window = window; + xcb_out.time = time; + xcb_out.cursor = cursor; + xcb_out.deviceid = deviceid; + xcb_out.mode = mode; + xcb_out.paired_device_mode = paired_device_mode; + xcb_out.owner_events = owner_events; + xcb_out.pad0 = 0; + xcb_out.mask_len = mask_len; + + 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; + /* uint32_t mask */ + xcb_parts[4].iov_base = (char *) mask; + xcb_parts[4].iov_len = mask_len * sizeof(uint32_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_input_xi_grab_device_cookie_t +xcb_input_xi_grab_device_unchecked (xcb_connection_t *c, + xcb_window_t window, + xcb_timestamp_t time, + xcb_cursor_t cursor, + xcb_input_device_id_t deviceid, + uint8_t mode, + uint8_t paired_device_mode, + uint8_t owner_events, + uint16_t mask_len, + const uint32_t *mask) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_GRAB_DEVICE, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_input_xi_grab_device_cookie_t xcb_ret; + xcb_input_xi_grab_device_request_t xcb_out; + + xcb_out.window = window; + xcb_out.time = time; + xcb_out.cursor = cursor; + xcb_out.deviceid = deviceid; + xcb_out.mode = mode; + xcb_out.paired_device_mode = paired_device_mode; + xcb_out.owner_events = owner_events; + xcb_out.pad0 = 0; + xcb_out.mask_len = mask_len; + + 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; + /* uint32_t mask */ + xcb_parts[4].iov_base = (char *) mask; + xcb_parts[4].iov_len = mask_len * sizeof(uint32_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_input_xi_grab_device_reply_t * +xcb_input_xi_grab_device_reply (xcb_connection_t *c, + xcb_input_xi_grab_device_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_xi_grab_device_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_input_xi_ungrab_device_checked (xcb_connection_t *c, + xcb_timestamp_t time, + xcb_input_device_id_t deviceid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_UNGRAB_DEVICE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_ungrab_device_request_t xcb_out; + + xcb_out.time = time; + xcb_out.deviceid = deviceid; + 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_void_cookie_t +xcb_input_xi_ungrab_device (xcb_connection_t *c, + xcb_timestamp_t time, + xcb_input_device_id_t deviceid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_UNGRAB_DEVICE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_ungrab_device_request_t xcb_out; + + xcb_out.time = time; + xcb_out.deviceid = deviceid; + 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_void_cookie_t +xcb_input_xi_allow_events_checked (xcb_connection_t *c, + xcb_timestamp_t time, + xcb_input_device_id_t deviceid, + uint8_t event_mode, + uint32_t touchid, + xcb_window_t grab_window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_ALLOW_EVENTS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_allow_events_request_t xcb_out; + + xcb_out.time = time; + xcb_out.deviceid = deviceid; + xcb_out.event_mode = event_mode; + xcb_out.pad0 = 0; + xcb_out.touchid = touchid; + xcb_out.grab_window = grab_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_input_xi_allow_events (xcb_connection_t *c, + xcb_timestamp_t time, + xcb_input_device_id_t deviceid, + uint8_t event_mode, + uint32_t touchid, + xcb_window_t grab_window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_ALLOW_EVENTS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_allow_events_request_t xcb_out; + + xcb_out.time = time; + xcb_out.deviceid = deviceid; + xcb_out.event_mode = event_mode; + xcb_out.pad0 = 0; + xcb_out.touchid = touchid; + xcb_out.grab_window = grab_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; +} + +void +xcb_input_grab_modifier_info_next (xcb_input_grab_modifier_info_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_grab_modifier_info_t); +} + +xcb_generic_iterator_t +xcb_input_grab_modifier_info_end (xcb_input_grab_modifier_info_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; +} + +int +xcb_input_xi_passive_grab_device_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_xi_passive_grab_device_request_t *_aux = (xcb_input_xi_passive_grab_device_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_input_xi_passive_grab_device_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* mask */ + xcb_block_len += _aux->mask_len * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* modifiers */ + xcb_block_len += _aux->num_modifiers * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_input_xi_passive_grab_device_cookie_t +xcb_input_xi_passive_grab_device (xcb_connection_t *c, + xcb_timestamp_t time, + xcb_window_t grab_window, + xcb_cursor_t cursor, + uint32_t detail, + xcb_input_device_id_t deviceid, + uint16_t num_modifiers, + uint16_t mask_len, + uint8_t grab_type, + uint8_t grab_mode, + uint8_t paired_device_mode, + uint8_t owner_events, + const uint32_t *mask, + const uint32_t *modifiers) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_PASSIVE_GRAB_DEVICE, + .isvoid = 0 + }; + + struct iovec xcb_parts[8]; + xcb_input_xi_passive_grab_device_cookie_t xcb_ret; + xcb_input_xi_passive_grab_device_request_t xcb_out; + + xcb_out.time = time; + xcb_out.grab_window = grab_window; + xcb_out.cursor = cursor; + xcb_out.detail = detail; + xcb_out.deviceid = deviceid; + xcb_out.num_modifiers = num_modifiers; + xcb_out.mask_len = mask_len; + xcb_out.grab_type = grab_type; + xcb_out.grab_mode = grab_mode; + xcb_out.paired_device_mode = paired_device_mode; + xcb_out.owner_events = owner_events; + 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; + /* uint32_t mask */ + xcb_parts[4].iov_base = (char *) mask; + xcb_parts[4].iov_len = mask_len * sizeof(uint32_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* uint32_t modifiers */ + xcb_parts[6].iov_base = (char *) modifiers; + xcb_parts[6].iov_len = num_modifiers * sizeof(uint32_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_input_xi_passive_grab_device_cookie_t +xcb_input_xi_passive_grab_device_unchecked (xcb_connection_t *c, + xcb_timestamp_t time, + xcb_window_t grab_window, + xcb_cursor_t cursor, + uint32_t detail, + xcb_input_device_id_t deviceid, + uint16_t num_modifiers, + uint16_t mask_len, + uint8_t grab_type, + uint8_t grab_mode, + uint8_t paired_device_mode, + uint8_t owner_events, + const uint32_t *mask, + const uint32_t *modifiers) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_PASSIVE_GRAB_DEVICE, + .isvoid = 0 + }; + + struct iovec xcb_parts[8]; + xcb_input_xi_passive_grab_device_cookie_t xcb_ret; + xcb_input_xi_passive_grab_device_request_t xcb_out; + + xcb_out.time = time; + xcb_out.grab_window = grab_window; + xcb_out.cursor = cursor; + xcb_out.detail = detail; + xcb_out.deviceid = deviceid; + xcb_out.num_modifiers = num_modifiers; + xcb_out.mask_len = mask_len; + xcb_out.grab_type = grab_type; + xcb_out.grab_mode = grab_mode; + xcb_out.paired_device_mode = paired_device_mode; + xcb_out.owner_events = owner_events; + 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; + /* uint32_t mask */ + xcb_parts[4].iov_base = (char *) mask; + xcb_parts[4].iov_len = mask_len * sizeof(uint32_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* uint32_t modifiers */ + xcb_parts[6].iov_base = (char *) modifiers; + xcb_parts[6].iov_len = num_modifiers * sizeof(uint32_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_input_grab_modifier_info_t * +xcb_input_xi_passive_grab_device_modifiers (const xcb_input_xi_passive_grab_device_reply_t *R) +{ + return (xcb_input_grab_modifier_info_t *) (R + 1); +} + +int +xcb_input_xi_passive_grab_device_modifiers_length (const xcb_input_xi_passive_grab_device_reply_t *R) +{ + return R->num_modifiers; +} + +xcb_input_grab_modifier_info_iterator_t +xcb_input_xi_passive_grab_device_modifiers_iterator (const xcb_input_xi_passive_grab_device_reply_t *R) +{ + xcb_input_grab_modifier_info_iterator_t i; + i.data = (xcb_input_grab_modifier_info_t *) (R + 1); + i.rem = R->num_modifiers; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_xi_passive_grab_device_reply_t * +xcb_input_xi_passive_grab_device_reply (xcb_connection_t *c, + xcb_input_xi_passive_grab_device_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_xi_passive_grab_device_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_input_xi_passive_ungrab_device_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_xi_passive_ungrab_device_request_t *_aux = (xcb_input_xi_passive_ungrab_device_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_input_xi_passive_ungrab_device_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* modifiers */ + xcb_block_len += _aux->num_modifiers * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_input_xi_passive_ungrab_device_checked (xcb_connection_t *c, + xcb_window_t grab_window, + uint32_t detail, + xcb_input_device_id_t deviceid, + uint16_t num_modifiers, + uint8_t grab_type, + const uint32_t *modifiers) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_PASSIVE_UNGRAB_DEVICE, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_passive_ungrab_device_request_t xcb_out; + + xcb_out.grab_window = grab_window; + xcb_out.detail = detail; + xcb_out.deviceid = deviceid; + xcb_out.num_modifiers = num_modifiers; + xcb_out.grab_type = grab_type; + 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; + /* uint32_t modifiers */ + xcb_parts[4].iov_base = (char *) modifiers; + xcb_parts[4].iov_len = num_modifiers * sizeof(uint32_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_input_xi_passive_ungrab_device (xcb_connection_t *c, + xcb_window_t grab_window, + uint32_t detail, + xcb_input_device_id_t deviceid, + uint16_t num_modifiers, + uint8_t grab_type, + const uint32_t *modifiers) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_PASSIVE_UNGRAB_DEVICE, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_passive_ungrab_device_request_t xcb_out; + + xcb_out.grab_window = grab_window; + xcb_out.detail = detail; + xcb_out.deviceid = deviceid; + xcb_out.num_modifiers = num_modifiers; + xcb_out.grab_type = grab_type; + 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; + /* uint32_t modifiers */ + xcb_parts[4].iov_base = (char *) modifiers; + xcb_parts[4].iov_len = num_modifiers * sizeof(uint32_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; +} + +uint32_t * +xcb_input_xi_passive_ungrab_device_modifiers (const xcb_input_xi_passive_ungrab_device_request_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_input_xi_passive_ungrab_device_modifiers_length (const xcb_input_xi_passive_ungrab_device_request_t *R) +{ + return R->num_modifiers; +} + +xcb_generic_iterator_t +xcb_input_xi_passive_ungrab_device_modifiers_end (const xcb_input_xi_passive_ungrab_device_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->num_modifiers); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_input_xi_list_properties_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_xi_list_properties_reply_t *_aux = (xcb_input_xi_list_properties_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_input_xi_list_properties_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* properties */ + xcb_block_len += _aux->num_properties * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_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_input_xi_list_properties_cookie_t +xcb_input_xi_list_properties (xcb_connection_t *c, + xcb_input_device_id_t deviceid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_LIST_PROPERTIES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_xi_list_properties_cookie_t xcb_ret; + xcb_input_xi_list_properties_request_t xcb_out; + + xcb_out.deviceid = deviceid; + 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_input_xi_list_properties_cookie_t +xcb_input_xi_list_properties_unchecked (xcb_connection_t *c, + xcb_input_device_id_t deviceid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_LIST_PROPERTIES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_xi_list_properties_cookie_t xcb_ret; + xcb_input_xi_list_properties_request_t xcb_out; + + xcb_out.deviceid = deviceid; + 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_atom_t * +xcb_input_xi_list_properties_properties (const xcb_input_xi_list_properties_reply_t *R) +{ + return (xcb_atom_t *) (R + 1); +} + +int +xcb_input_xi_list_properties_properties_length (const xcb_input_xi_list_properties_reply_t *R) +{ + return R->num_properties; +} + +xcb_generic_iterator_t +xcb_input_xi_list_properties_properties_end (const xcb_input_xi_list_properties_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_atom_t *) (R + 1)) + (R->num_properties); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_xi_list_properties_reply_t * +xcb_input_xi_list_properties_reply (xcb_connection_t *c, + xcb_input_xi_list_properties_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_xi_list_properties_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +uint8_t * +xcb_input_xi_change_property_items_data_8 (const xcb_input_xi_change_property_items_t *S) +{ + return S->data8; +} + +int +xcb_input_xi_change_property_items_data_8_length (const xcb_input_xi_change_property_request_t *R, + const xcb_input_xi_change_property_items_t *S) +{ + return R->num_items; +} + +xcb_generic_iterator_t +xcb_input_xi_change_property_items_data_8_end (const xcb_input_xi_change_property_request_t *R, + const xcb_input_xi_change_property_items_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->data8 + R->num_items; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +uint16_t * +xcb_input_xi_change_property_items_data_16 (const xcb_input_xi_change_property_items_t *S) +{ + return S->data16; +} + +int +xcb_input_xi_change_property_items_data_16_length (const xcb_input_xi_change_property_request_t *R, + const xcb_input_xi_change_property_items_t *S) +{ + return R->num_items; +} + +xcb_generic_iterator_t +xcb_input_xi_change_property_items_data_16_end (const xcb_input_xi_change_property_request_t *R, + const xcb_input_xi_change_property_items_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->data16 + R->num_items; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +uint32_t * +xcb_input_xi_change_property_items_data_32 (const xcb_input_xi_change_property_items_t *S) +{ + return S->data32; +} + +int +xcb_input_xi_change_property_items_data_32_length (const xcb_input_xi_change_property_request_t *R, + const xcb_input_xi_change_property_items_t *S) +{ + return R->num_items; +} + +xcb_generic_iterator_t +xcb_input_xi_change_property_items_data_32_end (const xcb_input_xi_change_property_request_t *R, + const xcb_input_xi_change_property_items_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->data32 + R->num_items; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +int +xcb_input_xi_change_property_items_serialize (void **_buffer, + uint32_t num_items, + uint8_t format, + const xcb_input_xi_change_property_items_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[9]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(format == XCB_INPUT_PROPERTY_FORMAT_8_BITS) { + /* 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; + /* data8 */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->data8; + xcb_block_len += num_items * sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = num_items * sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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(format == XCB_INPUT_PROPERTY_FORMAT_16_BITS) { + /* 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; + /* data16 */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->data16; + xcb_block_len += num_items * sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = num_items * sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + xcb_align_to = 4; + /* 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(format == XCB_INPUT_PROPERTY_FORMAT_32_BITS) { + /* 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; + /* data32 */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->data32; + xcb_block_len += num_items * sizeof(uint32_t); + xcb_parts[xcb_parts_idx].iov_len = num_items * sizeof(uint32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint32_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_input_xi_change_property_items_unpack (const void *_buffer, + uint32_t num_items, + uint8_t format, + xcb_input_xi_change_property_items_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(format == XCB_INPUT_PROPERTY_FORMAT_8_BITS) { + /* 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; + /* data8 */ + _aux->data8 = (uint8_t *)xcb_tmp; + xcb_block_len += num_items * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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; + } + if(format == XCB_INPUT_PROPERTY_FORMAT_16_BITS) { + /* 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; + /* data16 */ + _aux->data16 = (uint16_t *)xcb_tmp; + xcb_block_len += num_items * sizeof(uint16_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint16_t); + xcb_align_to = 4; + /* 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; + } + if(format == XCB_INPUT_PROPERTY_FORMAT_32_BITS) { + /* 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; + /* data32 */ + _aux->data32 = (uint32_t *)xcb_tmp; + xcb_block_len += num_items * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_input_xi_change_property_items_sizeof (const void *_buffer, + uint32_t num_items, + uint8_t format) +{ + xcb_input_xi_change_property_items_t _aux; + return xcb_input_xi_change_property_items_unpack(_buffer, num_items, format, &_aux); +} + +int +xcb_input_xi_change_property_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_xi_change_property_request_t *_aux = (xcb_input_xi_change_property_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_input_xi_change_property_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* items */ + xcb_block_len += xcb_input_xi_change_property_items_sizeof(xcb_tmp, _aux->num_items, _aux->format); + 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_input_xi_change_property_checked (xcb_connection_t *c, + xcb_input_device_id_t deviceid, + uint8_t mode, + uint8_t format, + xcb_atom_t property, + xcb_atom_t type, + uint32_t num_items, + const void *items) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_CHANGE_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_change_property_request_t xcb_out; + + xcb_out.deviceid = deviceid; + xcb_out.mode = mode; + xcb_out.format = format; + xcb_out.property = property; + xcb_out.type = type; + xcb_out.num_items = num_items; + + 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_input_xi_change_property_items_t items */ + xcb_parts[4].iov_base = (char *) items; + xcb_parts[4].iov_len = + xcb_input_xi_change_property_items_sizeof (items, num_items, format); + + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_input_xi_change_property (xcb_connection_t *c, + xcb_input_device_id_t deviceid, + uint8_t mode, + uint8_t format, + xcb_atom_t property, + xcb_atom_t type, + uint32_t num_items, + const void *items) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_CHANGE_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_change_property_request_t xcb_out; + + xcb_out.deviceid = deviceid; + xcb_out.mode = mode; + xcb_out.format = format; + xcb_out.property = property; + xcb_out.type = type; + xcb_out.num_items = num_items; + + 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_input_xi_change_property_items_t items */ + xcb_parts[4].iov_base = (char *) items; + xcb_parts[4].iov_len = + xcb_input_xi_change_property_items_sizeof (items, num_items, format); + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_input_xi_change_property_aux_checked (xcb_connection_t *c, + xcb_input_device_id_t deviceid, + uint8_t mode, + uint8_t format, + xcb_atom_t property, + xcb_atom_t type, + uint32_t num_items, + const xcb_input_xi_change_property_items_t *items) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_CHANGE_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_change_property_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.deviceid = deviceid; + xcb_out.mode = mode; + xcb_out.format = format; + xcb_out.property = property; + xcb_out.type = type; + xcb_out.num_items = num_items; + + 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_input_xi_change_property_items_t items */ + xcb_parts[4].iov_len = + xcb_input_xi_change_property_items_serialize (&xcb_aux0, num_items, format, items); + 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_input_xi_change_property_aux (xcb_connection_t *c, + xcb_input_device_id_t deviceid, + uint8_t mode, + uint8_t format, + xcb_atom_t property, + xcb_atom_t type, + uint32_t num_items, + const xcb_input_xi_change_property_items_t *items) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_CHANGE_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_change_property_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.deviceid = deviceid; + xcb_out.mode = mode; + xcb_out.format = format; + xcb_out.property = property; + xcb_out.type = type; + xcb_out.num_items = num_items; + + 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_input_xi_change_property_items_t items */ + xcb_parts[4].iov_len = + xcb_input_xi_change_property_items_serialize (&xcb_aux0, num_items, format, items); + 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_input_xi_change_property_items (const xcb_input_xi_change_property_request_t *R) +{ + return (void *) (R + 1); +} + +xcb_void_cookie_t +xcb_input_xi_delete_property_checked (xcb_connection_t *c, + xcb_input_device_id_t deviceid, + xcb_atom_t property) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_DELETE_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_delete_property_request_t xcb_out; + + xcb_out.deviceid = deviceid; + memset(xcb_out.pad0, 0, 2); + xcb_out.property = property; + + 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_input_xi_delete_property (xcb_connection_t *c, + xcb_input_device_id_t deviceid, + xcb_atom_t property) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_DELETE_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_delete_property_request_t xcb_out; + + xcb_out.deviceid = deviceid; + memset(xcb_out.pad0, 0, 2); + xcb_out.property = property; + + 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; +} + +uint8_t * +xcb_input_xi_get_property_items_data_8 (const xcb_input_xi_get_property_items_t *S) +{ + return S->data8; +} + +int +xcb_input_xi_get_property_items_data_8_length (const xcb_input_xi_get_property_reply_t *R, + const xcb_input_xi_get_property_items_t *S) +{ + return R->num_items; +} + +xcb_generic_iterator_t +xcb_input_xi_get_property_items_data_8_end (const xcb_input_xi_get_property_reply_t *R, + const xcb_input_xi_get_property_items_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->data8 + R->num_items; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +uint16_t * +xcb_input_xi_get_property_items_data_16 (const xcb_input_xi_get_property_items_t *S) +{ + return S->data16; +} + +int +xcb_input_xi_get_property_items_data_16_length (const xcb_input_xi_get_property_reply_t *R, + const xcb_input_xi_get_property_items_t *S) +{ + return R->num_items; +} + +xcb_generic_iterator_t +xcb_input_xi_get_property_items_data_16_end (const xcb_input_xi_get_property_reply_t *R, + const xcb_input_xi_get_property_items_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->data16 + R->num_items; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +uint32_t * +xcb_input_xi_get_property_items_data_32 (const xcb_input_xi_get_property_items_t *S) +{ + return S->data32; +} + +int +xcb_input_xi_get_property_items_data_32_length (const xcb_input_xi_get_property_reply_t *R, + const xcb_input_xi_get_property_items_t *S) +{ + return R->num_items; +} + +xcb_generic_iterator_t +xcb_input_xi_get_property_items_data_32_end (const xcb_input_xi_get_property_reply_t *R, + const xcb_input_xi_get_property_items_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->data32 + R->num_items; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +int +xcb_input_xi_get_property_items_serialize (void **_buffer, + uint32_t num_items, + uint8_t format, + const xcb_input_xi_get_property_items_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[9]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(format == XCB_INPUT_PROPERTY_FORMAT_8_BITS) { + /* 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; + /* data8 */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->data8; + xcb_block_len += num_items * sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = num_items * sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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(format == XCB_INPUT_PROPERTY_FORMAT_16_BITS) { + /* 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; + /* data16 */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->data16; + xcb_block_len += num_items * sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = num_items * sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + xcb_align_to = 4; + /* 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(format == XCB_INPUT_PROPERTY_FORMAT_32_BITS) { + /* 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; + /* data32 */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->data32; + xcb_block_len += num_items * sizeof(uint32_t); + xcb_parts[xcb_parts_idx].iov_len = num_items * sizeof(uint32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint32_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_input_xi_get_property_items_unpack (const void *_buffer, + uint32_t num_items, + uint8_t format, + xcb_input_xi_get_property_items_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(format == XCB_INPUT_PROPERTY_FORMAT_8_BITS) { + /* 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; + /* data8 */ + _aux->data8 = (uint8_t *)xcb_tmp; + xcb_block_len += num_items * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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; + } + if(format == XCB_INPUT_PROPERTY_FORMAT_16_BITS) { + /* 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; + /* data16 */ + _aux->data16 = (uint16_t *)xcb_tmp; + xcb_block_len += num_items * sizeof(uint16_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint16_t); + xcb_align_to = 4; + /* 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; + } + if(format == XCB_INPUT_PROPERTY_FORMAT_32_BITS) { + /* 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; + /* data32 */ + _aux->data32 = (uint32_t *)xcb_tmp; + xcb_block_len += num_items * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_input_xi_get_property_items_sizeof (const void *_buffer, + uint32_t num_items, + uint8_t format) +{ + xcb_input_xi_get_property_items_t _aux; + return xcb_input_xi_get_property_items_unpack(_buffer, num_items, format, &_aux); +} + +int +xcb_input_xi_get_property_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_xi_get_property_reply_t *_aux = (xcb_input_xi_get_property_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_input_xi_get_property_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* items */ + xcb_block_len += xcb_input_xi_get_property_items_sizeof(xcb_tmp, _aux->num_items, _aux->format); + 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_input_xi_get_property_cookie_t +xcb_input_xi_get_property (xcb_connection_t *c, + xcb_input_device_id_t deviceid, + uint8_t _delete, + xcb_atom_t property, + xcb_atom_t type, + uint32_t offset, + uint32_t len) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_GET_PROPERTY, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_xi_get_property_cookie_t xcb_ret; + xcb_input_xi_get_property_request_t xcb_out; + + xcb_out.deviceid = deviceid; + xcb_out._delete = _delete; + xcb_out.pad0 = 0; + xcb_out.property = property; + xcb_out.type = type; + xcb_out.offset = offset; + xcb_out.len = len; + + 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_input_xi_get_property_cookie_t +xcb_input_xi_get_property_unchecked (xcb_connection_t *c, + xcb_input_device_id_t deviceid, + uint8_t _delete, + xcb_atom_t property, + xcb_atom_t type, + uint32_t offset, + uint32_t len) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_GET_PROPERTY, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_xi_get_property_cookie_t xcb_ret; + xcb_input_xi_get_property_request_t xcb_out; + + xcb_out.deviceid = deviceid; + xcb_out._delete = _delete; + xcb_out.pad0 = 0; + xcb_out.property = property; + xcb_out.type = type; + xcb_out.offset = offset; + xcb_out.len = len; + + 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_input_xi_get_property_items (const xcb_input_xi_get_property_reply_t *R) +{ + return (void *) (R + 1); +} + +xcb_input_xi_get_property_reply_t * +xcb_input_xi_get_property_reply (xcb_connection_t *c, + xcb_input_xi_get_property_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_xi_get_property_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_input_xi_get_selected_events_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_xi_get_selected_events_reply_t *_aux = (xcb_input_xi_get_selected_events_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_input_xi_get_selected_events_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* masks */ + for(i=0; i<_aux->num_masks; i++) { + xcb_tmp_len = xcb_input_event_mask_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_input_event_mask_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_input_xi_get_selected_events_cookie_t +xcb_input_xi_get_selected_events (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_GET_SELECTED_EVENTS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_xi_get_selected_events_cookie_t xcb_ret; + xcb_input_xi_get_selected_events_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_input_xi_get_selected_events_cookie_t +xcb_input_xi_get_selected_events_unchecked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_GET_SELECTED_EVENTS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_input_xi_get_selected_events_cookie_t xcb_ret; + xcb_input_xi_get_selected_events_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; +} + +int +xcb_input_xi_get_selected_events_masks_length (const xcb_input_xi_get_selected_events_reply_t *R) +{ + return R->num_masks; +} + +xcb_input_event_mask_iterator_t +xcb_input_xi_get_selected_events_masks_iterator (const xcb_input_xi_get_selected_events_reply_t *R) +{ + xcb_input_event_mask_iterator_t i; + i.data = (xcb_input_event_mask_t *) (R + 1); + i.rem = R->num_masks; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_xi_get_selected_events_reply_t * +xcb_input_xi_get_selected_events_reply (xcb_connection_t *c, + xcb_input_xi_get_selected_events_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_input_xi_get_selected_events_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +void +xcb_input_barrier_release_pointer_info_next (xcb_input_barrier_release_pointer_info_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_barrier_release_pointer_info_t); +} + +xcb_generic_iterator_t +xcb_input_barrier_release_pointer_info_end (xcb_input_barrier_release_pointer_info_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; +} + +int +xcb_input_xi_barrier_release_pointer_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_xi_barrier_release_pointer_request_t *_aux = (xcb_input_xi_barrier_release_pointer_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_input_xi_barrier_release_pointer_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* barriers */ + xcb_block_len += _aux->num_barriers * sizeof(xcb_input_barrier_release_pointer_info_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_barrier_release_pointer_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_void_cookie_t +xcb_input_xi_barrier_release_pointer_checked (xcb_connection_t *c, + uint32_t num_barriers, + const xcb_input_barrier_release_pointer_info_t *barriers) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_BARRIER_RELEASE_POINTER, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_barrier_release_pointer_request_t xcb_out; + + xcb_out.num_barriers = num_barriers; + + 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_input_barrier_release_pointer_info_t barriers */ + xcb_parts[4].iov_base = (char *) barriers; + xcb_parts[4].iov_len = num_barriers * sizeof(xcb_input_barrier_release_pointer_info_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_input_xi_barrier_release_pointer (xcb_connection_t *c, + uint32_t num_barriers, + const xcb_input_barrier_release_pointer_info_t *barriers) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_XI_BARRIER_RELEASE_POINTER, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_input_xi_barrier_release_pointer_request_t xcb_out; + + xcb_out.num_barriers = num_barriers; + + 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_input_barrier_release_pointer_info_t barriers */ + xcb_parts[4].iov_base = (char *) barriers; + xcb_parts[4].iov_len = num_barriers * sizeof(xcb_input_barrier_release_pointer_info_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_input_barrier_release_pointer_info_t * +xcb_input_xi_barrier_release_pointer_barriers (const xcb_input_xi_barrier_release_pointer_request_t *R) +{ + return (xcb_input_barrier_release_pointer_info_t *) (R + 1); +} + +int +xcb_input_xi_barrier_release_pointer_barriers_length (const xcb_input_xi_barrier_release_pointer_request_t *R) +{ + return R->num_barriers; +} + +xcb_input_barrier_release_pointer_info_iterator_t +xcb_input_xi_barrier_release_pointer_barriers_iterator (const xcb_input_xi_barrier_release_pointer_request_t *R) +{ + xcb_input_barrier_release_pointer_info_iterator_t i; + i.data = (xcb_input_barrier_release_pointer_info_t *) (R + 1); + i.rem = R->num_barriers; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_input_device_changed_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_device_changed_event_t *_aux = (xcb_input_device_changed_event_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_input_device_changed_event_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* classes */ + for(i=0; i<_aux->num_classes; i++) { + xcb_tmp_len = xcb_input_device_class_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_input_device_class_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; +} + +int +xcb_input_device_changed_classes_length (const xcb_input_device_changed_event_t *R) +{ + return R->num_classes; +} + +xcb_input_device_class_iterator_t +xcb_input_device_changed_classes_iterator (const xcb_input_device_changed_event_t *R) +{ + xcb_input_device_class_iterator_t i; + i.data = (xcb_input_device_class_t *) (R + 1); + i.rem = R->num_classes; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_input_key_press_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_key_press_event_t *_aux = (xcb_input_key_press_event_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; + + int xcb_pre_tmp_1; /* sumof length */ + int xcb_pre_tmp_2; /* sumof loop counter */ + int64_t xcb_pre_tmp_3; /* sumof sum */ + const uint32_t* xcb_pre_tmp_4; /* sumof list ptr */ + + xcb_block_len += sizeof(xcb_input_key_press_event_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* button_mask */ + xcb_block_len += _aux->buttons_len * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* valuator_mask */ + xcb_block_len += _aux->valuators_len * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* axisvalues */ + /* sumof start */ + xcb_pre_tmp_1 = _aux->valuators_len; + xcb_pre_tmp_3 = 0; + xcb_pre_tmp_4 = xcb_input_key_press_valuator_mask(_aux); + for (xcb_pre_tmp_2 = 0; xcb_pre_tmp_2 < xcb_pre_tmp_1; xcb_pre_tmp_2++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_4; + xcb_pre_tmp_3 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_4++; + } + /* sumof end. Result is in xcb_pre_tmp_3 */ + xcb_block_len += xcb_pre_tmp_3 * sizeof(xcb_input_fp3232_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_fp3232_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; +} + +uint32_t * +xcb_input_key_press_button_mask (const xcb_input_key_press_event_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_input_key_press_button_mask_length (const xcb_input_key_press_event_t *R) +{ + return R->buttons_len; +} + +xcb_generic_iterator_t +xcb_input_key_press_button_mask_end (const xcb_input_key_press_event_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->buttons_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +uint32_t * +xcb_input_key_press_valuator_mask (const xcb_input_key_press_event_t *R) +{ + xcb_generic_iterator_t prev = xcb_input_key_press_button_mask_end(R); + return (uint32_t *) ((char *) prev.data + XCB_TYPE_PAD(uint32_t, prev.index) + 0); +} + +int +xcb_input_key_press_valuator_mask_length (const xcb_input_key_press_event_t *R) +{ + return R->valuators_len; +} + +xcb_generic_iterator_t +xcb_input_key_press_valuator_mask_end (const xcb_input_key_press_event_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_input_key_press_button_mask_end(R); + i.data = ((uint32_t *) ((char*) prev.data + XCB_TYPE_PAD(uint32_t, prev.index))) + (R->valuators_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_fp3232_t * +xcb_input_key_press_axisvalues (const xcb_input_key_press_event_t *R) +{ + xcb_generic_iterator_t prev = xcb_input_key_press_valuator_mask_end(R); + return (xcb_input_fp3232_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_input_fp3232_t, prev.index) + 0); +} + +int +xcb_input_key_press_axisvalues_length (const xcb_input_key_press_event_t *R) +{ + int xcb_pre_tmp_5; /* sumof length */ + int xcb_pre_tmp_6; /* sumof loop counter */ + int64_t xcb_pre_tmp_7; /* sumof sum */ + const uint32_t* xcb_pre_tmp_8; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_5 = R->valuators_len; + xcb_pre_tmp_7 = 0; + xcb_pre_tmp_8 = xcb_input_key_press_valuator_mask(R); + for (xcb_pre_tmp_6 = 0; xcb_pre_tmp_6 < xcb_pre_tmp_5; xcb_pre_tmp_6++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_8; + xcb_pre_tmp_7 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_8++; + } + /* sumof end. Result is in xcb_pre_tmp_7 */ + return xcb_pre_tmp_7; +} + +xcb_input_fp3232_iterator_t +xcb_input_key_press_axisvalues_iterator (const xcb_input_key_press_event_t *R) +{ + xcb_input_fp3232_iterator_t i; + xcb_generic_iterator_t prev = xcb_input_key_press_valuator_mask_end(R); + int xcb_pre_tmp_9; /* sumof length */ + int xcb_pre_tmp_10; /* sumof loop counter */ + int64_t xcb_pre_tmp_11; /* sumof sum */ + const uint32_t* xcb_pre_tmp_12; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_9 = R->valuators_len; + xcb_pre_tmp_11 = 0; + xcb_pre_tmp_12 = xcb_input_key_press_valuator_mask(R); + for (xcb_pre_tmp_10 = 0; xcb_pre_tmp_10 < xcb_pre_tmp_9; xcb_pre_tmp_10++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_12; + xcb_pre_tmp_11 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_12++; + } + /* sumof end. Result is in xcb_pre_tmp_11 */ + i.data = (xcb_input_fp3232_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_input_fp3232_t, prev.index)); + i.rem = xcb_pre_tmp_11; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_input_key_release_sizeof (const void *_buffer /**< */) +{ + return xcb_input_key_press_sizeof(_buffer); +} + +int +xcb_input_button_press_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_button_press_event_t *_aux = (xcb_input_button_press_event_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; + + int xcb_pre_tmp_1; /* sumof length */ + int xcb_pre_tmp_2; /* sumof loop counter */ + int64_t xcb_pre_tmp_3; /* sumof sum */ + const uint32_t* xcb_pre_tmp_4; /* sumof list ptr */ + + xcb_block_len += sizeof(xcb_input_button_press_event_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* button_mask */ + xcb_block_len += _aux->buttons_len * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* valuator_mask */ + xcb_block_len += _aux->valuators_len * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* axisvalues */ + /* sumof start */ + xcb_pre_tmp_1 = _aux->valuators_len; + xcb_pre_tmp_3 = 0; + xcb_pre_tmp_4 = xcb_input_button_press_valuator_mask(_aux); + for (xcb_pre_tmp_2 = 0; xcb_pre_tmp_2 < xcb_pre_tmp_1; xcb_pre_tmp_2++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_4; + xcb_pre_tmp_3 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_4++; + } + /* sumof end. Result is in xcb_pre_tmp_3 */ + xcb_block_len += xcb_pre_tmp_3 * sizeof(xcb_input_fp3232_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_fp3232_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; +} + +uint32_t * +xcb_input_button_press_button_mask (const xcb_input_button_press_event_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_input_button_press_button_mask_length (const xcb_input_button_press_event_t *R) +{ + return R->buttons_len; +} + +xcb_generic_iterator_t +xcb_input_button_press_button_mask_end (const xcb_input_button_press_event_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->buttons_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +uint32_t * +xcb_input_button_press_valuator_mask (const xcb_input_button_press_event_t *R) +{ + xcb_generic_iterator_t prev = xcb_input_button_press_button_mask_end(R); + return (uint32_t *) ((char *) prev.data + XCB_TYPE_PAD(uint32_t, prev.index) + 0); +} + +int +xcb_input_button_press_valuator_mask_length (const xcb_input_button_press_event_t *R) +{ + return R->valuators_len; +} + +xcb_generic_iterator_t +xcb_input_button_press_valuator_mask_end (const xcb_input_button_press_event_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_input_button_press_button_mask_end(R); + i.data = ((uint32_t *) ((char*) prev.data + XCB_TYPE_PAD(uint32_t, prev.index))) + (R->valuators_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_fp3232_t * +xcb_input_button_press_axisvalues (const xcb_input_button_press_event_t *R) +{ + xcb_generic_iterator_t prev = xcb_input_button_press_valuator_mask_end(R); + return (xcb_input_fp3232_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_input_fp3232_t, prev.index) + 0); +} + +int +xcb_input_button_press_axisvalues_length (const xcb_input_button_press_event_t *R) +{ + int xcb_pre_tmp_5; /* sumof length */ + int xcb_pre_tmp_6; /* sumof loop counter */ + int64_t xcb_pre_tmp_7; /* sumof sum */ + const uint32_t* xcb_pre_tmp_8; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_5 = R->valuators_len; + xcb_pre_tmp_7 = 0; + xcb_pre_tmp_8 = xcb_input_button_press_valuator_mask(R); + for (xcb_pre_tmp_6 = 0; xcb_pre_tmp_6 < xcb_pre_tmp_5; xcb_pre_tmp_6++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_8; + xcb_pre_tmp_7 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_8++; + } + /* sumof end. Result is in xcb_pre_tmp_7 */ + return xcb_pre_tmp_7; +} + +xcb_input_fp3232_iterator_t +xcb_input_button_press_axisvalues_iterator (const xcb_input_button_press_event_t *R) +{ + xcb_input_fp3232_iterator_t i; + xcb_generic_iterator_t prev = xcb_input_button_press_valuator_mask_end(R); + int xcb_pre_tmp_9; /* sumof length */ + int xcb_pre_tmp_10; /* sumof loop counter */ + int64_t xcb_pre_tmp_11; /* sumof sum */ + const uint32_t* xcb_pre_tmp_12; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_9 = R->valuators_len; + xcb_pre_tmp_11 = 0; + xcb_pre_tmp_12 = xcb_input_button_press_valuator_mask(R); + for (xcb_pre_tmp_10 = 0; xcb_pre_tmp_10 < xcb_pre_tmp_9; xcb_pre_tmp_10++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_12; + xcb_pre_tmp_11 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_12++; + } + /* sumof end. Result is in xcb_pre_tmp_11 */ + i.data = (xcb_input_fp3232_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_input_fp3232_t, prev.index)); + i.rem = xcb_pre_tmp_11; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_input_button_release_sizeof (const void *_buffer /**< */) +{ + return xcb_input_button_press_sizeof(_buffer); +} + +int +xcb_input_motion_sizeof (const void *_buffer /**< */) +{ + return xcb_input_button_press_sizeof(_buffer); +} + +int +xcb_input_enter_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_enter_event_t *_aux = (xcb_input_enter_event_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_input_enter_event_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* buttons */ + xcb_block_len += _aux->buttons_len * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; +} + +uint32_t * +xcb_input_enter_buttons (const xcb_input_enter_event_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_input_enter_buttons_length (const xcb_input_enter_event_t *R) +{ + return R->buttons_len; +} + +xcb_generic_iterator_t +xcb_input_enter_buttons_end (const xcb_input_enter_event_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->buttons_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_input_leave_sizeof (const void *_buffer /**< */) +{ + return xcb_input_enter_sizeof(_buffer); +} + +int +xcb_input_focus_in_sizeof (const void *_buffer /**< */) +{ + return xcb_input_enter_sizeof(_buffer); +} + +int +xcb_input_focus_out_sizeof (const void *_buffer /**< */) +{ + return xcb_input_enter_sizeof(_buffer); +} + +void +xcb_input_hierarchy_info_next (xcb_input_hierarchy_info_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_hierarchy_info_t); +} + +xcb_generic_iterator_t +xcb_input_hierarchy_info_end (xcb_input_hierarchy_info_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; +} + +int +xcb_input_hierarchy_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_hierarchy_event_t *_aux = (xcb_input_hierarchy_event_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_input_hierarchy_event_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* infos */ + xcb_block_len += _aux->num_infos * sizeof(xcb_input_hierarchy_info_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_hierarchy_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_input_hierarchy_info_t * +xcb_input_hierarchy_infos (const xcb_input_hierarchy_event_t *R) +{ + return (xcb_input_hierarchy_info_t *) (R + 1); +} + +int +xcb_input_hierarchy_infos_length (const xcb_input_hierarchy_event_t *R) +{ + return R->num_infos; +} + +xcb_input_hierarchy_info_iterator_t +xcb_input_hierarchy_infos_iterator (const xcb_input_hierarchy_event_t *R) +{ + xcb_input_hierarchy_info_iterator_t i; + i.data = (xcb_input_hierarchy_info_t *) (R + 1); + i.rem = R->num_infos; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_input_raw_key_press_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_raw_key_press_event_t *_aux = (xcb_input_raw_key_press_event_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; + + int xcb_pre_tmp_1; /* sumof length */ + int xcb_pre_tmp_2; /* sumof loop counter */ + int64_t xcb_pre_tmp_3; /* sumof sum */ + const uint32_t* xcb_pre_tmp_4; /* sumof list ptr */ + int xcb_pre_tmp_5; /* sumof length */ + int xcb_pre_tmp_6; /* sumof loop counter */ + int64_t xcb_pre_tmp_7; /* sumof sum */ + const uint32_t* xcb_pre_tmp_8; /* sumof list ptr */ + + xcb_block_len += sizeof(xcb_input_raw_key_press_event_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* valuator_mask */ + xcb_block_len += _aux->valuators_len * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* axisvalues */ + /* sumof start */ + xcb_pre_tmp_1 = _aux->valuators_len; + xcb_pre_tmp_3 = 0; + xcb_pre_tmp_4 = xcb_input_raw_key_press_valuator_mask(_aux); + for (xcb_pre_tmp_2 = 0; xcb_pre_tmp_2 < xcb_pre_tmp_1; xcb_pre_tmp_2++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_4; + xcb_pre_tmp_3 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_4++; + } + /* sumof end. Result is in xcb_pre_tmp_3 */ + xcb_block_len += xcb_pre_tmp_3 * sizeof(xcb_input_fp3232_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_fp3232_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; + /* axisvalues_raw */ + /* sumof start */ + xcb_pre_tmp_5 = _aux->valuators_len; + xcb_pre_tmp_7 = 0; + xcb_pre_tmp_8 = xcb_input_raw_key_press_valuator_mask(_aux); + for (xcb_pre_tmp_6 = 0; xcb_pre_tmp_6 < xcb_pre_tmp_5; xcb_pre_tmp_6++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_8; + xcb_pre_tmp_7 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_8++; + } + /* sumof end. Result is in xcb_pre_tmp_7 */ + xcb_block_len += xcb_pre_tmp_7 * sizeof(xcb_input_fp3232_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_fp3232_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; +} + +uint32_t * +xcb_input_raw_key_press_valuator_mask (const xcb_input_raw_key_press_event_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_input_raw_key_press_valuator_mask_length (const xcb_input_raw_key_press_event_t *R) +{ + return R->valuators_len; +} + +xcb_generic_iterator_t +xcb_input_raw_key_press_valuator_mask_end (const xcb_input_raw_key_press_event_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->valuators_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_fp3232_t * +xcb_input_raw_key_press_axisvalues (const xcb_input_raw_key_press_event_t *R) +{ + xcb_generic_iterator_t prev = xcb_input_raw_key_press_valuator_mask_end(R); + return (xcb_input_fp3232_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_input_fp3232_t, prev.index) + 0); +} + +int +xcb_input_raw_key_press_axisvalues_length (const xcb_input_raw_key_press_event_t *R) +{ + int xcb_pre_tmp_9; /* sumof length */ + int xcb_pre_tmp_10; /* sumof loop counter */ + int64_t xcb_pre_tmp_11; /* sumof sum */ + const uint32_t* xcb_pre_tmp_12; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_9 = R->valuators_len; + xcb_pre_tmp_11 = 0; + xcb_pre_tmp_12 = xcb_input_raw_key_press_valuator_mask(R); + for (xcb_pre_tmp_10 = 0; xcb_pre_tmp_10 < xcb_pre_tmp_9; xcb_pre_tmp_10++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_12; + xcb_pre_tmp_11 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_12++; + } + /* sumof end. Result is in xcb_pre_tmp_11 */ + return xcb_pre_tmp_11; +} + +xcb_input_fp3232_iterator_t +xcb_input_raw_key_press_axisvalues_iterator (const xcb_input_raw_key_press_event_t *R) +{ + xcb_input_fp3232_iterator_t i; + xcb_generic_iterator_t prev = xcb_input_raw_key_press_valuator_mask_end(R); + int xcb_pre_tmp_13; /* sumof length */ + int xcb_pre_tmp_14; /* sumof loop counter */ + int64_t xcb_pre_tmp_15; /* sumof sum */ + const uint32_t* xcb_pre_tmp_16; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_13 = R->valuators_len; + xcb_pre_tmp_15 = 0; + xcb_pre_tmp_16 = xcb_input_raw_key_press_valuator_mask(R); + for (xcb_pre_tmp_14 = 0; xcb_pre_tmp_14 < xcb_pre_tmp_13; xcb_pre_tmp_14++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_16; + xcb_pre_tmp_15 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_16++; + } + /* sumof end. Result is in xcb_pre_tmp_15 */ + i.data = (xcb_input_fp3232_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_input_fp3232_t, prev.index)); + i.rem = xcb_pre_tmp_15; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_fp3232_t * +xcb_input_raw_key_press_axisvalues_raw (const xcb_input_raw_key_press_event_t *R) +{ + xcb_generic_iterator_t prev = xcb_input_fp3232_end(xcb_input_raw_key_press_axisvalues_iterator(R)); + return (xcb_input_fp3232_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_input_fp3232_t, prev.index) + 0); +} + +int +xcb_input_raw_key_press_axisvalues_raw_length (const xcb_input_raw_key_press_event_t *R) +{ + int xcb_pre_tmp_17; /* sumof length */ + int xcb_pre_tmp_18; /* sumof loop counter */ + int64_t xcb_pre_tmp_19; /* sumof sum */ + const uint32_t* xcb_pre_tmp_20; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_17 = R->valuators_len; + xcb_pre_tmp_19 = 0; + xcb_pre_tmp_20 = xcb_input_raw_key_press_valuator_mask(R); + for (xcb_pre_tmp_18 = 0; xcb_pre_tmp_18 < xcb_pre_tmp_17; xcb_pre_tmp_18++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_20; + xcb_pre_tmp_19 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_20++; + } + /* sumof end. Result is in xcb_pre_tmp_19 */ + return xcb_pre_tmp_19; +} + +xcb_input_fp3232_iterator_t +xcb_input_raw_key_press_axisvalues_raw_iterator (const xcb_input_raw_key_press_event_t *R) +{ + xcb_input_fp3232_iterator_t i; + xcb_generic_iterator_t prev = xcb_input_fp3232_end(xcb_input_raw_key_press_axisvalues_iterator(R)); + int xcb_pre_tmp_21; /* sumof length */ + int xcb_pre_tmp_22; /* sumof loop counter */ + int64_t xcb_pre_tmp_23; /* sumof sum */ + const uint32_t* xcb_pre_tmp_24; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_21 = R->valuators_len; + xcb_pre_tmp_23 = 0; + xcb_pre_tmp_24 = xcb_input_raw_key_press_valuator_mask(R); + for (xcb_pre_tmp_22 = 0; xcb_pre_tmp_22 < xcb_pre_tmp_21; xcb_pre_tmp_22++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_24; + xcb_pre_tmp_23 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_24++; + } + /* sumof end. Result is in xcb_pre_tmp_23 */ + i.data = (xcb_input_fp3232_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_input_fp3232_t, prev.index)); + i.rem = xcb_pre_tmp_23; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_input_raw_key_release_sizeof (const void *_buffer /**< */) +{ + return xcb_input_raw_key_press_sizeof(_buffer); +} + +int +xcb_input_raw_button_press_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_raw_button_press_event_t *_aux = (xcb_input_raw_button_press_event_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; + + int xcb_pre_tmp_1; /* sumof length */ + int xcb_pre_tmp_2; /* sumof loop counter */ + int64_t xcb_pre_tmp_3; /* sumof sum */ + const uint32_t* xcb_pre_tmp_4; /* sumof list ptr */ + int xcb_pre_tmp_5; /* sumof length */ + int xcb_pre_tmp_6; /* sumof loop counter */ + int64_t xcb_pre_tmp_7; /* sumof sum */ + const uint32_t* xcb_pre_tmp_8; /* sumof list ptr */ + + xcb_block_len += sizeof(xcb_input_raw_button_press_event_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* valuator_mask */ + xcb_block_len += _aux->valuators_len * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* axisvalues */ + /* sumof start */ + xcb_pre_tmp_1 = _aux->valuators_len; + xcb_pre_tmp_3 = 0; + xcb_pre_tmp_4 = xcb_input_raw_button_press_valuator_mask(_aux); + for (xcb_pre_tmp_2 = 0; xcb_pre_tmp_2 < xcb_pre_tmp_1; xcb_pre_tmp_2++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_4; + xcb_pre_tmp_3 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_4++; + } + /* sumof end. Result is in xcb_pre_tmp_3 */ + xcb_block_len += xcb_pre_tmp_3 * sizeof(xcb_input_fp3232_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_fp3232_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; + /* axisvalues_raw */ + /* sumof start */ + xcb_pre_tmp_5 = _aux->valuators_len; + xcb_pre_tmp_7 = 0; + xcb_pre_tmp_8 = xcb_input_raw_button_press_valuator_mask(_aux); + for (xcb_pre_tmp_6 = 0; xcb_pre_tmp_6 < xcb_pre_tmp_5; xcb_pre_tmp_6++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_8; + xcb_pre_tmp_7 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_8++; + } + /* sumof end. Result is in xcb_pre_tmp_7 */ + xcb_block_len += xcb_pre_tmp_7 * sizeof(xcb_input_fp3232_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_fp3232_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; +} + +uint32_t * +xcb_input_raw_button_press_valuator_mask (const xcb_input_raw_button_press_event_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_input_raw_button_press_valuator_mask_length (const xcb_input_raw_button_press_event_t *R) +{ + return R->valuators_len; +} + +xcb_generic_iterator_t +xcb_input_raw_button_press_valuator_mask_end (const xcb_input_raw_button_press_event_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->valuators_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_fp3232_t * +xcb_input_raw_button_press_axisvalues (const xcb_input_raw_button_press_event_t *R) +{ + xcb_generic_iterator_t prev = xcb_input_raw_button_press_valuator_mask_end(R); + return (xcb_input_fp3232_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_input_fp3232_t, prev.index) + 0); +} + +int +xcb_input_raw_button_press_axisvalues_length (const xcb_input_raw_button_press_event_t *R) +{ + int xcb_pre_tmp_9; /* sumof length */ + int xcb_pre_tmp_10; /* sumof loop counter */ + int64_t xcb_pre_tmp_11; /* sumof sum */ + const uint32_t* xcb_pre_tmp_12; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_9 = R->valuators_len; + xcb_pre_tmp_11 = 0; + xcb_pre_tmp_12 = xcb_input_raw_button_press_valuator_mask(R); + for (xcb_pre_tmp_10 = 0; xcb_pre_tmp_10 < xcb_pre_tmp_9; xcb_pre_tmp_10++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_12; + xcb_pre_tmp_11 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_12++; + } + /* sumof end. Result is in xcb_pre_tmp_11 */ + return xcb_pre_tmp_11; +} + +xcb_input_fp3232_iterator_t +xcb_input_raw_button_press_axisvalues_iterator (const xcb_input_raw_button_press_event_t *R) +{ + xcb_input_fp3232_iterator_t i; + xcb_generic_iterator_t prev = xcb_input_raw_button_press_valuator_mask_end(R); + int xcb_pre_tmp_13; /* sumof length */ + int xcb_pre_tmp_14; /* sumof loop counter */ + int64_t xcb_pre_tmp_15; /* sumof sum */ + const uint32_t* xcb_pre_tmp_16; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_13 = R->valuators_len; + xcb_pre_tmp_15 = 0; + xcb_pre_tmp_16 = xcb_input_raw_button_press_valuator_mask(R); + for (xcb_pre_tmp_14 = 0; xcb_pre_tmp_14 < xcb_pre_tmp_13; xcb_pre_tmp_14++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_16; + xcb_pre_tmp_15 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_16++; + } + /* sumof end. Result is in xcb_pre_tmp_15 */ + i.data = (xcb_input_fp3232_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_input_fp3232_t, prev.index)); + i.rem = xcb_pre_tmp_15; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_fp3232_t * +xcb_input_raw_button_press_axisvalues_raw (const xcb_input_raw_button_press_event_t *R) +{ + xcb_generic_iterator_t prev = xcb_input_fp3232_end(xcb_input_raw_button_press_axisvalues_iterator(R)); + return (xcb_input_fp3232_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_input_fp3232_t, prev.index) + 0); +} + +int +xcb_input_raw_button_press_axisvalues_raw_length (const xcb_input_raw_button_press_event_t *R) +{ + int xcb_pre_tmp_17; /* sumof length */ + int xcb_pre_tmp_18; /* sumof loop counter */ + int64_t xcb_pre_tmp_19; /* sumof sum */ + const uint32_t* xcb_pre_tmp_20; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_17 = R->valuators_len; + xcb_pre_tmp_19 = 0; + xcb_pre_tmp_20 = xcb_input_raw_button_press_valuator_mask(R); + for (xcb_pre_tmp_18 = 0; xcb_pre_tmp_18 < xcb_pre_tmp_17; xcb_pre_tmp_18++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_20; + xcb_pre_tmp_19 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_20++; + } + /* sumof end. Result is in xcb_pre_tmp_19 */ + return xcb_pre_tmp_19; +} + +xcb_input_fp3232_iterator_t +xcb_input_raw_button_press_axisvalues_raw_iterator (const xcb_input_raw_button_press_event_t *R) +{ + xcb_input_fp3232_iterator_t i; + xcb_generic_iterator_t prev = xcb_input_fp3232_end(xcb_input_raw_button_press_axisvalues_iterator(R)); + int xcb_pre_tmp_21; /* sumof length */ + int xcb_pre_tmp_22; /* sumof loop counter */ + int64_t xcb_pre_tmp_23; /* sumof sum */ + const uint32_t* xcb_pre_tmp_24; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_21 = R->valuators_len; + xcb_pre_tmp_23 = 0; + xcb_pre_tmp_24 = xcb_input_raw_button_press_valuator_mask(R); + for (xcb_pre_tmp_22 = 0; xcb_pre_tmp_22 < xcb_pre_tmp_21; xcb_pre_tmp_22++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_24; + xcb_pre_tmp_23 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_24++; + } + /* sumof end. Result is in xcb_pre_tmp_23 */ + i.data = (xcb_input_fp3232_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_input_fp3232_t, prev.index)); + i.rem = xcb_pre_tmp_23; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_input_raw_button_release_sizeof (const void *_buffer /**< */) +{ + return xcb_input_raw_button_press_sizeof(_buffer); +} + +int +xcb_input_raw_motion_sizeof (const void *_buffer /**< */) +{ + return xcb_input_raw_button_press_sizeof(_buffer); +} + +int +xcb_input_touch_begin_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_touch_begin_event_t *_aux = (xcb_input_touch_begin_event_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; + + int xcb_pre_tmp_1; /* sumof length */ + int xcb_pre_tmp_2; /* sumof loop counter */ + int64_t xcb_pre_tmp_3; /* sumof sum */ + const uint32_t* xcb_pre_tmp_4; /* sumof list ptr */ + + xcb_block_len += sizeof(xcb_input_touch_begin_event_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* button_mask */ + xcb_block_len += _aux->buttons_len * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* valuator_mask */ + xcb_block_len += _aux->valuators_len * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* axisvalues */ + /* sumof start */ + xcb_pre_tmp_1 = _aux->valuators_len; + xcb_pre_tmp_3 = 0; + xcb_pre_tmp_4 = xcb_input_touch_begin_valuator_mask(_aux); + for (xcb_pre_tmp_2 = 0; xcb_pre_tmp_2 < xcb_pre_tmp_1; xcb_pre_tmp_2++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_4; + xcb_pre_tmp_3 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_4++; + } + /* sumof end. Result is in xcb_pre_tmp_3 */ + xcb_block_len += xcb_pre_tmp_3 * sizeof(xcb_input_fp3232_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_fp3232_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; +} + +uint32_t * +xcb_input_touch_begin_button_mask (const xcb_input_touch_begin_event_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_input_touch_begin_button_mask_length (const xcb_input_touch_begin_event_t *R) +{ + return R->buttons_len; +} + +xcb_generic_iterator_t +xcb_input_touch_begin_button_mask_end (const xcb_input_touch_begin_event_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->buttons_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +uint32_t * +xcb_input_touch_begin_valuator_mask (const xcb_input_touch_begin_event_t *R) +{ + xcb_generic_iterator_t prev = xcb_input_touch_begin_button_mask_end(R); + return (uint32_t *) ((char *) prev.data + XCB_TYPE_PAD(uint32_t, prev.index) + 0); +} + +int +xcb_input_touch_begin_valuator_mask_length (const xcb_input_touch_begin_event_t *R) +{ + return R->valuators_len; +} + +xcb_generic_iterator_t +xcb_input_touch_begin_valuator_mask_end (const xcb_input_touch_begin_event_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_input_touch_begin_button_mask_end(R); + i.data = ((uint32_t *) ((char*) prev.data + XCB_TYPE_PAD(uint32_t, prev.index))) + (R->valuators_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_fp3232_t * +xcb_input_touch_begin_axisvalues (const xcb_input_touch_begin_event_t *R) +{ + xcb_generic_iterator_t prev = xcb_input_touch_begin_valuator_mask_end(R); + return (xcb_input_fp3232_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_input_fp3232_t, prev.index) + 0); +} + +int +xcb_input_touch_begin_axisvalues_length (const xcb_input_touch_begin_event_t *R) +{ + int xcb_pre_tmp_5; /* sumof length */ + int xcb_pre_tmp_6; /* sumof loop counter */ + int64_t xcb_pre_tmp_7; /* sumof sum */ + const uint32_t* xcb_pre_tmp_8; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_5 = R->valuators_len; + xcb_pre_tmp_7 = 0; + xcb_pre_tmp_8 = xcb_input_touch_begin_valuator_mask(R); + for (xcb_pre_tmp_6 = 0; xcb_pre_tmp_6 < xcb_pre_tmp_5; xcb_pre_tmp_6++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_8; + xcb_pre_tmp_7 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_8++; + } + /* sumof end. Result is in xcb_pre_tmp_7 */ + return xcb_pre_tmp_7; +} + +xcb_input_fp3232_iterator_t +xcb_input_touch_begin_axisvalues_iterator (const xcb_input_touch_begin_event_t *R) +{ + xcb_input_fp3232_iterator_t i; + xcb_generic_iterator_t prev = xcb_input_touch_begin_valuator_mask_end(R); + int xcb_pre_tmp_9; /* sumof length */ + int xcb_pre_tmp_10; /* sumof loop counter */ + int64_t xcb_pre_tmp_11; /* sumof sum */ + const uint32_t* xcb_pre_tmp_12; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_9 = R->valuators_len; + xcb_pre_tmp_11 = 0; + xcb_pre_tmp_12 = xcb_input_touch_begin_valuator_mask(R); + for (xcb_pre_tmp_10 = 0; xcb_pre_tmp_10 < xcb_pre_tmp_9; xcb_pre_tmp_10++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_12; + xcb_pre_tmp_11 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_12++; + } + /* sumof end. Result is in xcb_pre_tmp_11 */ + i.data = (xcb_input_fp3232_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_input_fp3232_t, prev.index)); + i.rem = xcb_pre_tmp_11; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_input_touch_update_sizeof (const void *_buffer /**< */) +{ + return xcb_input_touch_begin_sizeof(_buffer); +} + +int +xcb_input_touch_end_sizeof (const void *_buffer /**< */) +{ + return xcb_input_touch_begin_sizeof(_buffer); +} + +int +xcb_input_raw_touch_begin_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_raw_touch_begin_event_t *_aux = (xcb_input_raw_touch_begin_event_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; + + int xcb_pre_tmp_1; /* sumof length */ + int xcb_pre_tmp_2; /* sumof loop counter */ + int64_t xcb_pre_tmp_3; /* sumof sum */ + const uint32_t* xcb_pre_tmp_4; /* sumof list ptr */ + int xcb_pre_tmp_5; /* sumof length */ + int xcb_pre_tmp_6; /* sumof loop counter */ + int64_t xcb_pre_tmp_7; /* sumof sum */ + const uint32_t* xcb_pre_tmp_8; /* sumof list ptr */ + + xcb_block_len += sizeof(xcb_input_raw_touch_begin_event_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* valuator_mask */ + xcb_block_len += _aux->valuators_len * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* axisvalues */ + /* sumof start */ + xcb_pre_tmp_1 = _aux->valuators_len; + xcb_pre_tmp_3 = 0; + xcb_pre_tmp_4 = xcb_input_raw_touch_begin_valuator_mask(_aux); + for (xcb_pre_tmp_2 = 0; xcb_pre_tmp_2 < xcb_pre_tmp_1; xcb_pre_tmp_2++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_4; + xcb_pre_tmp_3 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_4++; + } + /* sumof end. Result is in xcb_pre_tmp_3 */ + xcb_block_len += xcb_pre_tmp_3 * sizeof(xcb_input_fp3232_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_fp3232_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; + /* axisvalues_raw */ + /* sumof start */ + xcb_pre_tmp_5 = _aux->valuators_len; + xcb_pre_tmp_7 = 0; + xcb_pre_tmp_8 = xcb_input_raw_touch_begin_valuator_mask(_aux); + for (xcb_pre_tmp_6 = 0; xcb_pre_tmp_6 < xcb_pre_tmp_5; xcb_pre_tmp_6++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_8; + xcb_pre_tmp_7 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_8++; + } + /* sumof end. Result is in xcb_pre_tmp_7 */ + xcb_block_len += xcb_pre_tmp_7 * sizeof(xcb_input_fp3232_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_fp3232_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; +} + +uint32_t * +xcb_input_raw_touch_begin_valuator_mask (const xcb_input_raw_touch_begin_event_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_input_raw_touch_begin_valuator_mask_length (const xcb_input_raw_touch_begin_event_t *R) +{ + return R->valuators_len; +} + +xcb_generic_iterator_t +xcb_input_raw_touch_begin_valuator_mask_end (const xcb_input_raw_touch_begin_event_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->valuators_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_fp3232_t * +xcb_input_raw_touch_begin_axisvalues (const xcb_input_raw_touch_begin_event_t *R) +{ + xcb_generic_iterator_t prev = xcb_input_raw_touch_begin_valuator_mask_end(R); + return (xcb_input_fp3232_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_input_fp3232_t, prev.index) + 0); +} + +int +xcb_input_raw_touch_begin_axisvalues_length (const xcb_input_raw_touch_begin_event_t *R) +{ + int xcb_pre_tmp_9; /* sumof length */ + int xcb_pre_tmp_10; /* sumof loop counter */ + int64_t xcb_pre_tmp_11; /* sumof sum */ + const uint32_t* xcb_pre_tmp_12; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_9 = R->valuators_len; + xcb_pre_tmp_11 = 0; + xcb_pre_tmp_12 = xcb_input_raw_touch_begin_valuator_mask(R); + for (xcb_pre_tmp_10 = 0; xcb_pre_tmp_10 < xcb_pre_tmp_9; xcb_pre_tmp_10++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_12; + xcb_pre_tmp_11 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_12++; + } + /* sumof end. Result is in xcb_pre_tmp_11 */ + return xcb_pre_tmp_11; +} + +xcb_input_fp3232_iterator_t +xcb_input_raw_touch_begin_axisvalues_iterator (const xcb_input_raw_touch_begin_event_t *R) +{ + xcb_input_fp3232_iterator_t i; + xcb_generic_iterator_t prev = xcb_input_raw_touch_begin_valuator_mask_end(R); + int xcb_pre_tmp_13; /* sumof length */ + int xcb_pre_tmp_14; /* sumof loop counter */ + int64_t xcb_pre_tmp_15; /* sumof sum */ + const uint32_t* xcb_pre_tmp_16; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_13 = R->valuators_len; + xcb_pre_tmp_15 = 0; + xcb_pre_tmp_16 = xcb_input_raw_touch_begin_valuator_mask(R); + for (xcb_pre_tmp_14 = 0; xcb_pre_tmp_14 < xcb_pre_tmp_13; xcb_pre_tmp_14++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_16; + xcb_pre_tmp_15 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_16++; + } + /* sumof end. Result is in xcb_pre_tmp_15 */ + i.data = (xcb_input_fp3232_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_input_fp3232_t, prev.index)); + i.rem = xcb_pre_tmp_15; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_fp3232_t * +xcb_input_raw_touch_begin_axisvalues_raw (const xcb_input_raw_touch_begin_event_t *R) +{ + xcb_generic_iterator_t prev = xcb_input_fp3232_end(xcb_input_raw_touch_begin_axisvalues_iterator(R)); + return (xcb_input_fp3232_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_input_fp3232_t, prev.index) + 0); +} + +int +xcb_input_raw_touch_begin_axisvalues_raw_length (const xcb_input_raw_touch_begin_event_t *R) +{ + int xcb_pre_tmp_17; /* sumof length */ + int xcb_pre_tmp_18; /* sumof loop counter */ + int64_t xcb_pre_tmp_19; /* sumof sum */ + const uint32_t* xcb_pre_tmp_20; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_17 = R->valuators_len; + xcb_pre_tmp_19 = 0; + xcb_pre_tmp_20 = xcb_input_raw_touch_begin_valuator_mask(R); + for (xcb_pre_tmp_18 = 0; xcb_pre_tmp_18 < xcb_pre_tmp_17; xcb_pre_tmp_18++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_20; + xcb_pre_tmp_19 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_20++; + } + /* sumof end. Result is in xcb_pre_tmp_19 */ + return xcb_pre_tmp_19; +} + +xcb_input_fp3232_iterator_t +xcb_input_raw_touch_begin_axisvalues_raw_iterator (const xcb_input_raw_touch_begin_event_t *R) +{ + xcb_input_fp3232_iterator_t i; + xcb_generic_iterator_t prev = xcb_input_fp3232_end(xcb_input_raw_touch_begin_axisvalues_iterator(R)); + int xcb_pre_tmp_21; /* sumof length */ + int xcb_pre_tmp_22; /* sumof loop counter */ + int64_t xcb_pre_tmp_23; /* sumof sum */ + const uint32_t* xcb_pre_tmp_24; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_21 = R->valuators_len; + xcb_pre_tmp_23 = 0; + xcb_pre_tmp_24 = xcb_input_raw_touch_begin_valuator_mask(R); + for (xcb_pre_tmp_22 = 0; xcb_pre_tmp_22 < xcb_pre_tmp_21; xcb_pre_tmp_22++) { + const uint32_t *xcb_listelement = xcb_pre_tmp_24; + xcb_pre_tmp_23 += xcb_popcount((*xcb_listelement)); + xcb_pre_tmp_24++; + } + /* sumof end. Result is in xcb_pre_tmp_23 */ + i.data = (xcb_input_fp3232_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_input_fp3232_t, prev.index)); + i.rem = xcb_pre_tmp_23; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_input_raw_touch_update_sizeof (const void *_buffer /**< */) +{ + return xcb_input_raw_touch_begin_sizeof(_buffer); +} + +int +xcb_input_raw_touch_end_sizeof (const void *_buffer /**< */) +{ + return xcb_input_raw_touch_begin_sizeof(_buffer); +} + +void +xcb_input_event_for_send_next (xcb_input_event_for_send_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_input_event_for_send_t); +} + +xcb_generic_iterator_t +xcb_input_event_for_send_end (xcb_input_event_for_send_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; +} + +int +xcb_input_send_extension_event_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_input_send_extension_event_request_t *_aux = (xcb_input_send_extension_event_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_input_send_extension_event_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* events */ + xcb_block_len += _aux->num_events * sizeof(xcb_input_event_for_send_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_event_for_send_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; + /* classes */ + xcb_block_len += _aux->num_classes * sizeof(xcb_input_event_class_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_input_event_class_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_input_send_extension_event_checked (xcb_connection_t *c, + xcb_window_t destination, + uint8_t device_id, + uint8_t propagate, + uint16_t num_classes, + uint8_t num_events, + const xcb_input_event_for_send_t *events, + const xcb_input_event_class_t *classes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_SEND_EXTENSION_EVENT, + .isvoid = 1 + }; + + struct iovec xcb_parts[8]; + xcb_void_cookie_t xcb_ret; + xcb_input_send_extension_event_request_t xcb_out; + + xcb_out.destination = destination; + xcb_out.device_id = device_id; + xcb_out.propagate = propagate; + xcb_out.num_classes = num_classes; + xcb_out.num_events = num_events; + 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_input_event_for_send_t events */ + xcb_parts[4].iov_base = (char *) events; + xcb_parts[4].iov_len = num_events * sizeof(xcb_input_event_for_send_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_input_event_class_t classes */ + xcb_parts[6].iov_base = (char *) classes; + xcb_parts[6].iov_len = num_classes * sizeof(xcb_input_event_class_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].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_input_send_extension_event (xcb_connection_t *c, + xcb_window_t destination, + uint8_t device_id, + uint8_t propagate, + uint16_t num_classes, + uint8_t num_events, + const xcb_input_event_for_send_t *events, + const xcb_input_event_class_t *classes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_input_id, + .opcode = XCB_INPUT_SEND_EXTENSION_EVENT, + .isvoid = 1 + }; + + struct iovec xcb_parts[8]; + xcb_void_cookie_t xcb_ret; + xcb_input_send_extension_event_request_t xcb_out; + + xcb_out.destination = destination; + xcb_out.device_id = device_id; + xcb_out.propagate = propagate; + xcb_out.num_classes = num_classes; + xcb_out.num_events = num_events; + 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_input_event_for_send_t events */ + xcb_parts[4].iov_base = (char *) events; + xcb_parts[4].iov_len = num_events * sizeof(xcb_input_event_for_send_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_input_event_class_t classes */ + xcb_parts[6].iov_base = (char *) classes; + xcb_parts[6].iov_len = num_classes * sizeof(xcb_input_event_class_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_input_event_for_send_t * +xcb_input_send_extension_event_events (const xcb_input_send_extension_event_request_t *R) +{ + return (xcb_input_event_for_send_t *) (R + 1); +} + +int +xcb_input_send_extension_event_events_length (const xcb_input_send_extension_event_request_t *R) +{ + return R->num_events; +} + +xcb_input_event_for_send_iterator_t +xcb_input_send_extension_event_events_iterator (const xcb_input_send_extension_event_request_t *R) +{ + xcb_input_event_for_send_iterator_t i; + i.data = (xcb_input_event_for_send_t *) (R + 1); + i.rem = R->num_events; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_input_event_class_t * +xcb_input_send_extension_event_classes (const xcb_input_send_extension_event_request_t *R) +{ + xcb_generic_iterator_t prev = xcb_input_event_for_send_end(xcb_input_send_extension_event_events_iterator(R)); + return (xcb_input_event_class_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_input_event_class_t, prev.index) + 0); +} + +int +xcb_input_send_extension_event_classes_length (const xcb_input_send_extension_event_request_t *R) +{ + return R->num_classes; +} + +xcb_generic_iterator_t +xcb_input_send_extension_event_classes_end (const xcb_input_send_extension_event_request_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_input_event_for_send_end(xcb_input_send_extension_event_events_iterator(R)); + i.data = ((xcb_input_event_class_t *) ((char*) prev.data + XCB_TYPE_PAD(xcb_input_event_class_t, prev.index))) + (R->num_classes); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + diff --git a/depends/libxcb/src/xkb.c b/depends/libxcb/src/xkb.c new file mode 100644 index 0000000..6aee964 --- /dev/null +++ b/depends/libxcb/src/xkb.c @@ -0,0 +1,11625 @@ +/* + * This file generated automatically from xkb.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "xkb.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) +#include "xproto.h" + +xcb_extension_t xcb_xkb_id = { "XKEYBOARD", 0 }; + +void +xcb_xkb_device_spec_next (xcb_xkb_device_spec_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_device_spec_t); +} + +xcb_generic_iterator_t +xcb_xkb_device_spec_end (xcb_xkb_device_spec_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; +} + +void +xcb_xkb_led_class_spec_next (xcb_xkb_led_class_spec_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_led_class_spec_t); +} + +xcb_generic_iterator_t +xcb_xkb_led_class_spec_end (xcb_xkb_led_class_spec_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; +} + +void +xcb_xkb_bell_class_spec_next (xcb_xkb_bell_class_spec_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_bell_class_spec_t); +} + +xcb_generic_iterator_t +xcb_xkb_bell_class_spec_end (xcb_xkb_bell_class_spec_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; +} + +void +xcb_xkb_id_spec_next (xcb_xkb_id_spec_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_id_spec_t); +} + +xcb_generic_iterator_t +xcb_xkb_id_spec_end (xcb_xkb_id_spec_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; +} + +void +xcb_xkb_indicator_map_next (xcb_xkb_indicator_map_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_indicator_map_t); +} + +xcb_generic_iterator_t +xcb_xkb_indicator_map_end (xcb_xkb_indicator_map_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; +} + +void +xcb_xkb_mod_def_next (xcb_xkb_mod_def_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_mod_def_t); +} + +xcb_generic_iterator_t +xcb_xkb_mod_def_end (xcb_xkb_mod_def_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; +} + +void +xcb_xkb_key_name_next (xcb_xkb_key_name_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_key_name_t); +} + +xcb_generic_iterator_t +xcb_xkb_key_name_end (xcb_xkb_key_name_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; +} + +void +xcb_xkb_key_alias_next (xcb_xkb_key_alias_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_key_alias_t); +} + +xcb_generic_iterator_t +xcb_xkb_key_alias_end (xcb_xkb_key_alias_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; +} + +int +xcb_xkb_counted_string_16_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_counted_string_16_t *_aux = (xcb_xkb_counted_string_16_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_xkb_counted_string_16_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* string */ + xcb_block_len += _aux->length * sizeof(char); + 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; + /* alignment_pad */ + xcb_block_len += (((_aux->length + 5) & (~3)) - (_aux->length + 2)) * sizeof(char); + 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; +} + +char * +xcb_xkb_counted_string_16_string (const xcb_xkb_counted_string_16_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_xkb_counted_string_16_string_length (const xcb_xkb_counted_string_16_t *R) +{ + return R->length; +} + +xcb_generic_iterator_t +xcb_xkb_counted_string_16_string_end (const xcb_xkb_counted_string_16_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->length); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void * +xcb_xkb_counted_string_16_alignment_pad (const xcb_xkb_counted_string_16_t *R) +{ + xcb_generic_iterator_t prev = xcb_xkb_counted_string_16_string_end(R); + return (void *) ((char *) prev.data + XCB_TYPE_PAD(char, prev.index) + 0); +} + +int +xcb_xkb_counted_string_16_alignment_pad_length (const xcb_xkb_counted_string_16_t *R) +{ + return (((R->length + 5) & (~3)) - (R->length + 2)); +} + +xcb_generic_iterator_t +xcb_xkb_counted_string_16_alignment_pad_end (const xcb_xkb_counted_string_16_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_xkb_counted_string_16_string_end(R); + i.data = ((char *) ((char*) prev.data + XCB_TYPE_PAD(char, prev.index))) + ((((R->length + 5) & (~3)) - (R->length + 2))); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_xkb_counted_string_16_next (xcb_xkb_counted_string_16_iterator_t *i) +{ + xcb_xkb_counted_string_16_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_xkb_counted_string_16_t *)(((char *)R) + xcb_xkb_counted_string_16_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_xkb_counted_string_16_t *) child.data; +} + +xcb_generic_iterator_t +xcb_xkb_counted_string_16_end (xcb_xkb_counted_string_16_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_xkb_counted_string_16_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +void +xcb_xkb_kt_map_entry_next (xcb_xkb_kt_map_entry_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_kt_map_entry_t); +} + +xcb_generic_iterator_t +xcb_xkb_kt_map_entry_end (xcb_xkb_kt_map_entry_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; +} + +int +xcb_xkb_key_type_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_key_type_t *_aux = (xcb_xkb_key_type_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_xkb_key_type_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* map */ + xcb_block_len += _aux->nMapEntries * sizeof(xcb_xkb_kt_map_entry_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_kt_map_entry_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; + /* preserve */ + xcb_block_len += (_aux->hasPreserve * _aux->nMapEntries) * sizeof(xcb_xkb_mod_def_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_mod_def_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_xkb_kt_map_entry_t * +xcb_xkb_key_type_map (const xcb_xkb_key_type_t *R) +{ + return (xcb_xkb_kt_map_entry_t *) (R + 1); +} + +int +xcb_xkb_key_type_map_length (const xcb_xkb_key_type_t *R) +{ + return R->nMapEntries; +} + +xcb_xkb_kt_map_entry_iterator_t +xcb_xkb_key_type_map_iterator (const xcb_xkb_key_type_t *R) +{ + xcb_xkb_kt_map_entry_iterator_t i; + i.data = (xcb_xkb_kt_map_entry_t *) (R + 1); + i.rem = R->nMapEntries; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xkb_mod_def_t * +xcb_xkb_key_type_preserve (const xcb_xkb_key_type_t *R) +{ + xcb_generic_iterator_t prev = xcb_xkb_kt_map_entry_end(xcb_xkb_key_type_map_iterator(R)); + return (xcb_xkb_mod_def_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_mod_def_t, prev.index) + 0); +} + +int +xcb_xkb_key_type_preserve_length (const xcb_xkb_key_type_t *R) +{ + return (R->hasPreserve * R->nMapEntries); +} + +xcb_xkb_mod_def_iterator_t +xcb_xkb_key_type_preserve_iterator (const xcb_xkb_key_type_t *R) +{ + xcb_xkb_mod_def_iterator_t i; + xcb_generic_iterator_t prev = xcb_xkb_kt_map_entry_end(xcb_xkb_key_type_map_iterator(R)); + i.data = (xcb_xkb_mod_def_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_mod_def_t, prev.index)); + i.rem = (R->hasPreserve * R->nMapEntries); + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_xkb_key_type_next (xcb_xkb_key_type_iterator_t *i) +{ + xcb_xkb_key_type_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_xkb_key_type_t *)(((char *)R) + xcb_xkb_key_type_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_xkb_key_type_t *) child.data; +} + +xcb_generic_iterator_t +xcb_xkb_key_type_end (xcb_xkb_key_type_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_xkb_key_type_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_xkb_key_sym_map_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_key_sym_map_t *_aux = (xcb_xkb_key_sym_map_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_xkb_key_sym_map_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* syms */ + xcb_block_len += _aux->nSyms * sizeof(xcb_keysym_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_keysym_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_keysym_t * +xcb_xkb_key_sym_map_syms (const xcb_xkb_key_sym_map_t *R) +{ + return (xcb_keysym_t *) (R + 1); +} + +int +xcb_xkb_key_sym_map_syms_length (const xcb_xkb_key_sym_map_t *R) +{ + return R->nSyms; +} + +xcb_generic_iterator_t +xcb_xkb_key_sym_map_syms_end (const xcb_xkb_key_sym_map_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_keysym_t *) (R + 1)) + (R->nSyms); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_xkb_key_sym_map_next (xcb_xkb_key_sym_map_iterator_t *i) +{ + xcb_xkb_key_sym_map_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_xkb_key_sym_map_t *)(((char *)R) + xcb_xkb_key_sym_map_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_xkb_key_sym_map_t *) child.data; +} + +xcb_generic_iterator_t +xcb_xkb_key_sym_map_end (xcb_xkb_key_sym_map_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_xkb_key_sym_map_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +void +xcb_xkb_common_behavior_next (xcb_xkb_common_behavior_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_common_behavior_t); +} + +xcb_generic_iterator_t +xcb_xkb_common_behavior_end (xcb_xkb_common_behavior_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; +} + +void +xcb_xkb_default_behavior_next (xcb_xkb_default_behavior_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_default_behavior_t); +} + +xcb_generic_iterator_t +xcb_xkb_default_behavior_end (xcb_xkb_default_behavior_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; +} + +void +xcb_xkb_lock_behavior_next (xcb_xkb_lock_behavior_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_lock_behavior_t); +} + +xcb_generic_iterator_t +xcb_xkb_lock_behavior_end (xcb_xkb_lock_behavior_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; +} + +void +xcb_xkb_radio_group_behavior_next (xcb_xkb_radio_group_behavior_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_radio_group_behavior_t); +} + +xcb_generic_iterator_t +xcb_xkb_radio_group_behavior_end (xcb_xkb_radio_group_behavior_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; +} + +void +xcb_xkb_overlay_behavior_next (xcb_xkb_overlay_behavior_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_overlay_behavior_t); +} + +xcb_generic_iterator_t +xcb_xkb_overlay_behavior_end (xcb_xkb_overlay_behavior_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; +} + +void +xcb_xkb_permament_lock_behavior_next (xcb_xkb_permament_lock_behavior_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_permament_lock_behavior_t); +} + +xcb_generic_iterator_t +xcb_xkb_permament_lock_behavior_end (xcb_xkb_permament_lock_behavior_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; +} + +void +xcb_xkb_permament_radio_group_behavior_next (xcb_xkb_permament_radio_group_behavior_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_permament_radio_group_behavior_t); +} + +xcb_generic_iterator_t +xcb_xkb_permament_radio_group_behavior_end (xcb_xkb_permament_radio_group_behavior_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; +} + +void +xcb_xkb_permament_overlay_behavior_next (xcb_xkb_permament_overlay_behavior_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_permament_overlay_behavior_t); +} + +xcb_generic_iterator_t +xcb_xkb_permament_overlay_behavior_end (xcb_xkb_permament_overlay_behavior_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; +} + +void +xcb_xkb_behavior_next (xcb_xkb_behavior_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_behavior_t); +} + +xcb_generic_iterator_t +xcb_xkb_behavior_end (xcb_xkb_behavior_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; +} + +void +xcb_xkb_set_behavior_next (xcb_xkb_set_behavior_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_set_behavior_t); +} + +xcb_generic_iterator_t +xcb_xkb_set_behavior_end (xcb_xkb_set_behavior_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; +} + +void +xcb_xkb_set_explicit_next (xcb_xkb_set_explicit_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_set_explicit_t); +} + +xcb_generic_iterator_t +xcb_xkb_set_explicit_end (xcb_xkb_set_explicit_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; +} + +void +xcb_xkb_key_mod_map_next (xcb_xkb_key_mod_map_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_key_mod_map_t); +} + +xcb_generic_iterator_t +xcb_xkb_key_mod_map_end (xcb_xkb_key_mod_map_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; +} + +void +xcb_xkb_key_v_mod_map_next (xcb_xkb_key_v_mod_map_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_key_v_mod_map_t); +} + +xcb_generic_iterator_t +xcb_xkb_key_v_mod_map_end (xcb_xkb_key_v_mod_map_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; +} + +void +xcb_xkb_kt_set_map_entry_next (xcb_xkb_kt_set_map_entry_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_kt_set_map_entry_t); +} + +xcb_generic_iterator_t +xcb_xkb_kt_set_map_entry_end (xcb_xkb_kt_set_map_entry_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; +} + +int +xcb_xkb_set_key_type_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_set_key_type_t *_aux = (xcb_xkb_set_key_type_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_xkb_set_key_type_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* entries */ + xcb_block_len += _aux->nMapEntries * sizeof(xcb_xkb_kt_set_map_entry_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_kt_set_map_entry_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; + /* preserve_entries */ + xcb_block_len += (_aux->preserve * _aux->nMapEntries) * sizeof(xcb_xkb_kt_set_map_entry_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_kt_set_map_entry_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_xkb_kt_set_map_entry_t * +xcb_xkb_set_key_type_entries (const xcb_xkb_set_key_type_t *R) +{ + return (xcb_xkb_kt_set_map_entry_t *) (R + 1); +} + +int +xcb_xkb_set_key_type_entries_length (const xcb_xkb_set_key_type_t *R) +{ + return R->nMapEntries; +} + +xcb_xkb_kt_set_map_entry_iterator_t +xcb_xkb_set_key_type_entries_iterator (const xcb_xkb_set_key_type_t *R) +{ + xcb_xkb_kt_set_map_entry_iterator_t i; + i.data = (xcb_xkb_kt_set_map_entry_t *) (R + 1); + i.rem = R->nMapEntries; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xkb_kt_set_map_entry_t * +xcb_xkb_set_key_type_preserve_entries (const xcb_xkb_set_key_type_t *R) +{ + xcb_generic_iterator_t prev = xcb_xkb_kt_set_map_entry_end(xcb_xkb_set_key_type_entries_iterator(R)); + return (xcb_xkb_kt_set_map_entry_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_kt_set_map_entry_t, prev.index) + 0); +} + +int +xcb_xkb_set_key_type_preserve_entries_length (const xcb_xkb_set_key_type_t *R) +{ + return (R->preserve * R->nMapEntries); +} + +xcb_xkb_kt_set_map_entry_iterator_t +xcb_xkb_set_key_type_preserve_entries_iterator (const xcb_xkb_set_key_type_t *R) +{ + xcb_xkb_kt_set_map_entry_iterator_t i; + xcb_generic_iterator_t prev = xcb_xkb_kt_set_map_entry_end(xcb_xkb_set_key_type_entries_iterator(R)); + i.data = (xcb_xkb_kt_set_map_entry_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_kt_set_map_entry_t, prev.index)); + i.rem = (R->preserve * R->nMapEntries); + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_xkb_set_key_type_next (xcb_xkb_set_key_type_iterator_t *i) +{ + xcb_xkb_set_key_type_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_xkb_set_key_type_t *)(((char *)R) + xcb_xkb_set_key_type_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_xkb_set_key_type_t *) child.data; +} + +xcb_generic_iterator_t +xcb_xkb_set_key_type_end (xcb_xkb_set_key_type_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_xkb_set_key_type_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +void +xcb_xkb_string8_next (xcb_xkb_string8_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_string8_t); +} + +xcb_generic_iterator_t +xcb_xkb_string8_end (xcb_xkb_string8_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; +} + +int +xcb_xkb_outline_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_outline_t *_aux = (xcb_xkb_outline_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_xkb_outline_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* points */ + xcb_block_len += _aux->nPoints * sizeof(xcb_point_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_point_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_point_t * +xcb_xkb_outline_points (const xcb_xkb_outline_t *R) +{ + return (xcb_point_t *) (R + 1); +} + +int +xcb_xkb_outline_points_length (const xcb_xkb_outline_t *R) +{ + return R->nPoints; +} + +xcb_point_iterator_t +xcb_xkb_outline_points_iterator (const xcb_xkb_outline_t *R) +{ + xcb_point_iterator_t i; + i.data = (xcb_point_t *) (R + 1); + i.rem = R->nPoints; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_xkb_outline_next (xcb_xkb_outline_iterator_t *i) +{ + xcb_xkb_outline_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_xkb_outline_t *)(((char *)R) + xcb_xkb_outline_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_xkb_outline_t *) child.data; +} + +xcb_generic_iterator_t +xcb_xkb_outline_end (xcb_xkb_outline_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_xkb_outline_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_xkb_shape_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_shape_t *_aux = (xcb_xkb_shape_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_xkb_shape_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* outlines */ + for(i=0; i<_aux->nOutlines; i++) { + xcb_tmp_len = xcb_xkb_outline_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xkb_outline_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; +} + +int +xcb_xkb_shape_outlines_length (const xcb_xkb_shape_t *R) +{ + return R->nOutlines; +} + +xcb_xkb_outline_iterator_t +xcb_xkb_shape_outlines_iterator (const xcb_xkb_shape_t *R) +{ + xcb_xkb_outline_iterator_t i; + i.data = (xcb_xkb_outline_t *) (R + 1); + i.rem = R->nOutlines; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_xkb_shape_next (xcb_xkb_shape_iterator_t *i) +{ + xcb_xkb_shape_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_xkb_shape_t *)(((char *)R) + xcb_xkb_shape_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_xkb_shape_t *) child.data; +} + +xcb_generic_iterator_t +xcb_xkb_shape_end (xcb_xkb_shape_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_xkb_shape_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +void +xcb_xkb_key_next (xcb_xkb_key_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_key_t); +} + +xcb_generic_iterator_t +xcb_xkb_key_end (xcb_xkb_key_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; +} + +void +xcb_xkb_overlay_key_next (xcb_xkb_overlay_key_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_overlay_key_t); +} + +xcb_generic_iterator_t +xcb_xkb_overlay_key_end (xcb_xkb_overlay_key_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; +} + +int +xcb_xkb_overlay_row_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_overlay_row_t *_aux = (xcb_xkb_overlay_row_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_xkb_overlay_row_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* keys */ + xcb_block_len += _aux->nKeys * sizeof(xcb_xkb_overlay_key_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_overlay_key_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_xkb_overlay_key_t * +xcb_xkb_overlay_row_keys (const xcb_xkb_overlay_row_t *R) +{ + return (xcb_xkb_overlay_key_t *) (R + 1); +} + +int +xcb_xkb_overlay_row_keys_length (const xcb_xkb_overlay_row_t *R) +{ + return R->nKeys; +} + +xcb_xkb_overlay_key_iterator_t +xcb_xkb_overlay_row_keys_iterator (const xcb_xkb_overlay_row_t *R) +{ + xcb_xkb_overlay_key_iterator_t i; + i.data = (xcb_xkb_overlay_key_t *) (R + 1); + i.rem = R->nKeys; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_xkb_overlay_row_next (xcb_xkb_overlay_row_iterator_t *i) +{ + xcb_xkb_overlay_row_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_xkb_overlay_row_t *)(((char *)R) + xcb_xkb_overlay_row_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_xkb_overlay_row_t *) child.data; +} + +xcb_generic_iterator_t +xcb_xkb_overlay_row_end (xcb_xkb_overlay_row_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_xkb_overlay_row_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_xkb_overlay_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_overlay_t *_aux = (xcb_xkb_overlay_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_xkb_overlay_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* rows */ + for(i=0; i<_aux->nRows; i++) { + xcb_tmp_len = xcb_xkb_overlay_row_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xkb_overlay_row_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; +} + +int +xcb_xkb_overlay_rows_length (const xcb_xkb_overlay_t *R) +{ + return R->nRows; +} + +xcb_xkb_overlay_row_iterator_t +xcb_xkb_overlay_rows_iterator (const xcb_xkb_overlay_t *R) +{ + xcb_xkb_overlay_row_iterator_t i; + i.data = (xcb_xkb_overlay_row_t *) (R + 1); + i.rem = R->nRows; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_xkb_overlay_next (xcb_xkb_overlay_iterator_t *i) +{ + xcb_xkb_overlay_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_xkb_overlay_t *)(((char *)R) + xcb_xkb_overlay_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_xkb_overlay_t *) child.data; +} + +xcb_generic_iterator_t +xcb_xkb_overlay_end (xcb_xkb_overlay_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_xkb_overlay_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_xkb_row_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_row_t *_aux = (xcb_xkb_row_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_xkb_row_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* keys */ + xcb_block_len += _aux->nKeys * sizeof(xcb_xkb_key_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_key_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_xkb_key_t * +xcb_xkb_row_keys (const xcb_xkb_row_t *R) +{ + return (xcb_xkb_key_t *) (R + 1); +} + +int +xcb_xkb_row_keys_length (const xcb_xkb_row_t *R) +{ + return R->nKeys; +} + +xcb_xkb_key_iterator_t +xcb_xkb_row_keys_iterator (const xcb_xkb_row_t *R) +{ + xcb_xkb_key_iterator_t i; + i.data = (xcb_xkb_key_t *) (R + 1); + i.rem = R->nKeys; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_xkb_row_next (xcb_xkb_row_iterator_t *i) +{ + xcb_xkb_row_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_xkb_row_t *)(((char *)R) + xcb_xkb_row_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_xkb_row_t *) child.data; +} + +xcb_generic_iterator_t +xcb_xkb_row_end (xcb_xkb_row_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_xkb_row_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_xkb_listing_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_listing_t *_aux = (xcb_xkb_listing_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_xkb_listing_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* string */ + xcb_block_len += _aux->length * sizeof(xcb_xkb_string8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_string8_t); + xcb_align_to = 2; + /* 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; + /* 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_xkb_string8_t * +xcb_xkb_listing_string (const xcb_xkb_listing_t *R) +{ + return (xcb_xkb_string8_t *) (R + 1); +} + +int +xcb_xkb_listing_string_length (const xcb_xkb_listing_t *R) +{ + return R->length; +} + +xcb_generic_iterator_t +xcb_xkb_listing_string_end (const xcb_xkb_listing_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_xkb_string8_t *) (R + 1)) + (R->length); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_xkb_listing_next (xcb_xkb_listing_iterator_t *i) +{ + xcb_xkb_listing_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_xkb_listing_t *)(((char *)R) + xcb_xkb_listing_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_xkb_listing_t *) child.data; +} + +xcb_generic_iterator_t +xcb_xkb_listing_end (xcb_xkb_listing_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_xkb_listing_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_xkb_device_led_info_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_device_led_info_t *_aux = (xcb_xkb_device_led_info_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_xkb_device_led_info_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* names */ + xcb_block_len += xcb_popcount(_aux->namesPresent) * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_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; + /* maps */ + xcb_block_len += xcb_popcount(_aux->mapsPresent) * sizeof(xcb_xkb_indicator_map_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_indicator_map_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_atom_t * +xcb_xkb_device_led_info_names (const xcb_xkb_device_led_info_t *R) +{ + return (xcb_atom_t *) (R + 1); +} + +int +xcb_xkb_device_led_info_names_length (const xcb_xkb_device_led_info_t *R) +{ + return xcb_popcount(R->namesPresent); +} + +xcb_generic_iterator_t +xcb_xkb_device_led_info_names_end (const xcb_xkb_device_led_info_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_atom_t *) (R + 1)) + (xcb_popcount(R->namesPresent)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xkb_indicator_map_t * +xcb_xkb_device_led_info_maps (const xcb_xkb_device_led_info_t *R) +{ + xcb_generic_iterator_t prev = xcb_xkb_device_led_info_names_end(R); + return (xcb_xkb_indicator_map_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_indicator_map_t, prev.index) + 0); +} + +int +xcb_xkb_device_led_info_maps_length (const xcb_xkb_device_led_info_t *R) +{ + return xcb_popcount(R->mapsPresent); +} + +xcb_xkb_indicator_map_iterator_t +xcb_xkb_device_led_info_maps_iterator (const xcb_xkb_device_led_info_t *R) +{ + xcb_xkb_indicator_map_iterator_t i; + xcb_generic_iterator_t prev = xcb_xkb_device_led_info_names_end(R); + i.data = (xcb_xkb_indicator_map_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_indicator_map_t, prev.index)); + i.rem = xcb_popcount(R->mapsPresent); + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_xkb_device_led_info_next (xcb_xkb_device_led_info_iterator_t *i) +{ + xcb_xkb_device_led_info_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_xkb_device_led_info_t *)(((char *)R) + xcb_xkb_device_led_info_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_xkb_device_led_info_t *) child.data; +} + +xcb_generic_iterator_t +xcb_xkb_device_led_info_end (xcb_xkb_device_led_info_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_xkb_device_led_info_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +void +xcb_xkb_sa_no_action_next (xcb_xkb_sa_no_action_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_sa_no_action_t); +} + +xcb_generic_iterator_t +xcb_xkb_sa_no_action_end (xcb_xkb_sa_no_action_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; +} + +void +xcb_xkb_sa_set_mods_next (xcb_xkb_sa_set_mods_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_sa_set_mods_t); +} + +xcb_generic_iterator_t +xcb_xkb_sa_set_mods_end (xcb_xkb_sa_set_mods_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; +} + +void +xcb_xkb_sa_latch_mods_next (xcb_xkb_sa_latch_mods_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_sa_latch_mods_t); +} + +xcb_generic_iterator_t +xcb_xkb_sa_latch_mods_end (xcb_xkb_sa_latch_mods_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; +} + +void +xcb_xkb_sa_lock_mods_next (xcb_xkb_sa_lock_mods_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_sa_lock_mods_t); +} + +xcb_generic_iterator_t +xcb_xkb_sa_lock_mods_end (xcb_xkb_sa_lock_mods_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; +} + +void +xcb_xkb_sa_set_group_next (xcb_xkb_sa_set_group_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_sa_set_group_t); +} + +xcb_generic_iterator_t +xcb_xkb_sa_set_group_end (xcb_xkb_sa_set_group_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; +} + +void +xcb_xkb_sa_latch_group_next (xcb_xkb_sa_latch_group_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_sa_latch_group_t); +} + +xcb_generic_iterator_t +xcb_xkb_sa_latch_group_end (xcb_xkb_sa_latch_group_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; +} + +void +xcb_xkb_sa_lock_group_next (xcb_xkb_sa_lock_group_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_sa_lock_group_t); +} + +xcb_generic_iterator_t +xcb_xkb_sa_lock_group_end (xcb_xkb_sa_lock_group_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; +} + +void +xcb_xkb_sa_move_ptr_next (xcb_xkb_sa_move_ptr_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_sa_move_ptr_t); +} + +xcb_generic_iterator_t +xcb_xkb_sa_move_ptr_end (xcb_xkb_sa_move_ptr_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; +} + +void +xcb_xkb_sa_ptr_btn_next (xcb_xkb_sa_ptr_btn_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_sa_ptr_btn_t); +} + +xcb_generic_iterator_t +xcb_xkb_sa_ptr_btn_end (xcb_xkb_sa_ptr_btn_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; +} + +void +xcb_xkb_sa_lock_ptr_btn_next (xcb_xkb_sa_lock_ptr_btn_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_sa_lock_ptr_btn_t); +} + +xcb_generic_iterator_t +xcb_xkb_sa_lock_ptr_btn_end (xcb_xkb_sa_lock_ptr_btn_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; +} + +void +xcb_xkb_sa_set_ptr_dflt_next (xcb_xkb_sa_set_ptr_dflt_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_sa_set_ptr_dflt_t); +} + +xcb_generic_iterator_t +xcb_xkb_sa_set_ptr_dflt_end (xcb_xkb_sa_set_ptr_dflt_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; +} + +void +xcb_xkb_sa_iso_lock_next (xcb_xkb_sa_iso_lock_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_sa_iso_lock_t); +} + +xcb_generic_iterator_t +xcb_xkb_sa_iso_lock_end (xcb_xkb_sa_iso_lock_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; +} + +void +xcb_xkb_sa_terminate_next (xcb_xkb_sa_terminate_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_sa_terminate_t); +} + +xcb_generic_iterator_t +xcb_xkb_sa_terminate_end (xcb_xkb_sa_terminate_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; +} + +void +xcb_xkb_sa_switch_screen_next (xcb_xkb_sa_switch_screen_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_sa_switch_screen_t); +} + +xcb_generic_iterator_t +xcb_xkb_sa_switch_screen_end (xcb_xkb_sa_switch_screen_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; +} + +void +xcb_xkb_sa_set_controls_next (xcb_xkb_sa_set_controls_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_sa_set_controls_t); +} + +xcb_generic_iterator_t +xcb_xkb_sa_set_controls_end (xcb_xkb_sa_set_controls_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; +} + +void +xcb_xkb_sa_lock_controls_next (xcb_xkb_sa_lock_controls_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_sa_lock_controls_t); +} + +xcb_generic_iterator_t +xcb_xkb_sa_lock_controls_end (xcb_xkb_sa_lock_controls_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; +} + +void +xcb_xkb_sa_action_message_next (xcb_xkb_sa_action_message_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_sa_action_message_t); +} + +xcb_generic_iterator_t +xcb_xkb_sa_action_message_end (xcb_xkb_sa_action_message_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; +} + +void +xcb_xkb_sa_redirect_key_next (xcb_xkb_sa_redirect_key_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_sa_redirect_key_t); +} + +xcb_generic_iterator_t +xcb_xkb_sa_redirect_key_end (xcb_xkb_sa_redirect_key_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; +} + +void +xcb_xkb_sa_device_btn_next (xcb_xkb_sa_device_btn_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_sa_device_btn_t); +} + +xcb_generic_iterator_t +xcb_xkb_sa_device_btn_end (xcb_xkb_sa_device_btn_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; +} + +void +xcb_xkb_sa_lock_device_btn_next (xcb_xkb_sa_lock_device_btn_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_sa_lock_device_btn_t); +} + +xcb_generic_iterator_t +xcb_xkb_sa_lock_device_btn_end (xcb_xkb_sa_lock_device_btn_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; +} + +void +xcb_xkb_sa_device_valuator_next (xcb_xkb_sa_device_valuator_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_sa_device_valuator_t); +} + +xcb_generic_iterator_t +xcb_xkb_sa_device_valuator_end (xcb_xkb_sa_device_valuator_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; +} + +void +xcb_xkb_si_action_next (xcb_xkb_si_action_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_si_action_t); +} + +xcb_generic_iterator_t +xcb_xkb_si_action_end (xcb_xkb_si_action_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; +} + +void +xcb_xkb_sym_interpret_next (xcb_xkb_sym_interpret_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_sym_interpret_t); +} + +xcb_generic_iterator_t +xcb_xkb_sym_interpret_end (xcb_xkb_sym_interpret_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; +} + +void +xcb_xkb_action_next (xcb_xkb_action_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xkb_action_t); +} + +xcb_generic_iterator_t +xcb_xkb_action_end (xcb_xkb_action_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_xkb_use_extension_cookie_t +xcb_xkb_use_extension (xcb_connection_t *c, + uint16_t wantedMajor, + uint16_t wantedMinor) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_USE_EXTENSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_use_extension_cookie_t xcb_ret; + xcb_xkb_use_extension_request_t xcb_out; + + xcb_out.wantedMajor = wantedMajor; + xcb_out.wantedMinor = wantedMinor; + + 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_xkb_use_extension_cookie_t +xcb_xkb_use_extension_unchecked (xcb_connection_t *c, + uint16_t wantedMajor, + uint16_t wantedMinor) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_USE_EXTENSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_use_extension_cookie_t xcb_ret; + xcb_xkb_use_extension_request_t xcb_out; + + xcb_out.wantedMajor = wantedMajor; + xcb_out.wantedMinor = wantedMinor; + + 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_xkb_use_extension_reply_t * +xcb_xkb_use_extension_reply (xcb_connection_t *c, + xcb_xkb_use_extension_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xkb_use_extension_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_xkb_select_events_details_serialize (void **_buffer, + uint16_t affectWhich, + uint16_t clear, + uint16_t selectAll, + const xcb_xkb_select_events_details_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[23]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if((affectWhich & ((~clear) & (~selectAll))) & XCB_XKB_EVENT_TYPE_NEW_KEYBOARD_NOTIFY) { + /* xcb_xkb_select_events_details_t.affectNewKeyboard */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->affectNewKeyboard; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_select_events_details_t.newKeyboardDetails */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->newKeyboardDetails; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + } + if((affectWhich & ((~clear) & (~selectAll))) & XCB_XKB_EVENT_TYPE_STATE_NOTIFY) { + /* xcb_xkb_select_events_details_t.affectState */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->affectState; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_select_events_details_t.stateDetails */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->stateDetails; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + } + if((affectWhich & ((~clear) & (~selectAll))) & XCB_XKB_EVENT_TYPE_CONTROLS_NOTIFY) { + /* xcb_xkb_select_events_details_t.affectCtrls */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->affectCtrls; + 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); + /* xcb_xkb_select_events_details_t.ctrlDetails */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->ctrlDetails; + 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((affectWhich & ((~clear) & (~selectAll))) & XCB_XKB_EVENT_TYPE_INDICATOR_STATE_NOTIFY) { + /* xcb_xkb_select_events_details_t.affectIndicatorState */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->affectIndicatorState; + 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); + /* xcb_xkb_select_events_details_t.indicatorStateDetails */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->indicatorStateDetails; + 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((affectWhich & ((~clear) & (~selectAll))) & XCB_XKB_EVENT_TYPE_INDICATOR_MAP_NOTIFY) { + /* xcb_xkb_select_events_details_t.affectIndicatorMap */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->affectIndicatorMap; + 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); + /* xcb_xkb_select_events_details_t.indicatorMapDetails */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->indicatorMapDetails; + 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((affectWhich & ((~clear) & (~selectAll))) & XCB_XKB_EVENT_TYPE_NAMES_NOTIFY) { + /* xcb_xkb_select_events_details_t.affectNames */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->affectNames; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_select_events_details_t.namesDetails */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->namesDetails; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + } + if((affectWhich & ((~clear) & (~selectAll))) & XCB_XKB_EVENT_TYPE_COMPAT_MAP_NOTIFY) { + /* xcb_xkb_select_events_details_t.affectCompat */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->affectCompat; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_select_events_details_t.compatDetails */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->compatDetails; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + } + if((affectWhich & ((~clear) & (~selectAll))) & XCB_XKB_EVENT_TYPE_BELL_NOTIFY) { + /* xcb_xkb_select_events_details_t.affectBell */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->affectBell; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_select_events_details_t.bellDetails */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->bellDetails; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + } + if((affectWhich & ((~clear) & (~selectAll))) & XCB_XKB_EVENT_TYPE_ACTION_MESSAGE) { + /* xcb_xkb_select_events_details_t.affectMsgDetails */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->affectMsgDetails; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_select_events_details_t.msgDetails */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->msgDetails; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + } + if((affectWhich & ((~clear) & (~selectAll))) & XCB_XKB_EVENT_TYPE_ACCESS_X_NOTIFY) { + /* xcb_xkb_select_events_details_t.affectAccessX */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->affectAccessX; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_select_events_details_t.accessXDetails */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->accessXDetails; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + } + if((affectWhich & ((~clear) & (~selectAll))) & XCB_XKB_EVENT_TYPE_EXTENSION_DEVICE_NOTIFY) { + /* xcb_xkb_select_events_details_t.affectExtDev */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->affectExtDev; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_select_events_details_t.extdevDetails */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->extdevDetails; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_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_xkb_select_events_details_unpack (const void *_buffer, + uint16_t affectWhich, + uint16_t clear, + uint16_t selectAll, + xcb_xkb_select_events_details_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((affectWhich & ((~clear) & (~selectAll))) & XCB_XKB_EVENT_TYPE_NEW_KEYBOARD_NOTIFY) { + /* xcb_xkb_select_events_details_t.affectNewKeyboard */ + _aux->affectNewKeyboard = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_select_events_details_t.newKeyboardDetails */ + _aux->newKeyboardDetails = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + } + if((affectWhich & ((~clear) & (~selectAll))) & XCB_XKB_EVENT_TYPE_STATE_NOTIFY) { + /* xcb_xkb_select_events_details_t.affectState */ + _aux->affectState = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_select_events_details_t.stateDetails */ + _aux->stateDetails = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + } + if((affectWhich & ((~clear) & (~selectAll))) & XCB_XKB_EVENT_TYPE_CONTROLS_NOTIFY) { + /* xcb_xkb_select_events_details_t.affectCtrls */ + _aux->affectCtrls = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_xkb_select_events_details_t.ctrlDetails */ + _aux->ctrlDetails = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + } + if((affectWhich & ((~clear) & (~selectAll))) & XCB_XKB_EVENT_TYPE_INDICATOR_STATE_NOTIFY) { + /* xcb_xkb_select_events_details_t.affectIndicatorState */ + _aux->affectIndicatorState = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_xkb_select_events_details_t.indicatorStateDetails */ + _aux->indicatorStateDetails = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + } + if((affectWhich & ((~clear) & (~selectAll))) & XCB_XKB_EVENT_TYPE_INDICATOR_MAP_NOTIFY) { + /* xcb_xkb_select_events_details_t.affectIndicatorMap */ + _aux->affectIndicatorMap = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_xkb_select_events_details_t.indicatorMapDetails */ + _aux->indicatorMapDetails = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + } + if((affectWhich & ((~clear) & (~selectAll))) & XCB_XKB_EVENT_TYPE_NAMES_NOTIFY) { + /* xcb_xkb_select_events_details_t.affectNames */ + _aux->affectNames = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_select_events_details_t.namesDetails */ + _aux->namesDetails = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + } + if((affectWhich & ((~clear) & (~selectAll))) & XCB_XKB_EVENT_TYPE_COMPAT_MAP_NOTIFY) { + /* xcb_xkb_select_events_details_t.affectCompat */ + _aux->affectCompat = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_select_events_details_t.compatDetails */ + _aux->compatDetails = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + } + if((affectWhich & ((~clear) & (~selectAll))) & XCB_XKB_EVENT_TYPE_BELL_NOTIFY) { + /* xcb_xkb_select_events_details_t.affectBell */ + _aux->affectBell = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_select_events_details_t.bellDetails */ + _aux->bellDetails = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + } + if((affectWhich & ((~clear) & (~selectAll))) & XCB_XKB_EVENT_TYPE_ACTION_MESSAGE) { + /* xcb_xkb_select_events_details_t.affectMsgDetails */ + _aux->affectMsgDetails = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_select_events_details_t.msgDetails */ + _aux->msgDetails = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + } + if((affectWhich & ((~clear) & (~selectAll))) & XCB_XKB_EVENT_TYPE_ACCESS_X_NOTIFY) { + /* xcb_xkb_select_events_details_t.affectAccessX */ + _aux->affectAccessX = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_select_events_details_t.accessXDetails */ + _aux->accessXDetails = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + } + if((affectWhich & ((~clear) & (~selectAll))) & XCB_XKB_EVENT_TYPE_EXTENSION_DEVICE_NOTIFY) { + /* xcb_xkb_select_events_details_t.affectExtDev */ + _aux->affectExtDev = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_select_events_details_t.extdevDetails */ + _aux->extdevDetails = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_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_xkb_select_events_details_sizeof (const void *_buffer, + uint16_t affectWhich, + uint16_t clear, + uint16_t selectAll) +{ + xcb_xkb_select_events_details_t _aux; + return xcb_xkb_select_events_details_unpack(_buffer, affectWhich, clear, selectAll, &_aux); +} + +int +xcb_xkb_select_events_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_select_events_request_t *_aux = (xcb_xkb_select_events_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_xkb_select_events_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* details */ + xcb_block_len += xcb_xkb_select_events_details_sizeof(xcb_tmp, _aux->affectWhich, _aux->clear, _aux->selectAll); + 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_xkb_select_events_checked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint16_t affectWhich, + uint16_t clear, + uint16_t selectAll, + uint16_t affectMap, + uint16_t map, + const void *details) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SELECT_EVENTS, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_select_events_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.affectWhich = affectWhich; + xcb_out.clear = clear; + xcb_out.selectAll = selectAll; + xcb_out.affectMap = affectMap; + xcb_out.map = map; + + 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_xkb_select_events_details_t details */ + xcb_parts[4].iov_base = (char *) details; + xcb_parts[4].iov_len = + xcb_xkb_select_events_details_sizeof (details, affectWhich, clear, selectAll); + + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_xkb_select_events (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint16_t affectWhich, + uint16_t clear, + uint16_t selectAll, + uint16_t affectMap, + uint16_t map, + const void *details) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SELECT_EVENTS, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_select_events_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.affectWhich = affectWhich; + xcb_out.clear = clear; + xcb_out.selectAll = selectAll; + xcb_out.affectMap = affectMap; + xcb_out.map = map; + + 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_xkb_select_events_details_t details */ + xcb_parts[4].iov_base = (char *) details; + xcb_parts[4].iov_len = + xcb_xkb_select_events_details_sizeof (details, affectWhich, clear, selectAll); + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_xkb_select_events_aux_checked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint16_t affectWhich, + uint16_t clear, + uint16_t selectAll, + uint16_t affectMap, + uint16_t map, + const xcb_xkb_select_events_details_t *details) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SELECT_EVENTS, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_select_events_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.affectWhich = affectWhich; + xcb_out.clear = clear; + xcb_out.selectAll = selectAll; + xcb_out.affectMap = affectMap; + xcb_out.map = map; + + 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_xkb_select_events_details_t details */ + xcb_parts[4].iov_len = + xcb_xkb_select_events_details_serialize (&xcb_aux0, affectWhich, clear, selectAll, details); + 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_xkb_select_events_aux (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint16_t affectWhich, + uint16_t clear, + uint16_t selectAll, + uint16_t affectMap, + uint16_t map, + const xcb_xkb_select_events_details_t *details) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SELECT_EVENTS, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_select_events_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.affectWhich = affectWhich; + xcb_out.clear = clear; + xcb_out.selectAll = selectAll; + xcb_out.affectMap = affectMap; + xcb_out.map = map; + + 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_xkb_select_events_details_t details */ + xcb_parts[4].iov_len = + xcb_xkb_select_events_details_serialize (&xcb_aux0, affectWhich, clear, selectAll, details); + 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_xkb_select_events_details (const xcb_xkb_select_events_request_t *R) +{ + return (void *) (R + 1); +} + +xcb_void_cookie_t +xcb_xkb_bell_checked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + xcb_xkb_bell_class_spec_t bellClass, + xcb_xkb_id_spec_t bellID, + int8_t percent, + uint8_t forceSound, + uint8_t eventOnly, + int16_t pitch, + int16_t duration, + xcb_atom_t name, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_BELL, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_bell_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.bellClass = bellClass; + xcb_out.bellID = bellID; + xcb_out.percent = percent; + xcb_out.forceSound = forceSound; + xcb_out.eventOnly = eventOnly; + xcb_out.pad0 = 0; + xcb_out.pitch = pitch; + xcb_out.duration = duration; + memset(xcb_out.pad1, 0, 2); + xcb_out.name = name; + 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_xkb_bell (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + xcb_xkb_bell_class_spec_t bellClass, + xcb_xkb_id_spec_t bellID, + int8_t percent, + uint8_t forceSound, + uint8_t eventOnly, + int16_t pitch, + int16_t duration, + xcb_atom_t name, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_BELL, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_bell_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.bellClass = bellClass; + xcb_out.bellID = bellID; + xcb_out.percent = percent; + xcb_out.forceSound = forceSound; + xcb_out.eventOnly = eventOnly; + xcb_out.pad0 = 0; + xcb_out.pitch = pitch; + xcb_out.duration = duration; + memset(xcb_out.pad1, 0, 2); + xcb_out.name = name; + 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_xkb_get_state_cookie_t +xcb_xkb_get_state (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_GET_STATE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_get_state_cookie_t xcb_ret; + xcb_xkb_get_state_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + 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_xkb_get_state_cookie_t +xcb_xkb_get_state_unchecked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_GET_STATE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_get_state_cookie_t xcb_ret; + xcb_xkb_get_state_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + 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_xkb_get_state_reply_t * +xcb_xkb_get_state_reply (xcb_connection_t *c, + xcb_xkb_get_state_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xkb_get_state_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_xkb_latch_lock_state_checked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint8_t affectModLocks, + uint8_t modLocks, + uint8_t lockGroup, + uint8_t groupLock, + uint8_t affectModLatches, + uint8_t latchGroup, + uint16_t groupLatch) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_LATCH_LOCK_STATE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_latch_lock_state_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.affectModLocks = affectModLocks; + xcb_out.modLocks = modLocks; + xcb_out.lockGroup = lockGroup; + xcb_out.groupLock = groupLock; + xcb_out.affectModLatches = affectModLatches; + xcb_out.pad0 = 0; + xcb_out.pad1 = 0; + xcb_out.latchGroup = latchGroup; + xcb_out.groupLatch = groupLatch; + + 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_xkb_latch_lock_state (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint8_t affectModLocks, + uint8_t modLocks, + uint8_t lockGroup, + uint8_t groupLock, + uint8_t affectModLatches, + uint8_t latchGroup, + uint16_t groupLatch) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_LATCH_LOCK_STATE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_latch_lock_state_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.affectModLocks = affectModLocks; + xcb_out.modLocks = modLocks; + xcb_out.lockGroup = lockGroup; + xcb_out.groupLock = groupLock; + xcb_out.affectModLatches = affectModLatches; + xcb_out.pad0 = 0; + xcb_out.pad1 = 0; + xcb_out.latchGroup = latchGroup; + xcb_out.groupLatch = groupLatch; + + 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_xkb_get_controls_cookie_t +xcb_xkb_get_controls (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_GET_CONTROLS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_get_controls_cookie_t xcb_ret; + xcb_xkb_get_controls_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + 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_xkb_get_controls_cookie_t +xcb_xkb_get_controls_unchecked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_GET_CONTROLS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_get_controls_cookie_t xcb_ret; + xcb_xkb_get_controls_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + 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_xkb_get_controls_reply_t * +xcb_xkb_get_controls_reply (xcb_connection_t *c, + xcb_xkb_get_controls_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xkb_get_controls_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_xkb_set_controls_checked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint8_t affectInternalRealMods, + uint8_t internalRealMods, + uint8_t affectIgnoreLockRealMods, + uint8_t ignoreLockRealMods, + uint16_t affectInternalVirtualMods, + uint16_t internalVirtualMods, + uint16_t affectIgnoreLockVirtualMods, + uint16_t ignoreLockVirtualMods, + uint8_t mouseKeysDfltBtn, + uint8_t groupsWrap, + uint16_t accessXOptions, + uint32_t affectEnabledControls, + uint32_t enabledControls, + uint32_t changeControls, + uint16_t repeatDelay, + uint16_t repeatInterval, + uint16_t slowKeysDelay, + uint16_t debounceDelay, + uint16_t mouseKeysDelay, + uint16_t mouseKeysInterval, + uint16_t mouseKeysTimeToMax, + uint16_t mouseKeysMaxSpeed, + int16_t mouseKeysCurve, + uint16_t accessXTimeout, + uint32_t accessXTimeoutMask, + uint32_t accessXTimeoutValues, + uint16_t accessXTimeoutOptionsMask, + uint16_t accessXTimeoutOptionsValues, + const uint8_t *perKeyRepeat) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SET_CONTROLS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_set_controls_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.affectInternalRealMods = affectInternalRealMods; + xcb_out.internalRealMods = internalRealMods; + xcb_out.affectIgnoreLockRealMods = affectIgnoreLockRealMods; + xcb_out.ignoreLockRealMods = ignoreLockRealMods; + xcb_out.affectInternalVirtualMods = affectInternalVirtualMods; + xcb_out.internalVirtualMods = internalVirtualMods; + xcb_out.affectIgnoreLockVirtualMods = affectIgnoreLockVirtualMods; + xcb_out.ignoreLockVirtualMods = ignoreLockVirtualMods; + xcb_out.mouseKeysDfltBtn = mouseKeysDfltBtn; + xcb_out.groupsWrap = groupsWrap; + xcb_out.accessXOptions = accessXOptions; + memset(xcb_out.pad0, 0, 2); + xcb_out.affectEnabledControls = affectEnabledControls; + xcb_out.enabledControls = enabledControls; + xcb_out.changeControls = changeControls; + xcb_out.repeatDelay = repeatDelay; + xcb_out.repeatInterval = repeatInterval; + xcb_out.slowKeysDelay = slowKeysDelay; + xcb_out.debounceDelay = debounceDelay; + xcb_out.mouseKeysDelay = mouseKeysDelay; + xcb_out.mouseKeysInterval = mouseKeysInterval; + xcb_out.mouseKeysTimeToMax = mouseKeysTimeToMax; + xcb_out.mouseKeysMaxSpeed = mouseKeysMaxSpeed; + xcb_out.mouseKeysCurve = mouseKeysCurve; + xcb_out.accessXTimeout = accessXTimeout; + xcb_out.accessXTimeoutMask = accessXTimeoutMask; + xcb_out.accessXTimeoutValues = accessXTimeoutValues; + xcb_out.accessXTimeoutOptionsMask = accessXTimeoutOptionsMask; + xcb_out.accessXTimeoutOptionsValues = accessXTimeoutOptionsValues; + memcpy(xcb_out.perKeyRepeat, perKeyRepeat, 32); + + 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_xkb_set_controls (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint8_t affectInternalRealMods, + uint8_t internalRealMods, + uint8_t affectIgnoreLockRealMods, + uint8_t ignoreLockRealMods, + uint16_t affectInternalVirtualMods, + uint16_t internalVirtualMods, + uint16_t affectIgnoreLockVirtualMods, + uint16_t ignoreLockVirtualMods, + uint8_t mouseKeysDfltBtn, + uint8_t groupsWrap, + uint16_t accessXOptions, + uint32_t affectEnabledControls, + uint32_t enabledControls, + uint32_t changeControls, + uint16_t repeatDelay, + uint16_t repeatInterval, + uint16_t slowKeysDelay, + uint16_t debounceDelay, + uint16_t mouseKeysDelay, + uint16_t mouseKeysInterval, + uint16_t mouseKeysTimeToMax, + uint16_t mouseKeysMaxSpeed, + int16_t mouseKeysCurve, + uint16_t accessXTimeout, + uint32_t accessXTimeoutMask, + uint32_t accessXTimeoutValues, + uint16_t accessXTimeoutOptionsMask, + uint16_t accessXTimeoutOptionsValues, + const uint8_t *perKeyRepeat) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SET_CONTROLS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_set_controls_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.affectInternalRealMods = affectInternalRealMods; + xcb_out.internalRealMods = internalRealMods; + xcb_out.affectIgnoreLockRealMods = affectIgnoreLockRealMods; + xcb_out.ignoreLockRealMods = ignoreLockRealMods; + xcb_out.affectInternalVirtualMods = affectInternalVirtualMods; + xcb_out.internalVirtualMods = internalVirtualMods; + xcb_out.affectIgnoreLockVirtualMods = affectIgnoreLockVirtualMods; + xcb_out.ignoreLockVirtualMods = ignoreLockVirtualMods; + xcb_out.mouseKeysDfltBtn = mouseKeysDfltBtn; + xcb_out.groupsWrap = groupsWrap; + xcb_out.accessXOptions = accessXOptions; + memset(xcb_out.pad0, 0, 2); + xcb_out.affectEnabledControls = affectEnabledControls; + xcb_out.enabledControls = enabledControls; + xcb_out.changeControls = changeControls; + xcb_out.repeatDelay = repeatDelay; + xcb_out.repeatInterval = repeatInterval; + xcb_out.slowKeysDelay = slowKeysDelay; + xcb_out.debounceDelay = debounceDelay; + xcb_out.mouseKeysDelay = mouseKeysDelay; + xcb_out.mouseKeysInterval = mouseKeysInterval; + xcb_out.mouseKeysTimeToMax = mouseKeysTimeToMax; + xcb_out.mouseKeysMaxSpeed = mouseKeysMaxSpeed; + xcb_out.mouseKeysCurve = mouseKeysCurve; + xcb_out.accessXTimeout = accessXTimeout; + xcb_out.accessXTimeoutMask = accessXTimeoutMask; + xcb_out.accessXTimeoutValues = accessXTimeoutValues; + xcb_out.accessXTimeoutOptionsMask = accessXTimeoutOptionsMask; + xcb_out.accessXTimeoutOptionsValues = accessXTimeoutOptionsValues; + memcpy(xcb_out.perKeyRepeat, perKeyRepeat, 32); + + 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_xkb_get_map_map_types_rtrn_length (const xcb_xkb_get_map_reply_t *R, + const xcb_xkb_get_map_map_t *S) +{ + return R->nTypes; +} + +xcb_xkb_key_type_iterator_t +xcb_xkb_get_map_map_types_rtrn_iterator (const xcb_xkb_get_map_reply_t *R, + const xcb_xkb_get_map_map_t *S) +{ + xcb_xkb_key_type_iterator_t i; + i.data = S->types_rtrn; + i.rem = R->nTypes; + i.index = (char *) i.data - (char *) S; + return i; +} + +int +xcb_xkb_get_map_map_syms_rtrn_length (const xcb_xkb_get_map_reply_t *R, + const xcb_xkb_get_map_map_t *S) +{ + return R->nKeySyms; +} + +xcb_xkb_key_sym_map_iterator_t +xcb_xkb_get_map_map_syms_rtrn_iterator (const xcb_xkb_get_map_reply_t *R, + const xcb_xkb_get_map_map_t *S) +{ + xcb_xkb_key_sym_map_iterator_t i; + i.data = S->syms_rtrn; + i.rem = R->nKeySyms; + i.index = (char *) i.data - (char *) S; + return i; +} + +uint8_t * +xcb_xkb_get_map_map_acts_rtrn_count (const xcb_xkb_get_map_map_t *S) +{ + return S->acts_rtrn_count; +} + +int +xcb_xkb_get_map_map_acts_rtrn_count_length (const xcb_xkb_get_map_reply_t *R, + const xcb_xkb_get_map_map_t *S) +{ + return R->nKeyActions; +} + +xcb_generic_iterator_t +xcb_xkb_get_map_map_acts_rtrn_count_end (const xcb_xkb_get_map_reply_t *R, + const xcb_xkb_get_map_map_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->acts_rtrn_count + R->nKeyActions; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_action_t * +xcb_xkb_get_map_map_acts_rtrn_acts (const xcb_xkb_get_map_map_t *S) +{ + return S->acts_rtrn_acts; +} + +int +xcb_xkb_get_map_map_acts_rtrn_acts_length (const xcb_xkb_get_map_reply_t *R, + const xcb_xkb_get_map_map_t *S) +{ + return R->totalActions; +} + +xcb_xkb_action_iterator_t +xcb_xkb_get_map_map_acts_rtrn_acts_iterator (const xcb_xkb_get_map_reply_t *R, + const xcb_xkb_get_map_map_t *S) +{ + xcb_xkb_action_iterator_t i; + i.data = S->acts_rtrn_acts; + i.rem = R->totalActions; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_set_behavior_t * +xcb_xkb_get_map_map_behaviors_rtrn (const xcb_xkb_get_map_map_t *S) +{ + return S->behaviors_rtrn; +} + +int +xcb_xkb_get_map_map_behaviors_rtrn_length (const xcb_xkb_get_map_reply_t *R, + const xcb_xkb_get_map_map_t *S) +{ + return R->totalKeyBehaviors; +} + +xcb_xkb_set_behavior_iterator_t +xcb_xkb_get_map_map_behaviors_rtrn_iterator (const xcb_xkb_get_map_reply_t *R, + const xcb_xkb_get_map_map_t *S) +{ + xcb_xkb_set_behavior_iterator_t i; + i.data = S->behaviors_rtrn; + i.rem = R->totalKeyBehaviors; + i.index = (char *) i.data - (char *) S; + return i; +} + +uint8_t * +xcb_xkb_get_map_map_vmods_rtrn (const xcb_xkb_get_map_map_t *S) +{ + return S->vmods_rtrn; +} + +int +xcb_xkb_get_map_map_vmods_rtrn_length (const xcb_xkb_get_map_reply_t *R, + const xcb_xkb_get_map_map_t *S) +{ + return xcb_popcount(R->virtualMods); +} + +xcb_generic_iterator_t +xcb_xkb_get_map_map_vmods_rtrn_end (const xcb_xkb_get_map_reply_t *R, + const xcb_xkb_get_map_map_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->vmods_rtrn + xcb_popcount(R->virtualMods); + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_set_explicit_t * +xcb_xkb_get_map_map_explicit_rtrn (const xcb_xkb_get_map_map_t *S) +{ + return S->explicit_rtrn; +} + +int +xcb_xkb_get_map_map_explicit_rtrn_length (const xcb_xkb_get_map_reply_t *R, + const xcb_xkb_get_map_map_t *S) +{ + return R->totalKeyExplicit; +} + +xcb_xkb_set_explicit_iterator_t +xcb_xkb_get_map_map_explicit_rtrn_iterator (const xcb_xkb_get_map_reply_t *R, + const xcb_xkb_get_map_map_t *S) +{ + xcb_xkb_set_explicit_iterator_t i; + i.data = S->explicit_rtrn; + i.rem = R->totalKeyExplicit; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_key_mod_map_t * +xcb_xkb_get_map_map_modmap_rtrn (const xcb_xkb_get_map_map_t *S) +{ + return S->modmap_rtrn; +} + +int +xcb_xkb_get_map_map_modmap_rtrn_length (const xcb_xkb_get_map_reply_t *R, + const xcb_xkb_get_map_map_t *S) +{ + return R->totalModMapKeys; +} + +xcb_xkb_key_mod_map_iterator_t +xcb_xkb_get_map_map_modmap_rtrn_iterator (const xcb_xkb_get_map_reply_t *R, + const xcb_xkb_get_map_map_t *S) +{ + xcb_xkb_key_mod_map_iterator_t i; + i.data = S->modmap_rtrn; + i.rem = R->totalModMapKeys; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_key_v_mod_map_t * +xcb_xkb_get_map_map_vmodmap_rtrn (const xcb_xkb_get_map_map_t *S) +{ + return S->vmodmap_rtrn; +} + +int +xcb_xkb_get_map_map_vmodmap_rtrn_length (const xcb_xkb_get_map_reply_t *R, + const xcb_xkb_get_map_map_t *S) +{ + return R->totalVModMapKeys; +} + +xcb_xkb_key_v_mod_map_iterator_t +xcb_xkb_get_map_map_vmodmap_rtrn_iterator (const xcb_xkb_get_map_reply_t *R, + const xcb_xkb_get_map_map_t *S) +{ + xcb_xkb_key_v_mod_map_iterator_t i; + i.data = S->vmodmap_rtrn; + i.rem = R->totalVModMapKeys; + i.index = (char *) i.data - (char *) S; + return i; +} + +int +xcb_xkb_get_map_map_serialize (void **_buffer, + uint8_t nTypes, + uint8_t nKeySyms, + uint8_t nKeyActions, + uint16_t totalActions, + uint8_t totalKeyBehaviors, + uint16_t virtualMods, + uint8_t totalKeyExplicit, + uint8_t totalModMapKeys, + uint8_t totalVModMapKeys, + uint16_t present, + const xcb_xkb_get_map_map_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[23]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(present & XCB_XKB_MAP_PART_KEY_TYPES) { + /* 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; + /* types_rtrn */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->types_rtrn; + xcb_parts[xcb_parts_idx].iov_len = 0; + xcb_tmp = (char *) _aux->types_rtrn; + for(i=0; i<nTypes; i++) { + xcb_block_len = xcb_xkb_key_type_sizeof(xcb_tmp); + xcb_parts[xcb_parts_idx].iov_len += xcb_block_len; + } + xcb_block_len = xcb_parts[xcb_parts_idx].iov_len; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_key_type_t); + } + if(present & XCB_XKB_MAP_PART_KEY_SYMS) { + /* 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; + /* syms_rtrn */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->syms_rtrn; + xcb_parts[xcb_parts_idx].iov_len = 0; + xcb_tmp = (char *) _aux->syms_rtrn; + for(i=0; i<nKeySyms; i++) { + xcb_block_len = xcb_xkb_key_sym_map_sizeof(xcb_tmp); + xcb_parts[xcb_parts_idx].iov_len += xcb_block_len; + } + xcb_block_len = xcb_parts[xcb_parts_idx].iov_len; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_key_sym_map_t); + } + if(present & XCB_XKB_MAP_PART_KEY_ACTIONS) { + /* 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; + /* acts_rtrn_count */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->acts_rtrn_count; + xcb_block_len += nKeyActions * sizeof(xcb_keycode_t); + xcb_parts[xcb_parts_idx].iov_len = nKeyActions * sizeof(xcb_keycode_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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; + /* 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; + /* acts_rtrn_acts */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->acts_rtrn_acts; + xcb_block_len += totalActions * sizeof(xcb_xkb_action_t); + xcb_parts[xcb_parts_idx].iov_len = totalActions * sizeof(xcb_xkb_action_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_action_t); + } + if(present & XCB_XKB_MAP_PART_KEY_BEHAVIORS) { + /* 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; + /* behaviors_rtrn */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->behaviors_rtrn; + xcb_block_len += totalKeyBehaviors * sizeof(xcb_xkb_set_behavior_t); + xcb_parts[xcb_parts_idx].iov_len = totalKeyBehaviors * sizeof(xcb_xkb_set_behavior_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_set_behavior_t); + } + if(present & XCB_XKB_MAP_PART_VIRTUAL_MODS) { + /* 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; + /* vmods_rtrn */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->vmods_rtrn; + xcb_block_len += xcb_popcount(virtualMods) * sizeof(xcb_keycode_t); + xcb_parts[xcb_parts_idx].iov_len = xcb_popcount(virtualMods) * sizeof(xcb_keycode_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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(present & XCB_XKB_MAP_PART_EXPLICIT_COMPONENTS) { + /* 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; + /* explicit_rtrn */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->explicit_rtrn; + xcb_block_len += totalKeyExplicit * sizeof(xcb_xkb_set_explicit_t); + xcb_parts[xcb_parts_idx].iov_len = totalKeyExplicit * sizeof(xcb_xkb_set_explicit_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_set_explicit_t); + xcb_align_to = 4; + /* 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(present & XCB_XKB_MAP_PART_MODIFIER_MAP) { + /* 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; + /* modmap_rtrn */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->modmap_rtrn; + xcb_block_len += totalModMapKeys * sizeof(xcb_xkb_key_mod_map_t); + xcb_parts[xcb_parts_idx].iov_len = totalModMapKeys * sizeof(xcb_xkb_key_mod_map_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_key_mod_map_t); + xcb_align_to = 4; + /* 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(present & XCB_XKB_MAP_PART_VIRTUAL_MOD_MAP) { + /* 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; + /* vmodmap_rtrn */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->vmodmap_rtrn; + xcb_block_len += totalVModMapKeys * sizeof(xcb_xkb_key_v_mod_map_t); + xcb_parts[xcb_parts_idx].iov_len = totalVModMapKeys * sizeof(xcb_xkb_key_v_mod_map_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_key_v_mod_map_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_xkb_get_map_map_unpack (const void *_buffer, + uint8_t nTypes, + uint8_t nKeySyms, + uint8_t nKeyActions, + uint16_t totalActions, + uint8_t totalKeyBehaviors, + uint16_t virtualMods, + uint8_t totalKeyExplicit, + uint8_t totalModMapKeys, + uint8_t totalVModMapKeys, + uint16_t present, + xcb_xkb_get_map_map_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + if(present & XCB_XKB_MAP_PART_KEY_TYPES) { + /* 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; + /* types_rtrn */ + _aux->types_rtrn = (xcb_xkb_key_type_t *)xcb_tmp; + for(i=0; i<nTypes; i++) { + xcb_tmp_len = xcb_xkb_key_type_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xkb_key_type_t); + } + if(present & XCB_XKB_MAP_PART_KEY_SYMS) { + /* 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; + /* syms_rtrn */ + _aux->syms_rtrn = (xcb_xkb_key_sym_map_t *)xcb_tmp; + for(i=0; i<nKeySyms; i++) { + xcb_tmp_len = xcb_xkb_key_sym_map_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xkb_key_sym_map_t); + } + if(present & XCB_XKB_MAP_PART_KEY_ACTIONS) { + /* 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; + /* acts_rtrn_count */ + _aux->acts_rtrn_count = (uint8_t *)xcb_tmp; + xcb_block_len += nKeyActions * sizeof(xcb_keycode_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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; + /* 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; + /* acts_rtrn_acts */ + _aux->acts_rtrn_acts = (xcb_xkb_action_t *)xcb_tmp; + xcb_block_len += totalActions * sizeof(xcb_xkb_action_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_action_t); + } + if(present & XCB_XKB_MAP_PART_KEY_BEHAVIORS) { + /* 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; + /* behaviors_rtrn */ + _aux->behaviors_rtrn = (xcb_xkb_set_behavior_t *)xcb_tmp; + xcb_block_len += totalKeyBehaviors * sizeof(xcb_xkb_set_behavior_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_set_behavior_t); + } + if(present & XCB_XKB_MAP_PART_VIRTUAL_MODS) { + /* 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; + /* vmods_rtrn */ + _aux->vmods_rtrn = (uint8_t *)xcb_tmp; + xcb_block_len += xcb_popcount(virtualMods) * sizeof(xcb_keycode_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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; + } + if(present & XCB_XKB_MAP_PART_EXPLICIT_COMPONENTS) { + /* 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; + /* explicit_rtrn */ + _aux->explicit_rtrn = (xcb_xkb_set_explicit_t *)xcb_tmp; + xcb_block_len += totalKeyExplicit * sizeof(xcb_xkb_set_explicit_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_set_explicit_t); + xcb_align_to = 4; + /* 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; + } + if(present & XCB_XKB_MAP_PART_MODIFIER_MAP) { + /* 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; + /* modmap_rtrn */ + _aux->modmap_rtrn = (xcb_xkb_key_mod_map_t *)xcb_tmp; + xcb_block_len += totalModMapKeys * sizeof(xcb_xkb_key_mod_map_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_key_mod_map_t); + xcb_align_to = 4; + /* 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; + } + if(present & XCB_XKB_MAP_PART_VIRTUAL_MOD_MAP) { + /* 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; + /* vmodmap_rtrn */ + _aux->vmodmap_rtrn = (xcb_xkb_key_v_mod_map_t *)xcb_tmp; + xcb_block_len += totalVModMapKeys * sizeof(xcb_xkb_key_v_mod_map_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_key_v_mod_map_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_xkb_get_map_map_sizeof (const void *_buffer, + uint8_t nTypes, + uint8_t nKeySyms, + uint8_t nKeyActions, + uint16_t totalActions, + uint8_t totalKeyBehaviors, + uint16_t virtualMods, + uint8_t totalKeyExplicit, + uint8_t totalModMapKeys, + uint8_t totalVModMapKeys, + uint16_t present) +{ + xcb_xkb_get_map_map_t _aux; + return xcb_xkb_get_map_map_unpack(_buffer, nTypes, nKeySyms, nKeyActions, totalActions, totalKeyBehaviors, virtualMods, totalKeyExplicit, totalModMapKeys, totalVModMapKeys, present, &_aux); +} + +int +xcb_xkb_get_map_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_get_map_reply_t *_aux = (xcb_xkb_get_map_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_xkb_get_map_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* map */ + xcb_block_len += xcb_xkb_get_map_map_sizeof(xcb_tmp, _aux->nTypes, _aux->nKeySyms, _aux->nKeyActions, _aux->totalActions, _aux->totalKeyBehaviors, _aux->virtualMods, _aux->totalKeyExplicit, _aux->totalModMapKeys, _aux->totalVModMapKeys, _aux->present); + 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_xkb_get_map_cookie_t +xcb_xkb_get_map (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint16_t full, + uint16_t partial, + uint8_t firstType, + uint8_t nTypes, + xcb_keycode_t firstKeySym, + uint8_t nKeySyms, + xcb_keycode_t firstKeyAction, + uint8_t nKeyActions, + xcb_keycode_t firstKeyBehavior, + uint8_t nKeyBehaviors, + uint16_t virtualMods, + xcb_keycode_t firstKeyExplicit, + uint8_t nKeyExplicit, + xcb_keycode_t firstModMapKey, + uint8_t nModMapKeys, + xcb_keycode_t firstVModMapKey, + uint8_t nVModMapKeys) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_GET_MAP, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_get_map_cookie_t xcb_ret; + xcb_xkb_get_map_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.full = full; + xcb_out.partial = partial; + xcb_out.firstType = firstType; + xcb_out.nTypes = nTypes; + xcb_out.firstKeySym = firstKeySym; + xcb_out.nKeySyms = nKeySyms; + xcb_out.firstKeyAction = firstKeyAction; + xcb_out.nKeyActions = nKeyActions; + xcb_out.firstKeyBehavior = firstKeyBehavior; + xcb_out.nKeyBehaviors = nKeyBehaviors; + xcb_out.virtualMods = virtualMods; + xcb_out.firstKeyExplicit = firstKeyExplicit; + xcb_out.nKeyExplicit = nKeyExplicit; + xcb_out.firstModMapKey = firstModMapKey; + xcb_out.nModMapKeys = nModMapKeys; + xcb_out.firstVModMapKey = firstVModMapKey; + xcb_out.nVModMapKeys = nVModMapKeys; + 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_xkb_get_map_cookie_t +xcb_xkb_get_map_unchecked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint16_t full, + uint16_t partial, + uint8_t firstType, + uint8_t nTypes, + xcb_keycode_t firstKeySym, + uint8_t nKeySyms, + xcb_keycode_t firstKeyAction, + uint8_t nKeyActions, + xcb_keycode_t firstKeyBehavior, + uint8_t nKeyBehaviors, + uint16_t virtualMods, + xcb_keycode_t firstKeyExplicit, + uint8_t nKeyExplicit, + xcb_keycode_t firstModMapKey, + uint8_t nModMapKeys, + xcb_keycode_t firstVModMapKey, + uint8_t nVModMapKeys) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_GET_MAP, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_get_map_cookie_t xcb_ret; + xcb_xkb_get_map_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.full = full; + xcb_out.partial = partial; + xcb_out.firstType = firstType; + xcb_out.nTypes = nTypes; + xcb_out.firstKeySym = firstKeySym; + xcb_out.nKeySyms = nKeySyms; + xcb_out.firstKeyAction = firstKeyAction; + xcb_out.nKeyActions = nKeyActions; + xcb_out.firstKeyBehavior = firstKeyBehavior; + xcb_out.nKeyBehaviors = nKeyBehaviors; + xcb_out.virtualMods = virtualMods; + xcb_out.firstKeyExplicit = firstKeyExplicit; + xcb_out.nKeyExplicit = nKeyExplicit; + xcb_out.firstModMapKey = firstModMapKey; + xcb_out.nModMapKeys = nModMapKeys; + xcb_out.firstVModMapKey = firstVModMapKey; + xcb_out.nVModMapKeys = nVModMapKeys; + 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; +} + +void * +xcb_xkb_get_map_map (const xcb_xkb_get_map_reply_t *R) +{ + return (void *) (R + 1); +} + +xcb_xkb_get_map_reply_t * +xcb_xkb_get_map_reply (xcb_connection_t *c, + xcb_xkb_get_map_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xkb_get_map_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_xkb_set_map_values_types_length (const xcb_xkb_set_map_request_t *R, + const xcb_xkb_set_map_values_t *S) +{ + return R->nTypes; +} + +xcb_xkb_set_key_type_iterator_t +xcb_xkb_set_map_values_types_iterator (const xcb_xkb_set_map_request_t *R, + const xcb_xkb_set_map_values_t *S) +{ + xcb_xkb_set_key_type_iterator_t i; + i.data = S->types; + i.rem = R->nTypes; + i.index = (char *) i.data - (char *) S; + return i; +} + +int +xcb_xkb_set_map_values_syms_length (const xcb_xkb_set_map_request_t *R, + const xcb_xkb_set_map_values_t *S) +{ + return R->nKeySyms; +} + +xcb_xkb_key_sym_map_iterator_t +xcb_xkb_set_map_values_syms_iterator (const xcb_xkb_set_map_request_t *R, + const xcb_xkb_set_map_values_t *S) +{ + xcb_xkb_key_sym_map_iterator_t i; + i.data = S->syms; + i.rem = R->nKeySyms; + i.index = (char *) i.data - (char *) S; + return i; +} + +uint8_t * +xcb_xkb_set_map_values_actions_count (const xcb_xkb_set_map_values_t *S) +{ + return S->actionsCount; +} + +int +xcb_xkb_set_map_values_actions_count_length (const xcb_xkb_set_map_request_t *R, + const xcb_xkb_set_map_values_t *S) +{ + return R->nKeyActions; +} + +xcb_generic_iterator_t +xcb_xkb_set_map_values_actions_count_end (const xcb_xkb_set_map_request_t *R, + const xcb_xkb_set_map_values_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->actionsCount + R->nKeyActions; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_action_t * +xcb_xkb_set_map_values_actions (const xcb_xkb_set_map_values_t *S) +{ + return S->actions; +} + +int +xcb_xkb_set_map_values_actions_length (const xcb_xkb_set_map_request_t *R, + const xcb_xkb_set_map_values_t *S) +{ + return R->totalActions; +} + +xcb_xkb_action_iterator_t +xcb_xkb_set_map_values_actions_iterator (const xcb_xkb_set_map_request_t *R, + const xcb_xkb_set_map_values_t *S) +{ + xcb_xkb_action_iterator_t i; + i.data = S->actions; + i.rem = R->totalActions; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_set_behavior_t * +xcb_xkb_set_map_values_behaviors (const xcb_xkb_set_map_values_t *S) +{ + return S->behaviors; +} + +int +xcb_xkb_set_map_values_behaviors_length (const xcb_xkb_set_map_request_t *R, + const xcb_xkb_set_map_values_t *S) +{ + return R->totalKeyBehaviors; +} + +xcb_xkb_set_behavior_iterator_t +xcb_xkb_set_map_values_behaviors_iterator (const xcb_xkb_set_map_request_t *R, + const xcb_xkb_set_map_values_t *S) +{ + xcb_xkb_set_behavior_iterator_t i; + i.data = S->behaviors; + i.rem = R->totalKeyBehaviors; + i.index = (char *) i.data - (char *) S; + return i; +} + +uint8_t * +xcb_xkb_set_map_values_vmods (const xcb_xkb_set_map_values_t *S) +{ + return S->vmods; +} + +int +xcb_xkb_set_map_values_vmods_length (const xcb_xkb_set_map_request_t *R, + const xcb_xkb_set_map_values_t *S) +{ + return xcb_popcount(R->virtualMods); +} + +xcb_generic_iterator_t +xcb_xkb_set_map_values_vmods_end (const xcb_xkb_set_map_request_t *R, + const xcb_xkb_set_map_values_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->vmods + xcb_popcount(R->virtualMods); + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_set_explicit_t * +xcb_xkb_set_map_values_explicit (const xcb_xkb_set_map_values_t *S) +{ + return S->explicit; +} + +int +xcb_xkb_set_map_values_explicit_length (const xcb_xkb_set_map_request_t *R, + const xcb_xkb_set_map_values_t *S) +{ + return R->totalKeyExplicit; +} + +xcb_xkb_set_explicit_iterator_t +xcb_xkb_set_map_values_explicit_iterator (const xcb_xkb_set_map_request_t *R, + const xcb_xkb_set_map_values_t *S) +{ + xcb_xkb_set_explicit_iterator_t i; + i.data = S->explicit; + i.rem = R->totalKeyExplicit; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_key_mod_map_t * +xcb_xkb_set_map_values_modmap (const xcb_xkb_set_map_values_t *S) +{ + return S->modmap; +} + +int +xcb_xkb_set_map_values_modmap_length (const xcb_xkb_set_map_request_t *R, + const xcb_xkb_set_map_values_t *S) +{ + return R->totalModMapKeys; +} + +xcb_xkb_key_mod_map_iterator_t +xcb_xkb_set_map_values_modmap_iterator (const xcb_xkb_set_map_request_t *R, + const xcb_xkb_set_map_values_t *S) +{ + xcb_xkb_key_mod_map_iterator_t i; + i.data = S->modmap; + i.rem = R->totalModMapKeys; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_key_v_mod_map_t * +xcb_xkb_set_map_values_vmodmap (const xcb_xkb_set_map_values_t *S) +{ + return S->vmodmap; +} + +int +xcb_xkb_set_map_values_vmodmap_length (const xcb_xkb_set_map_request_t *R, + const xcb_xkb_set_map_values_t *S) +{ + return R->totalVModMapKeys; +} + +xcb_xkb_key_v_mod_map_iterator_t +xcb_xkb_set_map_values_vmodmap_iterator (const xcb_xkb_set_map_request_t *R, + const xcb_xkb_set_map_values_t *S) +{ + xcb_xkb_key_v_mod_map_iterator_t i; + i.data = S->vmodmap; + i.rem = R->totalVModMapKeys; + i.index = (char *) i.data - (char *) S; + return i; +} + +int +xcb_xkb_set_map_values_serialize (void **_buffer, + uint8_t nTypes, + uint8_t nKeySyms, + uint8_t nKeyActions, + uint16_t totalActions, + uint8_t totalKeyBehaviors, + uint16_t virtualMods, + uint8_t totalKeyExplicit, + uint8_t totalModMapKeys, + uint8_t totalVModMapKeys, + uint16_t present, + const xcb_xkb_set_map_values_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[21]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(present & XCB_XKB_MAP_PART_KEY_TYPES) { + /* 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; + /* types */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->types; + xcb_parts[xcb_parts_idx].iov_len = 0; + xcb_tmp = (char *) _aux->types; + for(i=0; i<nTypes; i++) { + xcb_block_len = xcb_xkb_set_key_type_sizeof(xcb_tmp); + xcb_parts[xcb_parts_idx].iov_len += xcb_block_len; + } + xcb_block_len = xcb_parts[xcb_parts_idx].iov_len; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_set_key_type_t); + } + if(present & XCB_XKB_MAP_PART_KEY_SYMS) { + /* 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; + /* syms */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->syms; + xcb_parts[xcb_parts_idx].iov_len = 0; + xcb_tmp = (char *) _aux->syms; + for(i=0; i<nKeySyms; i++) { + xcb_block_len = xcb_xkb_key_sym_map_sizeof(xcb_tmp); + xcb_parts[xcb_parts_idx].iov_len += xcb_block_len; + } + xcb_block_len = xcb_parts[xcb_parts_idx].iov_len; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_key_sym_map_t); + } + if(present & XCB_XKB_MAP_PART_KEY_ACTIONS) { + /* 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; + /* actionsCount */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->actionsCount; + xcb_block_len += nKeyActions * sizeof(xcb_keycode_t); + xcb_parts[xcb_parts_idx].iov_len = nKeyActions * sizeof(xcb_keycode_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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; + /* 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; + /* actions */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->actions; + xcb_block_len += totalActions * sizeof(xcb_xkb_action_t); + xcb_parts[xcb_parts_idx].iov_len = totalActions * sizeof(xcb_xkb_action_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_action_t); + } + if(present & XCB_XKB_MAP_PART_KEY_BEHAVIORS) { + /* 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; + /* behaviors */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->behaviors; + xcb_block_len += totalKeyBehaviors * sizeof(xcb_xkb_set_behavior_t); + xcb_parts[xcb_parts_idx].iov_len = totalKeyBehaviors * sizeof(xcb_xkb_set_behavior_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_set_behavior_t); + } + if(present & XCB_XKB_MAP_PART_VIRTUAL_MODS) { + /* 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; + /* vmods */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->vmods; + xcb_block_len += xcb_popcount(virtualMods) * sizeof(xcb_keycode_t); + xcb_parts[xcb_parts_idx].iov_len = xcb_popcount(virtualMods) * sizeof(xcb_keycode_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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(present & XCB_XKB_MAP_PART_EXPLICIT_COMPONENTS) { + /* 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; + /* explicit */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->explicit; + xcb_block_len += totalKeyExplicit * sizeof(xcb_xkb_set_explicit_t); + xcb_parts[xcb_parts_idx].iov_len = totalKeyExplicit * sizeof(xcb_xkb_set_explicit_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_set_explicit_t); + } + if(present & XCB_XKB_MAP_PART_MODIFIER_MAP) { + /* 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; + /* modmap */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->modmap; + xcb_block_len += totalModMapKeys * sizeof(xcb_xkb_key_mod_map_t); + xcb_parts[xcb_parts_idx].iov_len = totalModMapKeys * sizeof(xcb_xkb_key_mod_map_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_key_mod_map_t); + } + if(present & XCB_XKB_MAP_PART_VIRTUAL_MOD_MAP) { + /* 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; + /* vmodmap */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->vmodmap; + xcb_block_len += totalVModMapKeys * sizeof(xcb_xkb_key_v_mod_map_t); + xcb_parts[xcb_parts_idx].iov_len = totalVModMapKeys * sizeof(xcb_xkb_key_v_mod_map_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_key_v_mod_map_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_xkb_set_map_values_unpack (const void *_buffer, + uint8_t nTypes, + uint8_t nKeySyms, + uint8_t nKeyActions, + uint16_t totalActions, + uint8_t totalKeyBehaviors, + uint16_t virtualMods, + uint8_t totalKeyExplicit, + uint8_t totalModMapKeys, + uint8_t totalVModMapKeys, + uint16_t present, + xcb_xkb_set_map_values_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + if(present & XCB_XKB_MAP_PART_KEY_TYPES) { + /* 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; + /* types */ + _aux->types = (xcb_xkb_set_key_type_t *)xcb_tmp; + for(i=0; i<nTypes; i++) { + xcb_tmp_len = xcb_xkb_set_key_type_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xkb_set_key_type_t); + } + if(present & XCB_XKB_MAP_PART_KEY_SYMS) { + /* 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; + /* syms */ + _aux->syms = (xcb_xkb_key_sym_map_t *)xcb_tmp; + for(i=0; i<nKeySyms; i++) { + xcb_tmp_len = xcb_xkb_key_sym_map_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xkb_key_sym_map_t); + } + if(present & XCB_XKB_MAP_PART_KEY_ACTIONS) { + /* 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; + /* actionsCount */ + _aux->actionsCount = (uint8_t *)xcb_tmp; + xcb_block_len += nKeyActions * sizeof(xcb_keycode_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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; + /* 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; + /* actions */ + _aux->actions = (xcb_xkb_action_t *)xcb_tmp; + xcb_block_len += totalActions * sizeof(xcb_xkb_action_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_action_t); + } + if(present & XCB_XKB_MAP_PART_KEY_BEHAVIORS) { + /* 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; + /* behaviors */ + _aux->behaviors = (xcb_xkb_set_behavior_t *)xcb_tmp; + xcb_block_len += totalKeyBehaviors * sizeof(xcb_xkb_set_behavior_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_set_behavior_t); + } + if(present & XCB_XKB_MAP_PART_VIRTUAL_MODS) { + /* 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; + /* vmods */ + _aux->vmods = (uint8_t *)xcb_tmp; + xcb_block_len += xcb_popcount(virtualMods) * sizeof(xcb_keycode_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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; + } + if(present & XCB_XKB_MAP_PART_EXPLICIT_COMPONENTS) { + /* 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; + /* explicit */ + _aux->explicit = (xcb_xkb_set_explicit_t *)xcb_tmp; + xcb_block_len += totalKeyExplicit * sizeof(xcb_xkb_set_explicit_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_set_explicit_t); + } + if(present & XCB_XKB_MAP_PART_MODIFIER_MAP) { + /* 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; + /* modmap */ + _aux->modmap = (xcb_xkb_key_mod_map_t *)xcb_tmp; + xcb_block_len += totalModMapKeys * sizeof(xcb_xkb_key_mod_map_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_key_mod_map_t); + } + if(present & XCB_XKB_MAP_PART_VIRTUAL_MOD_MAP) { + /* 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; + /* vmodmap */ + _aux->vmodmap = (xcb_xkb_key_v_mod_map_t *)xcb_tmp; + xcb_block_len += totalVModMapKeys * sizeof(xcb_xkb_key_v_mod_map_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_key_v_mod_map_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_xkb_set_map_values_sizeof (const void *_buffer, + uint8_t nTypes, + uint8_t nKeySyms, + uint8_t nKeyActions, + uint16_t totalActions, + uint8_t totalKeyBehaviors, + uint16_t virtualMods, + uint8_t totalKeyExplicit, + uint8_t totalModMapKeys, + uint8_t totalVModMapKeys, + uint16_t present) +{ + xcb_xkb_set_map_values_t _aux; + return xcb_xkb_set_map_values_unpack(_buffer, nTypes, nKeySyms, nKeyActions, totalActions, totalKeyBehaviors, virtualMods, totalKeyExplicit, totalModMapKeys, totalVModMapKeys, present, &_aux); +} + +int +xcb_xkb_set_map_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_set_map_request_t *_aux = (xcb_xkb_set_map_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_xkb_set_map_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* values */ + xcb_block_len += xcb_xkb_set_map_values_sizeof(xcb_tmp, _aux->nTypes, _aux->nKeySyms, _aux->nKeyActions, _aux->totalActions, _aux->totalKeyBehaviors, _aux->virtualMods, _aux->totalKeyExplicit, _aux->totalModMapKeys, _aux->totalVModMapKeys, _aux->present); + 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_xkb_set_map_checked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint16_t present, + uint16_t flags, + xcb_keycode_t minKeyCode, + xcb_keycode_t maxKeyCode, + uint8_t firstType, + uint8_t nTypes, + xcb_keycode_t firstKeySym, + uint8_t nKeySyms, + uint16_t totalSyms, + xcb_keycode_t firstKeyAction, + uint8_t nKeyActions, + uint16_t totalActions, + xcb_keycode_t firstKeyBehavior, + uint8_t nKeyBehaviors, + uint8_t totalKeyBehaviors, + xcb_keycode_t firstKeyExplicit, + uint8_t nKeyExplicit, + uint8_t totalKeyExplicit, + xcb_keycode_t firstModMapKey, + uint8_t nModMapKeys, + uint8_t totalModMapKeys, + xcb_keycode_t firstVModMapKey, + uint8_t nVModMapKeys, + uint8_t totalVModMapKeys, + uint16_t virtualMods, + const void *values) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SET_MAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_set_map_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.present = present; + xcb_out.flags = flags; + xcb_out.minKeyCode = minKeyCode; + xcb_out.maxKeyCode = maxKeyCode; + xcb_out.firstType = firstType; + xcb_out.nTypes = nTypes; + xcb_out.firstKeySym = firstKeySym; + xcb_out.nKeySyms = nKeySyms; + xcb_out.totalSyms = totalSyms; + xcb_out.firstKeyAction = firstKeyAction; + xcb_out.nKeyActions = nKeyActions; + xcb_out.totalActions = totalActions; + xcb_out.firstKeyBehavior = firstKeyBehavior; + xcb_out.nKeyBehaviors = nKeyBehaviors; + xcb_out.totalKeyBehaviors = totalKeyBehaviors; + xcb_out.firstKeyExplicit = firstKeyExplicit; + xcb_out.nKeyExplicit = nKeyExplicit; + xcb_out.totalKeyExplicit = totalKeyExplicit; + xcb_out.firstModMapKey = firstModMapKey; + xcb_out.nModMapKeys = nModMapKeys; + xcb_out.totalModMapKeys = totalModMapKeys; + xcb_out.firstVModMapKey = firstVModMapKey; + xcb_out.nVModMapKeys = nVModMapKeys; + xcb_out.totalVModMapKeys = totalVModMapKeys; + xcb_out.virtualMods = virtualMods; + + 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_xkb_set_map_values_t values */ + xcb_parts[4].iov_base = (char *) values; + xcb_parts[4].iov_len = + xcb_xkb_set_map_values_sizeof (values, nTypes, nKeySyms, nKeyActions, totalActions, totalKeyBehaviors, virtualMods, totalKeyExplicit, totalModMapKeys, totalVModMapKeys, present); + + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_xkb_set_map (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint16_t present, + uint16_t flags, + xcb_keycode_t minKeyCode, + xcb_keycode_t maxKeyCode, + uint8_t firstType, + uint8_t nTypes, + xcb_keycode_t firstKeySym, + uint8_t nKeySyms, + uint16_t totalSyms, + xcb_keycode_t firstKeyAction, + uint8_t nKeyActions, + uint16_t totalActions, + xcb_keycode_t firstKeyBehavior, + uint8_t nKeyBehaviors, + uint8_t totalKeyBehaviors, + xcb_keycode_t firstKeyExplicit, + uint8_t nKeyExplicit, + uint8_t totalKeyExplicit, + xcb_keycode_t firstModMapKey, + uint8_t nModMapKeys, + uint8_t totalModMapKeys, + xcb_keycode_t firstVModMapKey, + uint8_t nVModMapKeys, + uint8_t totalVModMapKeys, + uint16_t virtualMods, + const void *values) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SET_MAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_set_map_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.present = present; + xcb_out.flags = flags; + xcb_out.minKeyCode = minKeyCode; + xcb_out.maxKeyCode = maxKeyCode; + xcb_out.firstType = firstType; + xcb_out.nTypes = nTypes; + xcb_out.firstKeySym = firstKeySym; + xcb_out.nKeySyms = nKeySyms; + xcb_out.totalSyms = totalSyms; + xcb_out.firstKeyAction = firstKeyAction; + xcb_out.nKeyActions = nKeyActions; + xcb_out.totalActions = totalActions; + xcb_out.firstKeyBehavior = firstKeyBehavior; + xcb_out.nKeyBehaviors = nKeyBehaviors; + xcb_out.totalKeyBehaviors = totalKeyBehaviors; + xcb_out.firstKeyExplicit = firstKeyExplicit; + xcb_out.nKeyExplicit = nKeyExplicit; + xcb_out.totalKeyExplicit = totalKeyExplicit; + xcb_out.firstModMapKey = firstModMapKey; + xcb_out.nModMapKeys = nModMapKeys; + xcb_out.totalModMapKeys = totalModMapKeys; + xcb_out.firstVModMapKey = firstVModMapKey; + xcb_out.nVModMapKeys = nVModMapKeys; + xcb_out.totalVModMapKeys = totalVModMapKeys; + xcb_out.virtualMods = virtualMods; + + 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_xkb_set_map_values_t values */ + xcb_parts[4].iov_base = (char *) values; + xcb_parts[4].iov_len = + xcb_xkb_set_map_values_sizeof (values, nTypes, nKeySyms, nKeyActions, totalActions, totalKeyBehaviors, virtualMods, totalKeyExplicit, totalModMapKeys, totalVModMapKeys, present); + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_xkb_set_map_aux_checked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint16_t present, + uint16_t flags, + xcb_keycode_t minKeyCode, + xcb_keycode_t maxKeyCode, + uint8_t firstType, + uint8_t nTypes, + xcb_keycode_t firstKeySym, + uint8_t nKeySyms, + uint16_t totalSyms, + xcb_keycode_t firstKeyAction, + uint8_t nKeyActions, + uint16_t totalActions, + xcb_keycode_t firstKeyBehavior, + uint8_t nKeyBehaviors, + uint8_t totalKeyBehaviors, + xcb_keycode_t firstKeyExplicit, + uint8_t nKeyExplicit, + uint8_t totalKeyExplicit, + xcb_keycode_t firstModMapKey, + uint8_t nModMapKeys, + uint8_t totalModMapKeys, + xcb_keycode_t firstVModMapKey, + uint8_t nVModMapKeys, + uint8_t totalVModMapKeys, + uint16_t virtualMods, + const xcb_xkb_set_map_values_t *values) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SET_MAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_set_map_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.present = present; + xcb_out.flags = flags; + xcb_out.minKeyCode = minKeyCode; + xcb_out.maxKeyCode = maxKeyCode; + xcb_out.firstType = firstType; + xcb_out.nTypes = nTypes; + xcb_out.firstKeySym = firstKeySym; + xcb_out.nKeySyms = nKeySyms; + xcb_out.totalSyms = totalSyms; + xcb_out.firstKeyAction = firstKeyAction; + xcb_out.nKeyActions = nKeyActions; + xcb_out.totalActions = totalActions; + xcb_out.firstKeyBehavior = firstKeyBehavior; + xcb_out.nKeyBehaviors = nKeyBehaviors; + xcb_out.totalKeyBehaviors = totalKeyBehaviors; + xcb_out.firstKeyExplicit = firstKeyExplicit; + xcb_out.nKeyExplicit = nKeyExplicit; + xcb_out.totalKeyExplicit = totalKeyExplicit; + xcb_out.firstModMapKey = firstModMapKey; + xcb_out.nModMapKeys = nModMapKeys; + xcb_out.totalModMapKeys = totalModMapKeys; + xcb_out.firstVModMapKey = firstVModMapKey; + xcb_out.nVModMapKeys = nVModMapKeys; + xcb_out.totalVModMapKeys = totalVModMapKeys; + xcb_out.virtualMods = virtualMods; + + 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_xkb_set_map_values_t values */ + xcb_parts[4].iov_len = + xcb_xkb_set_map_values_serialize (&xcb_aux0, nTypes, nKeySyms, nKeyActions, totalActions, totalKeyBehaviors, virtualMods, totalKeyExplicit, totalModMapKeys, totalVModMapKeys, present, values); + 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_xkb_set_map_aux (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint16_t present, + uint16_t flags, + xcb_keycode_t minKeyCode, + xcb_keycode_t maxKeyCode, + uint8_t firstType, + uint8_t nTypes, + xcb_keycode_t firstKeySym, + uint8_t nKeySyms, + uint16_t totalSyms, + xcb_keycode_t firstKeyAction, + uint8_t nKeyActions, + uint16_t totalActions, + xcb_keycode_t firstKeyBehavior, + uint8_t nKeyBehaviors, + uint8_t totalKeyBehaviors, + xcb_keycode_t firstKeyExplicit, + uint8_t nKeyExplicit, + uint8_t totalKeyExplicit, + xcb_keycode_t firstModMapKey, + uint8_t nModMapKeys, + uint8_t totalModMapKeys, + xcb_keycode_t firstVModMapKey, + uint8_t nVModMapKeys, + uint8_t totalVModMapKeys, + uint16_t virtualMods, + const xcb_xkb_set_map_values_t *values) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SET_MAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_set_map_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.present = present; + xcb_out.flags = flags; + xcb_out.minKeyCode = minKeyCode; + xcb_out.maxKeyCode = maxKeyCode; + xcb_out.firstType = firstType; + xcb_out.nTypes = nTypes; + xcb_out.firstKeySym = firstKeySym; + xcb_out.nKeySyms = nKeySyms; + xcb_out.totalSyms = totalSyms; + xcb_out.firstKeyAction = firstKeyAction; + xcb_out.nKeyActions = nKeyActions; + xcb_out.totalActions = totalActions; + xcb_out.firstKeyBehavior = firstKeyBehavior; + xcb_out.nKeyBehaviors = nKeyBehaviors; + xcb_out.totalKeyBehaviors = totalKeyBehaviors; + xcb_out.firstKeyExplicit = firstKeyExplicit; + xcb_out.nKeyExplicit = nKeyExplicit; + xcb_out.totalKeyExplicit = totalKeyExplicit; + xcb_out.firstModMapKey = firstModMapKey; + xcb_out.nModMapKeys = nModMapKeys; + xcb_out.totalModMapKeys = totalModMapKeys; + xcb_out.firstVModMapKey = firstVModMapKey; + xcb_out.nVModMapKeys = nVModMapKeys; + xcb_out.totalVModMapKeys = totalVModMapKeys; + xcb_out.virtualMods = virtualMods; + + 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_xkb_set_map_values_t values */ + xcb_parts[4].iov_len = + xcb_xkb_set_map_values_serialize (&xcb_aux0, nTypes, nKeySyms, nKeyActions, totalActions, totalKeyBehaviors, virtualMods, totalKeyExplicit, totalModMapKeys, totalVModMapKeys, present, values); + 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_xkb_set_map_values (const xcb_xkb_set_map_request_t *R) +{ + return (void *) (R + 1); +} + +int +xcb_xkb_get_compat_map_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_get_compat_map_reply_t *_aux = (xcb_xkb_get_compat_map_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_xkb_get_compat_map_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* si_rtrn */ + xcb_block_len += _aux->nSIRtrn * sizeof(xcb_xkb_sym_interpret_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_sym_interpret_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; + /* group_rtrn */ + xcb_block_len += xcb_popcount(_aux->groupsRtrn) * sizeof(xcb_xkb_mod_def_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_mod_def_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_xkb_get_compat_map_cookie_t +xcb_xkb_get_compat_map (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint8_t groups, + uint8_t getAllSI, + uint16_t firstSI, + uint16_t nSI) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_GET_COMPAT_MAP, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_get_compat_map_cookie_t xcb_ret; + xcb_xkb_get_compat_map_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.groups = groups; + xcb_out.getAllSI = getAllSI; + xcb_out.firstSI = firstSI; + xcb_out.nSI = nSI; + + 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_xkb_get_compat_map_cookie_t +xcb_xkb_get_compat_map_unchecked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint8_t groups, + uint8_t getAllSI, + uint16_t firstSI, + uint16_t nSI) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_GET_COMPAT_MAP, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_get_compat_map_cookie_t xcb_ret; + xcb_xkb_get_compat_map_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.groups = groups; + xcb_out.getAllSI = getAllSI; + xcb_out.firstSI = firstSI; + xcb_out.nSI = nSI; + + 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_xkb_sym_interpret_t * +xcb_xkb_get_compat_map_si_rtrn (const xcb_xkb_get_compat_map_reply_t *R) +{ + return (xcb_xkb_sym_interpret_t *) (R + 1); +} + +int +xcb_xkb_get_compat_map_si_rtrn_length (const xcb_xkb_get_compat_map_reply_t *R) +{ + return R->nSIRtrn; +} + +xcb_xkb_sym_interpret_iterator_t +xcb_xkb_get_compat_map_si_rtrn_iterator (const xcb_xkb_get_compat_map_reply_t *R) +{ + xcb_xkb_sym_interpret_iterator_t i; + i.data = (xcb_xkb_sym_interpret_t *) (R + 1); + i.rem = R->nSIRtrn; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xkb_mod_def_t * +xcb_xkb_get_compat_map_group_rtrn (const xcb_xkb_get_compat_map_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_xkb_sym_interpret_end(xcb_xkb_get_compat_map_si_rtrn_iterator(R)); + return (xcb_xkb_mod_def_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_mod_def_t, prev.index) + 0); +} + +int +xcb_xkb_get_compat_map_group_rtrn_length (const xcb_xkb_get_compat_map_reply_t *R) +{ + return xcb_popcount(R->groupsRtrn); +} + +xcb_xkb_mod_def_iterator_t +xcb_xkb_get_compat_map_group_rtrn_iterator (const xcb_xkb_get_compat_map_reply_t *R) +{ + xcb_xkb_mod_def_iterator_t i; + xcb_generic_iterator_t prev = xcb_xkb_sym_interpret_end(xcb_xkb_get_compat_map_si_rtrn_iterator(R)); + i.data = (xcb_xkb_mod_def_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_mod_def_t, prev.index)); + i.rem = xcb_popcount(R->groupsRtrn); + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xkb_get_compat_map_reply_t * +xcb_xkb_get_compat_map_reply (xcb_connection_t *c, + xcb_xkb_get_compat_map_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xkb_get_compat_map_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_xkb_set_compat_map_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_set_compat_map_request_t *_aux = (xcb_xkb_set_compat_map_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_xkb_set_compat_map_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* si */ + xcb_block_len += _aux->nSI * sizeof(xcb_xkb_sym_interpret_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_sym_interpret_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; + /* groupMaps */ + xcb_block_len += xcb_popcount(_aux->groups) * sizeof(xcb_xkb_mod_def_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_mod_def_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_xkb_set_compat_map_checked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint8_t recomputeActions, + uint8_t truncateSI, + uint8_t groups, + uint16_t firstSI, + uint16_t nSI, + const xcb_xkb_sym_interpret_t *si, + const xcb_xkb_mod_def_t *groupMaps) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SET_COMPAT_MAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[8]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_set_compat_map_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.pad0 = 0; + xcb_out.recomputeActions = recomputeActions; + xcb_out.truncateSI = truncateSI; + xcb_out.groups = groups; + xcb_out.firstSI = firstSI; + xcb_out.nSI = nSI; + memset(xcb_out.pad1, 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_xkb_sym_interpret_t si */ + xcb_parts[4].iov_base = (char *) si; + xcb_parts[4].iov_len = nSI * sizeof(xcb_xkb_sym_interpret_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_xkb_mod_def_t groupMaps */ + xcb_parts[6].iov_base = (char *) groupMaps; + xcb_parts[6].iov_len = xcb_popcount(groups) * sizeof(xcb_xkb_mod_def_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].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_xkb_set_compat_map (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint8_t recomputeActions, + uint8_t truncateSI, + uint8_t groups, + uint16_t firstSI, + uint16_t nSI, + const xcb_xkb_sym_interpret_t *si, + const xcb_xkb_mod_def_t *groupMaps) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SET_COMPAT_MAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[8]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_set_compat_map_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.pad0 = 0; + xcb_out.recomputeActions = recomputeActions; + xcb_out.truncateSI = truncateSI; + xcb_out.groups = groups; + xcb_out.firstSI = firstSI; + xcb_out.nSI = nSI; + memset(xcb_out.pad1, 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_xkb_sym_interpret_t si */ + xcb_parts[4].iov_base = (char *) si; + xcb_parts[4].iov_len = nSI * sizeof(xcb_xkb_sym_interpret_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_xkb_mod_def_t groupMaps */ + xcb_parts[6].iov_base = (char *) groupMaps; + xcb_parts[6].iov_len = xcb_popcount(groups) * sizeof(xcb_xkb_mod_def_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_xkb_sym_interpret_t * +xcb_xkb_set_compat_map_si (const xcb_xkb_set_compat_map_request_t *R) +{ + return (xcb_xkb_sym_interpret_t *) (R + 1); +} + +int +xcb_xkb_set_compat_map_si_length (const xcb_xkb_set_compat_map_request_t *R) +{ + return R->nSI; +} + +xcb_xkb_sym_interpret_iterator_t +xcb_xkb_set_compat_map_si_iterator (const xcb_xkb_set_compat_map_request_t *R) +{ + xcb_xkb_sym_interpret_iterator_t i; + i.data = (xcb_xkb_sym_interpret_t *) (R + 1); + i.rem = R->nSI; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xkb_mod_def_t * +xcb_xkb_set_compat_map_group_maps (const xcb_xkb_set_compat_map_request_t *R) +{ + xcb_generic_iterator_t prev = xcb_xkb_sym_interpret_end(xcb_xkb_set_compat_map_si_iterator(R)); + return (xcb_xkb_mod_def_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_mod_def_t, prev.index) + 0); +} + +int +xcb_xkb_set_compat_map_group_maps_length (const xcb_xkb_set_compat_map_request_t *R) +{ + return xcb_popcount(R->groups); +} + +xcb_xkb_mod_def_iterator_t +xcb_xkb_set_compat_map_group_maps_iterator (const xcb_xkb_set_compat_map_request_t *R) +{ + xcb_xkb_mod_def_iterator_t i; + xcb_generic_iterator_t prev = xcb_xkb_sym_interpret_end(xcb_xkb_set_compat_map_si_iterator(R)); + i.data = (xcb_xkb_mod_def_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_mod_def_t, prev.index)); + i.rem = xcb_popcount(R->groups); + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xkb_get_indicator_state_cookie_t +xcb_xkb_get_indicator_state (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_GET_INDICATOR_STATE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_get_indicator_state_cookie_t xcb_ret; + xcb_xkb_get_indicator_state_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + 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_xkb_get_indicator_state_cookie_t +xcb_xkb_get_indicator_state_unchecked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_GET_INDICATOR_STATE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_get_indicator_state_cookie_t xcb_ret; + xcb_xkb_get_indicator_state_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + 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_xkb_get_indicator_state_reply_t * +xcb_xkb_get_indicator_state_reply (xcb_connection_t *c, + xcb_xkb_get_indicator_state_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xkb_get_indicator_state_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_xkb_get_indicator_map_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_get_indicator_map_reply_t *_aux = (xcb_xkb_get_indicator_map_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_xkb_get_indicator_map_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* maps */ + xcb_block_len += xcb_popcount(_aux->which) * sizeof(xcb_xkb_indicator_map_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_indicator_map_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_xkb_get_indicator_map_cookie_t +xcb_xkb_get_indicator_map (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint32_t which) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_GET_INDICATOR_MAP, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_get_indicator_map_cookie_t xcb_ret; + xcb_xkb_get_indicator_map_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + memset(xcb_out.pad0, 0, 2); + xcb_out.which = which; + + 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_xkb_get_indicator_map_cookie_t +xcb_xkb_get_indicator_map_unchecked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint32_t which) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_GET_INDICATOR_MAP, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_get_indicator_map_cookie_t xcb_ret; + xcb_xkb_get_indicator_map_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + memset(xcb_out.pad0, 0, 2); + xcb_out.which = which; + + 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_xkb_indicator_map_t * +xcb_xkb_get_indicator_map_maps (const xcb_xkb_get_indicator_map_reply_t *R) +{ + return (xcb_xkb_indicator_map_t *) (R + 1); +} + +int +xcb_xkb_get_indicator_map_maps_length (const xcb_xkb_get_indicator_map_reply_t *R) +{ + return xcb_popcount(R->which); +} + +xcb_xkb_indicator_map_iterator_t +xcb_xkb_get_indicator_map_maps_iterator (const xcb_xkb_get_indicator_map_reply_t *R) +{ + xcb_xkb_indicator_map_iterator_t i; + i.data = (xcb_xkb_indicator_map_t *) (R + 1); + i.rem = xcb_popcount(R->which); + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xkb_get_indicator_map_reply_t * +xcb_xkb_get_indicator_map_reply (xcb_connection_t *c, + xcb_xkb_get_indicator_map_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xkb_get_indicator_map_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_xkb_set_indicator_map_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_set_indicator_map_request_t *_aux = (xcb_xkb_set_indicator_map_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_xkb_set_indicator_map_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* maps */ + xcb_block_len += xcb_popcount(_aux->which) * sizeof(xcb_xkb_indicator_map_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_indicator_map_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_xkb_set_indicator_map_checked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint32_t which, + const xcb_xkb_indicator_map_t *maps) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SET_INDICATOR_MAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_set_indicator_map_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + memset(xcb_out.pad0, 0, 2); + xcb_out.which = which; + + 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_xkb_indicator_map_t maps */ + xcb_parts[4].iov_base = (char *) maps; + xcb_parts[4].iov_len = xcb_popcount(which) * sizeof(xcb_xkb_indicator_map_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_xkb_set_indicator_map (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint32_t which, + const xcb_xkb_indicator_map_t *maps) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SET_INDICATOR_MAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_set_indicator_map_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + memset(xcb_out.pad0, 0, 2); + xcb_out.which = which; + + 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_xkb_indicator_map_t maps */ + xcb_parts[4].iov_base = (char *) maps; + xcb_parts[4].iov_len = xcb_popcount(which) * sizeof(xcb_xkb_indicator_map_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_xkb_indicator_map_t * +xcb_xkb_set_indicator_map_maps (const xcb_xkb_set_indicator_map_request_t *R) +{ + return (xcb_xkb_indicator_map_t *) (R + 1); +} + +int +xcb_xkb_set_indicator_map_maps_length (const xcb_xkb_set_indicator_map_request_t *R) +{ + return xcb_popcount(R->which); +} + +xcb_xkb_indicator_map_iterator_t +xcb_xkb_set_indicator_map_maps_iterator (const xcb_xkb_set_indicator_map_request_t *R) +{ + xcb_xkb_indicator_map_iterator_t i; + i.data = (xcb_xkb_indicator_map_t *) (R + 1); + i.rem = xcb_popcount(R->which); + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xkb_get_named_indicator_cookie_t +xcb_xkb_get_named_indicator (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + xcb_xkb_led_class_spec_t ledClass, + xcb_xkb_id_spec_t ledID, + xcb_atom_t indicator) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_GET_NAMED_INDICATOR, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_get_named_indicator_cookie_t xcb_ret; + xcb_xkb_get_named_indicator_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.ledClass = ledClass; + xcb_out.ledID = ledID; + memset(xcb_out.pad0, 0, 2); + xcb_out.indicator = indicator; + + 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_xkb_get_named_indicator_cookie_t +xcb_xkb_get_named_indicator_unchecked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + xcb_xkb_led_class_spec_t ledClass, + xcb_xkb_id_spec_t ledID, + xcb_atom_t indicator) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_GET_NAMED_INDICATOR, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_get_named_indicator_cookie_t xcb_ret; + xcb_xkb_get_named_indicator_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.ledClass = ledClass; + xcb_out.ledID = ledID; + memset(xcb_out.pad0, 0, 2); + xcb_out.indicator = indicator; + + 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_xkb_get_named_indicator_reply_t * +xcb_xkb_get_named_indicator_reply (xcb_connection_t *c, + xcb_xkb_get_named_indicator_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xkb_get_named_indicator_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_xkb_set_named_indicator_checked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + xcb_xkb_led_class_spec_t ledClass, + xcb_xkb_id_spec_t ledID, + xcb_atom_t indicator, + uint8_t setState, + uint8_t on, + uint8_t setMap, + uint8_t createMap, + uint8_t map_flags, + uint8_t map_whichGroups, + uint8_t map_groups, + uint8_t map_whichMods, + uint8_t map_realMods, + uint16_t map_vmods, + uint32_t map_ctrls) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SET_NAMED_INDICATOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_set_named_indicator_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.ledClass = ledClass; + xcb_out.ledID = ledID; + memset(xcb_out.pad0, 0, 2); + xcb_out.indicator = indicator; + xcb_out.setState = setState; + xcb_out.on = on; + xcb_out.setMap = setMap; + xcb_out.createMap = createMap; + xcb_out.pad1 = 0; + xcb_out.map_flags = map_flags; + xcb_out.map_whichGroups = map_whichGroups; + xcb_out.map_groups = map_groups; + xcb_out.map_whichMods = map_whichMods; + xcb_out.map_realMods = map_realMods; + xcb_out.map_vmods = map_vmods; + xcb_out.map_ctrls = map_ctrls; + + 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_xkb_set_named_indicator (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + xcb_xkb_led_class_spec_t ledClass, + xcb_xkb_id_spec_t ledID, + xcb_atom_t indicator, + uint8_t setState, + uint8_t on, + uint8_t setMap, + uint8_t createMap, + uint8_t map_flags, + uint8_t map_whichGroups, + uint8_t map_groups, + uint8_t map_whichMods, + uint8_t map_realMods, + uint16_t map_vmods, + uint32_t map_ctrls) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SET_NAMED_INDICATOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_set_named_indicator_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.ledClass = ledClass; + xcb_out.ledID = ledID; + memset(xcb_out.pad0, 0, 2); + xcb_out.indicator = indicator; + xcb_out.setState = setState; + xcb_out.on = on; + xcb_out.setMap = setMap; + xcb_out.createMap = createMap; + xcb_out.pad1 = 0; + xcb_out.map_flags = map_flags; + xcb_out.map_whichGroups = map_whichGroups; + xcb_out.map_groups = map_groups; + xcb_out.map_whichMods = map_whichMods; + xcb_out.map_realMods = map_realMods; + xcb_out.map_vmods = map_vmods; + xcb_out.map_ctrls = map_ctrls; + + 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_atom_t * +xcb_xkb_get_names_value_list_type_names (const xcb_xkb_get_names_value_list_t *S) +{ + return S->typeNames; +} + +int +xcb_xkb_get_names_value_list_type_names_length (const xcb_xkb_get_names_reply_t *R, + const xcb_xkb_get_names_value_list_t *S) +{ + return R->nTypes; +} + +xcb_generic_iterator_t +xcb_xkb_get_names_value_list_type_names_end (const xcb_xkb_get_names_reply_t *R, + const xcb_xkb_get_names_value_list_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->typeNames + R->nTypes; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +uint8_t * +xcb_xkb_get_names_value_list_n_levels_per_type (const xcb_xkb_get_names_value_list_t *S) +{ + return S->nLevelsPerType; +} + +int +xcb_xkb_get_names_value_list_n_levels_per_type_length (const xcb_xkb_get_names_reply_t *R, + const xcb_xkb_get_names_value_list_t *S) +{ + return R->nTypes; +} + +xcb_generic_iterator_t +xcb_xkb_get_names_value_list_n_levels_per_type_end (const xcb_xkb_get_names_reply_t *R, + const xcb_xkb_get_names_value_list_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->nLevelsPerType + R->nTypes; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_atom_t * +xcb_xkb_get_names_value_list_kt_level_names (const xcb_xkb_get_names_value_list_t *S) +{ + return S->ktLevelNames; +} + +int +xcb_xkb_get_names_value_list_kt_level_names_length (const xcb_xkb_get_names_reply_t *R, + const xcb_xkb_get_names_value_list_t *S) +{ + int xcb_pre_tmp_1; /* sumof length */ + int xcb_pre_tmp_2; /* sumof loop counter */ + int64_t xcb_pre_tmp_3; /* sumof sum */ + const uint8_t* xcb_pre_tmp_4; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_1 = R->nTypes; + xcb_pre_tmp_3 = 0; + xcb_pre_tmp_4 = S->nLevelsPerType; + for (xcb_pre_tmp_2 = 0; xcb_pre_tmp_2 < xcb_pre_tmp_1; xcb_pre_tmp_2++) { + xcb_pre_tmp_3 += *xcb_pre_tmp_4; + xcb_pre_tmp_4++; + } + /* sumof end. Result is in xcb_pre_tmp_3 */ + return xcb_pre_tmp_3; +} + +xcb_generic_iterator_t +xcb_xkb_get_names_value_list_kt_level_names_end (const xcb_xkb_get_names_reply_t *R, + const xcb_xkb_get_names_value_list_t *S) +{ + xcb_generic_iterator_t i; + int xcb_pre_tmp_5; /* sumof length */ + int xcb_pre_tmp_6; /* sumof loop counter */ + int64_t xcb_pre_tmp_7; /* sumof sum */ + const uint8_t* xcb_pre_tmp_8; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_5 = R->nTypes; + xcb_pre_tmp_7 = 0; + xcb_pre_tmp_8 = S->nLevelsPerType; + for (xcb_pre_tmp_6 = 0; xcb_pre_tmp_6 < xcb_pre_tmp_5; xcb_pre_tmp_6++) { + xcb_pre_tmp_7 += *xcb_pre_tmp_8; + xcb_pre_tmp_8++; + } + /* sumof end. Result is in xcb_pre_tmp_7 */ + i.data = S->ktLevelNames + xcb_pre_tmp_7; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_atom_t * +xcb_xkb_get_names_value_list_indicator_names (const xcb_xkb_get_names_value_list_t *S) +{ + return S->indicatorNames; +} + +int +xcb_xkb_get_names_value_list_indicator_names_length (const xcb_xkb_get_names_reply_t *R, + const xcb_xkb_get_names_value_list_t *S) +{ + return xcb_popcount(R->indicators); +} + +xcb_generic_iterator_t +xcb_xkb_get_names_value_list_indicator_names_end (const xcb_xkb_get_names_reply_t *R, + const xcb_xkb_get_names_value_list_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->indicatorNames + xcb_popcount(R->indicators); + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_atom_t * +xcb_xkb_get_names_value_list_virtual_mod_names (const xcb_xkb_get_names_value_list_t *S) +{ + return S->virtualModNames; +} + +int +xcb_xkb_get_names_value_list_virtual_mod_names_length (const xcb_xkb_get_names_reply_t *R, + const xcb_xkb_get_names_value_list_t *S) +{ + return xcb_popcount(R->virtualMods); +} + +xcb_generic_iterator_t +xcb_xkb_get_names_value_list_virtual_mod_names_end (const xcb_xkb_get_names_reply_t *R, + const xcb_xkb_get_names_value_list_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->virtualModNames + xcb_popcount(R->virtualMods); + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_atom_t * +xcb_xkb_get_names_value_list_groups (const xcb_xkb_get_names_value_list_t *S) +{ + return S->groups; +} + +int +xcb_xkb_get_names_value_list_groups_length (const xcb_xkb_get_names_reply_t *R, + const xcb_xkb_get_names_value_list_t *S) +{ + return xcb_popcount(R->groupNames); +} + +xcb_generic_iterator_t +xcb_xkb_get_names_value_list_groups_end (const xcb_xkb_get_names_reply_t *R, + const xcb_xkb_get_names_value_list_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->groups + xcb_popcount(R->groupNames); + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_key_name_t * +xcb_xkb_get_names_value_list_key_names (const xcb_xkb_get_names_value_list_t *S) +{ + return S->keyNames; +} + +int +xcb_xkb_get_names_value_list_key_names_length (const xcb_xkb_get_names_reply_t *R, + const xcb_xkb_get_names_value_list_t *S) +{ + return R->nKeys; +} + +xcb_xkb_key_name_iterator_t +xcb_xkb_get_names_value_list_key_names_iterator (const xcb_xkb_get_names_reply_t *R, + const xcb_xkb_get_names_value_list_t *S) +{ + xcb_xkb_key_name_iterator_t i; + i.data = S->keyNames; + i.rem = R->nKeys; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_key_alias_t * +xcb_xkb_get_names_value_list_key_aliases (const xcb_xkb_get_names_value_list_t *S) +{ + return S->keyAliases; +} + +int +xcb_xkb_get_names_value_list_key_aliases_length (const xcb_xkb_get_names_reply_t *R, + const xcb_xkb_get_names_value_list_t *S) +{ + return R->nKeyAliases; +} + +xcb_xkb_key_alias_iterator_t +xcb_xkb_get_names_value_list_key_aliases_iterator (const xcb_xkb_get_names_reply_t *R, + const xcb_xkb_get_names_value_list_t *S) +{ + xcb_xkb_key_alias_iterator_t i; + i.data = S->keyAliases; + i.rem = R->nKeyAliases; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_atom_t * +xcb_xkb_get_names_value_list_radio_group_names (const xcb_xkb_get_names_value_list_t *S) +{ + return S->radioGroupNames; +} + +int +xcb_xkb_get_names_value_list_radio_group_names_length (const xcb_xkb_get_names_reply_t *R, + const xcb_xkb_get_names_value_list_t *S) +{ + return R->nRadioGroups; +} + +xcb_generic_iterator_t +xcb_xkb_get_names_value_list_radio_group_names_end (const xcb_xkb_get_names_reply_t *R, + const xcb_xkb_get_names_value_list_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->radioGroupNames + R->nRadioGroups; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +int +xcb_xkb_get_names_value_list_serialize (void **_buffer, + uint8_t nTypes, + uint32_t indicators, + uint16_t virtualMods, + uint8_t groupNames, + uint8_t nKeys, + uint8_t nKeyAliases, + uint8_t nRadioGroups, + uint32_t which, + const xcb_xkb_get_names_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; + + int xcb_pre_tmp_1; /* sumof length */ + int xcb_pre_tmp_2; /* sumof loop counter */ + int64_t xcb_pre_tmp_3; /* sumof sum */ + const uint8_t* xcb_pre_tmp_4; /* sumof list ptr */ + unsigned int xcb_pad = 0; + char xcb_pad0[3] = {0, 0, 0}; + struct iovec xcb_parts[26]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(which & XCB_XKB_NAME_DETAIL_KEYCODES) { + /* xcb_xkb_get_names_value_list_t.keycodesName */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->keycodesName; + xcb_block_len += sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_GEOMETRY) { + /* xcb_xkb_get_names_value_list_t.geometryName */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometryName; + xcb_block_len += sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_SYMBOLS) { + /* xcb_xkb_get_names_value_list_t.symbolsName */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->symbolsName; + xcb_block_len += sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_PHYS_SYMBOLS) { + /* xcb_xkb_get_names_value_list_t.physSymbolsName */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->physSymbolsName; + xcb_block_len += sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_TYPES) { + /* xcb_xkb_get_names_value_list_t.typesName */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->typesName; + xcb_block_len += sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_COMPAT) { + /* xcb_xkb_get_names_value_list_t.compatName */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->compatName; + xcb_block_len += sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_KEY_TYPE_NAMES) { + /* 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; + /* typeNames */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->typeNames; + xcb_block_len += nTypes * sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = nTypes * sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_KT_LEVEL_NAMES) { + /* 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; + /* nLevelsPerType */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->nLevelsPerType; + xcb_block_len += nTypes * sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = nTypes * sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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; + /* 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; + /* ktLevelNames */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames; + /* sumof start */ + xcb_pre_tmp_1 = nTypes; + xcb_pre_tmp_3 = 0; + xcb_pre_tmp_4 = _aux->nLevelsPerType; + for (xcb_pre_tmp_2 = 0; xcb_pre_tmp_2 < xcb_pre_tmp_1; xcb_pre_tmp_2++) { + xcb_pre_tmp_3 += *xcb_pre_tmp_4; + xcb_pre_tmp_4++; + } + /* sumof end. Result is in xcb_pre_tmp_3 */ + xcb_block_len += xcb_pre_tmp_3 * sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = xcb_pre_tmp_3 * sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_INDICATOR_NAMES) { + /* 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; + /* indicatorNames */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->indicatorNames; + xcb_block_len += xcb_popcount(indicators) * sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = xcb_popcount(indicators) * sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_VIRTUAL_MOD_NAMES) { + /* 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; + /* virtualModNames */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->virtualModNames; + xcb_block_len += xcb_popcount(virtualMods) * sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = xcb_popcount(virtualMods) * sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_GROUP_NAMES) { + /* 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; + /* groups */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->groups; + xcb_block_len += xcb_popcount(groupNames) * sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = xcb_popcount(groupNames) * sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_KEY_NAMES) { + /* 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; + /* keyNames */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->keyNames; + xcb_block_len += nKeys * sizeof(xcb_xkb_key_name_t); + xcb_parts[xcb_parts_idx].iov_len = nKeys * sizeof(xcb_xkb_key_name_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_key_name_t); + } + if(which & XCB_XKB_NAME_DETAIL_KEY_ALIASES) { + /* 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; + /* keyAliases */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->keyAliases; + xcb_block_len += nKeyAliases * sizeof(xcb_xkb_key_alias_t); + xcb_parts[xcb_parts_idx].iov_len = nKeyAliases * sizeof(xcb_xkb_key_alias_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_key_alias_t); + } + if(which & XCB_XKB_NAME_DETAIL_RG_NAMES) { + /* 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; + /* radioGroupNames */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->radioGroupNames; + xcb_block_len += nRadioGroups * sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = nRadioGroups * sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_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_xkb_get_names_value_list_unpack (const void *_buffer, + uint8_t nTypes, + uint32_t indicators, + uint16_t virtualMods, + uint8_t groupNames, + uint8_t nKeys, + uint8_t nKeyAliases, + uint8_t nRadioGroups, + uint32_t which, + xcb_xkb_get_names_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; + + int xcb_pre_tmp_1; /* sumof length */ + int xcb_pre_tmp_2; /* sumof loop counter */ + int64_t xcb_pre_tmp_3; /* sumof sum */ + const uint8_t* xcb_pre_tmp_4; /* sumof list ptr */ + + if(which & XCB_XKB_NAME_DETAIL_KEYCODES) { + /* xcb_xkb_get_names_value_list_t.keycodesName */ + _aux->keycodesName = *(xcb_atom_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_atom_t); + xcb_tmp += sizeof(xcb_atom_t); + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_GEOMETRY) { + /* xcb_xkb_get_names_value_list_t.geometryName */ + _aux->geometryName = *(xcb_atom_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_atom_t); + xcb_tmp += sizeof(xcb_atom_t); + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_SYMBOLS) { + /* xcb_xkb_get_names_value_list_t.symbolsName */ + _aux->symbolsName = *(xcb_atom_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_atom_t); + xcb_tmp += sizeof(xcb_atom_t); + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_PHYS_SYMBOLS) { + /* xcb_xkb_get_names_value_list_t.physSymbolsName */ + _aux->physSymbolsName = *(xcb_atom_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_atom_t); + xcb_tmp += sizeof(xcb_atom_t); + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_TYPES) { + /* xcb_xkb_get_names_value_list_t.typesName */ + _aux->typesName = *(xcb_atom_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_atom_t); + xcb_tmp += sizeof(xcb_atom_t); + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_COMPAT) { + /* xcb_xkb_get_names_value_list_t.compatName */ + _aux->compatName = *(xcb_atom_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_atom_t); + xcb_tmp += sizeof(xcb_atom_t); + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_KEY_TYPE_NAMES) { + /* 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; + /* typeNames */ + _aux->typeNames = (xcb_atom_t *)xcb_tmp; + xcb_block_len += nTypes * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_KT_LEVEL_NAMES) { + /* 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; + /* nLevelsPerType */ + _aux->nLevelsPerType = (uint8_t *)xcb_tmp; + xcb_block_len += nTypes * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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; + /* 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; + /* ktLevelNames */ + _aux->ktLevelNames = (xcb_atom_t *)xcb_tmp; + /* sumof start */ + xcb_pre_tmp_1 = nTypes; + xcb_pre_tmp_3 = 0; + xcb_pre_tmp_4 = _aux->nLevelsPerType; + for (xcb_pre_tmp_2 = 0; xcb_pre_tmp_2 < xcb_pre_tmp_1; xcb_pre_tmp_2++) { + xcb_pre_tmp_3 += *xcb_pre_tmp_4; + xcb_pre_tmp_4++; + } + /* sumof end. Result is in xcb_pre_tmp_3 */ + xcb_block_len += xcb_pre_tmp_3 * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_INDICATOR_NAMES) { + /* 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; + /* indicatorNames */ + _aux->indicatorNames = (xcb_atom_t *)xcb_tmp; + xcb_block_len += xcb_popcount(indicators) * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_VIRTUAL_MOD_NAMES) { + /* 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; + /* virtualModNames */ + _aux->virtualModNames = (xcb_atom_t *)xcb_tmp; + xcb_block_len += xcb_popcount(virtualMods) * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_GROUP_NAMES) { + /* 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; + /* groups */ + _aux->groups = (xcb_atom_t *)xcb_tmp; + xcb_block_len += xcb_popcount(groupNames) * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_KEY_NAMES) { + /* 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; + /* keyNames */ + _aux->keyNames = (xcb_xkb_key_name_t *)xcb_tmp; + xcb_block_len += nKeys * sizeof(xcb_xkb_key_name_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_key_name_t); + } + if(which & XCB_XKB_NAME_DETAIL_KEY_ALIASES) { + /* 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; + /* keyAliases */ + _aux->keyAliases = (xcb_xkb_key_alias_t *)xcb_tmp; + xcb_block_len += nKeyAliases * sizeof(xcb_xkb_key_alias_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_key_alias_t); + } + if(which & XCB_XKB_NAME_DETAIL_RG_NAMES) { + /* 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; + /* radioGroupNames */ + _aux->radioGroupNames = (xcb_atom_t *)xcb_tmp; + xcb_block_len += nRadioGroups * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_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_xkb_get_names_value_list_sizeof (const void *_buffer, + uint8_t nTypes, + uint32_t indicators, + uint16_t virtualMods, + uint8_t groupNames, + uint8_t nKeys, + uint8_t nKeyAliases, + uint8_t nRadioGroups, + uint32_t which) +{ + xcb_xkb_get_names_value_list_t _aux; + return xcb_xkb_get_names_value_list_unpack(_buffer, nTypes, indicators, virtualMods, groupNames, nKeys, nKeyAliases, nRadioGroups, which, &_aux); +} + +int +xcb_xkb_get_names_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_get_names_reply_t *_aux = (xcb_xkb_get_names_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_xkb_get_names_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* valueList */ + xcb_block_len += xcb_xkb_get_names_value_list_sizeof(xcb_tmp, _aux->nTypes, _aux->indicators, _aux->virtualMods, _aux->groupNames, _aux->nKeys, _aux->nKeyAliases, _aux->nRadioGroups, _aux->which); + 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_xkb_get_names_cookie_t +xcb_xkb_get_names (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint32_t which) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_GET_NAMES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_get_names_cookie_t xcb_ret; + xcb_xkb_get_names_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + memset(xcb_out.pad0, 0, 2); + xcb_out.which = which; + + 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_xkb_get_names_cookie_t +xcb_xkb_get_names_unchecked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint32_t which) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_GET_NAMES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_get_names_cookie_t xcb_ret; + xcb_xkb_get_names_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + memset(xcb_out.pad0, 0, 2); + xcb_out.which = which; + + 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_xkb_get_names_value_list (const xcb_xkb_get_names_reply_t *R) +{ + return (void *) (R + 1); +} + +xcb_xkb_get_names_reply_t * +xcb_xkb_get_names_reply (xcb_connection_t *c, + xcb_xkb_get_names_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xkb_get_names_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_atom_t * +xcb_xkb_set_names_values_type_names (const xcb_xkb_set_names_values_t *S) +{ + return S->typeNames; +} + +int +xcb_xkb_set_names_values_type_names_length (const xcb_xkb_set_names_request_t *R, + const xcb_xkb_set_names_values_t *S) +{ + return R->nTypes; +} + +xcb_generic_iterator_t +xcb_xkb_set_names_values_type_names_end (const xcb_xkb_set_names_request_t *R, + const xcb_xkb_set_names_values_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->typeNames + R->nTypes; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +uint8_t * +xcb_xkb_set_names_values_n_levels_per_type (const xcb_xkb_set_names_values_t *S) +{ + return S->nLevelsPerType; +} + +int +xcb_xkb_set_names_values_n_levels_per_type_length (const xcb_xkb_set_names_request_t *R, + const xcb_xkb_set_names_values_t *S) +{ + return R->nTypes; +} + +xcb_generic_iterator_t +xcb_xkb_set_names_values_n_levels_per_type_end (const xcb_xkb_set_names_request_t *R, + const xcb_xkb_set_names_values_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->nLevelsPerType + R->nTypes; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_atom_t * +xcb_xkb_set_names_values_kt_level_names (const xcb_xkb_set_names_values_t *S) +{ + return S->ktLevelNames; +} + +int +xcb_xkb_set_names_values_kt_level_names_length (const xcb_xkb_set_names_request_t *R, + const xcb_xkb_set_names_values_t *S) +{ + int xcb_pre_tmp_1; /* sumof length */ + int xcb_pre_tmp_2; /* sumof loop counter */ + int64_t xcb_pre_tmp_3; /* sumof sum */ + const uint8_t* xcb_pre_tmp_4; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_1 = R->nTypes; + xcb_pre_tmp_3 = 0; + xcb_pre_tmp_4 = S->nLevelsPerType; + for (xcb_pre_tmp_2 = 0; xcb_pre_tmp_2 < xcb_pre_tmp_1; xcb_pre_tmp_2++) { + xcb_pre_tmp_3 += *xcb_pre_tmp_4; + xcb_pre_tmp_4++; + } + /* sumof end. Result is in xcb_pre_tmp_3 */ + return xcb_pre_tmp_3; +} + +xcb_generic_iterator_t +xcb_xkb_set_names_values_kt_level_names_end (const xcb_xkb_set_names_request_t *R, + const xcb_xkb_set_names_values_t *S) +{ + xcb_generic_iterator_t i; + int xcb_pre_tmp_5; /* sumof length */ + int xcb_pre_tmp_6; /* sumof loop counter */ + int64_t xcb_pre_tmp_7; /* sumof sum */ + const uint8_t* xcb_pre_tmp_8; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_5 = R->nTypes; + xcb_pre_tmp_7 = 0; + xcb_pre_tmp_8 = S->nLevelsPerType; + for (xcb_pre_tmp_6 = 0; xcb_pre_tmp_6 < xcb_pre_tmp_5; xcb_pre_tmp_6++) { + xcb_pre_tmp_7 += *xcb_pre_tmp_8; + xcb_pre_tmp_8++; + } + /* sumof end. Result is in xcb_pre_tmp_7 */ + i.data = S->ktLevelNames + xcb_pre_tmp_7; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_atom_t * +xcb_xkb_set_names_values_indicator_names (const xcb_xkb_set_names_values_t *S) +{ + return S->indicatorNames; +} + +int +xcb_xkb_set_names_values_indicator_names_length (const xcb_xkb_set_names_request_t *R, + const xcb_xkb_set_names_values_t *S) +{ + return xcb_popcount(R->indicators); +} + +xcb_generic_iterator_t +xcb_xkb_set_names_values_indicator_names_end (const xcb_xkb_set_names_request_t *R, + const xcb_xkb_set_names_values_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->indicatorNames + xcb_popcount(R->indicators); + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_atom_t * +xcb_xkb_set_names_values_virtual_mod_names (const xcb_xkb_set_names_values_t *S) +{ + return S->virtualModNames; +} + +int +xcb_xkb_set_names_values_virtual_mod_names_length (const xcb_xkb_set_names_request_t *R, + const xcb_xkb_set_names_values_t *S) +{ + return xcb_popcount(R->virtualMods); +} + +xcb_generic_iterator_t +xcb_xkb_set_names_values_virtual_mod_names_end (const xcb_xkb_set_names_request_t *R, + const xcb_xkb_set_names_values_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->virtualModNames + xcb_popcount(R->virtualMods); + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_atom_t * +xcb_xkb_set_names_values_groups (const xcb_xkb_set_names_values_t *S) +{ + return S->groups; +} + +int +xcb_xkb_set_names_values_groups_length (const xcb_xkb_set_names_request_t *R, + const xcb_xkb_set_names_values_t *S) +{ + return xcb_popcount(R->groupNames); +} + +xcb_generic_iterator_t +xcb_xkb_set_names_values_groups_end (const xcb_xkb_set_names_request_t *R, + const xcb_xkb_set_names_values_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->groups + xcb_popcount(R->groupNames); + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_key_name_t * +xcb_xkb_set_names_values_key_names (const xcb_xkb_set_names_values_t *S) +{ + return S->keyNames; +} + +int +xcb_xkb_set_names_values_key_names_length (const xcb_xkb_set_names_request_t *R, + const xcb_xkb_set_names_values_t *S) +{ + return R->nKeys; +} + +xcb_xkb_key_name_iterator_t +xcb_xkb_set_names_values_key_names_iterator (const xcb_xkb_set_names_request_t *R, + const xcb_xkb_set_names_values_t *S) +{ + xcb_xkb_key_name_iterator_t i; + i.data = S->keyNames; + i.rem = R->nKeys; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_key_alias_t * +xcb_xkb_set_names_values_key_aliases (const xcb_xkb_set_names_values_t *S) +{ + return S->keyAliases; +} + +int +xcb_xkb_set_names_values_key_aliases_length (const xcb_xkb_set_names_request_t *R, + const xcb_xkb_set_names_values_t *S) +{ + return R->nKeyAliases; +} + +xcb_xkb_key_alias_iterator_t +xcb_xkb_set_names_values_key_aliases_iterator (const xcb_xkb_set_names_request_t *R, + const xcb_xkb_set_names_values_t *S) +{ + xcb_xkb_key_alias_iterator_t i; + i.data = S->keyAliases; + i.rem = R->nKeyAliases; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_atom_t * +xcb_xkb_set_names_values_radio_group_names (const xcb_xkb_set_names_values_t *S) +{ + return S->radioGroupNames; +} + +int +xcb_xkb_set_names_values_radio_group_names_length (const xcb_xkb_set_names_request_t *R, + const xcb_xkb_set_names_values_t *S) +{ + return R->nRadioGroups; +} + +xcb_generic_iterator_t +xcb_xkb_set_names_values_radio_group_names_end (const xcb_xkb_set_names_request_t *R, + const xcb_xkb_set_names_values_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->radioGroupNames + R->nRadioGroups; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +int +xcb_xkb_set_names_values_serialize (void **_buffer, + uint8_t nTypes, + uint32_t indicators, + uint16_t virtualMods, + uint8_t groupNames, + uint8_t nKeys, + uint8_t nKeyAliases, + uint8_t nRadioGroups, + uint32_t which, + const xcb_xkb_set_names_values_t *_aux) +{ + char *xcb_out = *_buffer; + unsigned int xcb_buffer_len = 0; + unsigned int xcb_align_to = 0; + unsigned int xcb_padding_offset = 0; + + int xcb_pre_tmp_1; /* sumof length */ + int xcb_pre_tmp_2; /* sumof loop counter */ + int64_t xcb_pre_tmp_3; /* sumof sum */ + const uint8_t* xcb_pre_tmp_4; /* sumof list ptr */ + unsigned int xcb_pad = 0; + char xcb_pad0[3] = {0, 0, 0}; + struct iovec xcb_parts[26]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(which & XCB_XKB_NAME_DETAIL_KEYCODES) { + /* xcb_xkb_set_names_values_t.keycodesName */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->keycodesName; + xcb_block_len += sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_GEOMETRY) { + /* xcb_xkb_set_names_values_t.geometryName */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometryName; + xcb_block_len += sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_SYMBOLS) { + /* xcb_xkb_set_names_values_t.symbolsName */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->symbolsName; + xcb_block_len += sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_PHYS_SYMBOLS) { + /* xcb_xkb_set_names_values_t.physSymbolsName */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->physSymbolsName; + xcb_block_len += sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_TYPES) { + /* xcb_xkb_set_names_values_t.typesName */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->typesName; + xcb_block_len += sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_COMPAT) { + /* xcb_xkb_set_names_values_t.compatName */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->compatName; + xcb_block_len += sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_KEY_TYPE_NAMES) { + /* 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; + /* typeNames */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->typeNames; + xcb_block_len += nTypes * sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = nTypes * sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_KT_LEVEL_NAMES) { + /* 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; + /* nLevelsPerType */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->nLevelsPerType; + xcb_block_len += nTypes * sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = nTypes * sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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; + /* 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; + /* ktLevelNames */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames; + /* sumof start */ + xcb_pre_tmp_1 = nTypes; + xcb_pre_tmp_3 = 0; + xcb_pre_tmp_4 = _aux->nLevelsPerType; + for (xcb_pre_tmp_2 = 0; xcb_pre_tmp_2 < xcb_pre_tmp_1; xcb_pre_tmp_2++) { + xcb_pre_tmp_3 += *xcb_pre_tmp_4; + xcb_pre_tmp_4++; + } + /* sumof end. Result is in xcb_pre_tmp_3 */ + xcb_block_len += xcb_pre_tmp_3 * sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = xcb_pre_tmp_3 * sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_INDICATOR_NAMES) { + /* 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; + /* indicatorNames */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->indicatorNames; + xcb_block_len += xcb_popcount(indicators) * sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = xcb_popcount(indicators) * sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_VIRTUAL_MOD_NAMES) { + /* 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; + /* virtualModNames */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->virtualModNames; + xcb_block_len += xcb_popcount(virtualMods) * sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = xcb_popcount(virtualMods) * sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_GROUP_NAMES) { + /* 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; + /* groups */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->groups; + xcb_block_len += xcb_popcount(groupNames) * sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = xcb_popcount(groupNames) * sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_KEY_NAMES) { + /* 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; + /* keyNames */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->keyNames; + xcb_block_len += nKeys * sizeof(xcb_xkb_key_name_t); + xcb_parts[xcb_parts_idx].iov_len = nKeys * sizeof(xcb_xkb_key_name_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_key_name_t); + } + if(which & XCB_XKB_NAME_DETAIL_KEY_ALIASES) { + /* 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; + /* keyAliases */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->keyAliases; + xcb_block_len += nKeyAliases * sizeof(xcb_xkb_key_alias_t); + xcb_parts[xcb_parts_idx].iov_len = nKeyAliases * sizeof(xcb_xkb_key_alias_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_key_alias_t); + } + if(which & XCB_XKB_NAME_DETAIL_RG_NAMES) { + /* 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; + /* radioGroupNames */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->radioGroupNames; + xcb_block_len += nRadioGroups * sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = nRadioGroups * sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_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_xkb_set_names_values_unpack (const void *_buffer, + uint8_t nTypes, + uint32_t indicators, + uint16_t virtualMods, + uint8_t groupNames, + uint8_t nKeys, + uint8_t nKeyAliases, + uint8_t nRadioGroups, + uint32_t which, + xcb_xkb_set_names_values_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; + + int xcb_pre_tmp_1; /* sumof length */ + int xcb_pre_tmp_2; /* sumof loop counter */ + int64_t xcb_pre_tmp_3; /* sumof sum */ + const uint8_t* xcb_pre_tmp_4; /* sumof list ptr */ + + if(which & XCB_XKB_NAME_DETAIL_KEYCODES) { + /* xcb_xkb_set_names_values_t.keycodesName */ + _aux->keycodesName = *(xcb_atom_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_atom_t); + xcb_tmp += sizeof(xcb_atom_t); + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_GEOMETRY) { + /* xcb_xkb_set_names_values_t.geometryName */ + _aux->geometryName = *(xcb_atom_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_atom_t); + xcb_tmp += sizeof(xcb_atom_t); + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_SYMBOLS) { + /* xcb_xkb_set_names_values_t.symbolsName */ + _aux->symbolsName = *(xcb_atom_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_atom_t); + xcb_tmp += sizeof(xcb_atom_t); + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_PHYS_SYMBOLS) { + /* xcb_xkb_set_names_values_t.physSymbolsName */ + _aux->physSymbolsName = *(xcb_atom_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_atom_t); + xcb_tmp += sizeof(xcb_atom_t); + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_TYPES) { + /* xcb_xkb_set_names_values_t.typesName */ + _aux->typesName = *(xcb_atom_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_atom_t); + xcb_tmp += sizeof(xcb_atom_t); + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_COMPAT) { + /* xcb_xkb_set_names_values_t.compatName */ + _aux->compatName = *(xcb_atom_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_atom_t); + xcb_tmp += sizeof(xcb_atom_t); + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_KEY_TYPE_NAMES) { + /* 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; + /* typeNames */ + _aux->typeNames = (xcb_atom_t *)xcb_tmp; + xcb_block_len += nTypes * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_KT_LEVEL_NAMES) { + /* 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; + /* nLevelsPerType */ + _aux->nLevelsPerType = (uint8_t *)xcb_tmp; + xcb_block_len += nTypes * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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; + /* 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; + /* ktLevelNames */ + _aux->ktLevelNames = (xcb_atom_t *)xcb_tmp; + /* sumof start */ + xcb_pre_tmp_1 = nTypes; + xcb_pre_tmp_3 = 0; + xcb_pre_tmp_4 = _aux->nLevelsPerType; + for (xcb_pre_tmp_2 = 0; xcb_pre_tmp_2 < xcb_pre_tmp_1; xcb_pre_tmp_2++) { + xcb_pre_tmp_3 += *xcb_pre_tmp_4; + xcb_pre_tmp_4++; + } + /* sumof end. Result is in xcb_pre_tmp_3 */ + xcb_block_len += xcb_pre_tmp_3 * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_INDICATOR_NAMES) { + /* 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; + /* indicatorNames */ + _aux->indicatorNames = (xcb_atom_t *)xcb_tmp; + xcb_block_len += xcb_popcount(indicators) * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_VIRTUAL_MOD_NAMES) { + /* 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; + /* virtualModNames */ + _aux->virtualModNames = (xcb_atom_t *)xcb_tmp; + xcb_block_len += xcb_popcount(virtualMods) * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_GROUP_NAMES) { + /* 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; + /* groups */ + _aux->groups = (xcb_atom_t *)xcb_tmp; + xcb_block_len += xcb_popcount(groupNames) * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_KEY_NAMES) { + /* 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; + /* keyNames */ + _aux->keyNames = (xcb_xkb_key_name_t *)xcb_tmp; + xcb_block_len += nKeys * sizeof(xcb_xkb_key_name_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_key_name_t); + } + if(which & XCB_XKB_NAME_DETAIL_KEY_ALIASES) { + /* 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; + /* keyAliases */ + _aux->keyAliases = (xcb_xkb_key_alias_t *)xcb_tmp; + xcb_block_len += nKeyAliases * sizeof(xcb_xkb_key_alias_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_key_alias_t); + } + if(which & XCB_XKB_NAME_DETAIL_RG_NAMES) { + /* 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; + /* radioGroupNames */ + _aux->radioGroupNames = (xcb_atom_t *)xcb_tmp; + xcb_block_len += nRadioGroups * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_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_xkb_set_names_values_sizeof (const void *_buffer, + uint8_t nTypes, + uint32_t indicators, + uint16_t virtualMods, + uint8_t groupNames, + uint8_t nKeys, + uint8_t nKeyAliases, + uint8_t nRadioGroups, + uint32_t which) +{ + xcb_xkb_set_names_values_t _aux; + return xcb_xkb_set_names_values_unpack(_buffer, nTypes, indicators, virtualMods, groupNames, nKeys, nKeyAliases, nRadioGroups, which, &_aux); +} + +int +xcb_xkb_set_names_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_set_names_request_t *_aux = (xcb_xkb_set_names_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_xkb_set_names_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* values */ + xcb_block_len += xcb_xkb_set_names_values_sizeof(xcb_tmp, _aux->nTypes, _aux->indicators, _aux->virtualMods, _aux->groupNames, _aux->nKeys, _aux->nKeyAliases, _aux->nRadioGroups, _aux->which); + 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_xkb_set_names_checked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint16_t virtualMods, + uint32_t which, + uint8_t firstType, + uint8_t nTypes, + uint8_t firstKTLevelt, + uint8_t nKTLevels, + uint32_t indicators, + uint8_t groupNames, + uint8_t nRadioGroups, + xcb_keycode_t firstKey, + uint8_t nKeys, + uint8_t nKeyAliases, + uint16_t totalKTLevelNames, + const void *values) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SET_NAMES, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_set_names_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.virtualMods = virtualMods; + xcb_out.which = which; + xcb_out.firstType = firstType; + xcb_out.nTypes = nTypes; + xcb_out.firstKTLevelt = firstKTLevelt; + xcb_out.nKTLevels = nKTLevels; + xcb_out.indicators = indicators; + xcb_out.groupNames = groupNames; + xcb_out.nRadioGroups = nRadioGroups; + xcb_out.firstKey = firstKey; + xcb_out.nKeys = nKeys; + xcb_out.nKeyAliases = nKeyAliases; + xcb_out.pad0 = 0; + xcb_out.totalKTLevelNames = totalKTLevelNames; + + 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_xkb_set_names_values_t values */ + xcb_parts[4].iov_base = (char *) values; + xcb_parts[4].iov_len = + xcb_xkb_set_names_values_sizeof (values, nTypes, indicators, virtualMods, groupNames, nKeys, nKeyAliases, nRadioGroups, which); + + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_xkb_set_names (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint16_t virtualMods, + uint32_t which, + uint8_t firstType, + uint8_t nTypes, + uint8_t firstKTLevelt, + uint8_t nKTLevels, + uint32_t indicators, + uint8_t groupNames, + uint8_t nRadioGroups, + xcb_keycode_t firstKey, + uint8_t nKeys, + uint8_t nKeyAliases, + uint16_t totalKTLevelNames, + const void *values) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SET_NAMES, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_set_names_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.virtualMods = virtualMods; + xcb_out.which = which; + xcb_out.firstType = firstType; + xcb_out.nTypes = nTypes; + xcb_out.firstKTLevelt = firstKTLevelt; + xcb_out.nKTLevels = nKTLevels; + xcb_out.indicators = indicators; + xcb_out.groupNames = groupNames; + xcb_out.nRadioGroups = nRadioGroups; + xcb_out.firstKey = firstKey; + xcb_out.nKeys = nKeys; + xcb_out.nKeyAliases = nKeyAliases; + xcb_out.pad0 = 0; + xcb_out.totalKTLevelNames = totalKTLevelNames; + + 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_xkb_set_names_values_t values */ + xcb_parts[4].iov_base = (char *) values; + xcb_parts[4].iov_len = + xcb_xkb_set_names_values_sizeof (values, nTypes, indicators, virtualMods, groupNames, nKeys, nKeyAliases, nRadioGroups, which); + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_xkb_set_names_aux_checked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint16_t virtualMods, + uint32_t which, + uint8_t firstType, + uint8_t nTypes, + uint8_t firstKTLevelt, + uint8_t nKTLevels, + uint32_t indicators, + uint8_t groupNames, + uint8_t nRadioGroups, + xcb_keycode_t firstKey, + uint8_t nKeys, + uint8_t nKeyAliases, + uint16_t totalKTLevelNames, + const xcb_xkb_set_names_values_t *values) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SET_NAMES, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_set_names_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.virtualMods = virtualMods; + xcb_out.which = which; + xcb_out.firstType = firstType; + xcb_out.nTypes = nTypes; + xcb_out.firstKTLevelt = firstKTLevelt; + xcb_out.nKTLevels = nKTLevels; + xcb_out.indicators = indicators; + xcb_out.groupNames = groupNames; + xcb_out.nRadioGroups = nRadioGroups; + xcb_out.firstKey = firstKey; + xcb_out.nKeys = nKeys; + xcb_out.nKeyAliases = nKeyAliases; + xcb_out.pad0 = 0; + xcb_out.totalKTLevelNames = totalKTLevelNames; + + 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_xkb_set_names_values_t values */ + xcb_parts[4].iov_len = + xcb_xkb_set_names_values_serialize (&xcb_aux0, nTypes, indicators, virtualMods, groupNames, nKeys, nKeyAliases, nRadioGroups, which, values); + 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_xkb_set_names_aux (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint16_t virtualMods, + uint32_t which, + uint8_t firstType, + uint8_t nTypes, + uint8_t firstKTLevelt, + uint8_t nKTLevels, + uint32_t indicators, + uint8_t groupNames, + uint8_t nRadioGroups, + xcb_keycode_t firstKey, + uint8_t nKeys, + uint8_t nKeyAliases, + uint16_t totalKTLevelNames, + const xcb_xkb_set_names_values_t *values) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SET_NAMES, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_set_names_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.virtualMods = virtualMods; + xcb_out.which = which; + xcb_out.firstType = firstType; + xcb_out.nTypes = nTypes; + xcb_out.firstKTLevelt = firstKTLevelt; + xcb_out.nKTLevels = nKTLevels; + xcb_out.indicators = indicators; + xcb_out.groupNames = groupNames; + xcb_out.nRadioGroups = nRadioGroups; + xcb_out.firstKey = firstKey; + xcb_out.nKeys = nKeys; + xcb_out.nKeyAliases = nKeyAliases; + xcb_out.pad0 = 0; + xcb_out.totalKTLevelNames = totalKTLevelNames; + + 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_xkb_set_names_values_t values */ + xcb_parts[4].iov_len = + xcb_xkb_set_names_values_serialize (&xcb_aux0, nTypes, indicators, virtualMods, groupNames, nKeys, nKeyAliases, nRadioGroups, which, values); + 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_xkb_set_names_values (const xcb_xkb_set_names_request_t *R) +{ + return (void *) (R + 1); +} + +xcb_xkb_per_client_flags_cookie_t +xcb_xkb_per_client_flags (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint32_t change, + uint32_t value, + uint32_t ctrlsToChange, + uint32_t autoCtrls, + uint32_t autoCtrlsValues) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_PER_CLIENT_FLAGS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_per_client_flags_cookie_t xcb_ret; + xcb_xkb_per_client_flags_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + memset(xcb_out.pad0, 0, 2); + xcb_out.change = change; + xcb_out.value = value; + xcb_out.ctrlsToChange = ctrlsToChange; + xcb_out.autoCtrls = autoCtrls; + xcb_out.autoCtrlsValues = autoCtrlsValues; + + 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_xkb_per_client_flags_cookie_t +xcb_xkb_per_client_flags_unchecked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint32_t change, + uint32_t value, + uint32_t ctrlsToChange, + uint32_t autoCtrls, + uint32_t autoCtrlsValues) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_PER_CLIENT_FLAGS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_per_client_flags_cookie_t xcb_ret; + xcb_xkb_per_client_flags_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + memset(xcb_out.pad0, 0, 2); + xcb_out.change = change; + xcb_out.value = value; + xcb_out.ctrlsToChange = ctrlsToChange; + xcb_out.autoCtrls = autoCtrls; + xcb_out.autoCtrlsValues = autoCtrlsValues; + + 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_xkb_per_client_flags_reply_t * +xcb_xkb_per_client_flags_reply (xcb_connection_t *c, + xcb_xkb_per_client_flags_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xkb_per_client_flags_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_xkb_list_components_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_list_components_reply_t *_aux = (xcb_xkb_list_components_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_xkb_list_components_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* keymaps */ + for(i=0; i<_aux->nKeymaps; i++) { + xcb_tmp_len = xcb_xkb_listing_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xkb_listing_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; + /* keycodes */ + for(i=0; i<_aux->nKeycodes; i++) { + xcb_tmp_len = xcb_xkb_listing_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xkb_listing_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; + /* types */ + for(i=0; i<_aux->nTypes; i++) { + xcb_tmp_len = xcb_xkb_listing_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xkb_listing_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; + /* compatMaps */ + for(i=0; i<_aux->nCompatMaps; i++) { + xcb_tmp_len = xcb_xkb_listing_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xkb_listing_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; + /* symbols */ + for(i=0; i<_aux->nSymbols; i++) { + xcb_tmp_len = xcb_xkb_listing_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xkb_listing_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; + /* geometries */ + for(i=0; i<_aux->nGeometries; i++) { + xcb_tmp_len = xcb_xkb_listing_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xkb_listing_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_xkb_list_components_cookie_t +xcb_xkb_list_components (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint16_t maxNames) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_LIST_COMPONENTS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_list_components_cookie_t xcb_ret; + xcb_xkb_list_components_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.maxNames = maxNames; + + 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_xkb_list_components_cookie_t +xcb_xkb_list_components_unchecked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint16_t maxNames) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_LIST_COMPONENTS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_list_components_cookie_t xcb_ret; + xcb_xkb_list_components_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.maxNames = maxNames; + + 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_xkb_list_components_keymaps_length (const xcb_xkb_list_components_reply_t *R) +{ + return R->nKeymaps; +} + +xcb_xkb_listing_iterator_t +xcb_xkb_list_components_keymaps_iterator (const xcb_xkb_list_components_reply_t *R) +{ + xcb_xkb_listing_iterator_t i; + i.data = (xcb_xkb_listing_t *) (R + 1); + i.rem = R->nKeymaps; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_xkb_list_components_keycodes_length (const xcb_xkb_list_components_reply_t *R) +{ + return R->nKeycodes; +} + +xcb_xkb_listing_iterator_t +xcb_xkb_list_components_keycodes_iterator (const xcb_xkb_list_components_reply_t *R) +{ + xcb_xkb_listing_iterator_t i; + xcb_generic_iterator_t prev = xcb_xkb_listing_end(xcb_xkb_list_components_keymaps_iterator(R)); + i.data = (xcb_xkb_listing_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_listing_t, prev.index)); + i.rem = R->nKeycodes; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_xkb_list_components_types_length (const xcb_xkb_list_components_reply_t *R) +{ + return R->nTypes; +} + +xcb_xkb_listing_iterator_t +xcb_xkb_list_components_types_iterator (const xcb_xkb_list_components_reply_t *R) +{ + xcb_xkb_listing_iterator_t i; + xcb_generic_iterator_t prev = xcb_xkb_listing_end(xcb_xkb_list_components_keycodes_iterator(R)); + i.data = (xcb_xkb_listing_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_listing_t, prev.index)); + i.rem = R->nTypes; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_xkb_list_components_compat_maps_length (const xcb_xkb_list_components_reply_t *R) +{ + return R->nCompatMaps; +} + +xcb_xkb_listing_iterator_t +xcb_xkb_list_components_compat_maps_iterator (const xcb_xkb_list_components_reply_t *R) +{ + xcb_xkb_listing_iterator_t i; + xcb_generic_iterator_t prev = xcb_xkb_listing_end(xcb_xkb_list_components_types_iterator(R)); + i.data = (xcb_xkb_listing_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_listing_t, prev.index)); + i.rem = R->nCompatMaps; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_xkb_list_components_symbols_length (const xcb_xkb_list_components_reply_t *R) +{ + return R->nSymbols; +} + +xcb_xkb_listing_iterator_t +xcb_xkb_list_components_symbols_iterator (const xcb_xkb_list_components_reply_t *R) +{ + xcb_xkb_listing_iterator_t i; + xcb_generic_iterator_t prev = xcb_xkb_listing_end(xcb_xkb_list_components_compat_maps_iterator(R)); + i.data = (xcb_xkb_listing_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_listing_t, prev.index)); + i.rem = R->nSymbols; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_xkb_list_components_geometries_length (const xcb_xkb_list_components_reply_t *R) +{ + return R->nGeometries; +} + +xcb_xkb_listing_iterator_t +xcb_xkb_list_components_geometries_iterator (const xcb_xkb_list_components_reply_t *R) +{ + xcb_xkb_listing_iterator_t i; + xcb_generic_iterator_t prev = xcb_xkb_listing_end(xcb_xkb_list_components_symbols_iterator(R)); + i.data = (xcb_xkb_listing_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_listing_t, prev.index)); + i.rem = R->nGeometries; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xkb_list_components_reply_t * +xcb_xkb_list_components_reply (xcb_connection_t *c, + xcb_xkb_list_components_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xkb_list_components_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_xkb_get_kbd_by_name_replies_types_map_types_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->types.nTypes; +} + +xcb_xkb_key_type_iterator_t +xcb_xkb_get_kbd_by_name_replies_types_map_types_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + xcb_xkb_key_type_iterator_t i; + i.data = S->types.map.types_rtrn; + i.rem = S->types.nTypes; + i.index = (char *) i.data - (char *) S; + return i; +} + +int +xcb_xkb_get_kbd_by_name_replies_types_map_syms_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->types.nKeySyms; +} + +xcb_xkb_key_sym_map_iterator_t +xcb_xkb_get_kbd_by_name_replies_types_map_syms_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + xcb_xkb_key_sym_map_iterator_t i; + i.data = S->types.map.syms_rtrn; + i.rem = S->types.nKeySyms; + i.index = (char *) i.data - (char *) S; + return i; +} + +uint8_t * +xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_count (const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->types.map.acts_rtrn_count; +} + +int +xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_count_length (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->types.nKeyActions; +} + +xcb_generic_iterator_t +xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_count_end (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->types.map.acts_rtrn_count + S->types.nKeyActions; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_action_t * +xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_acts (const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->types.map.acts_rtrn_acts; +} + +int +xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_acts_length (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->types.totalActions; +} + +xcb_xkb_action_iterator_t +xcb_xkb_get_kbd_by_name_replies_types_map_acts_rtrn_acts_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + xcb_xkb_action_iterator_t i; + i.data = S->types.map.acts_rtrn_acts; + i.rem = S->types.totalActions; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_set_behavior_t * +xcb_xkb_get_kbd_by_name_replies_types_map_behaviors_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->types.map.behaviors_rtrn; +} + +int +xcb_xkb_get_kbd_by_name_replies_types_map_behaviors_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->types.totalKeyBehaviors; +} + +xcb_xkb_set_behavior_iterator_t +xcb_xkb_get_kbd_by_name_replies_types_map_behaviors_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + xcb_xkb_set_behavior_iterator_t i; + i.data = S->types.map.behaviors_rtrn; + i.rem = S->types.totalKeyBehaviors; + i.index = (char *) i.data - (char *) S; + return i; +} + +uint8_t * +xcb_xkb_get_kbd_by_name_replies_types_map_vmods_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->types.map.vmods_rtrn; +} + +int +xcb_xkb_get_kbd_by_name_replies_types_map_vmods_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return xcb_popcount(S->types.virtualMods); +} + +xcb_generic_iterator_t +xcb_xkb_get_kbd_by_name_replies_types_map_vmods_rtrn_end (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->types.map.vmods_rtrn + xcb_popcount(S->types.virtualMods); + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_set_explicit_t * +xcb_xkb_get_kbd_by_name_replies_types_map_explicit_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->types.map.explicit_rtrn; +} + +int +xcb_xkb_get_kbd_by_name_replies_types_map_explicit_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->types.totalKeyExplicit; +} + +xcb_xkb_set_explicit_iterator_t +xcb_xkb_get_kbd_by_name_replies_types_map_explicit_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + xcb_xkb_set_explicit_iterator_t i; + i.data = S->types.map.explicit_rtrn; + i.rem = S->types.totalKeyExplicit; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_key_mod_map_t * +xcb_xkb_get_kbd_by_name_replies_types_map_modmap_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->types.map.modmap_rtrn; +} + +int +xcb_xkb_get_kbd_by_name_replies_types_map_modmap_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->types.totalModMapKeys; +} + +xcb_xkb_key_mod_map_iterator_t +xcb_xkb_get_kbd_by_name_replies_types_map_modmap_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + xcb_xkb_key_mod_map_iterator_t i; + i.data = S->types.map.modmap_rtrn; + i.rem = S->types.totalModMapKeys; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_key_v_mod_map_t * +xcb_xkb_get_kbd_by_name_replies_types_map_vmodmap_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->types.map.vmodmap_rtrn; +} + +int +xcb_xkb_get_kbd_by_name_replies_types_map_vmodmap_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->types.totalVModMapKeys; +} + +xcb_xkb_key_v_mod_map_iterator_t +xcb_xkb_get_kbd_by_name_replies_types_map_vmodmap_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + xcb_xkb_key_v_mod_map_iterator_t i; + i.data = S->types.map.vmodmap_rtrn; + i.rem = S->types.totalVModMapKeys; + i.index = (char *) i.data - (char *) S; + return i; +} + +int +xcb_xkb_get_kbd_by_name_replies_types_map_serialize (void **_buffer, + uint8_t nTypes, + uint8_t nKeySyms, + uint8_t nKeyActions, + uint16_t totalActions, + uint8_t totalKeyBehaviors, + uint16_t virtualMods, + uint8_t totalKeyExplicit, + uint8_t totalModMapKeys, + uint8_t totalVModMapKeys, + uint16_t present, + const xcb_xkb_get_kbd_by_name_replies_types_map_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[23]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(present & XCB_XKB_MAP_PART_KEY_TYPES) { + /* 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; + /* types_rtrn */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->types_rtrn; + xcb_parts[xcb_parts_idx].iov_len = 0; + xcb_tmp = (char *) _aux->types_rtrn; + for(i=0; i<nTypes; i++) { + xcb_block_len = xcb_xkb_key_type_sizeof(xcb_tmp); + xcb_parts[xcb_parts_idx].iov_len += xcb_block_len; + } + xcb_block_len = xcb_parts[xcb_parts_idx].iov_len; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_key_type_t); + } + if(present & XCB_XKB_MAP_PART_KEY_SYMS) { + /* 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; + /* syms_rtrn */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->syms_rtrn; + xcb_parts[xcb_parts_idx].iov_len = 0; + xcb_tmp = (char *) _aux->syms_rtrn; + for(i=0; i<nKeySyms; i++) { + xcb_block_len = xcb_xkb_key_sym_map_sizeof(xcb_tmp); + xcb_parts[xcb_parts_idx].iov_len += xcb_block_len; + } + xcb_block_len = xcb_parts[xcb_parts_idx].iov_len; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_key_sym_map_t); + } + if(present & XCB_XKB_MAP_PART_KEY_ACTIONS) { + /* 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; + /* acts_rtrn_count */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->acts_rtrn_count; + xcb_block_len += nKeyActions * sizeof(xcb_keycode_t); + xcb_parts[xcb_parts_idx].iov_len = nKeyActions * sizeof(xcb_keycode_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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; + /* 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; + /* acts_rtrn_acts */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->acts_rtrn_acts; + xcb_block_len += totalActions * sizeof(xcb_xkb_action_t); + xcb_parts[xcb_parts_idx].iov_len = totalActions * sizeof(xcb_xkb_action_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_action_t); + } + if(present & XCB_XKB_MAP_PART_KEY_BEHAVIORS) { + /* 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; + /* behaviors_rtrn */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->behaviors_rtrn; + xcb_block_len += totalKeyBehaviors * sizeof(xcb_xkb_set_behavior_t); + xcb_parts[xcb_parts_idx].iov_len = totalKeyBehaviors * sizeof(xcb_xkb_set_behavior_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_set_behavior_t); + } + if(present & XCB_XKB_MAP_PART_VIRTUAL_MODS) { + /* 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; + /* vmods_rtrn */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->vmods_rtrn; + xcb_block_len += xcb_popcount(virtualMods) * sizeof(xcb_keycode_t); + xcb_parts[xcb_parts_idx].iov_len = xcb_popcount(virtualMods) * sizeof(xcb_keycode_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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(present & XCB_XKB_MAP_PART_EXPLICIT_COMPONENTS) { + /* 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; + /* explicit_rtrn */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->explicit_rtrn; + xcb_block_len += totalKeyExplicit * sizeof(xcb_xkb_set_explicit_t); + xcb_parts[xcb_parts_idx].iov_len = totalKeyExplicit * sizeof(xcb_xkb_set_explicit_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_set_explicit_t); + xcb_align_to = 4; + /* 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(present & XCB_XKB_MAP_PART_MODIFIER_MAP) { + /* 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; + /* modmap_rtrn */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->modmap_rtrn; + xcb_block_len += totalModMapKeys * sizeof(xcb_xkb_key_mod_map_t); + xcb_parts[xcb_parts_idx].iov_len = totalModMapKeys * sizeof(xcb_xkb_key_mod_map_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_key_mod_map_t); + xcb_align_to = 4; + /* 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(present & XCB_XKB_MAP_PART_VIRTUAL_MOD_MAP) { + /* 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; + /* vmodmap_rtrn */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->vmodmap_rtrn; + xcb_block_len += totalVModMapKeys * sizeof(xcb_xkb_key_v_mod_map_t); + xcb_parts[xcb_parts_idx].iov_len = totalVModMapKeys * sizeof(xcb_xkb_key_v_mod_map_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_key_v_mod_map_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_xkb_get_kbd_by_name_replies_types_map_unpack (const void *_buffer, + uint8_t nTypes, + uint8_t nKeySyms, + uint8_t nKeyActions, + uint16_t totalActions, + uint8_t totalKeyBehaviors, + uint16_t virtualMods, + uint8_t totalKeyExplicit, + uint8_t totalModMapKeys, + uint8_t totalVModMapKeys, + uint16_t present, + xcb_xkb_get_kbd_by_name_replies_types_map_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + if(present & XCB_XKB_MAP_PART_KEY_TYPES) { + /* 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; + /* types_rtrn */ + _aux->types_rtrn = (xcb_xkb_key_type_t *)xcb_tmp; + for(i=0; i<nTypes; i++) { + xcb_tmp_len = xcb_xkb_key_type_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xkb_key_type_t); + } + if(present & XCB_XKB_MAP_PART_KEY_SYMS) { + /* 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; + /* syms_rtrn */ + _aux->syms_rtrn = (xcb_xkb_key_sym_map_t *)xcb_tmp; + for(i=0; i<nKeySyms; i++) { + xcb_tmp_len = xcb_xkb_key_sym_map_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xkb_key_sym_map_t); + } + if(present & XCB_XKB_MAP_PART_KEY_ACTIONS) { + /* 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; + /* acts_rtrn_count */ + _aux->acts_rtrn_count = (uint8_t *)xcb_tmp; + xcb_block_len += nKeyActions * sizeof(xcb_keycode_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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; + /* 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; + /* acts_rtrn_acts */ + _aux->acts_rtrn_acts = (xcb_xkb_action_t *)xcb_tmp; + xcb_block_len += totalActions * sizeof(xcb_xkb_action_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_action_t); + } + if(present & XCB_XKB_MAP_PART_KEY_BEHAVIORS) { + /* 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; + /* behaviors_rtrn */ + _aux->behaviors_rtrn = (xcb_xkb_set_behavior_t *)xcb_tmp; + xcb_block_len += totalKeyBehaviors * sizeof(xcb_xkb_set_behavior_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_set_behavior_t); + } + if(present & XCB_XKB_MAP_PART_VIRTUAL_MODS) { + /* 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; + /* vmods_rtrn */ + _aux->vmods_rtrn = (uint8_t *)xcb_tmp; + xcb_block_len += xcb_popcount(virtualMods) * sizeof(xcb_keycode_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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; + } + if(present & XCB_XKB_MAP_PART_EXPLICIT_COMPONENTS) { + /* 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; + /* explicit_rtrn */ + _aux->explicit_rtrn = (xcb_xkb_set_explicit_t *)xcb_tmp; + xcb_block_len += totalKeyExplicit * sizeof(xcb_xkb_set_explicit_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_set_explicit_t); + xcb_align_to = 4; + /* 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; + } + if(present & XCB_XKB_MAP_PART_MODIFIER_MAP) { + /* 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; + /* modmap_rtrn */ + _aux->modmap_rtrn = (xcb_xkb_key_mod_map_t *)xcb_tmp; + xcb_block_len += totalModMapKeys * sizeof(xcb_xkb_key_mod_map_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_key_mod_map_t); + xcb_align_to = 4; + /* 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; + } + if(present & XCB_XKB_MAP_PART_VIRTUAL_MOD_MAP) { + /* 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; + /* vmodmap_rtrn */ + _aux->vmodmap_rtrn = (xcb_xkb_key_v_mod_map_t *)xcb_tmp; + xcb_block_len += totalVModMapKeys * sizeof(xcb_xkb_key_v_mod_map_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_key_v_mod_map_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_xkb_get_kbd_by_name_replies_types_map_sizeof (const void *_buffer, + uint8_t nTypes, + uint8_t nKeySyms, + uint8_t nKeyActions, + uint16_t totalActions, + uint8_t totalKeyBehaviors, + uint16_t virtualMods, + uint8_t totalKeyExplicit, + uint8_t totalModMapKeys, + uint8_t totalVModMapKeys, + uint16_t present) +{ + xcb_xkb_get_kbd_by_name_replies_types_map_t _aux; + return xcb_xkb_get_kbd_by_name_replies_types_map_unpack(_buffer, nTypes, nKeySyms, nKeyActions, totalActions, totalKeyBehaviors, virtualMods, totalKeyExplicit, totalModMapKeys, totalVModMapKeys, present, &_aux); +} + +xcb_atom_t * +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_type_names (const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->key_names.valueList.typeNames; +} + +int +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_type_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->key_names.nTypes; +} + +xcb_generic_iterator_t +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_type_names_end (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->key_names.valueList.typeNames + S->key_names.nTypes; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +uint8_t * +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_n_levels_per_type (const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->key_names.valueList.nLevelsPerType; +} + +int +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_n_levels_per_type_length (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->key_names.nTypes; +} + +xcb_generic_iterator_t +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_n_levels_per_type_end (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->key_names.valueList.nLevelsPerType + S->key_names.nTypes; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_atom_t * +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names (const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->key_names.valueList.ktLevelNames; +} + +int +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + int xcb_pre_tmp_1; /* sumof length */ + int xcb_pre_tmp_2; /* sumof loop counter */ + int64_t xcb_pre_tmp_3; /* sumof sum */ + const uint8_t* xcb_pre_tmp_4; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_1 = S->key_names.nTypes; + xcb_pre_tmp_3 = 0; + xcb_pre_tmp_4 = S->key_names.valueList.nLevelsPerType; + for (xcb_pre_tmp_2 = 0; xcb_pre_tmp_2 < xcb_pre_tmp_1; xcb_pre_tmp_2++) { + xcb_pre_tmp_3 += *xcb_pre_tmp_4; + xcb_pre_tmp_4++; + } + /* sumof end. Result is in xcb_pre_tmp_3 */ + return xcb_pre_tmp_3; +} + +xcb_generic_iterator_t +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_kt_level_names_end (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + xcb_generic_iterator_t i; + int xcb_pre_tmp_5; /* sumof length */ + int xcb_pre_tmp_6; /* sumof loop counter */ + int64_t xcb_pre_tmp_7; /* sumof sum */ + const uint8_t* xcb_pre_tmp_8; /* sumof list ptr */ + /* sumof start */ + xcb_pre_tmp_5 = S->key_names.nTypes; + xcb_pre_tmp_7 = 0; + xcb_pre_tmp_8 = S->key_names.valueList.nLevelsPerType; + for (xcb_pre_tmp_6 = 0; xcb_pre_tmp_6 < xcb_pre_tmp_5; xcb_pre_tmp_6++) { + xcb_pre_tmp_7 += *xcb_pre_tmp_8; + xcb_pre_tmp_8++; + } + /* sumof end. Result is in xcb_pre_tmp_7 */ + i.data = S->key_names.valueList.ktLevelNames + xcb_pre_tmp_7; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_atom_t * +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_indicator_names (const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->key_names.valueList.indicatorNames; +} + +int +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_indicator_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return xcb_popcount(S->key_names.indicators); +} + +xcb_generic_iterator_t +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_indicator_names_end (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->key_names.valueList.indicatorNames + xcb_popcount(S->key_names.indicators); + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_atom_t * +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_virtual_mod_names (const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->key_names.valueList.virtualModNames; +} + +int +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_virtual_mod_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return xcb_popcount(S->key_names.virtualMods); +} + +xcb_generic_iterator_t +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_virtual_mod_names_end (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->key_names.valueList.virtualModNames + xcb_popcount(S->key_names.virtualMods); + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_atom_t * +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_groups (const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->key_names.valueList.groups; +} + +int +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_groups_length (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return xcb_popcount(S->key_names.groupNames); +} + +xcb_generic_iterator_t +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_groups_end (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->key_names.valueList.groups + xcb_popcount(S->key_names.groupNames); + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_key_name_t * +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_names (const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->key_names.valueList.keyNames; +} + +int +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->key_names.nKeys; +} + +xcb_xkb_key_name_iterator_t +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_names_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + xcb_xkb_key_name_iterator_t i; + i.data = S->key_names.valueList.keyNames; + i.rem = S->key_names.nKeys; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_key_alias_t * +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_aliases (const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->key_names.valueList.keyAliases; +} + +int +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_aliases_length (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->key_names.nKeyAliases; +} + +xcb_xkb_key_alias_iterator_t +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_key_aliases_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + xcb_xkb_key_alias_iterator_t i; + i.data = S->key_names.valueList.keyAliases; + i.rem = S->key_names.nKeyAliases; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_atom_t * +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_radio_group_names (const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->key_names.valueList.radioGroupNames; +} + +int +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_radio_group_names_length (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->key_names.nRadioGroups; +} + +xcb_generic_iterator_t +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_radio_group_names_end (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + xcb_generic_iterator_t i; + i.data = S->key_names.valueList.radioGroupNames + S->key_names.nRadioGroups; + i.rem = 0; + i.index = (char *) i.data - (char *) S; + return i; +} + +int +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_serialize (void **_buffer, + uint8_t nTypes, + uint32_t indicators, + uint16_t virtualMods, + uint8_t groupNames, + uint8_t nKeys, + uint8_t nKeyAliases, + uint8_t nRadioGroups, + uint32_t which, + const xcb_xkb_get_kbd_by_name_replies_key_names_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; + + int xcb_pre_tmp_1; /* sumof length */ + int xcb_pre_tmp_2; /* sumof loop counter */ + int64_t xcb_pre_tmp_3; /* sumof sum */ + const uint8_t* xcb_pre_tmp_4; /* sumof list ptr */ + unsigned int xcb_pad = 0; + char xcb_pad0[3] = {0, 0, 0}; + struct iovec xcb_parts[26]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(which & XCB_XKB_NAME_DETAIL_KEYCODES) { + /* xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t.keycodesName */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->keycodesName; + xcb_block_len += sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_GEOMETRY) { + /* xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t.geometryName */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometryName; + xcb_block_len += sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_SYMBOLS) { + /* xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t.symbolsName */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->symbolsName; + xcb_block_len += sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_PHYS_SYMBOLS) { + /* xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t.physSymbolsName */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->physSymbolsName; + xcb_block_len += sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_TYPES) { + /* xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t.typesName */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->typesName; + xcb_block_len += sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_COMPAT) { + /* xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t.compatName */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->compatName; + xcb_block_len += sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_KEY_TYPE_NAMES) { + /* 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; + /* typeNames */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->typeNames; + xcb_block_len += nTypes * sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = nTypes * sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_KT_LEVEL_NAMES) { + /* 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; + /* nLevelsPerType */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->nLevelsPerType; + xcb_block_len += nTypes * sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = nTypes * sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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; + /* 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; + /* ktLevelNames */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->ktLevelNames; + /* sumof start */ + xcb_pre_tmp_1 = nTypes; + xcb_pre_tmp_3 = 0; + xcb_pre_tmp_4 = _aux->nLevelsPerType; + for (xcb_pre_tmp_2 = 0; xcb_pre_tmp_2 < xcb_pre_tmp_1; xcb_pre_tmp_2++) { + xcb_pre_tmp_3 += *xcb_pre_tmp_4; + xcb_pre_tmp_4++; + } + /* sumof end. Result is in xcb_pre_tmp_3 */ + xcb_block_len += xcb_pre_tmp_3 * sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = xcb_pre_tmp_3 * sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_INDICATOR_NAMES) { + /* 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; + /* indicatorNames */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->indicatorNames; + xcb_block_len += xcb_popcount(indicators) * sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = xcb_popcount(indicators) * sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_VIRTUAL_MOD_NAMES) { + /* 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; + /* virtualModNames */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->virtualModNames; + xcb_block_len += xcb_popcount(virtualMods) * sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = xcb_popcount(virtualMods) * sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_GROUP_NAMES) { + /* 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; + /* groups */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->groups; + xcb_block_len += xcb_popcount(groupNames) * sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = xcb_popcount(groupNames) * sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_KEY_NAMES) { + /* 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; + /* keyNames */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->keyNames; + xcb_block_len += nKeys * sizeof(xcb_xkb_key_name_t); + xcb_parts[xcb_parts_idx].iov_len = nKeys * sizeof(xcb_xkb_key_name_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_key_name_t); + } + if(which & XCB_XKB_NAME_DETAIL_KEY_ALIASES) { + /* 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; + /* keyAliases */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->keyAliases; + xcb_block_len += nKeyAliases * sizeof(xcb_xkb_key_alias_t); + xcb_parts[xcb_parts_idx].iov_len = nKeyAliases * sizeof(xcb_xkb_key_alias_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_key_alias_t); + } + if(which & XCB_XKB_NAME_DETAIL_RG_NAMES) { + /* 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; + /* radioGroupNames */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->radioGroupNames; + xcb_block_len += nRadioGroups * sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = nRadioGroups * sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_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_xkb_get_kbd_by_name_replies_key_names_value_list_unpack (const void *_buffer, + uint8_t nTypes, + uint32_t indicators, + uint16_t virtualMods, + uint8_t groupNames, + uint8_t nKeys, + uint8_t nKeyAliases, + uint8_t nRadioGroups, + uint32_t which, + xcb_xkb_get_kbd_by_name_replies_key_names_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; + + int xcb_pre_tmp_1; /* sumof length */ + int xcb_pre_tmp_2; /* sumof loop counter */ + int64_t xcb_pre_tmp_3; /* sumof sum */ + const uint8_t* xcb_pre_tmp_4; /* sumof list ptr */ + + if(which & XCB_XKB_NAME_DETAIL_KEYCODES) { + /* xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t.keycodesName */ + _aux->keycodesName = *(xcb_atom_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_atom_t); + xcb_tmp += sizeof(xcb_atom_t); + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_GEOMETRY) { + /* xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t.geometryName */ + _aux->geometryName = *(xcb_atom_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_atom_t); + xcb_tmp += sizeof(xcb_atom_t); + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_SYMBOLS) { + /* xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t.symbolsName */ + _aux->symbolsName = *(xcb_atom_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_atom_t); + xcb_tmp += sizeof(xcb_atom_t); + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_PHYS_SYMBOLS) { + /* xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t.physSymbolsName */ + _aux->physSymbolsName = *(xcb_atom_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_atom_t); + xcb_tmp += sizeof(xcb_atom_t); + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_TYPES) { + /* xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t.typesName */ + _aux->typesName = *(xcb_atom_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_atom_t); + xcb_tmp += sizeof(xcb_atom_t); + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_COMPAT) { + /* xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t.compatName */ + _aux->compatName = *(xcb_atom_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_atom_t); + xcb_tmp += sizeof(xcb_atom_t); + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_KEY_TYPE_NAMES) { + /* 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; + /* typeNames */ + _aux->typeNames = (xcb_atom_t *)xcb_tmp; + xcb_block_len += nTypes * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_KT_LEVEL_NAMES) { + /* 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; + /* nLevelsPerType */ + _aux->nLevelsPerType = (uint8_t *)xcb_tmp; + xcb_block_len += nTypes * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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; + /* 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; + /* ktLevelNames */ + _aux->ktLevelNames = (xcb_atom_t *)xcb_tmp; + /* sumof start */ + xcb_pre_tmp_1 = nTypes; + xcb_pre_tmp_3 = 0; + xcb_pre_tmp_4 = _aux->nLevelsPerType; + for (xcb_pre_tmp_2 = 0; xcb_pre_tmp_2 < xcb_pre_tmp_1; xcb_pre_tmp_2++) { + xcb_pre_tmp_3 += *xcb_pre_tmp_4; + xcb_pre_tmp_4++; + } + /* sumof end. Result is in xcb_pre_tmp_3 */ + xcb_block_len += xcb_pre_tmp_3 * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_INDICATOR_NAMES) { + /* 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; + /* indicatorNames */ + _aux->indicatorNames = (xcb_atom_t *)xcb_tmp; + xcb_block_len += xcb_popcount(indicators) * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_VIRTUAL_MOD_NAMES) { + /* 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; + /* virtualModNames */ + _aux->virtualModNames = (xcb_atom_t *)xcb_tmp; + xcb_block_len += xcb_popcount(virtualMods) * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_GROUP_NAMES) { + /* 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; + /* groups */ + _aux->groups = (xcb_atom_t *)xcb_tmp; + xcb_block_len += xcb_popcount(groupNames) * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_t); + } + if(which & XCB_XKB_NAME_DETAIL_KEY_NAMES) { + /* 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; + /* keyNames */ + _aux->keyNames = (xcb_xkb_key_name_t *)xcb_tmp; + xcb_block_len += nKeys * sizeof(xcb_xkb_key_name_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_key_name_t); + } + if(which & XCB_XKB_NAME_DETAIL_KEY_ALIASES) { + /* 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; + /* keyAliases */ + _aux->keyAliases = (xcb_xkb_key_alias_t *)xcb_tmp; + xcb_block_len += nKeyAliases * sizeof(xcb_xkb_key_alias_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_key_alias_t); + } + if(which & XCB_XKB_NAME_DETAIL_RG_NAMES) { + /* 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; + /* radioGroupNames */ + _aux->radioGroupNames = (xcb_atom_t *)xcb_tmp; + xcb_block_len += nRadioGroups * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_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_xkb_get_kbd_by_name_replies_key_names_value_list_sizeof (const void *_buffer, + uint8_t nTypes, + uint32_t indicators, + uint16_t virtualMods, + uint8_t groupNames, + uint8_t nKeys, + uint8_t nKeyAliases, + uint8_t nRadioGroups, + uint32_t which) +{ + xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t _aux; + return xcb_xkb_get_kbd_by_name_replies_key_names_value_list_unpack(_buffer, nTypes, indicators, virtualMods, groupNames, nKeys, nKeyAliases, nRadioGroups, which, &_aux); +} + +xcb_xkb_get_kbd_by_name_replies_types_map_t * +xcb_xkb_get_kbd_by_name_replies_types_map (const xcb_xkb_get_kbd_by_name_replies_t *R) +{ + return (xcb_xkb_get_kbd_by_name_replies_types_map_t *) (R + 1); +} + +xcb_xkb_sym_interpret_t * +xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->compat_map.si_rtrn; +} + +int +xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->compat_map.nSIRtrn; +} + +xcb_xkb_sym_interpret_iterator_t +xcb_xkb_get_kbd_by_name_replies_compat_map_si_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + xcb_xkb_sym_interpret_iterator_t i; + i.data = S->compat_map.si_rtrn; + i.rem = S->compat_map.nSIRtrn; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_mod_def_t * +xcb_xkb_get_kbd_by_name_replies_compat_map_group_rtrn (const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->compat_map.group_rtrn; +} + +int +xcb_xkb_get_kbd_by_name_replies_compat_map_group_rtrn_length (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return xcb_popcount(S->compat_map.groupsRtrn); +} + +xcb_xkb_mod_def_iterator_t +xcb_xkb_get_kbd_by_name_replies_compat_map_group_rtrn_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + xcb_xkb_mod_def_iterator_t i; + i.data = S->compat_map.group_rtrn; + i.rem = xcb_popcount(S->compat_map.groupsRtrn); + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_indicator_map_t * +xcb_xkb_get_kbd_by_name_replies_indicator_maps_maps (const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->indicator_maps.maps; +} + +int +xcb_xkb_get_kbd_by_name_replies_indicator_maps_maps_length (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + return S->indicator_maps.nIndicators; +} + +xcb_xkb_indicator_map_iterator_t +xcb_xkb_get_kbd_by_name_replies_indicator_maps_maps_iterator (const xcb_xkb_get_kbd_by_name_reply_t *R, + const xcb_xkb_get_kbd_by_name_replies_t *S) +{ + xcb_xkb_indicator_map_iterator_t i; + i.data = S->indicator_maps.maps; + i.rem = S->indicator_maps.nIndicators; + i.index = (char *) i.data - (char *) S; + return i; +} + +xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t * +xcb_xkb_get_kbd_by_name_replies_key_names_value_list (const xcb_xkb_get_kbd_by_name_replies_t *R) +{ + return (xcb_xkb_get_kbd_by_name_replies_key_names_value_list_t *) (R + 1); +} + +xcb_xkb_counted_string_16_t * +xcb_xkb_get_kbd_by_name_replies_geometry_label_font (const xcb_xkb_get_kbd_by_name_replies_t *R) +{ + return (xcb_xkb_counted_string_16_t *) (R + 1); +} + +int +xcb_xkb_get_kbd_by_name_replies_serialize (void **_buffer, + uint16_t reported, + const xcb_xkb_get_kbd_by_name_replies_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[96]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if((reported & XCB_XKB_GBN_DETAIL_TYPES) || + (reported & XCB_XKB_GBN_DETAIL_CLIENT_SYMBOLS) || + (reported & XCB_XKB_GBN_DETAIL_SERVER_SYMBOLS)) { + /* xcb_xkb_get_kbd_by_name_replies_t.types.getmap_type */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.getmap_type; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.typeDeviceID */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.typeDeviceID; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.getmap_sequence */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.getmap_sequence; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.getmap_length */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.getmap_length; + 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); + /* xcb_xkb_get_kbd_by_name_replies_t.types.pad1 */ + xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; + xcb_block_len += sizeof(uint8_t)*2; + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t)*2; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.typeMinKeyCode */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.typeMinKeyCode; + xcb_block_len += sizeof(xcb_keycode_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_keycode_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.typeMaxKeyCode */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.typeMaxKeyCode; + xcb_block_len += sizeof(xcb_keycode_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_keycode_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.present */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.present; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.firstType */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.firstType; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.nTypes */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.nTypes; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.totalTypes */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.totalTypes; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.firstKeySym */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.firstKeySym; + xcb_block_len += sizeof(xcb_keycode_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_keycode_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.totalSyms */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.totalSyms; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.nKeySyms */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.nKeySyms; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.firstKeyAction */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.firstKeyAction; + xcb_block_len += sizeof(xcb_keycode_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_keycode_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.totalActions */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.totalActions; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.nKeyActions */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.nKeyActions; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.firstKeyBehavior */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.firstKeyBehavior; + xcb_block_len += sizeof(xcb_keycode_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_keycode_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.nKeyBehaviors */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.nKeyBehaviors; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.totalKeyBehaviors */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.totalKeyBehaviors; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.firstKeyExplicit */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.firstKeyExplicit; + xcb_block_len += sizeof(xcb_keycode_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_keycode_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.nKeyExplicit */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.nKeyExplicit; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.totalKeyExplicit */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.totalKeyExplicit; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.firstModMapKey */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.firstModMapKey; + xcb_block_len += sizeof(xcb_keycode_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_keycode_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.nModMapKeys */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.nModMapKeys; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.totalModMapKeys */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.totalModMapKeys; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.firstVModMapKey */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.firstVModMapKey; + xcb_block_len += sizeof(xcb_keycode_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_keycode_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.nVModMapKeys */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.nVModMapKeys; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.totalVModMapKeys */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.totalVModMapKeys; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.pad2 */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &xcb_pad; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.virtualMods */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->types.virtualMods; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_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; + /* map */ + xcb_parts[xcb_parts_idx].iov_base = (char *)0; + xcb_block_len += xcb_xkb_get_kbd_by_name_replies_types_map_serialize(&xcb_parts[xcb_parts_idx].iov_base, _aux->types.nTypes, _aux->types.nKeySyms, _aux->types.nKeyActions, _aux->types.totalActions, _aux->types.totalKeyBehaviors, _aux->types.virtualMods, _aux->types.totalKeyExplicit, _aux->types.totalModMapKeys, _aux->types.totalVModMapKeys, _aux->types.present, &_aux->types.map); + xcb_parts[xcb_parts_idx].iov_len = xcb_xkb_get_kbd_by_name_replies_types_map_serialize(&xcb_parts[xcb_parts_idx].iov_base, _aux->types.nTypes, _aux->types.nKeySyms, _aux->types.nKeyActions, _aux->types.totalActions, _aux->types.totalKeyBehaviors, _aux->types.virtualMods, _aux->types.totalKeyExplicit, _aux->types.totalModMapKeys, _aux->types.totalVModMapKeys, _aux->types.present, &_aux->types.map); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(char); + } + if(reported & XCB_XKB_GBN_DETAIL_COMPAT_MAP) { + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.compatmap_type */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->compat_map.compatmap_type; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.compatDeviceID */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->compat_map.compatDeviceID; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.compatmap_sequence */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->compat_map.compatmap_sequence; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.compatmap_length */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->compat_map.compatmap_length; + 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); + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.groupsRtrn */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->compat_map.groupsRtrn; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.pad7 */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &xcb_pad; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.firstSIRtrn */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->compat_map.firstSIRtrn; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.nSIRtrn */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->compat_map.nSIRtrn; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.nTotalSI */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->compat_map.nTotalSI; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.pad8 */ + xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; + xcb_block_len += sizeof(uint8_t)*16; + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t)*16; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_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; + /* si_rtrn */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->compat_map.si_rtrn; + xcb_block_len += _aux->compat_map.nSIRtrn * sizeof(xcb_xkb_sym_interpret_t); + xcb_parts[xcb_parts_idx].iov_len = _aux->compat_map.nSIRtrn * sizeof(xcb_xkb_sym_interpret_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_sym_interpret_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; + /* group_rtrn */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->compat_map.group_rtrn; + xcb_block_len += xcb_popcount(_aux->compat_map.groupsRtrn) * sizeof(xcb_xkb_mod_def_t); + xcb_parts[xcb_parts_idx].iov_len = xcb_popcount(_aux->compat_map.groupsRtrn) * sizeof(xcb_xkb_mod_def_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_mod_def_t); + } + if(reported & XCB_XKB_GBN_DETAIL_INDICATOR_MAPS) { + /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.indicatormap_type */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->indicator_maps.indicatormap_type; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.indicatorDeviceID */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->indicator_maps.indicatorDeviceID; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.indicatormap_sequence */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->indicator_maps.indicatormap_sequence; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.indicatormap_length */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->indicator_maps.indicatormap_length; + 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); + /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.which */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->indicator_maps.which; + 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); + /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.realIndicators */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->indicator_maps.realIndicators; + 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); + /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.nIndicators */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->indicator_maps.nIndicators; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.pad9 */ + xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; + xcb_block_len += sizeof(uint8_t)*15; + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t)*15; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_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; + /* maps */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->indicator_maps.maps; + xcb_block_len += _aux->indicator_maps.nIndicators * sizeof(xcb_xkb_indicator_map_t); + xcb_parts[xcb_parts_idx].iov_len = _aux->indicator_maps.nIndicators * sizeof(xcb_xkb_indicator_map_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_indicator_map_t); + } + if((reported & XCB_XKB_GBN_DETAIL_KEY_NAMES) || + (reported & XCB_XKB_GBN_DETAIL_OTHER_NAMES)) { + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.keyname_type */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key_names.keyname_type; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.keyDeviceID */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key_names.keyDeviceID; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.keyname_sequence */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key_names.keyname_sequence; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.keyname_length */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key_names.keyname_length; + 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); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.which */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key_names.which; + 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); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.keyMinKeyCode */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key_names.keyMinKeyCode; + xcb_block_len += sizeof(xcb_keycode_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_keycode_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.keyMaxKeyCode */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key_names.keyMaxKeyCode; + xcb_block_len += sizeof(xcb_keycode_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_keycode_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.nTypes */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key_names.nTypes; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.groupNames */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key_names.groupNames; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.virtualMods */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key_names.virtualMods; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.firstKey */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key_names.firstKey; + xcb_block_len += sizeof(xcb_keycode_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_keycode_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.nKeys */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key_names.nKeys; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.indicators */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key_names.indicators; + 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); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.nRadioGroups */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key_names.nRadioGroups; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.nKeyAliases */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key_names.nKeyAliases; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.nKTLevels */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key_names.nKTLevels; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.pad10 */ + xcb_parts[xcb_parts_idx].iov_base = xcb_pad0; + xcb_block_len += sizeof(uint8_t)*4; + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t)*4; + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_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; + /* valueList */ + xcb_parts[xcb_parts_idx].iov_base = (char *)0; + xcb_block_len += xcb_xkb_get_kbd_by_name_replies_key_names_value_list_serialize(&xcb_parts[xcb_parts_idx].iov_base, _aux->key_names.nTypes, _aux->key_names.indicators, _aux->key_names.virtualMods, _aux->key_names.groupNames, _aux->key_names.nKeys, _aux->key_names.nKeyAliases, _aux->key_names.nRadioGroups, _aux->key_names.which, &_aux->key_names.valueList); + xcb_parts[xcb_parts_idx].iov_len = xcb_xkb_get_kbd_by_name_replies_key_names_value_list_serialize(&xcb_parts[xcb_parts_idx].iov_base, _aux->key_names.nTypes, _aux->key_names.indicators, _aux->key_names.virtualMods, _aux->key_names.groupNames, _aux->key_names.nKeys, _aux->key_names.nKeyAliases, _aux->key_names.nRadioGroups, _aux->key_names.which, &_aux->key_names.valueList); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(char); + } + if(reported & XCB_XKB_GBN_DETAIL_GEOMETRY) { + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.geometry_type */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometry.geometry_type; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.geometryDeviceID */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometry.geometryDeviceID; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.geometry_sequence */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometry.geometry_sequence; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.geometry_length */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometry.geometry_length; + 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); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.name */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometry.name; + xcb_block_len += sizeof(xcb_atom_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_atom_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_atom_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.geometryFound */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometry.geometryFound; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.pad12 */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &xcb_pad; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.widthMM */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometry.widthMM; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.heightMM */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometry.heightMM; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.nProperties */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometry.nProperties; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.nColors */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometry.nColors; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.nShapes */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometry.nShapes; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.nSections */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometry.nSections; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.nDoodads */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometry.nDoodads; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.nKeyAliases */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometry.nKeyAliases; + xcb_block_len += sizeof(uint16_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint16_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.baseColorNdx */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometry.baseColorNdx; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.labelColorNdx */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->geometry.labelColorNdx; + xcb_block_len += sizeof(uint8_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(uint8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(uint8_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; + /* labelFont */ + xcb_parts[xcb_parts_idx].iov_base = (char *) _aux->geometry.labelFont; + xcb_block_len += xcb_xkb_counted_string_16_sizeof(_aux->geometry.labelFont); + xcb_parts[xcb_parts_idx].iov_len = xcb_xkb_counted_string_16_sizeof(_aux->geometry.labelFont); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_xkb_counted_string_16_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_xkb_get_kbd_by_name_replies_unpack (const void *_buffer, + uint16_t reported, + xcb_xkb_get_kbd_by_name_replies_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((reported & XCB_XKB_GBN_DETAIL_TYPES) || + (reported & XCB_XKB_GBN_DETAIL_CLIENT_SYMBOLS) || + (reported & XCB_XKB_GBN_DETAIL_SERVER_SYMBOLS)) { + /* xcb_xkb_get_kbd_by_name_replies_t.types.getmap_type */ + _aux->types.getmap_type = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.typeDeviceID */ + _aux->types.typeDeviceID = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.getmap_sequence */ + _aux->types.getmap_sequence = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.getmap_length */ + _aux->types.getmap_length = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.pad1 */ + _aux->types.pad1[0] = *(uint8_t *)xcb_tmp; + _aux->types.pad1[1] = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t) * 2; + xcb_tmp += sizeof(uint8_t) * 2; + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.typeMinKeyCode */ + _aux->types.typeMinKeyCode = *(xcb_keycode_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_keycode_t); + xcb_tmp += sizeof(xcb_keycode_t); + xcb_align_to = ALIGNOF(xcb_keycode_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.typeMaxKeyCode */ + _aux->types.typeMaxKeyCode = *(xcb_keycode_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_keycode_t); + xcb_tmp += sizeof(xcb_keycode_t); + xcb_align_to = ALIGNOF(xcb_keycode_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.present */ + _aux->types.present = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.firstType */ + _aux->types.firstType = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.nTypes */ + _aux->types.nTypes = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.totalTypes */ + _aux->types.totalTypes = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.firstKeySym */ + _aux->types.firstKeySym = *(xcb_keycode_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_keycode_t); + xcb_tmp += sizeof(xcb_keycode_t); + xcb_align_to = ALIGNOF(xcb_keycode_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.totalSyms */ + _aux->types.totalSyms = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.nKeySyms */ + _aux->types.nKeySyms = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.firstKeyAction */ + _aux->types.firstKeyAction = *(xcb_keycode_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_keycode_t); + xcb_tmp += sizeof(xcb_keycode_t); + xcb_align_to = ALIGNOF(xcb_keycode_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.totalActions */ + _aux->types.totalActions = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.nKeyActions */ + _aux->types.nKeyActions = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.firstKeyBehavior */ + _aux->types.firstKeyBehavior = *(xcb_keycode_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_keycode_t); + xcb_tmp += sizeof(xcb_keycode_t); + xcb_align_to = ALIGNOF(xcb_keycode_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.nKeyBehaviors */ + _aux->types.nKeyBehaviors = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.totalKeyBehaviors */ + _aux->types.totalKeyBehaviors = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.firstKeyExplicit */ + _aux->types.firstKeyExplicit = *(xcb_keycode_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_keycode_t); + xcb_tmp += sizeof(xcb_keycode_t); + xcb_align_to = ALIGNOF(xcb_keycode_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.nKeyExplicit */ + _aux->types.nKeyExplicit = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.totalKeyExplicit */ + _aux->types.totalKeyExplicit = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.firstModMapKey */ + _aux->types.firstModMapKey = *(xcb_keycode_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_keycode_t); + xcb_tmp += sizeof(xcb_keycode_t); + xcb_align_to = ALIGNOF(xcb_keycode_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.nModMapKeys */ + _aux->types.nModMapKeys = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.totalModMapKeys */ + _aux->types.totalModMapKeys = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.firstVModMapKey */ + _aux->types.firstVModMapKey = *(xcb_keycode_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_keycode_t); + xcb_tmp += sizeof(xcb_keycode_t); + xcb_align_to = ALIGNOF(xcb_keycode_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.nVModMapKeys */ + _aux->types.nVModMapKeys = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.totalVModMapKeys */ + _aux->types.totalVModMapKeys = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.pad2 */ + _aux->types.pad2 = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.types.virtualMods */ + _aux->types.virtualMods = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_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; + /* map */ + xcb_block_len += xcb_xkb_get_kbd_by_name_replies_types_map_unpack(xcb_tmp, _aux->types.nTypes, _aux->types.nKeySyms, _aux->types.nKeyActions, _aux->types.totalActions, _aux->types.totalKeyBehaviors, _aux->types.virtualMods, _aux->types.totalKeyExplicit, _aux->types.totalModMapKeys, _aux->types.totalVModMapKeys, _aux->types.present, &_aux->types.map); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(char); + } + if(reported & XCB_XKB_GBN_DETAIL_COMPAT_MAP) { + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.compatmap_type */ + _aux->compat_map.compatmap_type = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.compatDeviceID */ + _aux->compat_map.compatDeviceID = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.compatmap_sequence */ + _aux->compat_map.compatmap_sequence = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.compatmap_length */ + _aux->compat_map.compatmap_length = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.groupsRtrn */ + _aux->compat_map.groupsRtrn = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.pad7 */ + _aux->compat_map.pad7 = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.firstSIRtrn */ + _aux->compat_map.firstSIRtrn = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.nSIRtrn */ + _aux->compat_map.nSIRtrn = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.nTotalSI */ + _aux->compat_map.nTotalSI = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.compat_map.pad8 */ + _aux->compat_map.pad8[0] = *(uint8_t *)xcb_tmp; + _aux->compat_map.pad8[1] = *(uint8_t *)xcb_tmp; + _aux->compat_map.pad8[2] = *(uint8_t *)xcb_tmp; + _aux->compat_map.pad8[3] = *(uint8_t *)xcb_tmp; + _aux->compat_map.pad8[4] = *(uint8_t *)xcb_tmp; + _aux->compat_map.pad8[5] = *(uint8_t *)xcb_tmp; + _aux->compat_map.pad8[6] = *(uint8_t *)xcb_tmp; + _aux->compat_map.pad8[7] = *(uint8_t *)xcb_tmp; + _aux->compat_map.pad8[8] = *(uint8_t *)xcb_tmp; + _aux->compat_map.pad8[9] = *(uint8_t *)xcb_tmp; + _aux->compat_map.pad8[10] = *(uint8_t *)xcb_tmp; + _aux->compat_map.pad8[11] = *(uint8_t *)xcb_tmp; + _aux->compat_map.pad8[12] = *(uint8_t *)xcb_tmp; + _aux->compat_map.pad8[13] = *(uint8_t *)xcb_tmp; + _aux->compat_map.pad8[14] = *(uint8_t *)xcb_tmp; + _aux->compat_map.pad8[15] = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t) * 16; + xcb_tmp += sizeof(uint8_t) * 16; + xcb_align_to = ALIGNOF(uint8_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; + /* si_rtrn */ + _aux->compat_map.si_rtrn = (xcb_xkb_sym_interpret_t *)xcb_tmp; + xcb_block_len += _aux->compat_map.nSIRtrn * sizeof(xcb_xkb_sym_interpret_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_sym_interpret_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; + /* group_rtrn */ + _aux->compat_map.group_rtrn = (xcb_xkb_mod_def_t *)xcb_tmp; + xcb_block_len += xcb_popcount(_aux->compat_map.groupsRtrn) * sizeof(xcb_xkb_mod_def_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_mod_def_t); + } + if(reported & XCB_XKB_GBN_DETAIL_INDICATOR_MAPS) { + /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.indicatormap_type */ + _aux->indicator_maps.indicatormap_type = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.indicatorDeviceID */ + _aux->indicator_maps.indicatorDeviceID = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.indicatormap_sequence */ + _aux->indicator_maps.indicatormap_sequence = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.indicatormap_length */ + _aux->indicator_maps.indicatormap_length = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.which */ + _aux->indicator_maps.which = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.realIndicators */ + _aux->indicator_maps.realIndicators = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.nIndicators */ + _aux->indicator_maps.nIndicators = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.indicator_maps.pad9 */ + _aux->indicator_maps.pad9[0] = *(uint8_t *)xcb_tmp; + _aux->indicator_maps.pad9[1] = *(uint8_t *)xcb_tmp; + _aux->indicator_maps.pad9[2] = *(uint8_t *)xcb_tmp; + _aux->indicator_maps.pad9[3] = *(uint8_t *)xcb_tmp; + _aux->indicator_maps.pad9[4] = *(uint8_t *)xcb_tmp; + _aux->indicator_maps.pad9[5] = *(uint8_t *)xcb_tmp; + _aux->indicator_maps.pad9[6] = *(uint8_t *)xcb_tmp; + _aux->indicator_maps.pad9[7] = *(uint8_t *)xcb_tmp; + _aux->indicator_maps.pad9[8] = *(uint8_t *)xcb_tmp; + _aux->indicator_maps.pad9[9] = *(uint8_t *)xcb_tmp; + _aux->indicator_maps.pad9[10] = *(uint8_t *)xcb_tmp; + _aux->indicator_maps.pad9[11] = *(uint8_t *)xcb_tmp; + _aux->indicator_maps.pad9[12] = *(uint8_t *)xcb_tmp; + _aux->indicator_maps.pad9[13] = *(uint8_t *)xcb_tmp; + _aux->indicator_maps.pad9[14] = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t) * 15; + xcb_tmp += sizeof(uint8_t) * 15; + xcb_align_to = ALIGNOF(uint8_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; + /* maps */ + _aux->indicator_maps.maps = (xcb_xkb_indicator_map_t *)xcb_tmp; + xcb_block_len += _aux->indicator_maps.nIndicators * sizeof(xcb_xkb_indicator_map_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_indicator_map_t); + } + if((reported & XCB_XKB_GBN_DETAIL_KEY_NAMES) || + (reported & XCB_XKB_GBN_DETAIL_OTHER_NAMES)) { + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.keyname_type */ + _aux->key_names.keyname_type = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.keyDeviceID */ + _aux->key_names.keyDeviceID = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.keyname_sequence */ + _aux->key_names.keyname_sequence = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.keyname_length */ + _aux->key_names.keyname_length = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.which */ + _aux->key_names.which = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.keyMinKeyCode */ + _aux->key_names.keyMinKeyCode = *(xcb_keycode_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_keycode_t); + xcb_tmp += sizeof(xcb_keycode_t); + xcb_align_to = ALIGNOF(xcb_keycode_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.keyMaxKeyCode */ + _aux->key_names.keyMaxKeyCode = *(xcb_keycode_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_keycode_t); + xcb_tmp += sizeof(xcb_keycode_t); + xcb_align_to = ALIGNOF(xcb_keycode_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.nTypes */ + _aux->key_names.nTypes = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.groupNames */ + _aux->key_names.groupNames = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.virtualMods */ + _aux->key_names.virtualMods = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.firstKey */ + _aux->key_names.firstKey = *(xcb_keycode_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_keycode_t); + xcb_tmp += sizeof(xcb_keycode_t); + xcb_align_to = ALIGNOF(xcb_keycode_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.nKeys */ + _aux->key_names.nKeys = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.indicators */ + _aux->key_names.indicators = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.nRadioGroups */ + _aux->key_names.nRadioGroups = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.nKeyAliases */ + _aux->key_names.nKeyAliases = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.nKTLevels */ + _aux->key_names.nKTLevels = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.key_names.pad10 */ + _aux->key_names.pad10[0] = *(uint8_t *)xcb_tmp; + _aux->key_names.pad10[1] = *(uint8_t *)xcb_tmp; + _aux->key_names.pad10[2] = *(uint8_t *)xcb_tmp; + _aux->key_names.pad10[3] = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t) * 4; + xcb_tmp += sizeof(uint8_t) * 4; + xcb_align_to = ALIGNOF(uint8_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; + /* valueList */ + xcb_block_len += xcb_xkb_get_kbd_by_name_replies_key_names_value_list_unpack(xcb_tmp, _aux->key_names.nTypes, _aux->key_names.indicators, _aux->key_names.virtualMods, _aux->key_names.groupNames, _aux->key_names.nKeys, _aux->key_names.nKeyAliases, _aux->key_names.nRadioGroups, _aux->key_names.which, &_aux->key_names.valueList); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(char); + } + if(reported & XCB_XKB_GBN_DETAIL_GEOMETRY) { + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.geometry_type */ + _aux->geometry.geometry_type = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.geometryDeviceID */ + _aux->geometry.geometryDeviceID = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.geometry_sequence */ + _aux->geometry.geometry_sequence = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.geometry_length */ + _aux->geometry.geometry_length = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.name */ + _aux->geometry.name = *(xcb_atom_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_atom_t); + xcb_tmp += sizeof(xcb_atom_t); + xcb_align_to = ALIGNOF(xcb_atom_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.geometryFound */ + _aux->geometry.geometryFound = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.pad12 */ + _aux->geometry.pad12 = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.widthMM */ + _aux->geometry.widthMM = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.heightMM */ + _aux->geometry.heightMM = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.nProperties */ + _aux->geometry.nProperties = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.nColors */ + _aux->geometry.nColors = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.nShapes */ + _aux->geometry.nShapes = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.nSections */ + _aux->geometry.nSections = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.nDoodads */ + _aux->geometry.nDoodads = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.nKeyAliases */ + _aux->geometry.nKeyAliases = *(uint16_t *)xcb_tmp; + xcb_block_len += sizeof(uint16_t); + xcb_tmp += sizeof(uint16_t); + xcb_align_to = ALIGNOF(uint16_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.baseColorNdx */ + _aux->geometry.baseColorNdx = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_t); + /* xcb_xkb_get_kbd_by_name_replies_t.geometry.labelColorNdx */ + _aux->geometry.labelColorNdx = *(uint8_t *)xcb_tmp; + xcb_block_len += sizeof(uint8_t); + xcb_tmp += sizeof(uint8_t); + xcb_align_to = ALIGNOF(uint8_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; + /* labelFont */ + _aux->geometry.labelFont = (xcb_xkb_counted_string_16_t *)xcb_tmp; + xcb_block_len += xcb_xkb_counted_string_16_sizeof(xcb_tmp); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_counted_string_16_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_xkb_get_kbd_by_name_replies_sizeof (const void *_buffer, + uint16_t reported) +{ + xcb_xkb_get_kbd_by_name_replies_t _aux; + return xcb_xkb_get_kbd_by_name_replies_unpack(_buffer, reported, &_aux); +} + +int +xcb_xkb_get_kbd_by_name_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_get_kbd_by_name_reply_t *_aux = (xcb_xkb_get_kbd_by_name_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_xkb_get_kbd_by_name_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* replies */ + xcb_block_len += xcb_xkb_get_kbd_by_name_replies_sizeof(xcb_tmp, _aux->reported); + 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_xkb_get_kbd_by_name_cookie_t +xcb_xkb_get_kbd_by_name (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint16_t need, + uint16_t want, + uint8_t load) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_GET_KBD_BY_NAME, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_get_kbd_by_name_cookie_t xcb_ret; + xcb_xkb_get_kbd_by_name_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.need = need; + xcb_out.want = want; + xcb_out.load = load; + xcb_out.pad0 = 0; + + 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_xkb_get_kbd_by_name_cookie_t +xcb_xkb_get_kbd_by_name_unchecked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint16_t need, + uint16_t want, + uint8_t load) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_GET_KBD_BY_NAME, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_get_kbd_by_name_cookie_t xcb_ret; + xcb_xkb_get_kbd_by_name_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.need = need; + xcb_out.want = want; + xcb_out.load = load; + xcb_out.pad0 = 0; + + 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_xkb_get_kbd_by_name_replies (const xcb_xkb_get_kbd_by_name_reply_t *R) +{ + return (void *) (R + 1); +} + +xcb_xkb_get_kbd_by_name_reply_t * +xcb_xkb_get_kbd_by_name_reply (xcb_connection_t *c, + xcb_xkb_get_kbd_by_name_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xkb_get_kbd_by_name_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_xkb_get_device_info_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_get_device_info_reply_t *_aux = (xcb_xkb_get_device_info_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_xkb_get_device_info_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* name */ + xcb_block_len += _aux->nameLen * sizeof(xcb_xkb_string8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_string8_t); + xcb_align_to = 4; + /* 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; + /* 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; + /* btnActions */ + xcb_block_len += _aux->nBtnsRtrn * sizeof(xcb_xkb_action_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_action_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; + /* leds */ + for(i=0; i<_aux->nDeviceLedFBs; i++) { + xcb_tmp_len = xcb_xkb_device_led_info_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xkb_device_led_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_xkb_get_device_info_cookie_t +xcb_xkb_get_device_info (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint16_t wanted, + uint8_t allButtons, + uint8_t firstButton, + uint8_t nButtons, + xcb_xkb_led_class_spec_t ledClass, + xcb_xkb_id_spec_t ledID) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_GET_DEVICE_INFO, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_get_device_info_cookie_t xcb_ret; + xcb_xkb_get_device_info_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.wanted = wanted; + xcb_out.allButtons = allButtons; + xcb_out.firstButton = firstButton; + xcb_out.nButtons = nButtons; + xcb_out.pad0 = 0; + xcb_out.ledClass = ledClass; + xcb_out.ledID = ledID; + + 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_xkb_get_device_info_cookie_t +xcb_xkb_get_device_info_unchecked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint16_t wanted, + uint8_t allButtons, + uint8_t firstButton, + uint8_t nButtons, + xcb_xkb_led_class_spec_t ledClass, + xcb_xkb_id_spec_t ledID) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_GET_DEVICE_INFO, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xkb_get_device_info_cookie_t xcb_ret; + xcb_xkb_get_device_info_request_t xcb_out; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.wanted = wanted; + xcb_out.allButtons = allButtons; + xcb_out.firstButton = firstButton; + xcb_out.nButtons = nButtons; + xcb_out.pad0 = 0; + xcb_out.ledClass = ledClass; + xcb_out.ledID = ledID; + + 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_xkb_string8_t * +xcb_xkb_get_device_info_name (const xcb_xkb_get_device_info_reply_t *R) +{ + return (xcb_xkb_string8_t *) (R + 1); +} + +int +xcb_xkb_get_device_info_name_length (const xcb_xkb_get_device_info_reply_t *R) +{ + return R->nameLen; +} + +xcb_generic_iterator_t +xcb_xkb_get_device_info_name_end (const xcb_xkb_get_device_info_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_xkb_string8_t *) (R + 1)) + (R->nameLen); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xkb_action_t * +xcb_xkb_get_device_info_btn_actions (const xcb_xkb_get_device_info_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_xkb_get_device_info_name_end(R); + return (xcb_xkb_action_t *) ((char *) prev.data + ((-prev.index) & (4 - 1)) + 0); +} + +int +xcb_xkb_get_device_info_btn_actions_length (const xcb_xkb_get_device_info_reply_t *R) +{ + return R->nBtnsRtrn; +} + +xcb_xkb_action_iterator_t +xcb_xkb_get_device_info_btn_actions_iterator (const xcb_xkb_get_device_info_reply_t *R) +{ + xcb_xkb_action_iterator_t i; + xcb_generic_iterator_t prev = xcb_xkb_get_device_info_name_end(R); + i.data = (xcb_xkb_action_t *) ((char *) prev.data + ((-prev.index) & (4 - 1))); + i.rem = R->nBtnsRtrn; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_xkb_get_device_info_leds_length (const xcb_xkb_get_device_info_reply_t *R) +{ + return R->nDeviceLedFBs; +} + +xcb_xkb_device_led_info_iterator_t +xcb_xkb_get_device_info_leds_iterator (const xcb_xkb_get_device_info_reply_t *R) +{ + xcb_xkb_device_led_info_iterator_t i; + xcb_generic_iterator_t prev = xcb_xkb_action_end(xcb_xkb_get_device_info_btn_actions_iterator(R)); + i.data = (xcb_xkb_device_led_info_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_device_led_info_t, prev.index)); + i.rem = R->nDeviceLedFBs; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xkb_get_device_info_reply_t * +xcb_xkb_get_device_info_reply (xcb_connection_t *c, + xcb_xkb_get_device_info_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xkb_get_device_info_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_xkb_set_device_info_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_set_device_info_request_t *_aux = (xcb_xkb_set_device_info_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_xkb_set_device_info_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* btnActions */ + xcb_block_len += _aux->nBtns * sizeof(xcb_xkb_action_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_action_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; + /* leds */ + for(i=0; i<_aux->nDeviceLedFBs; i++) { + xcb_tmp_len = xcb_xkb_device_led_info_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xkb_device_led_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_void_cookie_t +xcb_xkb_set_device_info_checked (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint8_t firstBtn, + uint8_t nBtns, + uint16_t change, + uint16_t nDeviceLedFBs, + const xcb_xkb_action_t *btnActions, + const xcb_xkb_device_led_info_t *leds) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SET_DEVICE_INFO, + .isvoid = 1 + }; + + struct iovec xcb_parts[8]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_set_device_info_request_t xcb_out; + unsigned int xcb_tmp_len; + char *xcb_tmp; + unsigned int i; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.firstBtn = firstBtn; + xcb_out.nBtns = nBtns; + xcb_out.change = change; + xcb_out.nDeviceLedFBs = nDeviceLedFBs; + + 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_xkb_action_t btnActions */ + xcb_parts[4].iov_base = (char *) btnActions; + xcb_parts[4].iov_len = nBtns * sizeof(xcb_xkb_action_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_xkb_device_led_info_t leds */ + xcb_parts[6].iov_base = (char *) leds; + xcb_parts[6].iov_len = 0; + xcb_tmp = (char *)leds; + for(i=0; i<nDeviceLedFBs; i++) { + xcb_tmp_len = xcb_xkb_device_led_info_sizeof(xcb_tmp); + xcb_parts[6].iov_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].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_xkb_set_device_info (xcb_connection_t *c, + xcb_xkb_device_spec_t deviceSpec, + uint8_t firstBtn, + uint8_t nBtns, + uint16_t change, + uint16_t nDeviceLedFBs, + const xcb_xkb_action_t *btnActions, + const xcb_xkb_device_led_info_t *leds) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SET_DEVICE_INFO, + .isvoid = 1 + }; + + struct iovec xcb_parts[8]; + xcb_void_cookie_t xcb_ret; + xcb_xkb_set_device_info_request_t xcb_out; + unsigned int xcb_tmp_len; + char *xcb_tmp; + unsigned int i; + + xcb_out.deviceSpec = deviceSpec; + xcb_out.firstBtn = firstBtn; + xcb_out.nBtns = nBtns; + xcb_out.change = change; + xcb_out.nDeviceLedFBs = nDeviceLedFBs; + + 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_xkb_action_t btnActions */ + xcb_parts[4].iov_base = (char *) btnActions; + xcb_parts[4].iov_len = nBtns * sizeof(xcb_xkb_action_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_xkb_device_led_info_t leds */ + xcb_parts[6].iov_base = (char *) leds; + xcb_parts[6].iov_len = 0; + xcb_tmp = (char *)leds; + for(i=0; i<nDeviceLedFBs; i++) { + xcb_tmp_len = xcb_xkb_device_led_info_sizeof(xcb_tmp); + xcb_parts[6].iov_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_xkb_action_t * +xcb_xkb_set_device_info_btn_actions (const xcb_xkb_set_device_info_request_t *R) +{ + return (xcb_xkb_action_t *) (R + 1); +} + +int +xcb_xkb_set_device_info_btn_actions_length (const xcb_xkb_set_device_info_request_t *R) +{ + return R->nBtns; +} + +xcb_xkb_action_iterator_t +xcb_xkb_set_device_info_btn_actions_iterator (const xcb_xkb_set_device_info_request_t *R) +{ + xcb_xkb_action_iterator_t i; + i.data = (xcb_xkb_action_t *) (R + 1); + i.rem = R->nBtns; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_xkb_set_device_info_leds_length (const xcb_xkb_set_device_info_request_t *R) +{ + return R->nDeviceLedFBs; +} + +xcb_xkb_device_led_info_iterator_t +xcb_xkb_set_device_info_leds_iterator (const xcb_xkb_set_device_info_request_t *R) +{ + xcb_xkb_device_led_info_iterator_t i; + xcb_generic_iterator_t prev = xcb_xkb_action_end(xcb_xkb_set_device_info_btn_actions_iterator(R)); + i.data = (xcb_xkb_device_led_info_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xkb_device_led_info_t, prev.index)); + i.rem = R->nDeviceLedFBs; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_xkb_set_debugging_flags_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xkb_set_debugging_flags_request_t *_aux = (xcb_xkb_set_debugging_flags_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_xkb_set_debugging_flags_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* message */ + xcb_block_len += _aux->msgLength * sizeof(xcb_xkb_string8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xkb_string8_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_xkb_set_debugging_flags_cookie_t +xcb_xkb_set_debugging_flags (xcb_connection_t *c, + uint16_t msgLength, + uint32_t affectFlags, + uint32_t flags, + uint32_t affectCtrls, + uint32_t ctrls, + const xcb_xkb_string8_t *message) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SET_DEBUGGING_FLAGS, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_xkb_set_debugging_flags_cookie_t xcb_ret; + xcb_xkb_set_debugging_flags_request_t xcb_out; + + xcb_out.msgLength = msgLength; + memset(xcb_out.pad0, 0, 2); + xcb_out.affectFlags = affectFlags; + xcb_out.flags = flags; + xcb_out.affectCtrls = affectCtrls; + xcb_out.ctrls = ctrls; + + 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_xkb_string8_t message */ + xcb_parts[4].iov_base = (char *) message; + xcb_parts[4].iov_len = msgLength * sizeof(xcb_xkb_string8_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_xkb_set_debugging_flags_cookie_t +xcb_xkb_set_debugging_flags_unchecked (xcb_connection_t *c, + uint16_t msgLength, + uint32_t affectFlags, + uint32_t flags, + uint32_t affectCtrls, + uint32_t ctrls, + const xcb_xkb_string8_t *message) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_xkb_id, + .opcode = XCB_XKB_SET_DEBUGGING_FLAGS, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_xkb_set_debugging_flags_cookie_t xcb_ret; + xcb_xkb_set_debugging_flags_request_t xcb_out; + + xcb_out.msgLength = msgLength; + memset(xcb_out.pad0, 0, 2); + xcb_out.affectFlags = affectFlags; + xcb_out.flags = flags; + xcb_out.affectCtrls = affectCtrls; + xcb_out.ctrls = ctrls; + + 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_xkb_string8_t message */ + xcb_parts[4].iov_base = (char *) message; + xcb_parts[4].iov_len = msgLength * sizeof(xcb_xkb_string8_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_xkb_set_debugging_flags_reply_t * +xcb_xkb_set_debugging_flags_reply (xcb_connection_t *c, + xcb_xkb_set_debugging_flags_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xkb_set_debugging_flags_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + diff --git a/depends/libxcb/src/xprint.c b/depends/libxcb/src/xprint.c new file mode 100644 index 0000000..b85ea70 --- /dev/null +++ b/depends/libxcb/src/xprint.c @@ -0,0 +1,2425 @@ +/* + * This file generated automatically from xprint.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "xprint.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) +#include "xproto.h" + +xcb_extension_t xcb_x_print_id = { "XpExtension", 0 }; + +void +xcb_x_print_string8_next (xcb_x_print_string8_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_x_print_string8_t); +} + +xcb_generic_iterator_t +xcb_x_print_string8_end (xcb_x_print_string8_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; +} + +int +xcb_x_print_printer_serialize (void **_buffer, + const xcb_x_print_printer_t *_aux, + const xcb_x_print_string8_t *name, + const xcb_x_print_string8_t *description) +{ + char *xcb_out = *_buffer; + unsigned int xcb_buffer_len = 0; + unsigned int xcb_align_to = 0; + + unsigned int xcb_pad = 0; + char xcb_pad0[3] = {0, 0, 0}; + struct iovec xcb_parts[7]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + /* xcb_x_print_printer_t.nameLen */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->nameLen; + 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); + /* name */ + xcb_parts[xcb_parts_idx].iov_base = (char *) name; + xcb_block_len += _aux->nameLen * sizeof(xcb_x_print_string8_t); + xcb_parts[xcb_parts_idx].iov_len = _aux->nameLen * sizeof(xcb_x_print_string8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_x_print_string8_t); + xcb_align_to = 4; + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + xcb_block_len = 0; + /* xcb_x_print_printer_t.descLen */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->descLen; + 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); + /* description */ + xcb_parts[xcb_parts_idx].iov_base = (char *) description; + xcb_block_len += _aux->descLen * sizeof(xcb_x_print_string8_t); + xcb_parts[xcb_parts_idx].iov_len = _aux->descLen * sizeof(xcb_x_print_string8_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_x_print_string8_t); + xcb_align_to = 4; + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + xcb_block_len = 0; + /* insert padding */ + xcb_pad = -xcb_block_len & (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; + + 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_x_print_printer_unserialize (const void *_buffer, + xcb_x_print_printer_t **_aux) +{ + char *xcb_tmp = (char *)_buffer; + xcb_x_print_printer_t xcb_out; + unsigned int xcb_buffer_len = 0; + unsigned int xcb_block_len = 0; + unsigned int xcb_pad = 0; + unsigned int xcb_align_to = 0; + + xcb_x_print_string8_t *name; + int name_len; + xcb_x_print_string8_t *description; + int description_len; + + /* xcb_x_print_printer_t.nameLen */ + xcb_out.nameLen = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* name */ + name = (xcb_x_print_string8_t *)xcb_tmp; + name_len = xcb_out.nameLen * sizeof(xcb_x_print_string8_t); + xcb_block_len += name_len; + xcb_tmp += name_len; + xcb_align_to = ALIGNOF(xcb_x_print_string8_t); + xcb_align_to = 4; + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + xcb_block_len = 0; + /* xcb_x_print_printer_t.descLen */ + xcb_out.descLen = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_t); + /* description */ + description = (xcb_x_print_string8_t *)xcb_tmp; + description_len = xcb_out.descLen * sizeof(xcb_x_print_string8_t); + xcb_block_len += description_len; + xcb_tmp += description_len; + xcb_align_to = ALIGNOF(xcb_x_print_string8_t); + xcb_align_to = 4; + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + xcb_block_len = 0; + /* 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; + + if (NULL == _aux) + return xcb_buffer_len; + + if (NULL == *_aux) { + /* allocate memory */ + *_aux = malloc(xcb_buffer_len); + } + + xcb_tmp = ((char *)*_aux)+xcb_buffer_len; + xcb_tmp -= description_len; + memmove(xcb_tmp, description, description_len); + xcb_tmp -= name_len; + memmove(xcb_tmp, name, name_len); + **_aux = xcb_out; + + return xcb_buffer_len; +} + +int +xcb_x_print_printer_sizeof (const void *_buffer) +{ + return xcb_x_print_printer_unserialize(_buffer, NULL); +} + +xcb_x_print_string8_t * +xcb_x_print_printer_name (const xcb_x_print_printer_t *R) +{ + return (xcb_x_print_string8_t *) (R + 1); +} + +int +xcb_x_print_printer_name_length (const xcb_x_print_printer_t *R) +{ + return R->nameLen; +} + +xcb_generic_iterator_t +xcb_x_print_printer_name_end (const xcb_x_print_printer_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_x_print_string8_t *) (R + 1)) + (R->nameLen); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_x_print_string8_t * +xcb_x_print_printer_description (const xcb_x_print_printer_t *R) +{ + xcb_generic_iterator_t prev = xcb_x_print_printer_name_end(R); + return (xcb_x_print_string8_t *) ((char *) prev.data + ((-prev.index) & (4 - 1)) + 4); +} + +int +xcb_x_print_printer_description_length (const xcb_x_print_printer_t *R) +{ + return R->descLen; +} + +xcb_generic_iterator_t +xcb_x_print_printer_description_end (const xcb_x_print_printer_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_x_print_printer_name_end(R); + i.data = ((xcb_x_print_string8_t *) ((char*) prev.data + ((-prev.index) & (4 - 1)))) + (R->descLen); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_x_print_printer_next (xcb_x_print_printer_iterator_t *i) +{ + xcb_x_print_printer_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_x_print_printer_t *)(((char *)R) + xcb_x_print_printer_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_x_print_printer_t *) child.data; +} + +xcb_generic_iterator_t +xcb_x_print_printer_end (xcb_x_print_printer_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_x_print_printer_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +void +xcb_x_print_pcontext_next (xcb_x_print_pcontext_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_x_print_pcontext_t); +} + +xcb_generic_iterator_t +xcb_x_print_pcontext_end (xcb_x_print_pcontext_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_x_print_print_query_version_cookie_t +xcb_x_print_print_query_version (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_x_print_print_query_version_cookie_t xcb_ret; + xcb_x_print_print_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_x_print_print_query_version_cookie_t +xcb_x_print_print_query_version_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_x_print_print_query_version_cookie_t xcb_ret; + xcb_x_print_print_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_x_print_print_query_version_reply_t * +xcb_x_print_print_query_version_reply (xcb_connection_t *c, + xcb_x_print_print_query_version_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_x_print_print_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_x_print_print_get_printer_list_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_x_print_print_get_printer_list_request_t *_aux = (xcb_x_print_print_get_printer_list_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_x_print_print_get_printer_list_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* printer_name */ + xcb_block_len += _aux->printerNameLen * sizeof(xcb_x_print_string8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_x_print_string8_t); + xcb_align_to = 4; + /* 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; + /* 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; + /* locale */ + xcb_block_len += _aux->localeLen * sizeof(xcb_x_print_string8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_x_print_string8_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_x_print_print_get_printer_list_cookie_t +xcb_x_print_print_get_printer_list (xcb_connection_t *c, + uint32_t printerNameLen, + uint32_t localeLen, + const xcb_x_print_string8_t *printer_name, + const xcb_x_print_string8_t *locale) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_GET_PRINTER_LIST, + .isvoid = 0 + }; + + struct iovec xcb_parts[8]; + xcb_x_print_print_get_printer_list_cookie_t xcb_ret; + xcb_x_print_print_get_printer_list_request_t xcb_out; + + xcb_out.printerNameLen = printerNameLen; + xcb_out.localeLen = localeLen; + + 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_x_print_string8_t printer_name */ + xcb_parts[4].iov_base = (char *) printer_name; + xcb_parts[4].iov_len = printerNameLen * sizeof(xcb_x_print_string8_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_x_print_string8_t locale */ + xcb_parts[6].iov_base = (char *) locale; + xcb_parts[6].iov_len = localeLen * sizeof(xcb_x_print_string8_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_x_print_print_get_printer_list_cookie_t +xcb_x_print_print_get_printer_list_unchecked (xcb_connection_t *c, + uint32_t printerNameLen, + uint32_t localeLen, + const xcb_x_print_string8_t *printer_name, + const xcb_x_print_string8_t *locale) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_GET_PRINTER_LIST, + .isvoid = 0 + }; + + struct iovec xcb_parts[8]; + xcb_x_print_print_get_printer_list_cookie_t xcb_ret; + xcb_x_print_print_get_printer_list_request_t xcb_out; + + xcb_out.printerNameLen = printerNameLen; + xcb_out.localeLen = localeLen; + + 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_x_print_string8_t printer_name */ + xcb_parts[4].iov_base = (char *) printer_name; + xcb_parts[4].iov_len = printerNameLen * sizeof(xcb_x_print_string8_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_x_print_string8_t locale */ + xcb_parts[6].iov_base = (char *) locale; + xcb_parts[6].iov_len = localeLen * sizeof(xcb_x_print_string8_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +int +xcb_x_print_print_get_printer_list_printers_length (const xcb_x_print_print_get_printer_list_reply_t *R) +{ + return R->listCount; +} + +xcb_x_print_printer_iterator_t +xcb_x_print_print_get_printer_list_printers_iterator (const xcb_x_print_print_get_printer_list_reply_t *R) +{ + xcb_x_print_printer_iterator_t i; + i.data = (xcb_x_print_printer_t *) (R + 1); + i.rem = R->listCount; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_x_print_print_get_printer_list_reply_t * +xcb_x_print_print_get_printer_list_reply (xcb_connection_t *c, + xcb_x_print_print_get_printer_list_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + xcb_x_print_print_get_printer_list_reply_t *reply = (xcb_x_print_print_get_printer_list_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); + int i; + xcb_x_print_printer_iterator_t printers_iter = xcb_x_print_print_get_printer_list_printers_iterator(reply); + int printers_len = xcb_x_print_print_get_printer_list_printers_length(reply); + xcb_x_print_printer_t *printers_data; + /* special cases: transform parts of the reply to match XCB data structures */ + for(i=0; i<printers_len; i++) { + printers_data = printers_iter.data; + xcb_x_print_printer_unserialize((const void *)printers_data, &printers_data); + xcb_x_print_printer_next(&printers_iter); + } + return reply; +} + +xcb_void_cookie_t +xcb_x_print_print_rehash_printer_list_checked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_REHASH_PRINTER_LIST, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_rehash_printer_list_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_x_print_print_rehash_printer_list (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_REHASH_PRINTER_LIST, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_rehash_printer_list_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; +} + +int +xcb_x_print_create_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_x_print_create_context_request_t *_aux = (xcb_x_print_create_context_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_x_print_create_context_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* printerName */ + xcb_block_len += _aux->printerNameLen * sizeof(xcb_x_print_string8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_x_print_string8_t); + xcb_align_to = 4; + /* 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; + /* 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; + /* locale */ + xcb_block_len += _aux->localeLen * sizeof(xcb_x_print_string8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_x_print_string8_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_x_print_create_context_checked (xcb_connection_t *c, + uint32_t context_id, + uint32_t printerNameLen, + uint32_t localeLen, + const xcb_x_print_string8_t *printerName, + const xcb_x_print_string8_t *locale) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_CREATE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[8]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_create_context_request_t xcb_out; + + xcb_out.context_id = context_id; + xcb_out.printerNameLen = printerNameLen; + xcb_out.localeLen = localeLen; + + 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_x_print_string8_t printerName */ + xcb_parts[4].iov_base = (char *) printerName; + xcb_parts[4].iov_len = printerNameLen * sizeof(xcb_x_print_string8_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_x_print_string8_t locale */ + xcb_parts[6].iov_base = (char *) locale; + xcb_parts[6].iov_len = localeLen * sizeof(xcb_x_print_string8_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].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_x_print_create_context (xcb_connection_t *c, + uint32_t context_id, + uint32_t printerNameLen, + uint32_t localeLen, + const xcb_x_print_string8_t *printerName, + const xcb_x_print_string8_t *locale) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 6, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_CREATE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[8]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_create_context_request_t xcb_out; + + xcb_out.context_id = context_id; + xcb_out.printerNameLen = printerNameLen; + xcb_out.localeLen = localeLen; + + 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_x_print_string8_t printerName */ + xcb_parts[4].iov_base = (char *) printerName; + xcb_parts[4].iov_len = printerNameLen * sizeof(xcb_x_print_string8_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_x_print_string8_t locale */ + xcb_parts[6].iov_base = (char *) locale; + xcb_parts[6].iov_len = localeLen * sizeof(xcb_x_print_string8_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_x_print_string8_t * +xcb_x_print_create_context_printer_name (const xcb_x_print_create_context_request_t *R) +{ + return (xcb_x_print_string8_t *) (R + 1); +} + +int +xcb_x_print_create_context_printer_name_length (const xcb_x_print_create_context_request_t *R) +{ + return R->printerNameLen; +} + +xcb_generic_iterator_t +xcb_x_print_create_context_printer_name_end (const xcb_x_print_create_context_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_x_print_string8_t *) (R + 1)) + (R->printerNameLen); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_x_print_string8_t * +xcb_x_print_create_context_locale (const xcb_x_print_create_context_request_t *R) +{ + xcb_generic_iterator_t prev = xcb_x_print_create_context_printer_name_end(R); + return (xcb_x_print_string8_t *) ((char *) prev.data + ((-prev.index) & (4 - 1)) + 0); +} + +int +xcb_x_print_create_context_locale_length (const xcb_x_print_create_context_request_t *R) +{ + return R->localeLen; +} + +xcb_generic_iterator_t +xcb_x_print_create_context_locale_end (const xcb_x_print_create_context_request_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_x_print_create_context_printer_name_end(R); + i.data = ((xcb_x_print_string8_t *) ((char*) prev.data + ((-prev.index) & (4 - 1)))) + (R->localeLen); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_x_print_print_set_context_checked (xcb_connection_t *c, + uint32_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_SET_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_set_context_request_t xcb_out; + + xcb_out.context = context; + + 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_x_print_print_set_context (xcb_connection_t *c, + uint32_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_SET_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_set_context_request_t xcb_out; + + xcb_out.context = context; + + 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_x_print_print_get_context_cookie_t +xcb_x_print_print_get_context (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_GET_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_x_print_print_get_context_cookie_t xcb_ret; + xcb_x_print_print_get_context_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_x_print_print_get_context_cookie_t +xcb_x_print_print_get_context_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_GET_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_x_print_print_get_context_cookie_t xcb_ret; + xcb_x_print_print_get_context_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_x_print_print_get_context_reply_t * +xcb_x_print_print_get_context_reply (xcb_connection_t *c, + xcb_x_print_print_get_context_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_x_print_print_get_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_x_print_print_destroy_context_checked (xcb_connection_t *c, + uint32_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_DESTROY_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_destroy_context_request_t xcb_out; + + xcb_out.context = context; + + 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_x_print_print_destroy_context (xcb_connection_t *c, + uint32_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_DESTROY_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_destroy_context_request_t xcb_out; + + xcb_out.context = context; + + 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_x_print_print_get_screen_of_context_cookie_t +xcb_x_print_print_get_screen_of_context (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_GET_SCREEN_OF_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_x_print_print_get_screen_of_context_cookie_t xcb_ret; + xcb_x_print_print_get_screen_of_context_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_x_print_print_get_screen_of_context_cookie_t +xcb_x_print_print_get_screen_of_context_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_GET_SCREEN_OF_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_x_print_print_get_screen_of_context_cookie_t xcb_ret; + xcb_x_print_print_get_screen_of_context_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_x_print_print_get_screen_of_context_reply_t * +xcb_x_print_print_get_screen_of_context_reply (xcb_connection_t *c, + xcb_x_print_print_get_screen_of_context_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_x_print_print_get_screen_of_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_x_print_print_start_job_checked (xcb_connection_t *c, + uint8_t output_mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_START_JOB, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_start_job_request_t xcb_out; + + xcb_out.output_mode = output_mode; + + 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_x_print_print_start_job (xcb_connection_t *c, + uint8_t output_mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_START_JOB, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_start_job_request_t xcb_out; + + xcb_out.output_mode = output_mode; + + 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_x_print_print_end_job_checked (xcb_connection_t *c, + uint8_t cancel) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_END_JOB, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_end_job_request_t xcb_out; + + xcb_out.cancel = cancel; + + 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_x_print_print_end_job (xcb_connection_t *c, + uint8_t cancel) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_END_JOB, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_end_job_request_t xcb_out; + + xcb_out.cancel = cancel; + + 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_x_print_print_start_doc_checked (xcb_connection_t *c, + uint8_t driver_mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_START_DOC, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_start_doc_request_t xcb_out; + + xcb_out.driver_mode = driver_mode; + + 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_x_print_print_start_doc (xcb_connection_t *c, + uint8_t driver_mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_START_DOC, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_start_doc_request_t xcb_out; + + xcb_out.driver_mode = driver_mode; + + 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_x_print_print_end_doc_checked (xcb_connection_t *c, + uint8_t cancel) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_END_DOC, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_end_doc_request_t xcb_out; + + xcb_out.cancel = cancel; + + 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_x_print_print_end_doc (xcb_connection_t *c, + uint8_t cancel) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_END_DOC, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_end_doc_request_t xcb_out; + + xcb_out.cancel = cancel; + + 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_x_print_print_put_document_data_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_x_print_print_put_document_data_request_t *_aux = (xcb_x_print_print_put_document_data_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_x_print_print_put_document_data_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->len_data * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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; + /* 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; + /* doc_format */ + xcb_block_len += _aux->len_fmt * sizeof(xcb_x_print_string8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_x_print_string8_t); + xcb_align_to = 4; + /* 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; + /* 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; + /* options */ + xcb_block_len += _aux->len_options * sizeof(xcb_x_print_string8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_x_print_string8_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_x_print_print_put_document_data_checked (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t len_data, + uint16_t len_fmt, + uint16_t len_options, + const uint8_t *data, + const xcb_x_print_string8_t *doc_format, + const xcb_x_print_string8_t *options) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 8, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_PUT_DOCUMENT_DATA, + .isvoid = 1 + }; + + struct iovec xcb_parts[10]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_put_document_data_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.len_data = len_data; + xcb_out.len_fmt = len_fmt; + xcb_out.len_options = len_options; + + 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; + /* uint8_t data */ + xcb_parts[4].iov_base = (char *) data; + xcb_parts[4].iov_len = len_data * sizeof(uint8_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_x_print_string8_t doc_format */ + xcb_parts[6].iov_base = (char *) doc_format; + xcb_parts[6].iov_len = len_fmt * sizeof(xcb_x_print_string8_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + /* xcb_x_print_string8_t options */ + xcb_parts[8].iov_base = (char *) options; + xcb_parts[8].iov_len = len_options * sizeof(xcb_x_print_string8_t); + xcb_parts[9].iov_base = 0; + xcb_parts[9].iov_len = -xcb_parts[8].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_x_print_print_put_document_data (xcb_connection_t *c, + xcb_drawable_t drawable, + uint32_t len_data, + uint16_t len_fmt, + uint16_t len_options, + const uint8_t *data, + const xcb_x_print_string8_t *doc_format, + const xcb_x_print_string8_t *options) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 8, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_PUT_DOCUMENT_DATA, + .isvoid = 1 + }; + + struct iovec xcb_parts[10]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_put_document_data_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.len_data = len_data; + xcb_out.len_fmt = len_fmt; + xcb_out.len_options = len_options; + + 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; + /* uint8_t data */ + xcb_parts[4].iov_base = (char *) data; + xcb_parts[4].iov_len = len_data * sizeof(uint8_t); + xcb_parts[5].iov_base = 0; + xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + /* xcb_x_print_string8_t doc_format */ + xcb_parts[6].iov_base = (char *) doc_format; + xcb_parts[6].iov_len = len_fmt * sizeof(xcb_x_print_string8_t); + xcb_parts[7].iov_base = 0; + xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3; + /* xcb_x_print_string8_t options */ + xcb_parts[8].iov_base = (char *) options; + xcb_parts[8].iov_len = len_options * sizeof(xcb_x_print_string8_t); + xcb_parts[9].iov_base = 0; + xcb_parts[9].iov_len = -xcb_parts[8].iov_len & 3; + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +uint8_t * +xcb_x_print_print_put_document_data_data (const xcb_x_print_print_put_document_data_request_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_x_print_print_put_document_data_data_length (const xcb_x_print_print_put_document_data_request_t *R) +{ + return R->len_data; +} + +xcb_generic_iterator_t +xcb_x_print_print_put_document_data_data_end (const xcb_x_print_print_put_document_data_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + (R->len_data); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_x_print_string8_t * +xcb_x_print_print_put_document_data_doc_format (const xcb_x_print_print_put_document_data_request_t *R) +{ + xcb_generic_iterator_t prev = xcb_x_print_print_put_document_data_data_end(R); + return (xcb_x_print_string8_t *) ((char *) prev.data + ((-prev.index) & (4 - 1)) + 0); +} + +int +xcb_x_print_print_put_document_data_doc_format_length (const xcb_x_print_print_put_document_data_request_t *R) +{ + return R->len_fmt; +} + +xcb_generic_iterator_t +xcb_x_print_print_put_document_data_doc_format_end (const xcb_x_print_print_put_document_data_request_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_x_print_print_put_document_data_data_end(R); + i.data = ((xcb_x_print_string8_t *) ((char*) prev.data + ((-prev.index) & (4 - 1)))) + (R->len_fmt); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_x_print_string8_t * +xcb_x_print_print_put_document_data_options (const xcb_x_print_print_put_document_data_request_t *R) +{ + xcb_generic_iterator_t prev = xcb_x_print_print_put_document_data_doc_format_end(R); + return (xcb_x_print_string8_t *) ((char *) prev.data + ((-prev.index) & (4 - 1)) + 0); +} + +int +xcb_x_print_print_put_document_data_options_length (const xcb_x_print_print_put_document_data_request_t *R) +{ + return R->len_options; +} + +xcb_generic_iterator_t +xcb_x_print_print_put_document_data_options_end (const xcb_x_print_print_put_document_data_request_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_x_print_print_put_document_data_doc_format_end(R); + i.data = ((xcb_x_print_string8_t *) ((char*) prev.data + ((-prev.index) & (4 - 1)))) + (R->len_options); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_x_print_print_get_document_data_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_x_print_print_get_document_data_reply_t *_aux = (xcb_x_print_print_get_document_data_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_x_print_print_get_document_data_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += _aux->dataLen * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_x_print_print_get_document_data_cookie_t +xcb_x_print_print_get_document_data (xcb_connection_t *c, + xcb_x_print_pcontext_t context, + uint32_t max_bytes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_GET_DOCUMENT_DATA, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_x_print_print_get_document_data_cookie_t xcb_ret; + xcb_x_print_print_get_document_data_request_t xcb_out; + + xcb_out.context = context; + xcb_out.max_bytes = max_bytes; + + 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_x_print_print_get_document_data_cookie_t +xcb_x_print_print_get_document_data_unchecked (xcb_connection_t *c, + xcb_x_print_pcontext_t context, + uint32_t max_bytes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_GET_DOCUMENT_DATA, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_x_print_print_get_document_data_cookie_t xcb_ret; + xcb_x_print_print_get_document_data_request_t xcb_out; + + xcb_out.context = context; + xcb_out.max_bytes = max_bytes; + + 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; +} + +uint8_t * +xcb_x_print_print_get_document_data_data (const xcb_x_print_print_get_document_data_reply_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_x_print_print_get_document_data_data_length (const xcb_x_print_print_get_document_data_reply_t *R) +{ + return R->dataLen; +} + +xcb_generic_iterator_t +xcb_x_print_print_get_document_data_data_end (const xcb_x_print_print_get_document_data_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + (R->dataLen); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_x_print_print_get_document_data_reply_t * +xcb_x_print_print_get_document_data_reply (xcb_connection_t *c, + xcb_x_print_print_get_document_data_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_x_print_print_get_document_data_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_x_print_print_start_page_checked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_START_PAGE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_start_page_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_x_print_print_start_page (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_START_PAGE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_start_page_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_void_cookie_t +xcb_x_print_print_end_page_checked (xcb_connection_t *c, + uint8_t cancel) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_END_PAGE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_end_page_request_t xcb_out; + + xcb_out.cancel = cancel; + 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_x_print_print_end_page (xcb_connection_t *c, + uint8_t cancel) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_END_PAGE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_end_page_request_t xcb_out; + + xcb_out.cancel = cancel; + 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_x_print_print_select_input_checked (xcb_connection_t *c, + xcb_x_print_pcontext_t context, + uint32_t event_mask) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_SELECT_INPUT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_select_input_request_t xcb_out; + + xcb_out.context = context; + 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_x_print_print_select_input (xcb_connection_t *c, + xcb_x_print_pcontext_t context, + uint32_t event_mask) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_SELECT_INPUT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_select_input_request_t xcb_out; + + xcb_out.context = context; + 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_x_print_print_input_selected_cookie_t +xcb_x_print_print_input_selected (xcb_connection_t *c, + xcb_x_print_pcontext_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_INPUT_SELECTED, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_x_print_print_input_selected_cookie_t xcb_ret; + xcb_x_print_print_input_selected_request_t xcb_out; + + xcb_out.context = context; + + 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_x_print_print_input_selected_cookie_t +xcb_x_print_print_input_selected_unchecked (xcb_connection_t *c, + xcb_x_print_pcontext_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_INPUT_SELECTED, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_x_print_print_input_selected_cookie_t xcb_ret; + xcb_x_print_print_input_selected_request_t xcb_out; + + xcb_out.context = context; + + 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_x_print_print_input_selected_reply_t * +xcb_x_print_print_input_selected_reply (xcb_connection_t *c, + xcb_x_print_print_input_selected_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_x_print_print_input_selected_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_x_print_print_get_attributes_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_x_print_print_get_attributes_reply_t *_aux = (xcb_x_print_print_get_attributes_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_x_print_print_get_attributes_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* attributes */ + xcb_block_len += _aux->stringLen * sizeof(xcb_x_print_string8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_x_print_string8_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_x_print_print_get_attributes_cookie_t +xcb_x_print_print_get_attributes (xcb_connection_t *c, + xcb_x_print_pcontext_t context, + uint8_t pool) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_GET_ATTRIBUTES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_x_print_print_get_attributes_cookie_t xcb_ret; + xcb_x_print_print_get_attributes_request_t xcb_out; + + xcb_out.context = context; + xcb_out.pool = pool; + 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_x_print_print_get_attributes_cookie_t +xcb_x_print_print_get_attributes_unchecked (xcb_connection_t *c, + xcb_x_print_pcontext_t context, + uint8_t pool) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_GET_ATTRIBUTES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_x_print_print_get_attributes_cookie_t xcb_ret; + xcb_x_print_print_get_attributes_request_t xcb_out; + + xcb_out.context = context; + xcb_out.pool = pool; + 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_x_print_string8_t * +xcb_x_print_print_get_attributes_attributes (const xcb_x_print_print_get_attributes_reply_t *R) +{ + return (xcb_x_print_string8_t *) (R + 1); +} + +int +xcb_x_print_print_get_attributes_attributes_length (const xcb_x_print_print_get_attributes_reply_t *R) +{ + return R->stringLen; +} + +xcb_generic_iterator_t +xcb_x_print_print_get_attributes_attributes_end (const xcb_x_print_print_get_attributes_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_x_print_string8_t *) (R + 1)) + (R->stringLen); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_x_print_print_get_attributes_reply_t * +xcb_x_print_print_get_attributes_reply (xcb_connection_t *c, + xcb_x_print_print_get_attributes_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_x_print_print_get_attributes_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_x_print_print_get_one_attributes_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_x_print_print_get_one_attributes_request_t *_aux = (xcb_x_print_print_get_one_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_x_print_print_get_one_attributes_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* name */ + xcb_block_len += _aux->nameLen * sizeof(xcb_x_print_string8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_x_print_string8_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_x_print_print_get_one_attributes_cookie_t +xcb_x_print_print_get_one_attributes (xcb_connection_t *c, + xcb_x_print_pcontext_t context, + uint32_t nameLen, + uint8_t pool, + const xcb_x_print_string8_t *name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_GET_ONE_ATTRIBUTES, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_x_print_print_get_one_attributes_cookie_t xcb_ret; + xcb_x_print_print_get_one_attributes_request_t xcb_out; + + xcb_out.context = context; + xcb_out.nameLen = nameLen; + xcb_out.pool = pool; + 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_x_print_string8_t name */ + xcb_parts[4].iov_base = (char *) name; + xcb_parts[4].iov_len = nameLen * sizeof(xcb_x_print_string8_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_x_print_print_get_one_attributes_cookie_t +xcb_x_print_print_get_one_attributes_unchecked (xcb_connection_t *c, + xcb_x_print_pcontext_t context, + uint32_t nameLen, + uint8_t pool, + const xcb_x_print_string8_t *name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_GET_ONE_ATTRIBUTES, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_x_print_print_get_one_attributes_cookie_t xcb_ret; + xcb_x_print_print_get_one_attributes_request_t xcb_out; + + xcb_out.context = context; + xcb_out.nameLen = nameLen; + xcb_out.pool = pool; + 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_x_print_string8_t name */ + xcb_parts[4].iov_base = (char *) name; + xcb_parts[4].iov_len = nameLen * sizeof(xcb_x_print_string8_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_x_print_string8_t * +xcb_x_print_print_get_one_attributes_value (const xcb_x_print_print_get_one_attributes_reply_t *R) +{ + return (xcb_x_print_string8_t *) (R + 1); +} + +int +xcb_x_print_print_get_one_attributes_value_length (const xcb_x_print_print_get_one_attributes_reply_t *R) +{ + return R->valueLen; +} + +xcb_generic_iterator_t +xcb_x_print_print_get_one_attributes_value_end (const xcb_x_print_print_get_one_attributes_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_x_print_string8_t *) (R + 1)) + (R->valueLen); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_x_print_print_get_one_attributes_reply_t * +xcb_x_print_print_get_one_attributes_reply (xcb_connection_t *c, + xcb_x_print_print_get_one_attributes_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_x_print_print_get_one_attributes_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_x_print_print_set_attributes_sizeof (const void *_buffer, + uint32_t attributes_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_x_print_print_set_attributes_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* attributes */ + xcb_block_len += attributes_len * sizeof(xcb_x_print_string8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_x_print_string8_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_x_print_print_set_attributes_checked (xcb_connection_t *c, + xcb_x_print_pcontext_t context, + uint32_t stringLen, + uint8_t pool, + uint8_t rule, + uint32_t attributes_len, + const xcb_x_print_string8_t *attributes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_SET_ATTRIBUTES, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_set_attributes_request_t xcb_out; + + xcb_out.context = context; + xcb_out.stringLen = stringLen; + xcb_out.pool = pool; + xcb_out.rule = rule; + 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_x_print_string8_t attributes */ + xcb_parts[4].iov_base = (char *) attributes; + xcb_parts[4].iov_len = attributes_len * sizeof(xcb_x_print_string8_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_x_print_print_set_attributes (xcb_connection_t *c, + xcb_x_print_pcontext_t context, + uint32_t stringLen, + uint8_t pool, + uint8_t rule, + uint32_t attributes_len, + const xcb_x_print_string8_t *attributes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_SET_ATTRIBUTES, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_x_print_print_set_attributes_request_t xcb_out; + + xcb_out.context = context; + xcb_out.stringLen = stringLen; + xcb_out.pool = pool; + xcb_out.rule = rule; + 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_x_print_string8_t attributes */ + xcb_parts[4].iov_base = (char *) attributes; + xcb_parts[4].iov_len = attributes_len * sizeof(xcb_x_print_string8_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_x_print_string8_t * +xcb_x_print_print_set_attributes_attributes (const xcb_x_print_print_set_attributes_request_t *R) +{ + return (xcb_x_print_string8_t *) (R + 1); +} + +int +xcb_x_print_print_set_attributes_attributes_length (const xcb_x_print_print_set_attributes_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_x_print_print_set_attributes_request_t))/sizeof(xcb_x_print_string8_t)); +} + +xcb_generic_iterator_t +xcb_x_print_print_set_attributes_attributes_end (const xcb_x_print_print_set_attributes_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_x_print_string8_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_x_print_print_set_attributes_request_t))/sizeof(xcb_x_print_string8_t))); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_x_print_print_get_page_dimensions_cookie_t +xcb_x_print_print_get_page_dimensions (xcb_connection_t *c, + xcb_x_print_pcontext_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_GET_PAGE_DIMENSIONS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_x_print_print_get_page_dimensions_cookie_t xcb_ret; + xcb_x_print_print_get_page_dimensions_request_t xcb_out; + + xcb_out.context = context; + + 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_x_print_print_get_page_dimensions_cookie_t +xcb_x_print_print_get_page_dimensions_unchecked (xcb_connection_t *c, + xcb_x_print_pcontext_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_GET_PAGE_DIMENSIONS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_x_print_print_get_page_dimensions_cookie_t xcb_ret; + xcb_x_print_print_get_page_dimensions_request_t xcb_out; + + xcb_out.context = context; + + 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_x_print_print_get_page_dimensions_reply_t * +xcb_x_print_print_get_page_dimensions_reply (xcb_connection_t *c, + xcb_x_print_print_get_page_dimensions_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_x_print_print_get_page_dimensions_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_x_print_print_query_screens_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_x_print_print_query_screens_reply_t *_aux = (xcb_x_print_print_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_x_print_print_query_screens_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* roots */ + xcb_block_len += _aux->listCount * sizeof(xcb_window_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_window_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_x_print_print_query_screens_cookie_t +xcb_x_print_print_query_screens (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_QUERY_SCREENS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_x_print_print_query_screens_cookie_t xcb_ret; + xcb_x_print_print_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_x_print_print_query_screens_cookie_t +xcb_x_print_print_query_screens_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_QUERY_SCREENS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_x_print_print_query_screens_cookie_t xcb_ret; + xcb_x_print_print_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_window_t * +xcb_x_print_print_query_screens_roots (const xcb_x_print_print_query_screens_reply_t *R) +{ + return (xcb_window_t *) (R + 1); +} + +int +xcb_x_print_print_query_screens_roots_length (const xcb_x_print_print_query_screens_reply_t *R) +{ + return R->listCount; +} + +xcb_generic_iterator_t +xcb_x_print_print_query_screens_roots_end (const xcb_x_print_print_query_screens_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_window_t *) (R + 1)) + (R->listCount); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_x_print_print_query_screens_reply_t * +xcb_x_print_print_query_screens_reply (xcb_connection_t *c, + xcb_x_print_print_query_screens_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_x_print_print_query_screens_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_x_print_print_set_image_resolution_cookie_t +xcb_x_print_print_set_image_resolution (xcb_connection_t *c, + xcb_x_print_pcontext_t context, + uint16_t image_resolution) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_SET_IMAGE_RESOLUTION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_x_print_print_set_image_resolution_cookie_t xcb_ret; + xcb_x_print_print_set_image_resolution_request_t xcb_out; + + xcb_out.context = context; + xcb_out.image_resolution = image_resolution; + + 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_x_print_print_set_image_resolution_cookie_t +xcb_x_print_print_set_image_resolution_unchecked (xcb_connection_t *c, + xcb_x_print_pcontext_t context, + uint16_t image_resolution) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_SET_IMAGE_RESOLUTION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_x_print_print_set_image_resolution_cookie_t xcb_ret; + xcb_x_print_print_set_image_resolution_request_t xcb_out; + + xcb_out.context = context; + xcb_out.image_resolution = image_resolution; + + 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_x_print_print_set_image_resolution_reply_t * +xcb_x_print_print_set_image_resolution_reply (xcb_connection_t *c, + xcb_x_print_print_set_image_resolution_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_x_print_print_set_image_resolution_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_x_print_print_get_image_resolution_cookie_t +xcb_x_print_print_get_image_resolution (xcb_connection_t *c, + xcb_x_print_pcontext_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_GET_IMAGE_RESOLUTION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_x_print_print_get_image_resolution_cookie_t xcb_ret; + xcb_x_print_print_get_image_resolution_request_t xcb_out; + + xcb_out.context = context; + + 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_x_print_print_get_image_resolution_cookie_t +xcb_x_print_print_get_image_resolution_unchecked (xcb_connection_t *c, + xcb_x_print_pcontext_t context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_x_print_id, + .opcode = XCB_X_PRINT_PRINT_GET_IMAGE_RESOLUTION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_x_print_print_get_image_resolution_cookie_t xcb_ret; + xcb_x_print_print_get_image_resolution_request_t xcb_out; + + xcb_out.context = context; + + 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_x_print_print_get_image_resolution_reply_t * +xcb_x_print_print_get_image_resolution_reply (xcb_connection_t *c, + xcb_x_print_print_get_image_resolution_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_x_print_print_get_image_resolution_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + diff --git a/depends/libxcb/src/xproto.c b/depends/libxcb/src/xproto.c new file mode 100644 index 0000000..d87420d --- /dev/null +++ b/depends/libxcb/src/xproto.c @@ -0,0 +1,14547 @@ +/* + * This file generated automatically from xproto.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "xproto.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) + +void +xcb_char2b_next (xcb_char2b_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_char2b_t); +} + +xcb_generic_iterator_t +xcb_char2b_end (xcb_char2b_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; +} + +void +xcb_window_next (xcb_window_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_window_t); +} + +xcb_generic_iterator_t +xcb_window_end (xcb_window_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; +} + +void +xcb_pixmap_next (xcb_pixmap_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_pixmap_t); +} + +xcb_generic_iterator_t +xcb_pixmap_end (xcb_pixmap_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; +} + +void +xcb_cursor_next (xcb_cursor_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_cursor_t); +} + +xcb_generic_iterator_t +xcb_cursor_end (xcb_cursor_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; +} + +void +xcb_font_next (xcb_font_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_font_t); +} + +xcb_generic_iterator_t +xcb_font_end (xcb_font_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; +} + +void +xcb_gcontext_next (xcb_gcontext_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_gcontext_t); +} + +xcb_generic_iterator_t +xcb_gcontext_end (xcb_gcontext_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; +} + +void +xcb_colormap_next (xcb_colormap_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_colormap_t); +} + +xcb_generic_iterator_t +xcb_colormap_end (xcb_colormap_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; +} + +void +xcb_atom_next (xcb_atom_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_atom_t); +} + +xcb_generic_iterator_t +xcb_atom_end (xcb_atom_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; +} + +void +xcb_drawable_next (xcb_drawable_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_drawable_t); +} + +xcb_generic_iterator_t +xcb_drawable_end (xcb_drawable_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; +} + +void +xcb_fontable_next (xcb_fontable_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_fontable_t); +} + +xcb_generic_iterator_t +xcb_fontable_end (xcb_fontable_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; +} + +void +xcb_bool32_next (xcb_bool32_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_bool32_t); +} + +xcb_generic_iterator_t +xcb_bool32_end (xcb_bool32_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; +} + +void +xcb_visualid_next (xcb_visualid_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_visualid_t); +} + +xcb_generic_iterator_t +xcb_visualid_end (xcb_visualid_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; +} + +void +xcb_timestamp_next (xcb_timestamp_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_timestamp_t); +} + +xcb_generic_iterator_t +xcb_timestamp_end (xcb_timestamp_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; +} + +void +xcb_keysym_next (xcb_keysym_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_keysym_t); +} + +xcb_generic_iterator_t +xcb_keysym_end (xcb_keysym_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; +} + +void +xcb_keycode_next (xcb_keycode_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_keycode_t); +} + +xcb_generic_iterator_t +xcb_keycode_end (xcb_keycode_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; +} + +void +xcb_keycode32_next (xcb_keycode32_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_keycode32_t); +} + +xcb_generic_iterator_t +xcb_keycode32_end (xcb_keycode32_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; +} + +void +xcb_button_next (xcb_button_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_button_t); +} + +xcb_generic_iterator_t +xcb_button_end (xcb_button_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; +} + +void +xcb_point_next (xcb_point_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_point_t); +} + +xcb_generic_iterator_t +xcb_point_end (xcb_point_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; +} + +void +xcb_rectangle_next (xcb_rectangle_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_rectangle_t); +} + +xcb_generic_iterator_t +xcb_rectangle_end (xcb_rectangle_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; +} + +void +xcb_arc_next (xcb_arc_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_arc_t); +} + +xcb_generic_iterator_t +xcb_arc_end (xcb_arc_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; +} + +void +xcb_format_next (xcb_format_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_format_t); +} + +xcb_generic_iterator_t +xcb_format_end (xcb_format_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; +} + +void +xcb_visualtype_next (xcb_visualtype_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_visualtype_t); +} + +xcb_generic_iterator_t +xcb_visualtype_end (xcb_visualtype_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; +} + +int +xcb_depth_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_depth_t *_aux = (xcb_depth_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_depth_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* visuals */ + xcb_block_len += _aux->visuals_len * sizeof(xcb_visualtype_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_visualtype_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_visualtype_t * +xcb_depth_visuals (const xcb_depth_t *R) +{ + return (xcb_visualtype_t *) (R + 1); +} + +int +xcb_depth_visuals_length (const xcb_depth_t *R) +{ + return R->visuals_len; +} + +xcb_visualtype_iterator_t +xcb_depth_visuals_iterator (const xcb_depth_t *R) +{ + xcb_visualtype_iterator_t i; + i.data = (xcb_visualtype_t *) (R + 1); + i.rem = R->visuals_len; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_depth_next (xcb_depth_iterator_t *i) +{ + xcb_depth_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_depth_t *)(((char *)R) + xcb_depth_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_depth_t *) child.data; +} + +xcb_generic_iterator_t +xcb_depth_end (xcb_depth_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_depth_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_screen_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_screen_t *_aux = (xcb_screen_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_screen_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* allowed_depths */ + for(i=0; i<_aux->allowed_depths_len; i++) { + xcb_tmp_len = xcb_depth_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_depth_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; +} + +int +xcb_screen_allowed_depths_length (const xcb_screen_t *R) +{ + return R->allowed_depths_len; +} + +xcb_depth_iterator_t +xcb_screen_allowed_depths_iterator (const xcb_screen_t *R) +{ + xcb_depth_iterator_t i; + i.data = (xcb_depth_t *) (R + 1); + i.rem = R->allowed_depths_len; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_screen_next (xcb_screen_iterator_t *i) +{ + xcb_screen_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_screen_t *)(((char *)R) + xcb_screen_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_screen_t *) child.data; +} + +xcb_generic_iterator_t +xcb_screen_end (xcb_screen_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_screen_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_setup_request_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_setup_request_t *_aux = (xcb_setup_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_setup_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* authorization_protocol_name */ + xcb_block_len += _aux->authorization_protocol_name_len * sizeof(char); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(char); + xcb_align_to = 4; + /* 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; + /* 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; + /* authorization_protocol_data */ + xcb_block_len += _aux->authorization_protocol_data_len * sizeof(char); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(char); + xcb_align_to = 4; + /* 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; + /* 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; +} + +char * +xcb_setup_request_authorization_protocol_name (const xcb_setup_request_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_setup_request_authorization_protocol_name_length (const xcb_setup_request_t *R) +{ + return R->authorization_protocol_name_len; +} + +xcb_generic_iterator_t +xcb_setup_request_authorization_protocol_name_end (const xcb_setup_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->authorization_protocol_name_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +char * +xcb_setup_request_authorization_protocol_data (const xcb_setup_request_t *R) +{ + xcb_generic_iterator_t prev = xcb_setup_request_authorization_protocol_name_end(R); + return (char *) ((char *) prev.data + ((-prev.index) & (4 - 1)) + 0); +} + +int +xcb_setup_request_authorization_protocol_data_length (const xcb_setup_request_t *R) +{ + return R->authorization_protocol_data_len; +} + +xcb_generic_iterator_t +xcb_setup_request_authorization_protocol_data_end (const xcb_setup_request_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_setup_request_authorization_protocol_name_end(R); + i.data = ((char *) ((char*) prev.data + ((-prev.index) & (4 - 1)))) + (R->authorization_protocol_data_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_setup_request_next (xcb_setup_request_iterator_t *i) +{ + xcb_setup_request_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_setup_request_t *)(((char *)R) + xcb_setup_request_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_setup_request_t *) child.data; +} + +xcb_generic_iterator_t +xcb_setup_request_end (xcb_setup_request_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_setup_request_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_setup_failed_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_setup_failed_t *_aux = (xcb_setup_failed_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_setup_failed_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* reason */ + xcb_block_len += _aux->reason_len * sizeof(char); + 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; +} + +char * +xcb_setup_failed_reason (const xcb_setup_failed_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_setup_failed_reason_length (const xcb_setup_failed_t *R) +{ + return R->reason_len; +} + +xcb_generic_iterator_t +xcb_setup_failed_reason_end (const xcb_setup_failed_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->reason_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_setup_failed_next (xcb_setup_failed_iterator_t *i) +{ + xcb_setup_failed_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_setup_failed_t *)(((char *)R) + xcb_setup_failed_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_setup_failed_t *) child.data; +} + +xcb_generic_iterator_t +xcb_setup_failed_end (xcb_setup_failed_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_setup_failed_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_setup_authenticate_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_setup_authenticate_t *_aux = (xcb_setup_authenticate_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_setup_authenticate_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* reason */ + xcb_block_len += (_aux->length * 4) * sizeof(char); + 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; +} + +char * +xcb_setup_authenticate_reason (const xcb_setup_authenticate_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_setup_authenticate_reason_length (const xcb_setup_authenticate_t *R) +{ + return (R->length * 4); +} + +xcb_generic_iterator_t +xcb_setup_authenticate_reason_end (const xcb_setup_authenticate_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + ((R->length * 4)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_setup_authenticate_next (xcb_setup_authenticate_iterator_t *i) +{ + xcb_setup_authenticate_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_setup_authenticate_t *)(((char *)R) + xcb_setup_authenticate_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_setup_authenticate_t *) child.data; +} + +xcb_generic_iterator_t +xcb_setup_authenticate_end (xcb_setup_authenticate_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_setup_authenticate_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_setup_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_setup_t *_aux = (xcb_setup_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_setup_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* vendor */ + xcb_block_len += _aux->vendor_len * sizeof(char); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(char); + xcb_align_to = 4; + /* 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; + /* 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; + /* pixmap_formats */ + xcb_block_len += _aux->pixmap_formats_len * sizeof(xcb_format_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_format_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; + /* roots */ + for(i=0; i<_aux->roots_len; i++) { + xcb_tmp_len = xcb_screen_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_screen_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; +} + +char * +xcb_setup_vendor (const xcb_setup_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_setup_vendor_length (const xcb_setup_t *R) +{ + return R->vendor_len; +} + +xcb_generic_iterator_t +xcb_setup_vendor_end (const xcb_setup_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->vendor_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_format_t * +xcb_setup_pixmap_formats (const xcb_setup_t *R) +{ + xcb_generic_iterator_t prev = xcb_setup_vendor_end(R); + return (xcb_format_t *) ((char *) prev.data + ((-prev.index) & (4 - 1)) + 0); +} + +int +xcb_setup_pixmap_formats_length (const xcb_setup_t *R) +{ + return R->pixmap_formats_len; +} + +xcb_format_iterator_t +xcb_setup_pixmap_formats_iterator (const xcb_setup_t *R) +{ + xcb_format_iterator_t i; + xcb_generic_iterator_t prev = xcb_setup_vendor_end(R); + i.data = (xcb_format_t *) ((char *) prev.data + ((-prev.index) & (4 - 1))); + i.rem = R->pixmap_formats_len; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_setup_roots_length (const xcb_setup_t *R) +{ + return R->roots_len; +} + +xcb_screen_iterator_t +xcb_setup_roots_iterator (const xcb_setup_t *R) +{ + xcb_screen_iterator_t i; + xcb_generic_iterator_t prev = xcb_format_end(xcb_setup_pixmap_formats_iterator(R)); + i.data = (xcb_screen_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_screen_t, prev.index)); + i.rem = R->roots_len; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_setup_next (xcb_setup_iterator_t *i) +{ + xcb_setup_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_setup_t *)(((char *)R) + xcb_setup_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_setup_t *) child.data; +} + +xcb_generic_iterator_t +xcb_setup_end (xcb_setup_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_setup_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +void +xcb_client_message_data_next (xcb_client_message_data_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_client_message_data_t); +} + +xcb_generic_iterator_t +xcb_client_message_data_end (xcb_client_message_data_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; +} + +int +xcb_create_window_value_list_serialize (void **_buffer, + uint32_t value_mask, + const xcb_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_value_list_unpack (const void *_buffer, + uint32_t value_mask, + xcb_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_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_create_window_value_list_sizeof (const void *_buffer, + uint32_t value_mask) +{ + xcb_create_window_value_list_t _aux; + return xcb_create_window_value_list_unpack(_buffer, value_mask, &_aux); +} + +int +xcb_create_window_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_create_window_request_t *_aux = (xcb_create_window_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_create_window_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* value_list */ + xcb_block_len += xcb_create_window_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_create_window_checked (xcb_connection_t *c, + uint8_t depth, + xcb_window_t wid, + xcb_window_t parent, + int16_t x, + int16_t y, + uint16_t width, + uint16_t height, + uint16_t border_width, + uint16_t _class, + xcb_visualid_t visual, + uint32_t value_mask, + const void *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CREATE_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_create_window_request_t xcb_out; + + xcb_out.depth = depth; + xcb_out.wid = wid; + xcb_out.parent = parent; + 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.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_create_window_value_list_t value_list */ + xcb_parts[4].iov_base = (char *) value_list; + xcb_parts[4].iov_len = + xcb_create_window_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_create_window (xcb_connection_t *c, + uint8_t depth, + xcb_window_t wid, + xcb_window_t parent, + int16_t x, + int16_t y, + uint16_t width, + uint16_t height, + uint16_t border_width, + uint16_t _class, + xcb_visualid_t visual, + uint32_t value_mask, + const void *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CREATE_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_create_window_request_t xcb_out; + + xcb_out.depth = depth; + xcb_out.wid = wid; + xcb_out.parent = parent; + 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.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_create_window_value_list_t value_list */ + xcb_parts[4].iov_base = (char *) value_list; + xcb_parts[4].iov_len = + xcb_create_window_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_create_window_aux_checked (xcb_connection_t *c, + uint8_t depth, + xcb_window_t wid, + xcb_window_t parent, + int16_t x, + int16_t y, + uint16_t width, + uint16_t height, + uint16_t border_width, + uint16_t _class, + xcb_visualid_t visual, + uint32_t value_mask, + const xcb_create_window_value_list_t *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CREATE_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_create_window_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.depth = depth; + xcb_out.wid = wid; + xcb_out.parent = parent; + 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.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_create_window_value_list_t value_list */ + xcb_parts[4].iov_len = + xcb_create_window_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_create_window_aux (xcb_connection_t *c, + uint8_t depth, + xcb_window_t wid, + xcb_window_t parent, + int16_t x, + int16_t y, + uint16_t width, + uint16_t height, + uint16_t border_width, + uint16_t _class, + xcb_visualid_t visual, + uint32_t value_mask, + const xcb_create_window_value_list_t *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CREATE_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_create_window_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.depth = depth; + xcb_out.wid = wid; + xcb_out.parent = parent; + 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.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_create_window_value_list_t value_list */ + xcb_parts[4].iov_len = + xcb_create_window_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_create_window_value_list (const xcb_create_window_request_t *R) +{ + return (void *) (R + 1); +} + +int +xcb_change_window_attributes_value_list_serialize (void **_buffer, + uint32_t value_mask, + const xcb_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_attributes_value_list_unpack (const void *_buffer, + uint32_t value_mask, + xcb_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_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_change_window_attributes_value_list_sizeof (const void *_buffer, + uint32_t value_mask) +{ + xcb_change_window_attributes_value_list_t _aux; + return xcb_change_window_attributes_value_list_unpack(_buffer, value_mask, &_aux); +} + +int +xcb_change_window_attributes_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_change_window_attributes_request_t *_aux = (xcb_change_window_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_change_window_attributes_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* value_list */ + xcb_block_len += xcb_change_window_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_change_window_attributes_checked (xcb_connection_t *c, + xcb_window_t window, + uint32_t value_mask, + const void *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CHANGE_WINDOW_ATTRIBUTES, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_change_window_attributes_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.window = window; + 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_change_window_attributes_value_list_t value_list */ + xcb_parts[4].iov_base = (char *) value_list; + xcb_parts[4].iov_len = + xcb_change_window_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_change_window_attributes (xcb_connection_t *c, + xcb_window_t window, + uint32_t value_mask, + const void *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CHANGE_WINDOW_ATTRIBUTES, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_change_window_attributes_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.window = window; + 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_change_window_attributes_value_list_t value_list */ + xcb_parts[4].iov_base = (char *) value_list; + xcb_parts[4].iov_len = + xcb_change_window_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_change_window_attributes_aux_checked (xcb_connection_t *c, + xcb_window_t window, + uint32_t value_mask, + const xcb_change_window_attributes_value_list_t *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CHANGE_WINDOW_ATTRIBUTES, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_change_window_attributes_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.pad0 = 0; + xcb_out.window = window; + 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_change_window_attributes_value_list_t value_list */ + xcb_parts[4].iov_len = + xcb_change_window_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_change_window_attributes_aux (xcb_connection_t *c, + xcb_window_t window, + uint32_t value_mask, + const xcb_change_window_attributes_value_list_t *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CHANGE_WINDOW_ATTRIBUTES, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_change_window_attributes_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.pad0 = 0; + xcb_out.window = window; + 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_change_window_attributes_value_list_t value_list */ + xcb_parts[4].iov_len = + xcb_change_window_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_change_window_attributes_value_list (const xcb_change_window_attributes_request_t *R) +{ + return (void *) (R + 1); +} + +xcb_get_window_attributes_cookie_t +xcb_get_window_attributes (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_WINDOW_ATTRIBUTES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_window_attributes_cookie_t xcb_ret; + xcb_get_window_attributes_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_get_window_attributes_cookie_t +xcb_get_window_attributes_unchecked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_WINDOW_ATTRIBUTES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_window_attributes_cookie_t xcb_ret; + xcb_get_window_attributes_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_get_window_attributes_reply_t * +xcb_get_window_attributes_reply (xcb_connection_t *c, + xcb_get_window_attributes_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_get_window_attributes_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_destroy_window_checked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_DESTROY_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_destroy_window_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_destroy_window (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_DESTROY_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_destroy_window_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_destroy_subwindows_checked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_DESTROY_SUBWINDOWS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_destroy_subwindows_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_destroy_subwindows (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_DESTROY_SUBWINDOWS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_destroy_subwindows_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_change_save_set_checked (xcb_connection_t *c, + uint8_t mode, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_CHANGE_SAVE_SET, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_change_save_set_request_t xcb_out; + + xcb_out.mode = mode; + 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_change_save_set (xcb_connection_t *c, + uint8_t mode, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_CHANGE_SAVE_SET, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_change_save_set_request_t xcb_out; + + xcb_out.mode = mode; + 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_reparent_window_checked (xcb_connection_t *c, + xcb_window_t window, + xcb_window_t parent, + int16_t x, + int16_t y) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_REPARENT_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_reparent_window_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.window = window; + xcb_out.parent = parent; + 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; + + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_reparent_window (xcb_connection_t *c, + xcb_window_t window, + xcb_window_t parent, + int16_t x, + int16_t y) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_REPARENT_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_reparent_window_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.window = window; + xcb_out.parent = parent; + 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; + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_map_window_checked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_MAP_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_map_window_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_map_window (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_MAP_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_map_window_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_map_subwindows_checked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_MAP_SUBWINDOWS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_map_subwindows_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_map_subwindows (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_MAP_SUBWINDOWS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_map_subwindows_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_unmap_window_checked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_UNMAP_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_unmap_window_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_unmap_window (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_UNMAP_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_unmap_window_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_unmap_subwindows_checked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_UNMAP_SUBWINDOWS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_unmap_subwindows_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_unmap_subwindows (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_UNMAP_SUBWINDOWS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_unmap_subwindows_request_t xcb_out; + + xcb_out.pad0 = 0; + 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; +} + +int +xcb_configure_window_value_list_serialize (void **_buffer, + uint16_t value_mask, + const xcb_configure_window_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[8]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(value_mask & XCB_CONFIG_WINDOW_X) { + /* xcb_configure_window_value_list_t.x */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->x; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_CONFIG_WINDOW_Y) { + /* xcb_configure_window_value_list_t.y */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->y; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_CONFIG_WINDOW_WIDTH) { + /* xcb_configure_window_value_list_t.width */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->width; + 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_CONFIG_WINDOW_HEIGHT) { + /* xcb_configure_window_value_list_t.height */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->height; + 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_CONFIG_WINDOW_BORDER_WIDTH) { + /* xcb_configure_window_value_list_t.border_width */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->border_width; + 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_CONFIG_WINDOW_SIBLING) { + /* xcb_configure_window_value_list_t.sibling */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->sibling; + xcb_block_len += sizeof(xcb_window_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_window_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_window_t); + } + if(value_mask & XCB_CONFIG_WINDOW_STACK_MODE) { + /* xcb_configure_window_value_list_t.stack_mode */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->stack_mode; + 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); + } + /* 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_configure_window_value_list_unpack (const void *_buffer, + uint16_t value_mask, + xcb_configure_window_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_CONFIG_WINDOW_X) { + /* xcb_configure_window_value_list_t.x */ + _aux->x = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_CONFIG_WINDOW_Y) { + /* xcb_configure_window_value_list_t.y */ + _aux->y = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_CONFIG_WINDOW_WIDTH) { + /* xcb_configure_window_value_list_t.width */ + _aux->width = *(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_CONFIG_WINDOW_HEIGHT) { + /* xcb_configure_window_value_list_t.height */ + _aux->height = *(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_CONFIG_WINDOW_BORDER_WIDTH) { + /* xcb_configure_window_value_list_t.border_width */ + _aux->border_width = *(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_CONFIG_WINDOW_SIBLING) { + /* xcb_configure_window_value_list_t.sibling */ + _aux->sibling = *(xcb_window_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_window_t); + xcb_tmp += sizeof(xcb_window_t); + xcb_align_to = ALIGNOF(xcb_window_t); + } + if(value_mask & XCB_CONFIG_WINDOW_STACK_MODE) { + /* xcb_configure_window_value_list_t.stack_mode */ + _aux->stack_mode = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_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_configure_window_value_list_sizeof (const void *_buffer, + uint16_t value_mask) +{ + xcb_configure_window_value_list_t _aux; + return xcb_configure_window_value_list_unpack(_buffer, value_mask, &_aux); +} + +int +xcb_configure_window_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_configure_window_request_t *_aux = (xcb_configure_window_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_configure_window_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* value_list */ + xcb_block_len += xcb_configure_window_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_configure_window_checked (xcb_connection_t *c, + xcb_window_t window, + uint16_t value_mask, + const void *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CONFIGURE_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_configure_window_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.window = window; + xcb_out.value_mask = value_mask; + memset(xcb_out.pad1, 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_configure_window_value_list_t value_list */ + xcb_parts[4].iov_base = (char *) value_list; + xcb_parts[4].iov_len = + xcb_configure_window_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_configure_window (xcb_connection_t *c, + xcb_window_t window, + uint16_t value_mask, + const void *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CONFIGURE_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_configure_window_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.window = window; + xcb_out.value_mask = value_mask; + memset(xcb_out.pad1, 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_configure_window_value_list_t value_list */ + xcb_parts[4].iov_base = (char *) value_list; + xcb_parts[4].iov_len = + xcb_configure_window_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_configure_window_aux_checked (xcb_connection_t *c, + xcb_window_t window, + uint16_t value_mask, + const xcb_configure_window_value_list_t *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CONFIGURE_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_configure_window_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.pad0 = 0; + xcb_out.window = window; + xcb_out.value_mask = value_mask; + memset(xcb_out.pad1, 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_configure_window_value_list_t value_list */ + xcb_parts[4].iov_len = + xcb_configure_window_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_configure_window_aux (xcb_connection_t *c, + xcb_window_t window, + uint16_t value_mask, + const xcb_configure_window_value_list_t *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CONFIGURE_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_configure_window_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.pad0 = 0; + xcb_out.window = window; + xcb_out.value_mask = value_mask; + memset(xcb_out.pad1, 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_configure_window_value_list_t value_list */ + xcb_parts[4].iov_len = + xcb_configure_window_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_configure_window_value_list (const xcb_configure_window_request_t *R) +{ + return (void *) (R + 1); +} + +xcb_void_cookie_t +xcb_circulate_window_checked (xcb_connection_t *c, + uint8_t direction, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_CIRCULATE_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_circulate_window_request_t xcb_out; + + xcb_out.direction = direction; + 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_circulate_window (xcb_connection_t *c, + uint8_t direction, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_CIRCULATE_WINDOW, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_circulate_window_request_t xcb_out; + + xcb_out.direction = direction; + 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_get_geometry_cookie_t +xcb_get_geometry (xcb_connection_t *c, + xcb_drawable_t drawable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_GEOMETRY, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_geometry_cookie_t xcb_ret; + xcb_get_geometry_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_get_geometry_cookie_t +xcb_get_geometry_unchecked (xcb_connection_t *c, + xcb_drawable_t drawable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_GEOMETRY, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_geometry_cookie_t xcb_ret; + xcb_get_geometry_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_get_geometry_reply_t * +xcb_get_geometry_reply (xcb_connection_t *c, + xcb_get_geometry_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_get_geometry_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_query_tree_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_query_tree_reply_t *_aux = (xcb_query_tree_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_query_tree_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* children */ + xcb_block_len += _aux->children_len * sizeof(xcb_window_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_window_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_query_tree_cookie_t +xcb_query_tree (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_QUERY_TREE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_query_tree_cookie_t xcb_ret; + xcb_query_tree_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_query_tree_cookie_t +xcb_query_tree_unchecked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_QUERY_TREE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_query_tree_cookie_t xcb_ret; + xcb_query_tree_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_window_t * +xcb_query_tree_children (const xcb_query_tree_reply_t *R) +{ + return (xcb_window_t *) (R + 1); +} + +int +xcb_query_tree_children_length (const xcb_query_tree_reply_t *R) +{ + return R->children_len; +} + +xcb_generic_iterator_t +xcb_query_tree_children_end (const xcb_query_tree_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_window_t *) (R + 1)) + (R->children_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_query_tree_reply_t * +xcb_query_tree_reply (xcb_connection_t *c, + xcb_query_tree_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_query_tree_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_intern_atom_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_intern_atom_request_t *_aux = (xcb_intern_atom_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_intern_atom_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* name */ + xcb_block_len += _aux->name_len * sizeof(char); + 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_intern_atom_cookie_t +xcb_intern_atom (xcb_connection_t *c, + uint8_t only_if_exists, + uint16_t name_len, + const char *name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_INTERN_ATOM, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_intern_atom_cookie_t xcb_ret; + xcb_intern_atom_request_t xcb_out; + + xcb_out.only_if_exists = only_if_exists; + xcb_out.name_len = name_len; + 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; + /* char name */ + xcb_parts[4].iov_base = (char *) name; + xcb_parts[4].iov_len = name_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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_intern_atom_cookie_t +xcb_intern_atom_unchecked (xcb_connection_t *c, + uint8_t only_if_exists, + uint16_t name_len, + const char *name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_INTERN_ATOM, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_intern_atom_cookie_t xcb_ret; + xcb_intern_atom_request_t xcb_out; + + xcb_out.only_if_exists = only_if_exists; + xcb_out.name_len = name_len; + 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; + /* char name */ + xcb_parts[4].iov_base = (char *) name; + xcb_parts[4].iov_len = name_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; +} + +xcb_intern_atom_reply_t * +xcb_intern_atom_reply (xcb_connection_t *c, + xcb_intern_atom_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_intern_atom_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_get_atom_name_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_get_atom_name_reply_t *_aux = (xcb_get_atom_name_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_get_atom_name_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* name */ + xcb_block_len += _aux->name_len * sizeof(char); + 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_get_atom_name_cookie_t +xcb_get_atom_name (xcb_connection_t *c, + xcb_atom_t atom) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_ATOM_NAME, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_atom_name_cookie_t xcb_ret; + xcb_get_atom_name_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.atom = atom; + + 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_get_atom_name_cookie_t +xcb_get_atom_name_unchecked (xcb_connection_t *c, + xcb_atom_t atom) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_ATOM_NAME, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_atom_name_cookie_t xcb_ret; + xcb_get_atom_name_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.atom = atom; + + 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; +} + +char * +xcb_get_atom_name_name (const xcb_get_atom_name_reply_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_get_atom_name_name_length (const xcb_get_atom_name_reply_t *R) +{ + return R->name_len; +} + +xcb_generic_iterator_t +xcb_get_atom_name_name_end (const xcb_get_atom_name_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->name_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_get_atom_name_reply_t * +xcb_get_atom_name_reply (xcb_connection_t *c, + xcb_get_atom_name_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_get_atom_name_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_change_property_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_change_property_request_t *_aux = (xcb_change_property_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_change_property_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += ((_aux->data_len * _aux->format) / 8) * sizeof(char); + 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_change_property_checked (xcb_connection_t *c, + uint8_t mode, + xcb_window_t window, + xcb_atom_t property, + xcb_atom_t type, + uint8_t format, + uint32_t data_len, + const void *data) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_CHANGE_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_change_property_request_t xcb_out; + + xcb_out.mode = mode; + xcb_out.window = window; + xcb_out.property = property; + xcb_out.type = type; + xcb_out.format = format; + memset(xcb_out.pad0, 0, 3); + xcb_out.data_len = data_len; + + 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; + /* void data */ + xcb_parts[4].iov_base = (char *) data; + xcb_parts[4].iov_len = ((data_len * format) / 8) * 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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_change_property (xcb_connection_t *c, + uint8_t mode, + xcb_window_t window, + xcb_atom_t property, + xcb_atom_t type, + uint8_t format, + uint32_t data_len, + const void *data) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_CHANGE_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_change_property_request_t xcb_out; + + xcb_out.mode = mode; + xcb_out.window = window; + xcb_out.property = property; + xcb_out.type = type; + xcb_out.format = format; + memset(xcb_out.pad0, 0, 3); + xcb_out.data_len = data_len; + + 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; + /* void data */ + xcb_parts[4].iov_base = (char *) data; + xcb_parts[4].iov_len = ((data_len * format) / 8) * 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; +} + +void * +xcb_change_property_data (const xcb_change_property_request_t *R) +{ + return (void *) (R + 1); +} + +int +xcb_change_property_data_length (const xcb_change_property_request_t *R) +{ + return ((R->data_len * R->format) / 8); +} + +xcb_generic_iterator_t +xcb_change_property_data_end (const xcb_change_property_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (((R->data_len * R->format) / 8)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_delete_property_checked (xcb_connection_t *c, + xcb_window_t window, + xcb_atom_t property) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_DELETE_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_delete_property_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.window = window; + xcb_out.property = property; + + 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_delete_property (xcb_connection_t *c, + xcb_window_t window, + xcb_atom_t property) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_DELETE_PROPERTY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_delete_property_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.window = window; + xcb_out.property = property; + + 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_get_property_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_get_property_reply_t *_aux = (xcb_get_property_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_get_property_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* value */ + xcb_block_len += (_aux->value_len * (_aux->format / 8)) * sizeof(char); + 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_get_property_cookie_t +xcb_get_property (xcb_connection_t *c, + uint8_t _delete, + xcb_window_t window, + xcb_atom_t property, + xcb_atom_t type, + uint32_t long_offset, + uint32_t long_length) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_PROPERTY, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_property_cookie_t xcb_ret; + xcb_get_property_request_t xcb_out; + + xcb_out._delete = _delete; + xcb_out.window = window; + xcb_out.property = property; + xcb_out.type = type; + xcb_out.long_offset = long_offset; + xcb_out.long_length = long_length; + + 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_get_property_cookie_t +xcb_get_property_unchecked (xcb_connection_t *c, + uint8_t _delete, + xcb_window_t window, + xcb_atom_t property, + xcb_atom_t type, + uint32_t long_offset, + uint32_t long_length) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_PROPERTY, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_property_cookie_t xcb_ret; + xcb_get_property_request_t xcb_out; + + xcb_out._delete = _delete; + xcb_out.window = window; + xcb_out.property = property; + xcb_out.type = type; + xcb_out.long_offset = long_offset; + xcb_out.long_length = long_length; + + 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_get_property_value (const xcb_get_property_reply_t *R) +{ + return (void *) (R + 1); +} + +int +xcb_get_property_value_length (const xcb_get_property_reply_t *R) +{ + return (R->value_len * (R->format / 8)); +} + +xcb_generic_iterator_t +xcb_get_property_value_end (const xcb_get_property_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + ((R->value_len * (R->format / 8))); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_get_property_reply_t * +xcb_get_property_reply (xcb_connection_t *c, + xcb_get_property_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_get_property_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_list_properties_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_list_properties_reply_t *_aux = (xcb_list_properties_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_list_properties_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* atoms */ + xcb_block_len += _aux->atoms_len * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_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_list_properties_cookie_t +xcb_list_properties (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_LIST_PROPERTIES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_list_properties_cookie_t xcb_ret; + xcb_list_properties_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_list_properties_cookie_t +xcb_list_properties_unchecked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_LIST_PROPERTIES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_list_properties_cookie_t xcb_ret; + xcb_list_properties_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_atom_t * +xcb_list_properties_atoms (const xcb_list_properties_reply_t *R) +{ + return (xcb_atom_t *) (R + 1); +} + +int +xcb_list_properties_atoms_length (const xcb_list_properties_reply_t *R) +{ + return R->atoms_len; +} + +xcb_generic_iterator_t +xcb_list_properties_atoms_end (const xcb_list_properties_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_atom_t *) (R + 1)) + (R->atoms_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_list_properties_reply_t * +xcb_list_properties_reply (xcb_connection_t *c, + xcb_list_properties_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_list_properties_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_set_selection_owner_checked (xcb_connection_t *c, + xcb_window_t owner, + xcb_atom_t selection, + xcb_timestamp_t time) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_SET_SELECTION_OWNER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_set_selection_owner_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.owner = owner; + xcb_out.selection = selection; + xcb_out.time = time; + + 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_set_selection_owner (xcb_connection_t *c, + xcb_window_t owner, + xcb_atom_t selection, + xcb_timestamp_t time) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_SET_SELECTION_OWNER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_set_selection_owner_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.owner = owner; + xcb_out.selection = selection; + xcb_out.time = time; + + 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_get_selection_owner_cookie_t +xcb_get_selection_owner (xcb_connection_t *c, + xcb_atom_t selection) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_SELECTION_OWNER, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_selection_owner_cookie_t xcb_ret; + xcb_get_selection_owner_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.selection = selection; + + 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_get_selection_owner_cookie_t +xcb_get_selection_owner_unchecked (xcb_connection_t *c, + xcb_atom_t selection) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_SELECTION_OWNER, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_selection_owner_cookie_t xcb_ret; + xcb_get_selection_owner_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.selection = selection; + + 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_get_selection_owner_reply_t * +xcb_get_selection_owner_reply (xcb_connection_t *c, + xcb_get_selection_owner_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_get_selection_owner_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_convert_selection_checked (xcb_connection_t *c, + xcb_window_t requestor, + xcb_atom_t selection, + xcb_atom_t target, + xcb_atom_t property, + xcb_timestamp_t time) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_CONVERT_SELECTION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_convert_selection_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.requestor = requestor; + xcb_out.selection = selection; + xcb_out.target = target; + xcb_out.property = property; + xcb_out.time = time; + + 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_convert_selection (xcb_connection_t *c, + xcb_window_t requestor, + xcb_atom_t selection, + xcb_atom_t target, + xcb_atom_t property, + xcb_timestamp_t time) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_CONVERT_SELECTION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_convert_selection_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.requestor = requestor; + xcb_out.selection = selection; + xcb_out.target = target; + xcb_out.property = property; + xcb_out.time = time; + + 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_send_event_checked (xcb_connection_t *c, + uint8_t propagate, + xcb_window_t destination, + uint32_t event_mask, + const char *event) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_SEND_EVENT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_send_event_request_t xcb_out; + + xcb_out.propagate = propagate; + xcb_out.destination = destination; + xcb_out.event_mask = event_mask; + memcpy(xcb_out.event, event, 32); + + 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_send_event (xcb_connection_t *c, + uint8_t propagate, + xcb_window_t destination, + uint32_t event_mask, + const char *event) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_SEND_EVENT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_send_event_request_t xcb_out; + + xcb_out.propagate = propagate; + xcb_out.destination = destination; + xcb_out.event_mask = event_mask; + memcpy(xcb_out.event, event, 32); + + 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_grab_pointer_cookie_t +xcb_grab_pointer (xcb_connection_t *c, + uint8_t owner_events, + xcb_window_t grab_window, + uint16_t event_mask, + uint8_t pointer_mode, + uint8_t keyboard_mode, + xcb_window_t confine_to, + xcb_cursor_t cursor, + xcb_timestamp_t time) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GRAB_POINTER, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_grab_pointer_cookie_t xcb_ret; + xcb_grab_pointer_request_t xcb_out; + + xcb_out.owner_events = owner_events; + xcb_out.grab_window = grab_window; + xcb_out.event_mask = event_mask; + xcb_out.pointer_mode = pointer_mode; + xcb_out.keyboard_mode = keyboard_mode; + xcb_out.confine_to = confine_to; + xcb_out.cursor = cursor; + xcb_out.time = time; + + 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_grab_pointer_cookie_t +xcb_grab_pointer_unchecked (xcb_connection_t *c, + uint8_t owner_events, + xcb_window_t grab_window, + uint16_t event_mask, + uint8_t pointer_mode, + uint8_t keyboard_mode, + xcb_window_t confine_to, + xcb_cursor_t cursor, + xcb_timestamp_t time) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GRAB_POINTER, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_grab_pointer_cookie_t xcb_ret; + xcb_grab_pointer_request_t xcb_out; + + xcb_out.owner_events = owner_events; + xcb_out.grab_window = grab_window; + xcb_out.event_mask = event_mask; + xcb_out.pointer_mode = pointer_mode; + xcb_out.keyboard_mode = keyboard_mode; + xcb_out.confine_to = confine_to; + xcb_out.cursor = cursor; + xcb_out.time = time; + + 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_grab_pointer_reply_t * +xcb_grab_pointer_reply (xcb_connection_t *c, + xcb_grab_pointer_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_grab_pointer_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_ungrab_pointer_checked (xcb_connection_t *c, + xcb_timestamp_t time) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_UNGRAB_POINTER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_ungrab_pointer_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.time = time; + + 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_ungrab_pointer (xcb_connection_t *c, + xcb_timestamp_t time) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_UNGRAB_POINTER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_ungrab_pointer_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.time = time; + + 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_grab_button_checked (xcb_connection_t *c, + uint8_t owner_events, + xcb_window_t grab_window, + uint16_t event_mask, + uint8_t pointer_mode, + uint8_t keyboard_mode, + xcb_window_t confine_to, + xcb_cursor_t cursor, + uint8_t button, + uint16_t modifiers) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GRAB_BUTTON, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_grab_button_request_t xcb_out; + + xcb_out.owner_events = owner_events; + xcb_out.grab_window = grab_window; + xcb_out.event_mask = event_mask; + xcb_out.pointer_mode = pointer_mode; + xcb_out.keyboard_mode = keyboard_mode; + xcb_out.confine_to = confine_to; + xcb_out.cursor = cursor; + xcb_out.button = button; + xcb_out.pad0 = 0; + xcb_out.modifiers = modifiers; + + 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_grab_button (xcb_connection_t *c, + uint8_t owner_events, + xcb_window_t grab_window, + uint16_t event_mask, + uint8_t pointer_mode, + uint8_t keyboard_mode, + xcb_window_t confine_to, + xcb_cursor_t cursor, + uint8_t button, + uint16_t modifiers) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GRAB_BUTTON, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_grab_button_request_t xcb_out; + + xcb_out.owner_events = owner_events; + xcb_out.grab_window = grab_window; + xcb_out.event_mask = event_mask; + xcb_out.pointer_mode = pointer_mode; + xcb_out.keyboard_mode = keyboard_mode; + xcb_out.confine_to = confine_to; + xcb_out.cursor = cursor; + xcb_out.button = button; + xcb_out.pad0 = 0; + xcb_out.modifiers = modifiers; + + 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_ungrab_button_checked (xcb_connection_t *c, + uint8_t button, + xcb_window_t grab_window, + uint16_t modifiers) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_UNGRAB_BUTTON, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_ungrab_button_request_t xcb_out; + + xcb_out.button = button; + xcb_out.grab_window = grab_window; + xcb_out.modifiers = modifiers; + 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_void_cookie_t +xcb_ungrab_button (xcb_connection_t *c, + uint8_t button, + xcb_window_t grab_window, + uint16_t modifiers) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_UNGRAB_BUTTON, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_ungrab_button_request_t xcb_out; + + xcb_out.button = button; + xcb_out.grab_window = grab_window; + xcb_out.modifiers = modifiers; + 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_void_cookie_t +xcb_change_active_pointer_grab_checked (xcb_connection_t *c, + xcb_cursor_t cursor, + xcb_timestamp_t time, + uint16_t event_mask) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_CHANGE_ACTIVE_POINTER_GRAB, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_change_active_pointer_grab_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cursor = cursor; + xcb_out.time = time; + xcb_out.event_mask = event_mask; + memset(xcb_out.pad1, 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_void_cookie_t +xcb_change_active_pointer_grab (xcb_connection_t *c, + xcb_cursor_t cursor, + xcb_timestamp_t time, + uint16_t event_mask) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_CHANGE_ACTIVE_POINTER_GRAB, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_change_active_pointer_grab_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cursor = cursor; + xcb_out.time = time; + xcb_out.event_mask = event_mask; + memset(xcb_out.pad1, 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_grab_keyboard_cookie_t +xcb_grab_keyboard (xcb_connection_t *c, + uint8_t owner_events, + xcb_window_t grab_window, + xcb_timestamp_t time, + uint8_t pointer_mode, + uint8_t keyboard_mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GRAB_KEYBOARD, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_grab_keyboard_cookie_t xcb_ret; + xcb_grab_keyboard_request_t xcb_out; + + xcb_out.owner_events = owner_events; + xcb_out.grab_window = grab_window; + xcb_out.time = time; + xcb_out.pointer_mode = pointer_mode; + xcb_out.keyboard_mode = keyboard_mode; + 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_grab_keyboard_cookie_t +xcb_grab_keyboard_unchecked (xcb_connection_t *c, + uint8_t owner_events, + xcb_window_t grab_window, + xcb_timestamp_t time, + uint8_t pointer_mode, + uint8_t keyboard_mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GRAB_KEYBOARD, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_grab_keyboard_cookie_t xcb_ret; + xcb_grab_keyboard_request_t xcb_out; + + xcb_out.owner_events = owner_events; + xcb_out.grab_window = grab_window; + xcb_out.time = time; + xcb_out.pointer_mode = pointer_mode; + xcb_out.keyboard_mode = keyboard_mode; + 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_grab_keyboard_reply_t * +xcb_grab_keyboard_reply (xcb_connection_t *c, + xcb_grab_keyboard_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_grab_keyboard_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_ungrab_keyboard_checked (xcb_connection_t *c, + xcb_timestamp_t time) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_UNGRAB_KEYBOARD, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_ungrab_keyboard_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.time = time; + + 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_ungrab_keyboard (xcb_connection_t *c, + xcb_timestamp_t time) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_UNGRAB_KEYBOARD, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_ungrab_keyboard_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.time = time; + + 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_grab_key_checked (xcb_connection_t *c, + uint8_t owner_events, + xcb_window_t grab_window, + uint16_t modifiers, + xcb_keycode_t key, + uint8_t pointer_mode, + uint8_t keyboard_mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GRAB_KEY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_grab_key_request_t xcb_out; + + xcb_out.owner_events = owner_events; + xcb_out.grab_window = grab_window; + xcb_out.modifiers = modifiers; + xcb_out.key = key; + xcb_out.pointer_mode = pointer_mode; + xcb_out.keyboard_mode = keyboard_mode; + 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_grab_key (xcb_connection_t *c, + uint8_t owner_events, + xcb_window_t grab_window, + uint16_t modifiers, + xcb_keycode_t key, + uint8_t pointer_mode, + uint8_t keyboard_mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GRAB_KEY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_grab_key_request_t xcb_out; + + xcb_out.owner_events = owner_events; + xcb_out.grab_window = grab_window; + xcb_out.modifiers = modifiers; + xcb_out.key = key; + xcb_out.pointer_mode = pointer_mode; + xcb_out.keyboard_mode = keyboard_mode; + 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_ungrab_key_checked (xcb_connection_t *c, + xcb_keycode_t key, + xcb_window_t grab_window, + uint16_t modifiers) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_UNGRAB_KEY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_ungrab_key_request_t xcb_out; + + xcb_out.key = key; + xcb_out.grab_window = grab_window; + xcb_out.modifiers = modifiers; + 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_void_cookie_t +xcb_ungrab_key (xcb_connection_t *c, + xcb_keycode_t key, + xcb_window_t grab_window, + uint16_t modifiers) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_UNGRAB_KEY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_ungrab_key_request_t xcb_out; + + xcb_out.key = key; + xcb_out.grab_window = grab_window; + xcb_out.modifiers = modifiers; + 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_void_cookie_t +xcb_allow_events_checked (xcb_connection_t *c, + uint8_t mode, + xcb_timestamp_t time) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_ALLOW_EVENTS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_allow_events_request_t xcb_out; + + xcb_out.mode = mode; + xcb_out.time = time; + + 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_allow_events (xcb_connection_t *c, + uint8_t mode, + xcb_timestamp_t time) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_ALLOW_EVENTS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_allow_events_request_t xcb_out; + + xcb_out.mode = mode; + xcb_out.time = time; + + 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_grab_server_checked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GRAB_SERVER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_grab_server_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_grab_server (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GRAB_SERVER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_grab_server_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_ungrab_server_checked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_UNGRAB_SERVER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_ungrab_server_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_ungrab_server (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_UNGRAB_SERVER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_ungrab_server_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_query_pointer_cookie_t +xcb_query_pointer (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_QUERY_POINTER, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_query_pointer_cookie_t xcb_ret; + xcb_query_pointer_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_query_pointer_cookie_t +xcb_query_pointer_unchecked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_QUERY_POINTER, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_query_pointer_cookie_t xcb_ret; + xcb_query_pointer_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_query_pointer_reply_t * +xcb_query_pointer_reply (xcb_connection_t *c, + xcb_query_pointer_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_query_pointer_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +void +xcb_timecoord_next (xcb_timecoord_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_timecoord_t); +} + +xcb_generic_iterator_t +xcb_timecoord_end (xcb_timecoord_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; +} + +int +xcb_get_motion_events_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_get_motion_events_reply_t *_aux = (xcb_get_motion_events_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_get_motion_events_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* events */ + xcb_block_len += _aux->events_len * sizeof(xcb_timecoord_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_timecoord_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_get_motion_events_cookie_t +xcb_get_motion_events (xcb_connection_t *c, + xcb_window_t window, + xcb_timestamp_t start, + xcb_timestamp_t stop) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_MOTION_EVENTS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_motion_events_cookie_t xcb_ret; + xcb_get_motion_events_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.window = window; + xcb_out.start = start; + xcb_out.stop = stop; + + 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_get_motion_events_cookie_t +xcb_get_motion_events_unchecked (xcb_connection_t *c, + xcb_window_t window, + xcb_timestamp_t start, + xcb_timestamp_t stop) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_MOTION_EVENTS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_motion_events_cookie_t xcb_ret; + xcb_get_motion_events_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.window = window; + xcb_out.start = start; + xcb_out.stop = stop; + + 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_timecoord_t * +xcb_get_motion_events_events (const xcb_get_motion_events_reply_t *R) +{ + return (xcb_timecoord_t *) (R + 1); +} + +int +xcb_get_motion_events_events_length (const xcb_get_motion_events_reply_t *R) +{ + return R->events_len; +} + +xcb_timecoord_iterator_t +xcb_get_motion_events_events_iterator (const xcb_get_motion_events_reply_t *R) +{ + xcb_timecoord_iterator_t i; + i.data = (xcb_timecoord_t *) (R + 1); + i.rem = R->events_len; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_get_motion_events_reply_t * +xcb_get_motion_events_reply (xcb_connection_t *c, + xcb_get_motion_events_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_get_motion_events_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_translate_coordinates_cookie_t +xcb_translate_coordinates (xcb_connection_t *c, + xcb_window_t src_window, + xcb_window_t dst_window, + int16_t src_x, + int16_t src_y) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_TRANSLATE_COORDINATES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_translate_coordinates_cookie_t xcb_ret; + xcb_translate_coordinates_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.src_window = src_window; + xcb_out.dst_window = dst_window; + xcb_out.src_x = src_x; + xcb_out.src_y = src_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; + + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_translate_coordinates_cookie_t +xcb_translate_coordinates_unchecked (xcb_connection_t *c, + xcb_window_t src_window, + xcb_window_t dst_window, + int16_t src_x, + int16_t src_y) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_TRANSLATE_COORDINATES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_translate_coordinates_cookie_t xcb_ret; + xcb_translate_coordinates_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.src_window = src_window; + xcb_out.dst_window = dst_window; + xcb_out.src_x = src_x; + xcb_out.src_y = src_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; + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_translate_coordinates_reply_t * +xcb_translate_coordinates_reply (xcb_connection_t *c, + xcb_translate_coordinates_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_translate_coordinates_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_warp_pointer_checked (xcb_connection_t *c, + xcb_window_t src_window, + xcb_window_t dst_window, + int16_t src_x, + int16_t src_y, + uint16_t src_width, + uint16_t src_height, + int16_t dst_x, + int16_t dst_y) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_WARP_POINTER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_warp_pointer_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.src_window = src_window; + xcb_out.dst_window = dst_window; + xcb_out.src_x = src_x; + xcb_out.src_y = src_y; + xcb_out.src_width = src_width; + xcb_out.src_height = src_height; + xcb_out.dst_x = dst_x; + xcb_out.dst_y = dst_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; + + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_warp_pointer (xcb_connection_t *c, + xcb_window_t src_window, + xcb_window_t dst_window, + int16_t src_x, + int16_t src_y, + uint16_t src_width, + uint16_t src_height, + int16_t dst_x, + int16_t dst_y) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_WARP_POINTER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_warp_pointer_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.src_window = src_window; + xcb_out.dst_window = dst_window; + xcb_out.src_x = src_x; + xcb_out.src_y = src_y; + xcb_out.src_width = src_width; + xcb_out.src_height = src_height; + xcb_out.dst_x = dst_x; + xcb_out.dst_y = dst_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; + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_set_input_focus_checked (xcb_connection_t *c, + uint8_t revert_to, + xcb_window_t focus, + xcb_timestamp_t time) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_SET_INPUT_FOCUS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_set_input_focus_request_t xcb_out; + + xcb_out.revert_to = revert_to; + xcb_out.focus = focus; + xcb_out.time = time; + + 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_set_input_focus (xcb_connection_t *c, + uint8_t revert_to, + xcb_window_t focus, + xcb_timestamp_t time) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_SET_INPUT_FOCUS, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_set_input_focus_request_t xcb_out; + + xcb_out.revert_to = revert_to; + xcb_out.focus = focus; + xcb_out.time = time; + + 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_get_input_focus_cookie_t +xcb_get_input_focus (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_INPUT_FOCUS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_input_focus_cookie_t xcb_ret; + xcb_get_input_focus_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_get_input_focus_cookie_t +xcb_get_input_focus_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_INPUT_FOCUS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_input_focus_cookie_t xcb_ret; + xcb_get_input_focus_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_get_input_focus_reply_t * +xcb_get_input_focus_reply (xcb_connection_t *c, + xcb_get_input_focus_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_get_input_focus_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_query_keymap_cookie_t +xcb_query_keymap (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_QUERY_KEYMAP, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_query_keymap_cookie_t xcb_ret; + xcb_query_keymap_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_query_keymap_cookie_t +xcb_query_keymap_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_QUERY_KEYMAP, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_query_keymap_cookie_t xcb_ret; + xcb_query_keymap_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_query_keymap_reply_t * +xcb_query_keymap_reply (xcb_connection_t *c, + xcb_query_keymap_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_query_keymap_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_open_font_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_open_font_request_t *_aux = (xcb_open_font_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_open_font_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* name */ + xcb_block_len += _aux->name_len * sizeof(char); + 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_open_font_checked (xcb_connection_t *c, + xcb_font_t fid, + uint16_t name_len, + const char *name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_OPEN_FONT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_open_font_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.fid = fid; + xcb_out.name_len = name_len; + memset(xcb_out.pad1, 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; + /* char name */ + xcb_parts[4].iov_base = (char *) name; + xcb_parts[4].iov_len = name_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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_open_font (xcb_connection_t *c, + xcb_font_t fid, + uint16_t name_len, + const char *name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_OPEN_FONT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_open_font_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.fid = fid; + xcb_out.name_len = name_len; + memset(xcb_out.pad1, 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; + /* char name */ + xcb_parts[4].iov_base = (char *) name; + xcb_parts[4].iov_len = name_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; +} + +char * +xcb_open_font_name (const xcb_open_font_request_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_open_font_name_length (const xcb_open_font_request_t *R) +{ + return R->name_len; +} + +xcb_generic_iterator_t +xcb_open_font_name_end (const xcb_open_font_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->name_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_close_font_checked (xcb_connection_t *c, + xcb_font_t font) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_CLOSE_FONT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_close_font_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.font = font; + + 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_close_font (xcb_connection_t *c, + xcb_font_t font) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_CLOSE_FONT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_close_font_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.font = font; + + 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_fontprop_next (xcb_fontprop_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_fontprop_t); +} + +xcb_generic_iterator_t +xcb_fontprop_end (xcb_fontprop_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; +} + +void +xcb_charinfo_next (xcb_charinfo_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_charinfo_t); +} + +xcb_generic_iterator_t +xcb_charinfo_end (xcb_charinfo_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; +} + +int +xcb_query_font_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_query_font_reply_t *_aux = (xcb_query_font_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_query_font_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* properties */ + xcb_block_len += _aux->properties_len * sizeof(xcb_fontprop_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_fontprop_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; + /* char_infos */ + xcb_block_len += _aux->char_infos_len * sizeof(xcb_charinfo_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_charinfo_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_query_font_cookie_t +xcb_query_font (xcb_connection_t *c, + xcb_fontable_t font) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_QUERY_FONT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_query_font_cookie_t xcb_ret; + xcb_query_font_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.font = font; + + 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_query_font_cookie_t +xcb_query_font_unchecked (xcb_connection_t *c, + xcb_fontable_t font) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_QUERY_FONT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_query_font_cookie_t xcb_ret; + xcb_query_font_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.font = font; + + 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_fontprop_t * +xcb_query_font_properties (const xcb_query_font_reply_t *R) +{ + return (xcb_fontprop_t *) (R + 1); +} + +int +xcb_query_font_properties_length (const xcb_query_font_reply_t *R) +{ + return R->properties_len; +} + +xcb_fontprop_iterator_t +xcb_query_font_properties_iterator (const xcb_query_font_reply_t *R) +{ + xcb_fontprop_iterator_t i; + i.data = (xcb_fontprop_t *) (R + 1); + i.rem = R->properties_len; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_charinfo_t * +xcb_query_font_char_infos (const xcb_query_font_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_fontprop_end(xcb_query_font_properties_iterator(R)); + return (xcb_charinfo_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_charinfo_t, prev.index) + 0); +} + +int +xcb_query_font_char_infos_length (const xcb_query_font_reply_t *R) +{ + return R->char_infos_len; +} + +xcb_charinfo_iterator_t +xcb_query_font_char_infos_iterator (const xcb_query_font_reply_t *R) +{ + xcb_charinfo_iterator_t i; + xcb_generic_iterator_t prev = xcb_fontprop_end(xcb_query_font_properties_iterator(R)); + i.data = (xcb_charinfo_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_charinfo_t, prev.index)); + i.rem = R->char_infos_len; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_query_font_reply_t * +xcb_query_font_reply (xcb_connection_t *c, + xcb_query_font_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_query_font_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_query_text_extents_sizeof (const void *_buffer, + uint32_t string_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_query_text_extents_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* string */ + xcb_block_len += string_len * sizeof(xcb_char2b_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_char2b_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_query_text_extents_cookie_t +xcb_query_text_extents (xcb_connection_t *c, + xcb_fontable_t font, + uint32_t string_len, + const xcb_char2b_t *string) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_QUERY_TEXT_EXTENTS, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_query_text_extents_cookie_t xcb_ret; + xcb_query_text_extents_request_t xcb_out; + + xcb_out.odd_length = (string_len & 1); + xcb_out.font = font; + + 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_char2b_t string */ + xcb_parts[4].iov_base = (char *) string; + xcb_parts[4].iov_len = string_len * sizeof(xcb_char2b_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_query_text_extents_cookie_t +xcb_query_text_extents_unchecked (xcb_connection_t *c, + xcb_fontable_t font, + uint32_t string_len, + const xcb_char2b_t *string) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_QUERY_TEXT_EXTENTS, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_query_text_extents_cookie_t xcb_ret; + xcb_query_text_extents_request_t xcb_out; + + xcb_out.odd_length = (string_len & 1); + xcb_out.font = font; + + 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_char2b_t string */ + xcb_parts[4].iov_base = (char *) string; + xcb_parts[4].iov_len = string_len * sizeof(xcb_char2b_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_query_text_extents_reply_t * +xcb_query_text_extents_reply (xcb_connection_t *c, + xcb_query_text_extents_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_query_text_extents_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_str_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_str_t *_aux = (xcb_str_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_str_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* name */ + xcb_block_len += _aux->name_len * sizeof(char); + 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; +} + +char * +xcb_str_name (const xcb_str_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_str_name_length (const xcb_str_t *R) +{ + return R->name_len; +} + +xcb_generic_iterator_t +xcb_str_name_end (const xcb_str_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->name_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_str_next (xcb_str_iterator_t *i) +{ + xcb_str_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_str_t *)(((char *)R) + xcb_str_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_str_t *) child.data; +} + +xcb_generic_iterator_t +xcb_str_end (xcb_str_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_str_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_list_fonts_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_list_fonts_request_t *_aux = (xcb_list_fonts_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_list_fonts_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* pattern */ + xcb_block_len += _aux->pattern_len * sizeof(char); + 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_list_fonts_cookie_t +xcb_list_fonts (xcb_connection_t *c, + uint16_t max_names, + uint16_t pattern_len, + const char *pattern) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_LIST_FONTS, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_list_fonts_cookie_t xcb_ret; + xcb_list_fonts_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.max_names = max_names; + xcb_out.pattern_len = pattern_len; + + 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 pattern */ + xcb_parts[4].iov_base = (char *) pattern; + xcb_parts[4].iov_len = pattern_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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_list_fonts_cookie_t +xcb_list_fonts_unchecked (xcb_connection_t *c, + uint16_t max_names, + uint16_t pattern_len, + const char *pattern) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_LIST_FONTS, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_list_fonts_cookie_t xcb_ret; + xcb_list_fonts_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.max_names = max_names; + xcb_out.pattern_len = pattern_len; + + 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 pattern */ + xcb_parts[4].iov_base = (char *) pattern; + xcb_parts[4].iov_len = pattern_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; +} + +int +xcb_list_fonts_names_length (const xcb_list_fonts_reply_t *R) +{ + return R->names_len; +} + +xcb_str_iterator_t +xcb_list_fonts_names_iterator (const xcb_list_fonts_reply_t *R) +{ + xcb_str_iterator_t i; + i.data = (xcb_str_t *) (R + 1); + i.rem = R->names_len; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_list_fonts_reply_t * +xcb_list_fonts_reply (xcb_connection_t *c, + xcb_list_fonts_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_list_fonts_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_list_fonts_with_info_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_list_fonts_with_info_request_t *_aux = (xcb_list_fonts_with_info_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_list_fonts_with_info_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* pattern */ + xcb_block_len += _aux->pattern_len * sizeof(char); + 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_list_fonts_with_info_cookie_t +xcb_list_fonts_with_info (xcb_connection_t *c, + uint16_t max_names, + uint16_t pattern_len, + const char *pattern) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_LIST_FONTS_WITH_INFO, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_list_fonts_with_info_cookie_t xcb_ret; + xcb_list_fonts_with_info_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.max_names = max_names; + xcb_out.pattern_len = pattern_len; + + 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 pattern */ + xcb_parts[4].iov_base = (char *) pattern; + xcb_parts[4].iov_len = pattern_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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_list_fonts_with_info_cookie_t +xcb_list_fonts_with_info_unchecked (xcb_connection_t *c, + uint16_t max_names, + uint16_t pattern_len, + const char *pattern) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_LIST_FONTS_WITH_INFO, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_list_fonts_with_info_cookie_t xcb_ret; + xcb_list_fonts_with_info_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.max_names = max_names; + xcb_out.pattern_len = pattern_len; + + 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 pattern */ + xcb_parts[4].iov_base = (char *) pattern; + xcb_parts[4].iov_len = pattern_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; +} + +xcb_fontprop_t * +xcb_list_fonts_with_info_properties (const xcb_list_fonts_with_info_reply_t *R) +{ + return (xcb_fontprop_t *) (R + 1); +} + +int +xcb_list_fonts_with_info_properties_length (const xcb_list_fonts_with_info_reply_t *R) +{ + return R->properties_len; +} + +xcb_fontprop_iterator_t +xcb_list_fonts_with_info_properties_iterator (const xcb_list_fonts_with_info_reply_t *R) +{ + xcb_fontprop_iterator_t i; + i.data = (xcb_fontprop_t *) (R + 1); + i.rem = R->properties_len; + i.index = (char *) i.data - (char *) R; + return i; +} + +char * +xcb_list_fonts_with_info_name (const xcb_list_fonts_with_info_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_fontprop_end(xcb_list_fonts_with_info_properties_iterator(R)); + return (char *) ((char *) prev.data + XCB_TYPE_PAD(char, prev.index) + 0); +} + +int +xcb_list_fonts_with_info_name_length (const xcb_list_fonts_with_info_reply_t *R) +{ + return R->name_len; +} + +xcb_generic_iterator_t +xcb_list_fonts_with_info_name_end (const xcb_list_fonts_with_info_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_fontprop_end(xcb_list_fonts_with_info_properties_iterator(R)); + i.data = ((char *) ((char*) prev.data + XCB_TYPE_PAD(char, prev.index))) + (R->name_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_list_fonts_with_info_reply_t * +xcb_list_fonts_with_info_reply (xcb_connection_t *c, + xcb_list_fonts_with_info_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_list_fonts_with_info_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_set_font_path_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_set_font_path_request_t *_aux = (xcb_set_font_path_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_set_font_path_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* font */ + for(i=0; i<_aux->font_qty; i++) { + xcb_tmp_len = xcb_str_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_str_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_set_font_path_checked (xcb_connection_t *c, + uint16_t font_qty, + const xcb_str_t *font) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_SET_FONT_PATH, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_set_font_path_request_t xcb_out; + unsigned int xcb_tmp_len; + char *xcb_tmp; + unsigned int i; + + xcb_out.pad0 = 0; + xcb_out.font_qty = font_qty; + memset(xcb_out.pad1, 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_str_t font */ + xcb_parts[4].iov_base = (char *) font; + xcb_parts[4].iov_len = 0; + xcb_tmp = (char *)font; + for(i=0; i<font_qty; i++) { + xcb_tmp_len = xcb_str_sizeof(xcb_tmp); + xcb_parts[4].iov_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + 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_set_font_path (xcb_connection_t *c, + uint16_t font_qty, + const xcb_str_t *font) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_SET_FONT_PATH, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_set_font_path_request_t xcb_out; + unsigned int xcb_tmp_len; + char *xcb_tmp; + unsigned int i; + + xcb_out.pad0 = 0; + xcb_out.font_qty = font_qty; + memset(xcb_out.pad1, 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_str_t font */ + xcb_parts[4].iov_base = (char *) font; + xcb_parts[4].iov_len = 0; + xcb_tmp = (char *)font; + for(i=0; i<font_qty; i++) { + xcb_tmp_len = xcb_str_sizeof(xcb_tmp); + xcb_parts[4].iov_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + 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; +} + +int +xcb_set_font_path_font_length (const xcb_set_font_path_request_t *R) +{ + return R->font_qty; +} + +xcb_str_iterator_t +xcb_set_font_path_font_iterator (const xcb_set_font_path_request_t *R) +{ + xcb_str_iterator_t i; + i.data = (xcb_str_t *) (R + 1); + i.rem = R->font_qty; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_get_font_path_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_get_font_path_reply_t *_aux = (xcb_get_font_path_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_get_font_path_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* path */ + for(i=0; i<_aux->path_len; i++) { + xcb_tmp_len = xcb_str_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_str_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_get_font_path_cookie_t +xcb_get_font_path (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_FONT_PATH, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_font_path_cookie_t xcb_ret; + xcb_get_font_path_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_get_font_path_cookie_t +xcb_get_font_path_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_FONT_PATH, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_font_path_cookie_t xcb_ret; + xcb_get_font_path_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_get_font_path_path_length (const xcb_get_font_path_reply_t *R) +{ + return R->path_len; +} + +xcb_str_iterator_t +xcb_get_font_path_path_iterator (const xcb_get_font_path_reply_t *R) +{ + xcb_str_iterator_t i; + i.data = (xcb_str_t *) (R + 1); + i.rem = R->path_len; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_get_font_path_reply_t * +xcb_get_font_path_reply (xcb_connection_t *c, + xcb_get_font_path_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_get_font_path_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_create_pixmap_checked (xcb_connection_t *c, + uint8_t depth, + xcb_pixmap_t pid, + xcb_drawable_t drawable, + uint16_t width, + uint16_t height) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_CREATE_PIXMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_create_pixmap_request_t xcb_out; + + xcb_out.depth = depth; + xcb_out.pid = pid; + xcb_out.drawable = drawable; + xcb_out.width = width; + xcb_out.height = height; + + 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_create_pixmap (xcb_connection_t *c, + uint8_t depth, + xcb_pixmap_t pid, + xcb_drawable_t drawable, + uint16_t width, + uint16_t height) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_CREATE_PIXMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_create_pixmap_request_t xcb_out; + + xcb_out.depth = depth; + xcb_out.pid = pid; + xcb_out.drawable = drawable; + xcb_out.width = width; + xcb_out.height = height; + + 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_free_pixmap_checked (xcb_connection_t *c, + xcb_pixmap_t pixmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_FREE_PIXMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_free_pixmap_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_free_pixmap (xcb_connection_t *c, + xcb_pixmap_t pixmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_FREE_PIXMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_free_pixmap_request_t xcb_out; + + xcb_out.pad0 = 0; + 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; +} + +int +xcb_create_gc_value_list_serialize (void **_buffer, + uint32_t value_mask, + const xcb_create_gc_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[24]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(value_mask & XCB_GC_FUNCTION) { + /* xcb_create_gc_value_list_t.function */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->function; + 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_GC_PLANE_MASK) { + /* xcb_create_gc_value_list_t.plane_mask */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->plane_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_GC_FOREGROUND) { + /* xcb_create_gc_value_list_t.foreground */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->foreground; + 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_GC_BACKGROUND) { + /* xcb_create_gc_value_list_t.background */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->background; + 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_GC_LINE_WIDTH) { + /* xcb_create_gc_value_list_t.line_width */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->line_width; + 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_GC_LINE_STYLE) { + /* xcb_create_gc_value_list_t.line_style */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->line_style; + 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_GC_CAP_STYLE) { + /* xcb_create_gc_value_list_t.cap_style */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->cap_style; + 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_GC_JOIN_STYLE) { + /* xcb_create_gc_value_list_t.join_style */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->join_style; + 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_GC_FILL_STYLE) { + /* xcb_create_gc_value_list_t.fill_style */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->fill_style; + 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_GC_FILL_RULE) { + /* xcb_create_gc_value_list_t.fill_rule */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->fill_rule; + 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_GC_TILE) { + /* xcb_create_gc_value_list_t.tile */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->tile; + 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_GC_STIPPLE) { + /* xcb_create_gc_value_list_t.stipple */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->stipple; + 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_GC_TILE_STIPPLE_ORIGIN_X) { + /* xcb_create_gc_value_list_t.tile_stipple_x_origin */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->tile_stipple_x_origin; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_GC_TILE_STIPPLE_ORIGIN_Y) { + /* xcb_create_gc_value_list_t.tile_stipple_y_origin */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->tile_stipple_y_origin; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_GC_FONT) { + /* xcb_create_gc_value_list_t.font */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->font; + xcb_block_len += sizeof(xcb_font_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_font_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_font_t); + } + if(value_mask & XCB_GC_SUBWINDOW_MODE) { + /* xcb_create_gc_value_list_t.subwindow_mode */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->subwindow_mode; + 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_GC_GRAPHICS_EXPOSURES) { + /* xcb_create_gc_value_list_t.graphics_exposures */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->graphics_exposures; + 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_GC_CLIP_ORIGIN_X) { + /* xcb_create_gc_value_list_t.clip_x_origin */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clip_x_origin; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_GC_CLIP_ORIGIN_Y) { + /* xcb_create_gc_value_list_t.clip_y_origin */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clip_y_origin; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_GC_CLIP_MASK) { + /* xcb_create_gc_value_list_t.clip_mask */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clip_mask; + 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_GC_DASH_OFFSET) { + /* xcb_create_gc_value_list_t.dash_offset */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->dash_offset; + 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_GC_DASH_LIST) { + /* xcb_create_gc_value_list_t.dashes */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->dashes; + 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_GC_ARC_MODE) { + /* xcb_create_gc_value_list_t.arc_mode */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->arc_mode; + 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); + } + /* 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_create_gc_value_list_unpack (const void *_buffer, + uint32_t value_mask, + xcb_create_gc_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_GC_FUNCTION) { + /* xcb_create_gc_value_list_t.function */ + _aux->function = *(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_GC_PLANE_MASK) { + /* xcb_create_gc_value_list_t.plane_mask */ + _aux->plane_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_GC_FOREGROUND) { + /* xcb_create_gc_value_list_t.foreground */ + _aux->foreground = *(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_GC_BACKGROUND) { + /* xcb_create_gc_value_list_t.background */ + _aux->background = *(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_GC_LINE_WIDTH) { + /* xcb_create_gc_value_list_t.line_width */ + _aux->line_width = *(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_GC_LINE_STYLE) { + /* xcb_create_gc_value_list_t.line_style */ + _aux->line_style = *(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_GC_CAP_STYLE) { + /* xcb_create_gc_value_list_t.cap_style */ + _aux->cap_style = *(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_GC_JOIN_STYLE) { + /* xcb_create_gc_value_list_t.join_style */ + _aux->join_style = *(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_GC_FILL_STYLE) { + /* xcb_create_gc_value_list_t.fill_style */ + _aux->fill_style = *(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_GC_FILL_RULE) { + /* xcb_create_gc_value_list_t.fill_rule */ + _aux->fill_rule = *(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_GC_TILE) { + /* xcb_create_gc_value_list_t.tile */ + _aux->tile = *(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_GC_STIPPLE) { + /* xcb_create_gc_value_list_t.stipple */ + _aux->stipple = *(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_GC_TILE_STIPPLE_ORIGIN_X) { + /* xcb_create_gc_value_list_t.tile_stipple_x_origin */ + _aux->tile_stipple_x_origin = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_GC_TILE_STIPPLE_ORIGIN_Y) { + /* xcb_create_gc_value_list_t.tile_stipple_y_origin */ + _aux->tile_stipple_y_origin = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_GC_FONT) { + /* xcb_create_gc_value_list_t.font */ + _aux->font = *(xcb_font_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_font_t); + xcb_tmp += sizeof(xcb_font_t); + xcb_align_to = ALIGNOF(xcb_font_t); + } + if(value_mask & XCB_GC_SUBWINDOW_MODE) { + /* xcb_create_gc_value_list_t.subwindow_mode */ + _aux->subwindow_mode = *(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_GC_GRAPHICS_EXPOSURES) { + /* xcb_create_gc_value_list_t.graphics_exposures */ + _aux->graphics_exposures = *(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_GC_CLIP_ORIGIN_X) { + /* xcb_create_gc_value_list_t.clip_x_origin */ + _aux->clip_x_origin = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_GC_CLIP_ORIGIN_Y) { + /* xcb_create_gc_value_list_t.clip_y_origin */ + _aux->clip_y_origin = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_GC_CLIP_MASK) { + /* xcb_create_gc_value_list_t.clip_mask */ + _aux->clip_mask = *(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_GC_DASH_OFFSET) { + /* xcb_create_gc_value_list_t.dash_offset */ + _aux->dash_offset = *(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_GC_DASH_LIST) { + /* xcb_create_gc_value_list_t.dashes */ + _aux->dashes = *(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_GC_ARC_MODE) { + /* xcb_create_gc_value_list_t.arc_mode */ + _aux->arc_mode = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_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_create_gc_value_list_sizeof (const void *_buffer, + uint32_t value_mask) +{ + xcb_create_gc_value_list_t _aux; + return xcb_create_gc_value_list_unpack(_buffer, value_mask, &_aux); +} + +int +xcb_create_gc_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_create_gc_request_t *_aux = (xcb_create_gc_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_create_gc_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* value_list */ + xcb_block_len += xcb_create_gc_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_create_gc_checked (xcb_connection_t *c, + xcb_gcontext_t cid, + xcb_drawable_t drawable, + uint32_t value_mask, + const void *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CREATE_GC, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_create_gc_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cid = cid; + xcb_out.drawable = drawable; + 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_create_gc_value_list_t value_list */ + xcb_parts[4].iov_base = (char *) value_list; + xcb_parts[4].iov_len = + xcb_create_gc_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_create_gc (xcb_connection_t *c, + xcb_gcontext_t cid, + xcb_drawable_t drawable, + uint32_t value_mask, + const void *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CREATE_GC, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_create_gc_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cid = cid; + xcb_out.drawable = drawable; + 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_create_gc_value_list_t value_list */ + xcb_parts[4].iov_base = (char *) value_list; + xcb_parts[4].iov_len = + xcb_create_gc_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_create_gc_aux_checked (xcb_connection_t *c, + xcb_gcontext_t cid, + xcb_drawable_t drawable, + uint32_t value_mask, + const xcb_create_gc_value_list_t *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CREATE_GC, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_create_gc_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.pad0 = 0; + xcb_out.cid = cid; + xcb_out.drawable = drawable; + 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_create_gc_value_list_t value_list */ + xcb_parts[4].iov_len = + xcb_create_gc_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_create_gc_aux (xcb_connection_t *c, + xcb_gcontext_t cid, + xcb_drawable_t drawable, + uint32_t value_mask, + const xcb_create_gc_value_list_t *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CREATE_GC, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_create_gc_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.pad0 = 0; + xcb_out.cid = cid; + xcb_out.drawable = drawable; + 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_create_gc_value_list_t value_list */ + xcb_parts[4].iov_len = + xcb_create_gc_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_create_gc_value_list (const xcb_create_gc_request_t *R) +{ + return (void *) (R + 1); +} + +int +xcb_change_gc_value_list_serialize (void **_buffer, + uint32_t value_mask, + const xcb_change_gc_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[24]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(value_mask & XCB_GC_FUNCTION) { + /* xcb_change_gc_value_list_t.function */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->function; + 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_GC_PLANE_MASK) { + /* xcb_change_gc_value_list_t.plane_mask */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->plane_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_GC_FOREGROUND) { + /* xcb_change_gc_value_list_t.foreground */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->foreground; + 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_GC_BACKGROUND) { + /* xcb_change_gc_value_list_t.background */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->background; + 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_GC_LINE_WIDTH) { + /* xcb_change_gc_value_list_t.line_width */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->line_width; + 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_GC_LINE_STYLE) { + /* xcb_change_gc_value_list_t.line_style */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->line_style; + 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_GC_CAP_STYLE) { + /* xcb_change_gc_value_list_t.cap_style */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->cap_style; + 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_GC_JOIN_STYLE) { + /* xcb_change_gc_value_list_t.join_style */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->join_style; + 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_GC_FILL_STYLE) { + /* xcb_change_gc_value_list_t.fill_style */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->fill_style; + 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_GC_FILL_RULE) { + /* xcb_change_gc_value_list_t.fill_rule */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->fill_rule; + 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_GC_TILE) { + /* xcb_change_gc_value_list_t.tile */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->tile; + 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_GC_STIPPLE) { + /* xcb_change_gc_value_list_t.stipple */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->stipple; + 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_GC_TILE_STIPPLE_ORIGIN_X) { + /* xcb_change_gc_value_list_t.tile_stipple_x_origin */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->tile_stipple_x_origin; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_GC_TILE_STIPPLE_ORIGIN_Y) { + /* xcb_change_gc_value_list_t.tile_stipple_y_origin */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->tile_stipple_y_origin; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_GC_FONT) { + /* xcb_change_gc_value_list_t.font */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->font; + xcb_block_len += sizeof(xcb_font_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_font_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_font_t); + } + if(value_mask & XCB_GC_SUBWINDOW_MODE) { + /* xcb_change_gc_value_list_t.subwindow_mode */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->subwindow_mode; + 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_GC_GRAPHICS_EXPOSURES) { + /* xcb_change_gc_value_list_t.graphics_exposures */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->graphics_exposures; + 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_GC_CLIP_ORIGIN_X) { + /* xcb_change_gc_value_list_t.clip_x_origin */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clip_x_origin; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_GC_CLIP_ORIGIN_Y) { + /* xcb_change_gc_value_list_t.clip_y_origin */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clip_y_origin; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_GC_CLIP_MASK) { + /* xcb_change_gc_value_list_t.clip_mask */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clip_mask; + 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_GC_DASH_OFFSET) { + /* xcb_change_gc_value_list_t.dash_offset */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->dash_offset; + 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_GC_DASH_LIST) { + /* xcb_change_gc_value_list_t.dashes */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->dashes; + 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_GC_ARC_MODE) { + /* xcb_change_gc_value_list_t.arc_mode */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->arc_mode; + 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); + } + /* 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_change_gc_value_list_unpack (const void *_buffer, + uint32_t value_mask, + xcb_change_gc_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_GC_FUNCTION) { + /* xcb_change_gc_value_list_t.function */ + _aux->function = *(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_GC_PLANE_MASK) { + /* xcb_change_gc_value_list_t.plane_mask */ + _aux->plane_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_GC_FOREGROUND) { + /* xcb_change_gc_value_list_t.foreground */ + _aux->foreground = *(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_GC_BACKGROUND) { + /* xcb_change_gc_value_list_t.background */ + _aux->background = *(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_GC_LINE_WIDTH) { + /* xcb_change_gc_value_list_t.line_width */ + _aux->line_width = *(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_GC_LINE_STYLE) { + /* xcb_change_gc_value_list_t.line_style */ + _aux->line_style = *(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_GC_CAP_STYLE) { + /* xcb_change_gc_value_list_t.cap_style */ + _aux->cap_style = *(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_GC_JOIN_STYLE) { + /* xcb_change_gc_value_list_t.join_style */ + _aux->join_style = *(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_GC_FILL_STYLE) { + /* xcb_change_gc_value_list_t.fill_style */ + _aux->fill_style = *(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_GC_FILL_RULE) { + /* xcb_change_gc_value_list_t.fill_rule */ + _aux->fill_rule = *(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_GC_TILE) { + /* xcb_change_gc_value_list_t.tile */ + _aux->tile = *(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_GC_STIPPLE) { + /* xcb_change_gc_value_list_t.stipple */ + _aux->stipple = *(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_GC_TILE_STIPPLE_ORIGIN_X) { + /* xcb_change_gc_value_list_t.tile_stipple_x_origin */ + _aux->tile_stipple_x_origin = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_GC_TILE_STIPPLE_ORIGIN_Y) { + /* xcb_change_gc_value_list_t.tile_stipple_y_origin */ + _aux->tile_stipple_y_origin = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_GC_FONT) { + /* xcb_change_gc_value_list_t.font */ + _aux->font = *(xcb_font_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_font_t); + xcb_tmp += sizeof(xcb_font_t); + xcb_align_to = ALIGNOF(xcb_font_t); + } + if(value_mask & XCB_GC_SUBWINDOW_MODE) { + /* xcb_change_gc_value_list_t.subwindow_mode */ + _aux->subwindow_mode = *(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_GC_GRAPHICS_EXPOSURES) { + /* xcb_change_gc_value_list_t.graphics_exposures */ + _aux->graphics_exposures = *(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_GC_CLIP_ORIGIN_X) { + /* xcb_change_gc_value_list_t.clip_x_origin */ + _aux->clip_x_origin = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_GC_CLIP_ORIGIN_Y) { + /* xcb_change_gc_value_list_t.clip_y_origin */ + _aux->clip_y_origin = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_GC_CLIP_MASK) { + /* xcb_change_gc_value_list_t.clip_mask */ + _aux->clip_mask = *(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_GC_DASH_OFFSET) { + /* xcb_change_gc_value_list_t.dash_offset */ + _aux->dash_offset = *(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_GC_DASH_LIST) { + /* xcb_change_gc_value_list_t.dashes */ + _aux->dashes = *(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_GC_ARC_MODE) { + /* xcb_change_gc_value_list_t.arc_mode */ + _aux->arc_mode = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_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_change_gc_value_list_sizeof (const void *_buffer, + uint32_t value_mask) +{ + xcb_change_gc_value_list_t _aux; + return xcb_change_gc_value_list_unpack(_buffer, value_mask, &_aux); +} + +int +xcb_change_gc_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_change_gc_request_t *_aux = (xcb_change_gc_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_change_gc_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* value_list */ + xcb_block_len += xcb_change_gc_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_change_gc_checked (xcb_connection_t *c, + xcb_gcontext_t gc, + uint32_t value_mask, + const void *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CHANGE_GC, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_change_gc_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.gc = gc; + 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_change_gc_value_list_t value_list */ + xcb_parts[4].iov_base = (char *) value_list; + xcb_parts[4].iov_len = + xcb_change_gc_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_change_gc (xcb_connection_t *c, + xcb_gcontext_t gc, + uint32_t value_mask, + const void *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CHANGE_GC, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_change_gc_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.gc = gc; + 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_change_gc_value_list_t value_list */ + xcb_parts[4].iov_base = (char *) value_list; + xcb_parts[4].iov_len = + xcb_change_gc_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_change_gc_aux_checked (xcb_connection_t *c, + xcb_gcontext_t gc, + uint32_t value_mask, + const xcb_change_gc_value_list_t *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CHANGE_GC, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_change_gc_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.pad0 = 0; + xcb_out.gc = gc; + 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_change_gc_value_list_t value_list */ + xcb_parts[4].iov_len = + xcb_change_gc_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_change_gc_aux (xcb_connection_t *c, + xcb_gcontext_t gc, + uint32_t value_mask, + const xcb_change_gc_value_list_t *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CHANGE_GC, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_change_gc_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.pad0 = 0; + xcb_out.gc = gc; + 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_change_gc_value_list_t value_list */ + xcb_parts[4].iov_len = + xcb_change_gc_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_change_gc_value_list (const xcb_change_gc_request_t *R) +{ + return (void *) (R + 1); +} + +xcb_void_cookie_t +xcb_copy_gc_checked (xcb_connection_t *c, + xcb_gcontext_t src_gc, + xcb_gcontext_t dst_gc, + uint32_t value_mask) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_COPY_GC, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_copy_gc_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.src_gc = src_gc; + xcb_out.dst_gc = dst_gc; + 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_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_copy_gc (xcb_connection_t *c, + xcb_gcontext_t src_gc, + xcb_gcontext_t dst_gc, + uint32_t value_mask) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_COPY_GC, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_copy_gc_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.src_gc = src_gc; + xcb_out.dst_gc = dst_gc; + 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_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +int +xcb_set_dashes_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_set_dashes_request_t *_aux = (xcb_set_dashes_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_set_dashes_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* dashes */ + xcb_block_len += _aux->dashes_len * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_set_dashes_checked (xcb_connection_t *c, + xcb_gcontext_t gc, + uint16_t dash_offset, + uint16_t dashes_len, + const uint8_t *dashes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_SET_DASHES, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_set_dashes_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.gc = gc; + xcb_out.dash_offset = dash_offset; + xcb_out.dashes_len = dashes_len; + + 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; + /* uint8_t dashes */ + xcb_parts[4].iov_base = (char *) dashes; + xcb_parts[4].iov_len = dashes_len * sizeof(uint8_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_set_dashes (xcb_connection_t *c, + xcb_gcontext_t gc, + uint16_t dash_offset, + uint16_t dashes_len, + const uint8_t *dashes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_SET_DASHES, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_set_dashes_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.gc = gc; + xcb_out.dash_offset = dash_offset; + xcb_out.dashes_len = dashes_len; + + 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; + /* uint8_t dashes */ + xcb_parts[4].iov_base = (char *) dashes; + xcb_parts[4].iov_len = dashes_len * sizeof(uint8_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; +} + +uint8_t * +xcb_set_dashes_dashes (const xcb_set_dashes_request_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_set_dashes_dashes_length (const xcb_set_dashes_request_t *R) +{ + return R->dashes_len; +} + +xcb_generic_iterator_t +xcb_set_dashes_dashes_end (const xcb_set_dashes_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + (R->dashes_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_set_clip_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_set_clip_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_set_clip_rectangles_checked (xcb_connection_t *c, + uint8_t ordering, + xcb_gcontext_t gc, + int16_t clip_x_origin, + int16_t clip_y_origin, + uint32_t rectangles_len, + const xcb_rectangle_t *rectangles) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_SET_CLIP_RECTANGLES, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_set_clip_rectangles_request_t xcb_out; + + xcb_out.ordering = ordering; + xcb_out.gc = gc; + xcb_out.clip_x_origin = clip_x_origin; + xcb_out.clip_y_origin = clip_y_origin; + + 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_set_clip_rectangles (xcb_connection_t *c, + uint8_t ordering, + xcb_gcontext_t gc, + int16_t clip_x_origin, + int16_t clip_y_origin, + uint32_t rectangles_len, + const xcb_rectangle_t *rectangles) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_SET_CLIP_RECTANGLES, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_set_clip_rectangles_request_t xcb_out; + + xcb_out.ordering = ordering; + xcb_out.gc = gc; + xcb_out.clip_x_origin = clip_x_origin; + xcb_out.clip_y_origin = clip_y_origin; + + 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_set_clip_rectangles_rectangles (const xcb_set_clip_rectangles_request_t *R) +{ + return (xcb_rectangle_t *) (R + 1); +} + +int +xcb_set_clip_rectangles_rectangles_length (const xcb_set_clip_rectangles_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_set_clip_rectangles_request_t))/sizeof(xcb_rectangle_t)); +} + +xcb_rectangle_iterator_t +xcb_set_clip_rectangles_rectangles_iterator (const xcb_set_clip_rectangles_request_t *R) +{ + xcb_rectangle_iterator_t i; + i.data = (xcb_rectangle_t *) (R + 1); + i.rem = (((R->length * 4) - sizeof(xcb_set_clip_rectangles_request_t))/sizeof(xcb_rectangle_t)); + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_free_gc_checked (xcb_connection_t *c, + xcb_gcontext_t gc) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_FREE_GC, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_free_gc_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.gc = gc; + + 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_free_gc (xcb_connection_t *c, + xcb_gcontext_t gc) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_FREE_GC, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_free_gc_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.gc = gc; + + 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_clear_area_checked (xcb_connection_t *c, + uint8_t exposures, + xcb_window_t window, + int16_t x, + int16_t y, + uint16_t width, + uint16_t height) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_CLEAR_AREA, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_clear_area_request_t xcb_out; + + xcb_out.exposures = exposures; + xcb_out.window = window; + xcb_out.x = x; + xcb_out.y = y; + xcb_out.width = width; + xcb_out.height = height; + + 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_clear_area (xcb_connection_t *c, + uint8_t exposures, + xcb_window_t window, + int16_t x, + int16_t y, + uint16_t width, + uint16_t height) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_CLEAR_AREA, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_clear_area_request_t xcb_out; + + xcb_out.exposures = exposures; + xcb_out.window = window; + xcb_out.x = x; + xcb_out.y = y; + xcb_out.width = width; + xcb_out.height = height; + + 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_copy_area_checked (xcb_connection_t *c, + xcb_drawable_t src_drawable, + xcb_drawable_t dst_drawable, + xcb_gcontext_t gc, + int16_t src_x, + int16_t src_y, + int16_t dst_x, + int16_t dst_y, + uint16_t width, + uint16_t height) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_COPY_AREA, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_copy_area_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.src_drawable = src_drawable; + xcb_out.dst_drawable = dst_drawable; + xcb_out.gc = gc; + xcb_out.src_x = src_x; + xcb_out.src_y = src_y; + xcb_out.dst_x = dst_x; + xcb_out.dst_y = dst_y; + xcb_out.width = width; + xcb_out.height = height; + + 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_copy_area (xcb_connection_t *c, + xcb_drawable_t src_drawable, + xcb_drawable_t dst_drawable, + xcb_gcontext_t gc, + int16_t src_x, + int16_t src_y, + int16_t dst_x, + int16_t dst_y, + uint16_t width, + uint16_t height) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_COPY_AREA, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_copy_area_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.src_drawable = src_drawable; + xcb_out.dst_drawable = dst_drawable; + xcb_out.gc = gc; + xcb_out.src_x = src_x; + xcb_out.src_y = src_y; + xcb_out.dst_x = dst_x; + xcb_out.dst_y = dst_y; + xcb_out.width = width; + xcb_out.height = height; + + 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_copy_plane_checked (xcb_connection_t *c, + xcb_drawable_t src_drawable, + xcb_drawable_t dst_drawable, + xcb_gcontext_t gc, + int16_t src_x, + int16_t src_y, + int16_t dst_x, + int16_t dst_y, + uint16_t width, + uint16_t height, + uint32_t bit_plane) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_COPY_PLANE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_copy_plane_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.src_drawable = src_drawable; + xcb_out.dst_drawable = dst_drawable; + xcb_out.gc = gc; + xcb_out.src_x = src_x; + xcb_out.src_y = src_y; + xcb_out.dst_x = dst_x; + xcb_out.dst_y = dst_y; + xcb_out.width = width; + xcb_out.height = height; + xcb_out.bit_plane = bit_plane; + + 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_copy_plane (xcb_connection_t *c, + xcb_drawable_t src_drawable, + xcb_drawable_t dst_drawable, + xcb_gcontext_t gc, + int16_t src_x, + int16_t src_y, + int16_t dst_x, + int16_t dst_y, + uint16_t width, + uint16_t height, + uint32_t bit_plane) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_COPY_PLANE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_copy_plane_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.src_drawable = src_drawable; + xcb_out.dst_drawable = dst_drawable; + xcb_out.gc = gc; + xcb_out.src_x = src_x; + xcb_out.src_y = src_y; + xcb_out.dst_x = dst_x; + xcb_out.dst_y = dst_y; + xcb_out.width = width; + xcb_out.height = height; + xcb_out.bit_plane = bit_plane; + + 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_poly_point_sizeof (const void *_buffer, + uint32_t points_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_poly_point_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* points */ + xcb_block_len += points_len * sizeof(xcb_point_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_point_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_poly_point_checked (xcb_connection_t *c, + uint8_t coordinate_mode, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + uint32_t points_len, + const xcb_point_t *points) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_POLY_POINT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_poly_point_request_t xcb_out; + + xcb_out.coordinate_mode = coordinate_mode; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + + 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_point_t points */ + xcb_parts[4].iov_base = (char *) points; + xcb_parts[4].iov_len = points_len * sizeof(xcb_point_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_poly_point (xcb_connection_t *c, + uint8_t coordinate_mode, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + uint32_t points_len, + const xcb_point_t *points) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_POLY_POINT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_poly_point_request_t xcb_out; + + xcb_out.coordinate_mode = coordinate_mode; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + + 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_point_t points */ + xcb_parts[4].iov_base = (char *) points; + xcb_parts[4].iov_len = points_len * sizeof(xcb_point_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_point_t * +xcb_poly_point_points (const xcb_poly_point_request_t *R) +{ + return (xcb_point_t *) (R + 1); +} + +int +xcb_poly_point_points_length (const xcb_poly_point_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_poly_point_request_t))/sizeof(xcb_point_t)); +} + +xcb_point_iterator_t +xcb_poly_point_points_iterator (const xcb_poly_point_request_t *R) +{ + xcb_point_iterator_t i; + i.data = (xcb_point_t *) (R + 1); + i.rem = (((R->length * 4) - sizeof(xcb_poly_point_request_t))/sizeof(xcb_point_t)); + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_poly_line_sizeof (const void *_buffer, + uint32_t points_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_poly_line_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* points */ + xcb_block_len += points_len * sizeof(xcb_point_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_point_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_poly_line_checked (xcb_connection_t *c, + uint8_t coordinate_mode, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + uint32_t points_len, + const xcb_point_t *points) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_POLY_LINE, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_poly_line_request_t xcb_out; + + xcb_out.coordinate_mode = coordinate_mode; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + + 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_point_t points */ + xcb_parts[4].iov_base = (char *) points; + xcb_parts[4].iov_len = points_len * sizeof(xcb_point_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_poly_line (xcb_connection_t *c, + uint8_t coordinate_mode, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + uint32_t points_len, + const xcb_point_t *points) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_POLY_LINE, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_poly_line_request_t xcb_out; + + xcb_out.coordinate_mode = coordinate_mode; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + + 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_point_t points */ + xcb_parts[4].iov_base = (char *) points; + xcb_parts[4].iov_len = points_len * sizeof(xcb_point_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_point_t * +xcb_poly_line_points (const xcb_poly_line_request_t *R) +{ + return (xcb_point_t *) (R + 1); +} + +int +xcb_poly_line_points_length (const xcb_poly_line_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_poly_line_request_t))/sizeof(xcb_point_t)); +} + +xcb_point_iterator_t +xcb_poly_line_points_iterator (const xcb_poly_line_request_t *R) +{ + xcb_point_iterator_t i; + i.data = (xcb_point_t *) (R + 1); + i.rem = (((R->length * 4) - sizeof(xcb_poly_line_request_t))/sizeof(xcb_point_t)); + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_segment_next (xcb_segment_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_segment_t); +} + +xcb_generic_iterator_t +xcb_segment_end (xcb_segment_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; +} + +int +xcb_poly_segment_sizeof (const void *_buffer, + uint32_t segments_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_poly_segment_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* segments */ + xcb_block_len += segments_len * sizeof(xcb_segment_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_segment_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_poly_segment_checked (xcb_connection_t *c, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + uint32_t segments_len, + const xcb_segment_t *segments) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_POLY_SEGMENT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_poly_segment_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + + 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_segment_t segments */ + xcb_parts[4].iov_base = (char *) segments; + xcb_parts[4].iov_len = segments_len * sizeof(xcb_segment_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_poly_segment (xcb_connection_t *c, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + uint32_t segments_len, + const xcb_segment_t *segments) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_POLY_SEGMENT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_poly_segment_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + + 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_segment_t segments */ + xcb_parts[4].iov_base = (char *) segments; + xcb_parts[4].iov_len = segments_len * sizeof(xcb_segment_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_segment_t * +xcb_poly_segment_segments (const xcb_poly_segment_request_t *R) +{ + return (xcb_segment_t *) (R + 1); +} + +int +xcb_poly_segment_segments_length (const xcb_poly_segment_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_poly_segment_request_t))/sizeof(xcb_segment_t)); +} + +xcb_segment_iterator_t +xcb_poly_segment_segments_iterator (const xcb_poly_segment_request_t *R) +{ + xcb_segment_iterator_t i; + i.data = (xcb_segment_t *) (R + 1); + i.rem = (((R->length * 4) - sizeof(xcb_poly_segment_request_t))/sizeof(xcb_segment_t)); + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_poly_rectangle_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_poly_rectangle_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_poly_rectangle_checked (xcb_connection_t *c, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + uint32_t rectangles_len, + const xcb_rectangle_t *rectangles) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_POLY_RECTANGLE, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_poly_rectangle_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + + 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_poly_rectangle (xcb_connection_t *c, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + uint32_t rectangles_len, + const xcb_rectangle_t *rectangles) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_POLY_RECTANGLE, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_poly_rectangle_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + + 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_poly_rectangle_rectangles (const xcb_poly_rectangle_request_t *R) +{ + return (xcb_rectangle_t *) (R + 1); +} + +int +xcb_poly_rectangle_rectangles_length (const xcb_poly_rectangle_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_poly_rectangle_request_t))/sizeof(xcb_rectangle_t)); +} + +xcb_rectangle_iterator_t +xcb_poly_rectangle_rectangles_iterator (const xcb_poly_rectangle_request_t *R) +{ + xcb_rectangle_iterator_t i; + i.data = (xcb_rectangle_t *) (R + 1); + i.rem = (((R->length * 4) - sizeof(xcb_poly_rectangle_request_t))/sizeof(xcb_rectangle_t)); + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_poly_arc_sizeof (const void *_buffer, + uint32_t arcs_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_poly_arc_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* arcs */ + xcb_block_len += arcs_len * sizeof(xcb_arc_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_arc_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_poly_arc_checked (xcb_connection_t *c, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + uint32_t arcs_len, + const xcb_arc_t *arcs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_POLY_ARC, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_poly_arc_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + + 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_arc_t arcs */ + xcb_parts[4].iov_base = (char *) arcs; + xcb_parts[4].iov_len = arcs_len * sizeof(xcb_arc_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_poly_arc (xcb_connection_t *c, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + uint32_t arcs_len, + const xcb_arc_t *arcs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_POLY_ARC, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_poly_arc_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + + 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_arc_t arcs */ + xcb_parts[4].iov_base = (char *) arcs; + xcb_parts[4].iov_len = arcs_len * sizeof(xcb_arc_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_arc_t * +xcb_poly_arc_arcs (const xcb_poly_arc_request_t *R) +{ + return (xcb_arc_t *) (R + 1); +} + +int +xcb_poly_arc_arcs_length (const xcb_poly_arc_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_poly_arc_request_t))/sizeof(xcb_arc_t)); +} + +xcb_arc_iterator_t +xcb_poly_arc_arcs_iterator (const xcb_poly_arc_request_t *R) +{ + xcb_arc_iterator_t i; + i.data = (xcb_arc_t *) (R + 1); + i.rem = (((R->length * 4) - sizeof(xcb_poly_arc_request_t))/sizeof(xcb_arc_t)); + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_fill_poly_sizeof (const void *_buffer, + uint32_t points_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_fill_poly_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* points */ + xcb_block_len += points_len * sizeof(xcb_point_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_point_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_fill_poly_checked (xcb_connection_t *c, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + uint8_t shape, + uint8_t coordinate_mode, + uint32_t points_len, + const xcb_point_t *points) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_FILL_POLY, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_fill_poly_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + xcb_out.shape = shape; + xcb_out.coordinate_mode = coordinate_mode; + memset(xcb_out.pad1, 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_point_t points */ + xcb_parts[4].iov_base = (char *) points; + xcb_parts[4].iov_len = points_len * sizeof(xcb_point_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_fill_poly (xcb_connection_t *c, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + uint8_t shape, + uint8_t coordinate_mode, + uint32_t points_len, + const xcb_point_t *points) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_FILL_POLY, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_fill_poly_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + xcb_out.shape = shape; + xcb_out.coordinate_mode = coordinate_mode; + memset(xcb_out.pad1, 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_point_t points */ + xcb_parts[4].iov_base = (char *) points; + xcb_parts[4].iov_len = points_len * sizeof(xcb_point_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_point_t * +xcb_fill_poly_points (const xcb_fill_poly_request_t *R) +{ + return (xcb_point_t *) (R + 1); +} + +int +xcb_fill_poly_points_length (const xcb_fill_poly_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_fill_poly_request_t))/sizeof(xcb_point_t)); +} + +xcb_point_iterator_t +xcb_fill_poly_points_iterator (const xcb_fill_poly_request_t *R) +{ + xcb_point_iterator_t i; + i.data = (xcb_point_t *) (R + 1); + i.rem = (((R->length * 4) - sizeof(xcb_fill_poly_request_t))/sizeof(xcb_point_t)); + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_poly_fill_rectangle_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_poly_fill_rectangle_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_poly_fill_rectangle_checked (xcb_connection_t *c, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + uint32_t rectangles_len, + const xcb_rectangle_t *rectangles) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_POLY_FILL_RECTANGLE, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_poly_fill_rectangle_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + + 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_poly_fill_rectangle (xcb_connection_t *c, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + uint32_t rectangles_len, + const xcb_rectangle_t *rectangles) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_POLY_FILL_RECTANGLE, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_poly_fill_rectangle_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + + 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_poly_fill_rectangle_rectangles (const xcb_poly_fill_rectangle_request_t *R) +{ + return (xcb_rectangle_t *) (R + 1); +} + +int +xcb_poly_fill_rectangle_rectangles_length (const xcb_poly_fill_rectangle_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_poly_fill_rectangle_request_t))/sizeof(xcb_rectangle_t)); +} + +xcb_rectangle_iterator_t +xcb_poly_fill_rectangle_rectangles_iterator (const xcb_poly_fill_rectangle_request_t *R) +{ + xcb_rectangle_iterator_t i; + i.data = (xcb_rectangle_t *) (R + 1); + i.rem = (((R->length * 4) - sizeof(xcb_poly_fill_rectangle_request_t))/sizeof(xcb_rectangle_t)); + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_poly_fill_arc_sizeof (const void *_buffer, + uint32_t arcs_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_poly_fill_arc_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* arcs */ + xcb_block_len += arcs_len * sizeof(xcb_arc_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_arc_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_poly_fill_arc_checked (xcb_connection_t *c, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + uint32_t arcs_len, + const xcb_arc_t *arcs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_POLY_FILL_ARC, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_poly_fill_arc_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + + 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_arc_t arcs */ + xcb_parts[4].iov_base = (char *) arcs; + xcb_parts[4].iov_len = arcs_len * sizeof(xcb_arc_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_poly_fill_arc (xcb_connection_t *c, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + uint32_t arcs_len, + const xcb_arc_t *arcs) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_POLY_FILL_ARC, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_poly_fill_arc_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + + 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_arc_t arcs */ + xcb_parts[4].iov_base = (char *) arcs; + xcb_parts[4].iov_len = arcs_len * sizeof(xcb_arc_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_arc_t * +xcb_poly_fill_arc_arcs (const xcb_poly_fill_arc_request_t *R) +{ + return (xcb_arc_t *) (R + 1); +} + +int +xcb_poly_fill_arc_arcs_length (const xcb_poly_fill_arc_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_poly_fill_arc_request_t))/sizeof(xcb_arc_t)); +} + +xcb_arc_iterator_t +xcb_poly_fill_arc_arcs_iterator (const xcb_poly_fill_arc_request_t *R) +{ + xcb_arc_iterator_t i; + i.data = (xcb_arc_t *) (R + 1); + i.rem = (((R->length * 4) - sizeof(xcb_poly_fill_arc_request_t))/sizeof(xcb_arc_t)); + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_put_image_sizeof (const void *_buffer, + uint32_t data_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_put_image_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += data_len * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_put_image_checked (xcb_connection_t *c, + uint8_t format, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + uint16_t width, + uint16_t height, + int16_t dst_x, + int16_t dst_y, + uint8_t left_pad, + uint8_t depth, + uint32_t data_len, + const uint8_t *data) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_PUT_IMAGE, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_put_image_request_t xcb_out; + + xcb_out.format = format; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + xcb_out.width = width; + xcb_out.height = height; + xcb_out.dst_x = dst_x; + xcb_out.dst_y = dst_y; + xcb_out.left_pad = left_pad; + xcb_out.depth = depth; + 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; + /* uint8_t data */ + xcb_parts[4].iov_base = (char *) data; + xcb_parts[4].iov_len = data_len * sizeof(uint8_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_put_image (xcb_connection_t *c, + uint8_t format, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + uint16_t width, + uint16_t height, + int16_t dst_x, + int16_t dst_y, + uint8_t left_pad, + uint8_t depth, + uint32_t data_len, + const uint8_t *data) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_PUT_IMAGE, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_put_image_request_t xcb_out; + + xcb_out.format = format; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + xcb_out.width = width; + xcb_out.height = height; + xcb_out.dst_x = dst_x; + xcb_out.dst_y = dst_y; + xcb_out.left_pad = left_pad; + xcb_out.depth = depth; + 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; + /* uint8_t data */ + xcb_parts[4].iov_base = (char *) data; + xcb_parts[4].iov_len = data_len * sizeof(uint8_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; +} + +uint8_t * +xcb_put_image_data (const xcb_put_image_request_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_put_image_data_length (const xcb_put_image_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_put_image_request_t))/sizeof(uint8_t)); +} + +xcb_generic_iterator_t +xcb_put_image_data_end (const xcb_put_image_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_put_image_request_t))/sizeof(uint8_t))); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_get_image_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_get_image_reply_t *_aux = (xcb_get_image_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_get_image_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += (_aux->length * 4) * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_get_image_cookie_t +xcb_get_image (xcb_connection_t *c, + uint8_t format, + xcb_drawable_t drawable, + int16_t x, + int16_t y, + uint16_t width, + uint16_t height, + uint32_t plane_mask) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_IMAGE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_image_cookie_t xcb_ret; + xcb_get_image_request_t xcb_out; + + xcb_out.format = format; + xcb_out.drawable = drawable; + xcb_out.x = x; + xcb_out.y = y; + xcb_out.width = width; + xcb_out.height = height; + xcb_out.plane_mask = plane_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_get_image_cookie_t +xcb_get_image_unchecked (xcb_connection_t *c, + uint8_t format, + xcb_drawable_t drawable, + int16_t x, + int16_t y, + uint16_t width, + uint16_t height, + uint32_t plane_mask) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_IMAGE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_image_cookie_t xcb_ret; + xcb_get_image_request_t xcb_out; + + xcb_out.format = format; + xcb_out.drawable = drawable; + xcb_out.x = x; + xcb_out.y = y; + xcb_out.width = width; + xcb_out.height = height; + xcb_out.plane_mask = plane_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; +} + +uint8_t * +xcb_get_image_data (const xcb_get_image_reply_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_get_image_data_length (const xcb_get_image_reply_t *R) +{ + return (R->length * 4); +} + +xcb_generic_iterator_t +xcb_get_image_data_end (const xcb_get_image_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((R->length * 4)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_get_image_reply_t * +xcb_get_image_reply (xcb_connection_t *c, + xcb_get_image_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_get_image_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_poly_text_8_sizeof (const void *_buffer, + uint32_t items_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_poly_text_8_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* items */ + xcb_block_len += items_len * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_poly_text_8_checked (xcb_connection_t *c, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + int16_t x, + int16_t y, + uint32_t items_len, + const uint8_t *items) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_POLY_TEXT_8, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_poly_text_8_request_t xcb_out; + + xcb_out.pad0 = 0; + 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; + /* uint8_t items */ + xcb_parts[4].iov_base = (char *) items; + xcb_parts[4].iov_len = items_len * sizeof(uint8_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_poly_text_8 (xcb_connection_t *c, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + int16_t x, + int16_t y, + uint32_t items_len, + const uint8_t *items) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_POLY_TEXT_8, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_poly_text_8_request_t xcb_out; + + xcb_out.pad0 = 0; + 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; + /* uint8_t items */ + xcb_parts[4].iov_base = (char *) items; + xcb_parts[4].iov_len = items_len * sizeof(uint8_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; +} + +uint8_t * +xcb_poly_text_8_items (const xcb_poly_text_8_request_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_poly_text_8_items_length (const xcb_poly_text_8_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_poly_text_8_request_t))/sizeof(uint8_t)); +} + +xcb_generic_iterator_t +xcb_poly_text_8_items_end (const xcb_poly_text_8_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_poly_text_8_request_t))/sizeof(uint8_t))); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_poly_text_16_sizeof (const void *_buffer, + uint32_t items_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_poly_text_16_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* items */ + xcb_block_len += items_len * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_poly_text_16_checked (xcb_connection_t *c, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + int16_t x, + int16_t y, + uint32_t items_len, + const uint8_t *items) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_POLY_TEXT_16, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_poly_text_16_request_t xcb_out; + + xcb_out.pad0 = 0; + 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; + /* uint8_t items */ + xcb_parts[4].iov_base = (char *) items; + xcb_parts[4].iov_len = items_len * sizeof(uint8_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_poly_text_16 (xcb_connection_t *c, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + int16_t x, + int16_t y, + uint32_t items_len, + const uint8_t *items) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_POLY_TEXT_16, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_poly_text_16_request_t xcb_out; + + xcb_out.pad0 = 0; + 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; + /* uint8_t items */ + xcb_parts[4].iov_base = (char *) items; + xcb_parts[4].iov_len = items_len * sizeof(uint8_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; +} + +uint8_t * +xcb_poly_text_16_items (const xcb_poly_text_16_request_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_poly_text_16_items_length (const xcb_poly_text_16_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_poly_text_16_request_t))/sizeof(uint8_t)); +} + +xcb_generic_iterator_t +xcb_poly_text_16_items_end (const xcb_poly_text_16_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_poly_text_16_request_t))/sizeof(uint8_t))); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_image_text_8_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_image_text_8_request_t *_aux = (xcb_image_text_8_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_image_text_8_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* string */ + xcb_block_len += _aux->string_len * sizeof(char); + 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_image_text_8_checked (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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +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; +} + +char * +xcb_image_text_8_string (const xcb_image_text_8_request_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_image_text_8_string_length (const xcb_image_text_8_request_t *R) +{ + return R->string_len; +} + +xcb_generic_iterator_t +xcb_image_text_8_string_end (const xcb_image_text_8_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->string_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_image_text_16_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_image_text_16_request_t *_aux = (xcb_image_text_16_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_image_text_16_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* string */ + xcb_block_len += _aux->string_len * sizeof(xcb_char2b_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_char2b_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_image_text_16_checked (xcb_connection_t *c, + uint8_t string_len, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + int16_t x, + int16_t y, + const xcb_char2b_t *string) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_IMAGE_TEXT_16, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_image_text_16_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; + /* xcb_char2b_t string */ + xcb_parts[4].iov_base = (char *) string; + xcb_parts[4].iov_len = string_len * sizeof(xcb_char2b_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_image_text_16 (xcb_connection_t *c, + uint8_t string_len, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + int16_t x, + int16_t y, + const xcb_char2b_t *string) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_IMAGE_TEXT_16, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_image_text_16_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; + /* xcb_char2b_t string */ + xcb_parts[4].iov_base = (char *) string; + xcb_parts[4].iov_len = string_len * sizeof(xcb_char2b_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_char2b_t * +xcb_image_text_16_string (const xcb_image_text_16_request_t *R) +{ + return (xcb_char2b_t *) (R + 1); +} + +int +xcb_image_text_16_string_length (const xcb_image_text_16_request_t *R) +{ + return R->string_len; +} + +xcb_char2b_iterator_t +xcb_image_text_16_string_iterator (const xcb_image_text_16_request_t *R) +{ + xcb_char2b_iterator_t i; + i.data = (xcb_char2b_t *) (R + 1); + i.rem = R->string_len; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_create_colormap_checked (xcb_connection_t *c, + uint8_t alloc, + xcb_colormap_t mid, + xcb_window_t window, + xcb_visualid_t visual) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_CREATE_COLORMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_create_colormap_request_t xcb_out; + + xcb_out.alloc = alloc; + xcb_out.mid = mid; + xcb_out.window = window; + xcb_out.visual = visual; + + 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_create_colormap (xcb_connection_t *c, + uint8_t alloc, + xcb_colormap_t mid, + xcb_window_t window, + xcb_visualid_t visual) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_CREATE_COLORMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_create_colormap_request_t xcb_out; + + xcb_out.alloc = alloc; + xcb_out.mid = mid; + xcb_out.window = window; + xcb_out.visual = visual; + + 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_free_colormap_checked (xcb_connection_t *c, + xcb_colormap_t cmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_FREE_COLORMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_free_colormap_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cmap = cmap; + + 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_free_colormap (xcb_connection_t *c, + xcb_colormap_t cmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_FREE_COLORMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_free_colormap_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cmap = cmap; + + 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_copy_colormap_and_free_checked (xcb_connection_t *c, + xcb_colormap_t mid, + xcb_colormap_t src_cmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_COPY_COLORMAP_AND_FREE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_copy_colormap_and_free_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.mid = mid; + xcb_out.src_cmap = src_cmap; + + 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_copy_colormap_and_free (xcb_connection_t *c, + xcb_colormap_t mid, + xcb_colormap_t src_cmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_COPY_COLORMAP_AND_FREE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_copy_colormap_and_free_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.mid = mid; + xcb_out.src_cmap = src_cmap; + + 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_install_colormap_checked (xcb_connection_t *c, + xcb_colormap_t cmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_INSTALL_COLORMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_install_colormap_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cmap = cmap; + + 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_install_colormap (xcb_connection_t *c, + xcb_colormap_t cmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_INSTALL_COLORMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_install_colormap_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cmap = cmap; + + 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_uninstall_colormap_checked (xcb_connection_t *c, + xcb_colormap_t cmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_UNINSTALL_COLORMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_uninstall_colormap_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cmap = cmap; + + 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_uninstall_colormap (xcb_connection_t *c, + xcb_colormap_t cmap) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_UNINSTALL_COLORMAP, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_uninstall_colormap_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cmap = cmap; + + 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_list_installed_colormaps_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_list_installed_colormaps_reply_t *_aux = (xcb_list_installed_colormaps_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_list_installed_colormaps_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* cmaps */ + xcb_block_len += _aux->cmaps_len * sizeof(xcb_colormap_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_colormap_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_list_installed_colormaps_cookie_t +xcb_list_installed_colormaps (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_LIST_INSTALLED_COLORMAPS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_list_installed_colormaps_cookie_t xcb_ret; + xcb_list_installed_colormaps_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_list_installed_colormaps_cookie_t +xcb_list_installed_colormaps_unchecked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_LIST_INSTALLED_COLORMAPS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_list_installed_colormaps_cookie_t xcb_ret; + xcb_list_installed_colormaps_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_colormap_t * +xcb_list_installed_colormaps_cmaps (const xcb_list_installed_colormaps_reply_t *R) +{ + return (xcb_colormap_t *) (R + 1); +} + +int +xcb_list_installed_colormaps_cmaps_length (const xcb_list_installed_colormaps_reply_t *R) +{ + return R->cmaps_len; +} + +xcb_generic_iterator_t +xcb_list_installed_colormaps_cmaps_end (const xcb_list_installed_colormaps_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_colormap_t *) (R + 1)) + (R->cmaps_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_list_installed_colormaps_reply_t * +xcb_list_installed_colormaps_reply (xcb_connection_t *c, + xcb_list_installed_colormaps_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_list_installed_colormaps_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_alloc_color_cookie_t +xcb_alloc_color (xcb_connection_t *c, + xcb_colormap_t cmap, + uint16_t red, + uint16_t green, + uint16_t blue) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_ALLOC_COLOR, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_alloc_color_cookie_t xcb_ret; + xcb_alloc_color_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cmap = cmap; + xcb_out.red = red; + xcb_out.green = green; + xcb_out.blue = blue; + memset(xcb_out.pad1, 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_alloc_color_cookie_t +xcb_alloc_color_unchecked (xcb_connection_t *c, + xcb_colormap_t cmap, + uint16_t red, + uint16_t green, + uint16_t blue) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_ALLOC_COLOR, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_alloc_color_cookie_t xcb_ret; + xcb_alloc_color_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cmap = cmap; + xcb_out.red = red; + xcb_out.green = green; + xcb_out.blue = blue; + memset(xcb_out.pad1, 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_alloc_color_reply_t * +xcb_alloc_color_reply (xcb_connection_t *c, + xcb_alloc_color_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_alloc_color_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_alloc_named_color_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_alloc_named_color_request_t *_aux = (xcb_alloc_named_color_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_alloc_named_color_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* name */ + xcb_block_len += _aux->name_len * sizeof(char); + 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_alloc_named_color_cookie_t +xcb_alloc_named_color (xcb_connection_t *c, + xcb_colormap_t cmap, + uint16_t name_len, + const char *name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_ALLOC_NAMED_COLOR, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_alloc_named_color_cookie_t xcb_ret; + xcb_alloc_named_color_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cmap = cmap; + xcb_out.name_len = name_len; + memset(xcb_out.pad1, 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; + /* char name */ + xcb_parts[4].iov_base = (char *) name; + xcb_parts[4].iov_len = name_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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_alloc_named_color_cookie_t +xcb_alloc_named_color_unchecked (xcb_connection_t *c, + xcb_colormap_t cmap, + uint16_t name_len, + const char *name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_ALLOC_NAMED_COLOR, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_alloc_named_color_cookie_t xcb_ret; + xcb_alloc_named_color_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cmap = cmap; + xcb_out.name_len = name_len; + memset(xcb_out.pad1, 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; + /* char name */ + xcb_parts[4].iov_base = (char *) name; + xcb_parts[4].iov_len = name_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; +} + +xcb_alloc_named_color_reply_t * +xcb_alloc_named_color_reply (xcb_connection_t *c, + xcb_alloc_named_color_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_alloc_named_color_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_alloc_color_cells_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_alloc_color_cells_reply_t *_aux = (xcb_alloc_color_cells_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_alloc_color_cells_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* pixels */ + xcb_block_len += _aux->pixels_len * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* masks */ + xcb_block_len += _aux->masks_len * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_alloc_color_cells_cookie_t +xcb_alloc_color_cells (xcb_connection_t *c, + uint8_t contiguous, + xcb_colormap_t cmap, + uint16_t colors, + uint16_t planes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_ALLOC_COLOR_CELLS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_alloc_color_cells_cookie_t xcb_ret; + xcb_alloc_color_cells_request_t xcb_out; + + xcb_out.contiguous = contiguous; + xcb_out.cmap = cmap; + xcb_out.colors = colors; + xcb_out.planes = planes; + + 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_alloc_color_cells_cookie_t +xcb_alloc_color_cells_unchecked (xcb_connection_t *c, + uint8_t contiguous, + xcb_colormap_t cmap, + uint16_t colors, + uint16_t planes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_ALLOC_COLOR_CELLS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_alloc_color_cells_cookie_t xcb_ret; + xcb_alloc_color_cells_request_t xcb_out; + + xcb_out.contiguous = contiguous; + xcb_out.cmap = cmap; + xcb_out.colors = colors; + xcb_out.planes = planes; + + 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; +} + +uint32_t * +xcb_alloc_color_cells_pixels (const xcb_alloc_color_cells_reply_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_alloc_color_cells_pixels_length (const xcb_alloc_color_cells_reply_t *R) +{ + return R->pixels_len; +} + +xcb_generic_iterator_t +xcb_alloc_color_cells_pixels_end (const xcb_alloc_color_cells_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->pixels_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +uint32_t * +xcb_alloc_color_cells_masks (const xcb_alloc_color_cells_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_alloc_color_cells_pixels_end(R); + return (uint32_t *) ((char *) prev.data + XCB_TYPE_PAD(uint32_t, prev.index) + 0); +} + +int +xcb_alloc_color_cells_masks_length (const xcb_alloc_color_cells_reply_t *R) +{ + return R->masks_len; +} + +xcb_generic_iterator_t +xcb_alloc_color_cells_masks_end (const xcb_alloc_color_cells_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_alloc_color_cells_pixels_end(R); + i.data = ((uint32_t *) ((char*) prev.data + XCB_TYPE_PAD(uint32_t, prev.index))) + (R->masks_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_alloc_color_cells_reply_t * +xcb_alloc_color_cells_reply (xcb_connection_t *c, + xcb_alloc_color_cells_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_alloc_color_cells_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_alloc_color_planes_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_alloc_color_planes_reply_t *_aux = (xcb_alloc_color_planes_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_alloc_color_planes_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* pixels */ + xcb_block_len += _aux->pixels_len * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_alloc_color_planes_cookie_t +xcb_alloc_color_planes (xcb_connection_t *c, + uint8_t contiguous, + xcb_colormap_t cmap, + uint16_t colors, + uint16_t reds, + uint16_t greens, + uint16_t blues) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_ALLOC_COLOR_PLANES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_alloc_color_planes_cookie_t xcb_ret; + xcb_alloc_color_planes_request_t xcb_out; + + xcb_out.contiguous = contiguous; + xcb_out.cmap = cmap; + xcb_out.colors = colors; + xcb_out.reds = reds; + xcb_out.greens = greens; + xcb_out.blues = blues; + + 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_alloc_color_planes_cookie_t +xcb_alloc_color_planes_unchecked (xcb_connection_t *c, + uint8_t contiguous, + xcb_colormap_t cmap, + uint16_t colors, + uint16_t reds, + uint16_t greens, + uint16_t blues) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_ALLOC_COLOR_PLANES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_alloc_color_planes_cookie_t xcb_ret; + xcb_alloc_color_planes_request_t xcb_out; + + xcb_out.contiguous = contiguous; + xcb_out.cmap = cmap; + xcb_out.colors = colors; + xcb_out.reds = reds; + xcb_out.greens = greens; + xcb_out.blues = blues; + + 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; +} + +uint32_t * +xcb_alloc_color_planes_pixels (const xcb_alloc_color_planes_reply_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_alloc_color_planes_pixels_length (const xcb_alloc_color_planes_reply_t *R) +{ + return R->pixels_len; +} + +xcb_generic_iterator_t +xcb_alloc_color_planes_pixels_end (const xcb_alloc_color_planes_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->pixels_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_alloc_color_planes_reply_t * +xcb_alloc_color_planes_reply (xcb_connection_t *c, + xcb_alloc_color_planes_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_alloc_color_planes_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_free_colors_sizeof (const void *_buffer, + uint32_t pixels_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_free_colors_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* pixels */ + xcb_block_len += pixels_len * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_free_colors_checked (xcb_connection_t *c, + xcb_colormap_t cmap, + uint32_t plane_mask, + uint32_t pixels_len, + const uint32_t *pixels) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_FREE_COLORS, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_free_colors_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cmap = cmap; + xcb_out.plane_mask = plane_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; + /* uint32_t pixels */ + xcb_parts[4].iov_base = (char *) pixels; + xcb_parts[4].iov_len = pixels_len * sizeof(uint32_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_free_colors (xcb_connection_t *c, + xcb_colormap_t cmap, + uint32_t plane_mask, + uint32_t pixels_len, + const uint32_t *pixels) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_FREE_COLORS, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_free_colors_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cmap = cmap; + xcb_out.plane_mask = plane_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; + /* uint32_t pixels */ + xcb_parts[4].iov_base = (char *) pixels; + xcb_parts[4].iov_len = pixels_len * sizeof(uint32_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; +} + +uint32_t * +xcb_free_colors_pixels (const xcb_free_colors_request_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_free_colors_pixels_length (const xcb_free_colors_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_free_colors_request_t))/sizeof(uint32_t)); +} + +xcb_generic_iterator_t +xcb_free_colors_pixels_end (const xcb_free_colors_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_free_colors_request_t))/sizeof(uint32_t))); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_coloritem_next (xcb_coloritem_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_coloritem_t); +} + +xcb_generic_iterator_t +xcb_coloritem_end (xcb_coloritem_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; +} + +int +xcb_store_colors_sizeof (const void *_buffer, + uint32_t items_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_store_colors_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* items */ + xcb_block_len += items_len * sizeof(xcb_coloritem_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_coloritem_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_store_colors_checked (xcb_connection_t *c, + xcb_colormap_t cmap, + uint32_t items_len, + const xcb_coloritem_t *items) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_STORE_COLORS, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_store_colors_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cmap = cmap; + + 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_coloritem_t items */ + xcb_parts[4].iov_base = (char *) items; + xcb_parts[4].iov_len = items_len * sizeof(xcb_coloritem_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_store_colors (xcb_connection_t *c, + xcb_colormap_t cmap, + uint32_t items_len, + const xcb_coloritem_t *items) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_STORE_COLORS, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_store_colors_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cmap = cmap; + + 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_coloritem_t items */ + xcb_parts[4].iov_base = (char *) items; + xcb_parts[4].iov_len = items_len * sizeof(xcb_coloritem_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_coloritem_t * +xcb_store_colors_items (const xcb_store_colors_request_t *R) +{ + return (xcb_coloritem_t *) (R + 1); +} + +int +xcb_store_colors_items_length (const xcb_store_colors_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_store_colors_request_t))/sizeof(xcb_coloritem_t)); +} + +xcb_coloritem_iterator_t +xcb_store_colors_items_iterator (const xcb_store_colors_request_t *R) +{ + xcb_coloritem_iterator_t i; + i.data = (xcb_coloritem_t *) (R + 1); + i.rem = (((R->length * 4) - sizeof(xcb_store_colors_request_t))/sizeof(xcb_coloritem_t)); + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_store_named_color_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_store_named_color_request_t *_aux = (xcb_store_named_color_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_store_named_color_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* name */ + xcb_block_len += _aux->name_len * sizeof(char); + 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_store_named_color_checked (xcb_connection_t *c, + uint8_t flags, + xcb_colormap_t cmap, + uint32_t pixel, + uint16_t name_len, + const char *name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_STORE_NAMED_COLOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_store_named_color_request_t xcb_out; + + xcb_out.flags = flags; + xcb_out.cmap = cmap; + xcb_out.pixel = pixel; + xcb_out.name_len = name_len; + 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; + /* char name */ + xcb_parts[4].iov_base = (char *) name; + xcb_parts[4].iov_len = name_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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_store_named_color (xcb_connection_t *c, + uint8_t flags, + xcb_colormap_t cmap, + uint32_t pixel, + uint16_t name_len, + const char *name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_STORE_NAMED_COLOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_store_named_color_request_t xcb_out; + + xcb_out.flags = flags; + xcb_out.cmap = cmap; + xcb_out.pixel = pixel; + xcb_out.name_len = name_len; + 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; + /* char name */ + xcb_parts[4].iov_base = (char *) name; + xcb_parts[4].iov_len = name_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; +} + +char * +xcb_store_named_color_name (const xcb_store_named_color_request_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_store_named_color_name_length (const xcb_store_named_color_request_t *R) +{ + return R->name_len; +} + +xcb_generic_iterator_t +xcb_store_named_color_name_end (const xcb_store_named_color_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->name_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_rgb_next (xcb_rgb_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_rgb_t); +} + +xcb_generic_iterator_t +xcb_rgb_end (xcb_rgb_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; +} + +int +xcb_query_colors_sizeof (const void *_buffer, + uint32_t pixels_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_query_colors_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* pixels */ + xcb_block_len += pixels_len * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_query_colors_cookie_t +xcb_query_colors (xcb_connection_t *c, + xcb_colormap_t cmap, + uint32_t pixels_len, + const uint32_t *pixels) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_QUERY_COLORS, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_query_colors_cookie_t xcb_ret; + xcb_query_colors_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cmap = cmap; + + 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; + /* uint32_t pixels */ + xcb_parts[4].iov_base = (char *) pixels; + xcb_parts[4].iov_len = pixels_len * sizeof(uint32_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_query_colors_cookie_t +xcb_query_colors_unchecked (xcb_connection_t *c, + xcb_colormap_t cmap, + uint32_t pixels_len, + const uint32_t *pixels) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_QUERY_COLORS, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_query_colors_cookie_t xcb_ret; + xcb_query_colors_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cmap = cmap; + + 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; + /* uint32_t pixels */ + xcb_parts[4].iov_base = (char *) pixels; + xcb_parts[4].iov_len = pixels_len * sizeof(uint32_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_rgb_t * +xcb_query_colors_colors (const xcb_query_colors_reply_t *R) +{ + return (xcb_rgb_t *) (R + 1); +} + +int +xcb_query_colors_colors_length (const xcb_query_colors_reply_t *R) +{ + return R->colors_len; +} + +xcb_rgb_iterator_t +xcb_query_colors_colors_iterator (const xcb_query_colors_reply_t *R) +{ + xcb_rgb_iterator_t i; + i.data = (xcb_rgb_t *) (R + 1); + i.rem = R->colors_len; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_query_colors_reply_t * +xcb_query_colors_reply (xcb_connection_t *c, + xcb_query_colors_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_query_colors_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_lookup_color_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_lookup_color_request_t *_aux = (xcb_lookup_color_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_lookup_color_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* name */ + xcb_block_len += _aux->name_len * sizeof(char); + 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_lookup_color_cookie_t +xcb_lookup_color (xcb_connection_t *c, + xcb_colormap_t cmap, + uint16_t name_len, + const char *name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_LOOKUP_COLOR, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_lookup_color_cookie_t xcb_ret; + xcb_lookup_color_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cmap = cmap; + xcb_out.name_len = name_len; + memset(xcb_out.pad1, 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; + /* char name */ + xcb_parts[4].iov_base = (char *) name; + xcb_parts[4].iov_len = name_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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_lookup_color_cookie_t +xcb_lookup_color_unchecked (xcb_connection_t *c, + xcb_colormap_t cmap, + uint16_t name_len, + const char *name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_LOOKUP_COLOR, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_lookup_color_cookie_t xcb_ret; + xcb_lookup_color_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cmap = cmap; + xcb_out.name_len = name_len; + memset(xcb_out.pad1, 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; + /* char name */ + xcb_parts[4].iov_base = (char *) name; + xcb_parts[4].iov_len = name_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; +} + +xcb_lookup_color_reply_t * +xcb_lookup_color_reply (xcb_connection_t *c, + xcb_lookup_color_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_lookup_color_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_create_cursor_checked (xcb_connection_t *c, + xcb_cursor_t cid, + xcb_pixmap_t source, + xcb_pixmap_t mask, + uint16_t fore_red, + uint16_t fore_green, + uint16_t fore_blue, + uint16_t back_red, + uint16_t back_green, + uint16_t back_blue, + uint16_t x, + uint16_t y) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_CREATE_CURSOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_create_cursor_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cid = cid; + xcb_out.source = source; + xcb_out.mask = mask; + xcb_out.fore_red = fore_red; + xcb_out.fore_green = fore_green; + xcb_out.fore_blue = fore_blue; + xcb_out.back_red = back_red; + xcb_out.back_green = back_green; + xcb_out.back_blue = back_blue; + 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; + + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_create_cursor (xcb_connection_t *c, + xcb_cursor_t cid, + xcb_pixmap_t source, + xcb_pixmap_t mask, + uint16_t fore_red, + uint16_t fore_green, + uint16_t fore_blue, + uint16_t back_red, + uint16_t back_green, + uint16_t back_blue, + uint16_t x, + uint16_t y) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_CREATE_CURSOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_create_cursor_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cid = cid; + xcb_out.source = source; + xcb_out.mask = mask; + xcb_out.fore_red = fore_red; + xcb_out.fore_green = fore_green; + xcb_out.fore_blue = fore_blue; + xcb_out.back_red = back_red; + xcb_out.back_green = back_green; + xcb_out.back_blue = back_blue; + 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; + + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_create_glyph_cursor_checked (xcb_connection_t *c, + xcb_cursor_t cid, + xcb_font_t source_font, + xcb_font_t mask_font, + uint16_t source_char, + uint16_t mask_char, + uint16_t fore_red, + uint16_t fore_green, + uint16_t fore_blue, + uint16_t back_red, + uint16_t back_green, + uint16_t back_blue) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_CREATE_GLYPH_CURSOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_create_glyph_cursor_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cid = cid; + xcb_out.source_font = source_font; + xcb_out.mask_font = mask_font; + xcb_out.source_char = source_char; + xcb_out.mask_char = mask_char; + xcb_out.fore_red = fore_red; + xcb_out.fore_green = fore_green; + xcb_out.fore_blue = fore_blue; + xcb_out.back_red = back_red; + xcb_out.back_green = back_green; + xcb_out.back_blue = back_blue; + + 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_create_glyph_cursor (xcb_connection_t *c, + xcb_cursor_t cid, + xcb_font_t source_font, + xcb_font_t mask_font, + uint16_t source_char, + uint16_t mask_char, + uint16_t fore_red, + uint16_t fore_green, + uint16_t fore_blue, + uint16_t back_red, + uint16_t back_green, + uint16_t back_blue) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_CREATE_GLYPH_CURSOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_create_glyph_cursor_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cid = cid; + xcb_out.source_font = source_font; + xcb_out.mask_font = mask_font; + xcb_out.source_char = source_char; + xcb_out.mask_char = mask_char; + xcb_out.fore_red = fore_red; + xcb_out.fore_green = fore_green; + xcb_out.fore_blue = fore_blue; + xcb_out.back_red = back_red; + xcb_out.back_green = back_green; + xcb_out.back_blue = back_blue; + + 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_free_cursor_checked (xcb_connection_t *c, + xcb_cursor_t cursor) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_FREE_CURSOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_free_cursor_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cursor = cursor; + + 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_free_cursor (xcb_connection_t *c, + xcb_cursor_t cursor) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_FREE_CURSOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_free_cursor_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cursor = cursor; + + 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_recolor_cursor_checked (xcb_connection_t *c, + xcb_cursor_t cursor, + uint16_t fore_red, + uint16_t fore_green, + uint16_t fore_blue, + uint16_t back_red, + uint16_t back_green, + uint16_t back_blue) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_RECOLOR_CURSOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_recolor_cursor_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cursor = cursor; + xcb_out.fore_red = fore_red; + xcb_out.fore_green = fore_green; + xcb_out.fore_blue = fore_blue; + xcb_out.back_red = back_red; + xcb_out.back_green = back_green; + xcb_out.back_blue = back_blue; + + 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_recolor_cursor (xcb_connection_t *c, + xcb_cursor_t cursor, + uint16_t fore_red, + uint16_t fore_green, + uint16_t fore_blue, + uint16_t back_red, + uint16_t back_green, + uint16_t back_blue) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_RECOLOR_CURSOR, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_recolor_cursor_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.cursor = cursor; + xcb_out.fore_red = fore_red; + xcb_out.fore_green = fore_green; + xcb_out.fore_blue = fore_blue; + xcb_out.back_red = back_red; + xcb_out.back_green = back_green; + xcb_out.back_blue = back_blue; + + 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_query_best_size_cookie_t +xcb_query_best_size (xcb_connection_t *c, + uint8_t _class, + xcb_drawable_t drawable, + uint16_t width, + uint16_t height) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_QUERY_BEST_SIZE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_query_best_size_cookie_t xcb_ret; + xcb_query_best_size_request_t xcb_out; + + xcb_out._class = _class; + xcb_out.drawable = drawable; + xcb_out.width = width; + xcb_out.height = height; + + 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_query_best_size_cookie_t +xcb_query_best_size_unchecked (xcb_connection_t *c, + uint8_t _class, + xcb_drawable_t drawable, + uint16_t width, + uint16_t height) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_QUERY_BEST_SIZE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_query_best_size_cookie_t xcb_ret; + xcb_query_best_size_request_t xcb_out; + + xcb_out._class = _class; + xcb_out.drawable = drawable; + xcb_out.width = width; + xcb_out.height = height; + + 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_query_best_size_reply_t * +xcb_query_best_size_reply (xcb_connection_t *c, + xcb_query_best_size_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_query_best_size_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_query_extension_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_query_extension_request_t *_aux = (xcb_query_extension_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_query_extension_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* name */ + xcb_block_len += _aux->name_len * sizeof(char); + 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_query_extension_cookie_t +xcb_query_extension (xcb_connection_t *c, + uint16_t name_len, + const char *name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_QUERY_EXTENSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_query_extension_cookie_t xcb_ret; + xcb_query_extension_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.name_len = name_len; + memset(xcb_out.pad1, 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; + /* char name */ + xcb_parts[4].iov_base = (char *) name; + xcb_parts[4].iov_len = name_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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_query_extension_cookie_t +xcb_query_extension_unchecked (xcb_connection_t *c, + uint16_t name_len, + const char *name) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_QUERY_EXTENSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_query_extension_cookie_t xcb_ret; + xcb_query_extension_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.name_len = name_len; + memset(xcb_out.pad1, 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; + /* char name */ + xcb_parts[4].iov_base = (char *) name; + xcb_parts[4].iov_len = name_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; +} + +xcb_query_extension_reply_t * +xcb_query_extension_reply (xcb_connection_t *c, + xcb_query_extension_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_query_extension_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_list_extensions_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_list_extensions_reply_t *_aux = (xcb_list_extensions_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_list_extensions_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* names */ + for(i=0; i<_aux->names_len; i++) { + xcb_tmp_len = xcb_str_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_str_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_list_extensions_cookie_t +xcb_list_extensions (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_LIST_EXTENSIONS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_list_extensions_cookie_t xcb_ret; + xcb_list_extensions_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_list_extensions_cookie_t +xcb_list_extensions_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_LIST_EXTENSIONS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_list_extensions_cookie_t xcb_ret; + xcb_list_extensions_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_list_extensions_names_length (const xcb_list_extensions_reply_t *R) +{ + return R->names_len; +} + +xcb_str_iterator_t +xcb_list_extensions_names_iterator (const xcb_list_extensions_reply_t *R) +{ + xcb_str_iterator_t i; + i.data = (xcb_str_t *) (R + 1); + i.rem = R->names_len; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_list_extensions_reply_t * +xcb_list_extensions_reply (xcb_connection_t *c, + xcb_list_extensions_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_list_extensions_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_change_keyboard_mapping_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_change_keyboard_mapping_request_t *_aux = (xcb_change_keyboard_mapping_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_change_keyboard_mapping_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* keysyms */ + xcb_block_len += (_aux->keycode_count * _aux->keysyms_per_keycode) * sizeof(xcb_keysym_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_keysym_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_change_keyboard_mapping_checked (xcb_connection_t *c, + uint8_t keycode_count, + xcb_keycode_t first_keycode, + uint8_t keysyms_per_keycode, + const xcb_keysym_t *keysyms) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_CHANGE_KEYBOARD_MAPPING, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_change_keyboard_mapping_request_t xcb_out; + + xcb_out.keycode_count = keycode_count; + xcb_out.first_keycode = first_keycode; + xcb_out.keysyms_per_keycode = keysyms_per_keycode; + 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_keysym_t keysyms */ + xcb_parts[4].iov_base = (char *) keysyms; + xcb_parts[4].iov_len = (keycode_count * keysyms_per_keycode) * sizeof(xcb_keysym_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_change_keyboard_mapping (xcb_connection_t *c, + uint8_t keycode_count, + xcb_keycode_t first_keycode, + uint8_t keysyms_per_keycode, + const xcb_keysym_t *keysyms) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_CHANGE_KEYBOARD_MAPPING, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_change_keyboard_mapping_request_t xcb_out; + + xcb_out.keycode_count = keycode_count; + xcb_out.first_keycode = first_keycode; + xcb_out.keysyms_per_keycode = keysyms_per_keycode; + 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_keysym_t keysyms */ + xcb_parts[4].iov_base = (char *) keysyms; + xcb_parts[4].iov_len = (keycode_count * keysyms_per_keycode) * sizeof(xcb_keysym_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_keysym_t * +xcb_change_keyboard_mapping_keysyms (const xcb_change_keyboard_mapping_request_t *R) +{ + return (xcb_keysym_t *) (R + 1); +} + +int +xcb_change_keyboard_mapping_keysyms_length (const xcb_change_keyboard_mapping_request_t *R) +{ + return (R->keycode_count * R->keysyms_per_keycode); +} + +xcb_generic_iterator_t +xcb_change_keyboard_mapping_keysyms_end (const xcb_change_keyboard_mapping_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_keysym_t *) (R + 1)) + ((R->keycode_count * R->keysyms_per_keycode)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_get_keyboard_mapping_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_get_keyboard_mapping_reply_t *_aux = (xcb_get_keyboard_mapping_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_get_keyboard_mapping_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* keysyms */ + xcb_block_len += _aux->length * sizeof(xcb_keysym_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_keysym_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_get_keyboard_mapping_cookie_t +xcb_get_keyboard_mapping (xcb_connection_t *c, + xcb_keycode_t first_keycode, + uint8_t count) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_KEYBOARD_MAPPING, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_keyboard_mapping_cookie_t xcb_ret; + xcb_get_keyboard_mapping_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.first_keycode = first_keycode; + xcb_out.count = count; + + 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_get_keyboard_mapping_cookie_t +xcb_get_keyboard_mapping_unchecked (xcb_connection_t *c, + xcb_keycode_t first_keycode, + uint8_t count) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_KEYBOARD_MAPPING, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_keyboard_mapping_cookie_t xcb_ret; + xcb_get_keyboard_mapping_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.first_keycode = first_keycode; + xcb_out.count = count; + + 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_keysym_t * +xcb_get_keyboard_mapping_keysyms (const xcb_get_keyboard_mapping_reply_t *R) +{ + return (xcb_keysym_t *) (R + 1); +} + +int +xcb_get_keyboard_mapping_keysyms_length (const xcb_get_keyboard_mapping_reply_t *R) +{ + return R->length; +} + +xcb_generic_iterator_t +xcb_get_keyboard_mapping_keysyms_end (const xcb_get_keyboard_mapping_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_keysym_t *) (R + 1)) + (R->length); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_get_keyboard_mapping_reply_t * +xcb_get_keyboard_mapping_reply (xcb_connection_t *c, + xcb_get_keyboard_mapping_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_get_keyboard_mapping_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_change_keyboard_control_value_list_serialize (void **_buffer, + uint32_t value_mask, + const xcb_change_keyboard_control_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[9]; + unsigned int xcb_parts_idx = 0; + unsigned int xcb_block_len = 0; + unsigned int i; + char *xcb_tmp; + + if(value_mask & XCB_KB_KEY_CLICK_PERCENT) { + /* xcb_change_keyboard_control_value_list_t.key_click_percent */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key_click_percent; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_KB_BELL_PERCENT) { + /* xcb_change_keyboard_control_value_list_t.bell_percent */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->bell_percent; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_KB_BELL_PITCH) { + /* xcb_change_keyboard_control_value_list_t.bell_pitch */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->bell_pitch; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_KB_BELL_DURATION) { + /* xcb_change_keyboard_control_value_list_t.bell_duration */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->bell_duration; + xcb_block_len += sizeof(int32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_KB_LED) { + /* xcb_change_keyboard_control_value_list_t.led */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->led; + 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_KB_LED_MODE) { + /* xcb_change_keyboard_control_value_list_t.led_mode */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->led_mode; + 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_KB_KEY) { + /* xcb_change_keyboard_control_value_list_t.key */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key; + xcb_block_len += sizeof(xcb_keycode32_t); + xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode32_t); + xcb_parts_idx++; + xcb_align_to = ALIGNOF(xcb_keycode32_t); + } + if(value_mask & XCB_KB_AUTO_REPEAT_MODE) { + /* xcb_change_keyboard_control_value_list_t.auto_repeat_mode */ + xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->auto_repeat_mode; + 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); + } + /* 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_change_keyboard_control_value_list_unpack (const void *_buffer, + uint32_t value_mask, + xcb_change_keyboard_control_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_KB_KEY_CLICK_PERCENT) { + /* xcb_change_keyboard_control_value_list_t.key_click_percent */ + _aux->key_click_percent = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_KB_BELL_PERCENT) { + /* xcb_change_keyboard_control_value_list_t.bell_percent */ + _aux->bell_percent = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_KB_BELL_PITCH) { + /* xcb_change_keyboard_control_value_list_t.bell_pitch */ + _aux->bell_pitch = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_KB_BELL_DURATION) { + /* xcb_change_keyboard_control_value_list_t.bell_duration */ + _aux->bell_duration = *(int32_t *)xcb_tmp; + xcb_block_len += sizeof(int32_t); + xcb_tmp += sizeof(int32_t); + xcb_align_to = ALIGNOF(int32_t); + } + if(value_mask & XCB_KB_LED) { + /* xcb_change_keyboard_control_value_list_t.led */ + _aux->led = *(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_KB_LED_MODE) { + /* xcb_change_keyboard_control_value_list_t.led_mode */ + _aux->led_mode = *(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_KB_KEY) { + /* xcb_change_keyboard_control_value_list_t.key */ + _aux->key = *(xcb_keycode32_t *)xcb_tmp; + xcb_block_len += sizeof(xcb_keycode32_t); + xcb_tmp += sizeof(xcb_keycode32_t); + xcb_align_to = ALIGNOF(xcb_keycode32_t); + } + if(value_mask & XCB_KB_AUTO_REPEAT_MODE) { + /* xcb_change_keyboard_control_value_list_t.auto_repeat_mode */ + _aux->auto_repeat_mode = *(uint32_t *)xcb_tmp; + xcb_block_len += sizeof(uint32_t); + xcb_tmp += sizeof(uint32_t); + xcb_align_to = ALIGNOF(uint32_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_change_keyboard_control_value_list_sizeof (const void *_buffer, + uint32_t value_mask) +{ + xcb_change_keyboard_control_value_list_t _aux; + return xcb_change_keyboard_control_value_list_unpack(_buffer, value_mask, &_aux); +} + +int +xcb_change_keyboard_control_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_change_keyboard_control_request_t *_aux = (xcb_change_keyboard_control_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_change_keyboard_control_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* value_list */ + xcb_block_len += xcb_change_keyboard_control_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_change_keyboard_control_checked (xcb_connection_t *c, + uint32_t value_mask, + const void *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CHANGE_KEYBOARD_CONTROL, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_change_keyboard_control_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_change_keyboard_control_value_list_t value_list */ + xcb_parts[4].iov_base = (char *) value_list; + xcb_parts[4].iov_len = + xcb_change_keyboard_control_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_change_keyboard_control (xcb_connection_t *c, + uint32_t value_mask, + const void *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CHANGE_KEYBOARD_CONTROL, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_change_keyboard_control_request_t xcb_out; + + xcb_out.pad0 = 0; + 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_change_keyboard_control_value_list_t value_list */ + xcb_parts[4].iov_base = (char *) value_list; + xcb_parts[4].iov_len = + xcb_change_keyboard_control_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_change_keyboard_control_aux_checked (xcb_connection_t *c, + uint32_t value_mask, + const xcb_change_keyboard_control_value_list_t *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CHANGE_KEYBOARD_CONTROL, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_change_keyboard_control_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.pad0 = 0; + 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_change_keyboard_control_value_list_t value_list */ + xcb_parts[4].iov_len = + xcb_change_keyboard_control_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_change_keyboard_control_aux (xcb_connection_t *c, + uint32_t value_mask, + const xcb_change_keyboard_control_value_list_t *value_list) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 3, + .ext = 0, + .opcode = XCB_CHANGE_KEYBOARD_CONTROL, + .isvoid = 1 + }; + + struct iovec xcb_parts[5]; + xcb_void_cookie_t xcb_ret; + xcb_change_keyboard_control_request_t xcb_out; + void *xcb_aux0 = 0; + + xcb_out.pad0 = 0; + 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_change_keyboard_control_value_list_t value_list */ + xcb_parts[4].iov_len = + xcb_change_keyboard_control_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_change_keyboard_control_value_list (const xcb_change_keyboard_control_request_t *R) +{ + return (void *) (R + 1); +} + +xcb_get_keyboard_control_cookie_t +xcb_get_keyboard_control (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_KEYBOARD_CONTROL, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_keyboard_control_cookie_t xcb_ret; + xcb_get_keyboard_control_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_get_keyboard_control_cookie_t +xcb_get_keyboard_control_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_KEYBOARD_CONTROL, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_keyboard_control_cookie_t xcb_ret; + xcb_get_keyboard_control_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_get_keyboard_control_reply_t * +xcb_get_keyboard_control_reply (xcb_connection_t *c, + xcb_get_keyboard_control_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_get_keyboard_control_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_bell_checked (xcb_connection_t *c, + int8_t percent) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_BELL, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_bell_request_t xcb_out; + + xcb_out.percent = percent; + + 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_bell (xcb_connection_t *c, + int8_t percent) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_BELL, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_bell_request_t xcb_out; + + xcb_out.percent = percent; + + 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_change_pointer_control_checked (xcb_connection_t *c, + int16_t acceleration_numerator, + int16_t acceleration_denominator, + int16_t threshold, + uint8_t do_acceleration, + uint8_t do_threshold) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_CHANGE_POINTER_CONTROL, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_change_pointer_control_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.acceleration_numerator = acceleration_numerator; + xcb_out.acceleration_denominator = acceleration_denominator; + xcb_out.threshold = threshold; + xcb_out.do_acceleration = do_acceleration; + xcb_out.do_threshold = do_threshold; + + 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_change_pointer_control (xcb_connection_t *c, + int16_t acceleration_numerator, + int16_t acceleration_denominator, + int16_t threshold, + uint8_t do_acceleration, + uint8_t do_threshold) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_CHANGE_POINTER_CONTROL, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_change_pointer_control_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.acceleration_numerator = acceleration_numerator; + xcb_out.acceleration_denominator = acceleration_denominator; + xcb_out.threshold = threshold; + xcb_out.do_acceleration = do_acceleration; + xcb_out.do_threshold = do_threshold; + + 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_get_pointer_control_cookie_t +xcb_get_pointer_control (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_POINTER_CONTROL, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_pointer_control_cookie_t xcb_ret; + xcb_get_pointer_control_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_get_pointer_control_cookie_t +xcb_get_pointer_control_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_POINTER_CONTROL, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_pointer_control_cookie_t xcb_ret; + xcb_get_pointer_control_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_get_pointer_control_reply_t * +xcb_get_pointer_control_reply (xcb_connection_t *c, + xcb_get_pointer_control_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_get_pointer_control_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_set_screen_saver_checked (xcb_connection_t *c, + int16_t timeout, + int16_t interval, + uint8_t prefer_blanking, + uint8_t allow_exposures) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_SET_SCREEN_SAVER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_set_screen_saver_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.timeout = timeout; + xcb_out.interval = interval; + xcb_out.prefer_blanking = prefer_blanking; + xcb_out.allow_exposures = allow_exposures; + + 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_set_screen_saver (xcb_connection_t *c, + int16_t timeout, + int16_t interval, + uint8_t prefer_blanking, + uint8_t allow_exposures) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_SET_SCREEN_SAVER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_set_screen_saver_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.timeout = timeout; + xcb_out.interval = interval; + xcb_out.prefer_blanking = prefer_blanking; + xcb_out.allow_exposures = allow_exposures; + + 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_get_screen_saver_cookie_t +xcb_get_screen_saver (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_SCREEN_SAVER, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_screen_saver_cookie_t xcb_ret; + xcb_get_screen_saver_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_get_screen_saver_cookie_t +xcb_get_screen_saver_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_SCREEN_SAVER, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_screen_saver_cookie_t xcb_ret; + xcb_get_screen_saver_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_get_screen_saver_reply_t * +xcb_get_screen_saver_reply (xcb_connection_t *c, + xcb_get_screen_saver_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_get_screen_saver_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_change_hosts_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_change_hosts_request_t *_aux = (xcb_change_hosts_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_change_hosts_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* address */ + xcb_block_len += _aux->address_len * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_change_hosts_checked (xcb_connection_t *c, + uint8_t mode, + uint8_t family, + uint16_t address_len, + const uint8_t *address) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_CHANGE_HOSTS, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_change_hosts_request_t xcb_out; + + xcb_out.mode = mode; + xcb_out.family = family; + xcb_out.pad0 = 0; + xcb_out.address_len = address_len; + + 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; + /* uint8_t address */ + xcb_parts[4].iov_base = (char *) address; + xcb_parts[4].iov_len = address_len * sizeof(uint8_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_change_hosts (xcb_connection_t *c, + uint8_t mode, + uint8_t family, + uint16_t address_len, + const uint8_t *address) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_CHANGE_HOSTS, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_change_hosts_request_t xcb_out; + + xcb_out.mode = mode; + xcb_out.family = family; + xcb_out.pad0 = 0; + xcb_out.address_len = address_len; + + 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; + /* uint8_t address */ + xcb_parts[4].iov_base = (char *) address; + xcb_parts[4].iov_len = address_len * sizeof(uint8_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; +} + +uint8_t * +xcb_change_hosts_address (const xcb_change_hosts_request_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_change_hosts_address_length (const xcb_change_hosts_request_t *R) +{ + return R->address_len; +} + +xcb_generic_iterator_t +xcb_change_hosts_address_end (const xcb_change_hosts_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + (R->address_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_host_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_host_t *_aux = (xcb_host_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_host_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* address */ + xcb_block_len += _aux->address_len * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_t); + xcb_align_to = 4; + /* 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; + /* 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; +} + +uint8_t * +xcb_host_address (const xcb_host_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_host_address_length (const xcb_host_t *R) +{ + return R->address_len; +} + +xcb_generic_iterator_t +xcb_host_address_end (const xcb_host_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + (R->address_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_host_next (xcb_host_iterator_t *i) +{ + xcb_host_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_host_t *)(((char *)R) + xcb_host_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_host_t *) child.data; +} + +xcb_generic_iterator_t +xcb_host_end (xcb_host_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_host_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_list_hosts_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_list_hosts_reply_t *_aux = (xcb_list_hosts_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_list_hosts_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* hosts */ + for(i=0; i<_aux->hosts_len; i++) { + xcb_tmp_len = xcb_host_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_host_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_list_hosts_cookie_t +xcb_list_hosts (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_LIST_HOSTS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_list_hosts_cookie_t xcb_ret; + xcb_list_hosts_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_list_hosts_cookie_t +xcb_list_hosts_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_LIST_HOSTS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_list_hosts_cookie_t xcb_ret; + xcb_list_hosts_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_list_hosts_hosts_length (const xcb_list_hosts_reply_t *R) +{ + return R->hosts_len; +} + +xcb_host_iterator_t +xcb_list_hosts_hosts_iterator (const xcb_list_hosts_reply_t *R) +{ + xcb_host_iterator_t i; + i.data = (xcb_host_t *) (R + 1); + i.rem = R->hosts_len; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_list_hosts_reply_t * +xcb_list_hosts_reply (xcb_connection_t *c, + xcb_list_hosts_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_list_hosts_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_set_access_control_checked (xcb_connection_t *c, + uint8_t mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_SET_ACCESS_CONTROL, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_set_access_control_request_t xcb_out; + + xcb_out.mode = mode; + + 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_set_access_control (xcb_connection_t *c, + uint8_t mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_SET_ACCESS_CONTROL, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_set_access_control_request_t xcb_out; + + xcb_out.mode = mode; + + 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_set_close_down_mode_checked (xcb_connection_t *c, + uint8_t mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_SET_CLOSE_DOWN_MODE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_set_close_down_mode_request_t xcb_out; + + xcb_out.mode = mode; + + 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_set_close_down_mode (xcb_connection_t *c, + uint8_t mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_SET_CLOSE_DOWN_MODE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_set_close_down_mode_request_t xcb_out; + + xcb_out.mode = mode; + + 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_kill_client_checked (xcb_connection_t *c, + uint32_t resource) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_KILL_CLIENT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_kill_client_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.resource = resource; + + 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_kill_client (xcb_connection_t *c, + uint32_t resource) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_KILL_CLIENT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_kill_client_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.resource = resource; + + 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_rotate_properties_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_rotate_properties_request_t *_aux = (xcb_rotate_properties_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_rotate_properties_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* atoms */ + xcb_block_len += _aux->atoms_len * sizeof(xcb_atom_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_atom_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_rotate_properties_checked (xcb_connection_t *c, + xcb_window_t window, + uint16_t atoms_len, + int16_t delta, + const xcb_atom_t *atoms) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_ROTATE_PROPERTIES, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_rotate_properties_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.window = window; + xcb_out.atoms_len = atoms_len; + xcb_out.delta = delta; + + 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_atom_t atoms */ + xcb_parts[4].iov_base = (char *) atoms; + xcb_parts[4].iov_len = atoms_len * sizeof(xcb_atom_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_rotate_properties (xcb_connection_t *c, + xcb_window_t window, + uint16_t atoms_len, + int16_t delta, + const xcb_atom_t *atoms) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_ROTATE_PROPERTIES, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_rotate_properties_request_t xcb_out; + + xcb_out.pad0 = 0; + xcb_out.window = window; + xcb_out.atoms_len = atoms_len; + xcb_out.delta = delta; + + 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_atom_t atoms */ + xcb_parts[4].iov_base = (char *) atoms; + xcb_parts[4].iov_len = atoms_len * sizeof(xcb_atom_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_atom_t * +xcb_rotate_properties_atoms (const xcb_rotate_properties_request_t *R) +{ + return (xcb_atom_t *) (R + 1); +} + +int +xcb_rotate_properties_atoms_length (const xcb_rotate_properties_request_t *R) +{ + return R->atoms_len; +} + +xcb_generic_iterator_t +xcb_rotate_properties_atoms_end (const xcb_rotate_properties_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_atom_t *) (R + 1)) + (R->atoms_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_force_screen_saver_checked (xcb_connection_t *c, + uint8_t mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_FORCE_SCREEN_SAVER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_force_screen_saver_request_t xcb_out; + + xcb_out.mode = mode; + + 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_force_screen_saver (xcb_connection_t *c, + uint8_t mode) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_FORCE_SCREEN_SAVER, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_force_screen_saver_request_t xcb_out; + + xcb_out.mode = mode; + + 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_set_pointer_mapping_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_set_pointer_mapping_request_t *_aux = (xcb_set_pointer_mapping_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_set_pointer_mapping_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* map */ + xcb_block_len += _aux->map_len * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_set_pointer_mapping_cookie_t +xcb_set_pointer_mapping (xcb_connection_t *c, + uint8_t map_len, + const uint8_t *map) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_SET_POINTER_MAPPING, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_set_pointer_mapping_cookie_t xcb_ret; + xcb_set_pointer_mapping_request_t xcb_out; + + xcb_out.map_len = map_len; + + 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; + /* uint8_t map */ + xcb_parts[4].iov_base = (char *) map; + xcb_parts[4].iov_len = map_len * sizeof(uint8_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_set_pointer_mapping_cookie_t +xcb_set_pointer_mapping_unchecked (xcb_connection_t *c, + uint8_t map_len, + const uint8_t *map) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_SET_POINTER_MAPPING, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_set_pointer_mapping_cookie_t xcb_ret; + xcb_set_pointer_mapping_request_t xcb_out; + + xcb_out.map_len = map_len; + + 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; + /* uint8_t map */ + xcb_parts[4].iov_base = (char *) map; + xcb_parts[4].iov_len = map_len * sizeof(uint8_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_set_pointer_mapping_reply_t * +xcb_set_pointer_mapping_reply (xcb_connection_t *c, + xcb_set_pointer_mapping_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_set_pointer_mapping_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_get_pointer_mapping_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_get_pointer_mapping_reply_t *_aux = (xcb_get_pointer_mapping_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_get_pointer_mapping_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* map */ + xcb_block_len += _aux->map_len * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_get_pointer_mapping_cookie_t +xcb_get_pointer_mapping (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_POINTER_MAPPING, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_pointer_mapping_cookie_t xcb_ret; + xcb_get_pointer_mapping_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_get_pointer_mapping_cookie_t +xcb_get_pointer_mapping_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_POINTER_MAPPING, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_pointer_mapping_cookie_t xcb_ret; + xcb_get_pointer_mapping_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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; +} + +uint8_t * +xcb_get_pointer_mapping_map (const xcb_get_pointer_mapping_reply_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_get_pointer_mapping_map_length (const xcb_get_pointer_mapping_reply_t *R) +{ + return R->map_len; +} + +xcb_generic_iterator_t +xcb_get_pointer_mapping_map_end (const xcb_get_pointer_mapping_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + (R->map_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_get_pointer_mapping_reply_t * +xcb_get_pointer_mapping_reply (xcb_connection_t *c, + xcb_get_pointer_mapping_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_get_pointer_mapping_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_set_modifier_mapping_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_set_modifier_mapping_request_t *_aux = (xcb_set_modifier_mapping_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_set_modifier_mapping_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* keycodes */ + xcb_block_len += (_aux->keycodes_per_modifier * 8) * sizeof(xcb_keycode_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_keycode_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_set_modifier_mapping_cookie_t +xcb_set_modifier_mapping (xcb_connection_t *c, + uint8_t keycodes_per_modifier, + const xcb_keycode_t *keycodes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_SET_MODIFIER_MAPPING, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_set_modifier_mapping_cookie_t xcb_ret; + xcb_set_modifier_mapping_request_t xcb_out; + + xcb_out.keycodes_per_modifier = keycodes_per_modifier; + + 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_keycode_t keycodes */ + xcb_parts[4].iov_base = (char *) keycodes; + xcb_parts[4].iov_len = (keycodes_per_modifier * 8) * sizeof(uint8_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_set_modifier_mapping_cookie_t +xcb_set_modifier_mapping_unchecked (xcb_connection_t *c, + uint8_t keycodes_per_modifier, + const xcb_keycode_t *keycodes) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = 0, + .opcode = XCB_SET_MODIFIER_MAPPING, + .isvoid = 0 + }; + + struct iovec xcb_parts[6]; + xcb_set_modifier_mapping_cookie_t xcb_ret; + xcb_set_modifier_mapping_request_t xcb_out; + + xcb_out.keycodes_per_modifier = keycodes_per_modifier; + + 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_keycode_t keycodes */ + xcb_parts[4].iov_base = (char *) keycodes; + xcb_parts[4].iov_len = (keycodes_per_modifier * 8) * sizeof(uint8_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_set_modifier_mapping_reply_t * +xcb_set_modifier_mapping_reply (xcb_connection_t *c, + xcb_set_modifier_mapping_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_set_modifier_mapping_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_get_modifier_mapping_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_get_modifier_mapping_reply_t *_aux = (xcb_get_modifier_mapping_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_get_modifier_mapping_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* keycodes */ + xcb_block_len += (_aux->keycodes_per_modifier * 8) * sizeof(xcb_keycode_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_keycode_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_get_modifier_mapping_cookie_t +xcb_get_modifier_mapping (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_MODIFIER_MAPPING, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_modifier_mapping_cookie_t xcb_ret; + xcb_get_modifier_mapping_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_get_modifier_mapping_cookie_t +xcb_get_modifier_mapping_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_GET_MODIFIER_MAPPING, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_get_modifier_mapping_cookie_t xcb_ret; + xcb_get_modifier_mapping_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_keycode_t * +xcb_get_modifier_mapping_keycodes (const xcb_get_modifier_mapping_reply_t *R) +{ + return (xcb_keycode_t *) (R + 1); +} + +int +xcb_get_modifier_mapping_keycodes_length (const xcb_get_modifier_mapping_reply_t *R) +{ + return (R->keycodes_per_modifier * 8); +} + +xcb_generic_iterator_t +xcb_get_modifier_mapping_keycodes_end (const xcb_get_modifier_mapping_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((xcb_keycode_t *) (R + 1)) + ((R->keycodes_per_modifier * 8)); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_get_modifier_mapping_reply_t * +xcb_get_modifier_mapping_reply (xcb_connection_t *c, + xcb_get_modifier_mapping_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_get_modifier_mapping_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_no_operation_checked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_NO_OPERATION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_no_operation_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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_no_operation (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = 0, + .opcode = XCB_NO_OPERATION, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_no_operation_request_t xcb_out; + + xcb_out.pad0 = 0; + + 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; +} + diff --git a/depends/libxcb/src/xselinux.c b/depends/libxcb/src/xselinux.c new file mode 100644 index 0000000..539dd61 --- /dev/null +++ b/depends/libxcb/src/xselinux.c @@ -0,0 +1,2710 @@ +/* + * This file generated automatically from xselinux.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "xselinux.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) +#include "xproto.h" + +xcb_extension_t xcb_selinux_id = { "SELinux", 0 }; + +xcb_selinux_query_version_cookie_t +xcb_selinux_query_version (xcb_connection_t *c, + uint8_t client_major, + uint8_t client_minor) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_query_version_cookie_t xcb_ret; + xcb_selinux_query_version_request_t xcb_out; + + xcb_out.client_major = client_major; + xcb_out.client_minor = client_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_selinux_query_version_cookie_t +xcb_selinux_query_version_unchecked (xcb_connection_t *c, + uint8_t client_major, + uint8_t client_minor) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_query_version_cookie_t xcb_ret; + xcb_selinux_query_version_request_t xcb_out; + + xcb_out.client_major = client_major; + xcb_out.client_minor = client_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_selinux_query_version_reply_t * +xcb_selinux_query_version_reply (xcb_connection_t *c, + xcb_selinux_query_version_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_selinux_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_selinux_set_device_create_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_selinux_set_device_create_context_request_t *_aux = (xcb_selinux_set_device_create_context_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_selinux_set_device_create_context_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* context */ + xcb_block_len += _aux->context_len * sizeof(char); + 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_selinux_set_device_create_context_checked (xcb_connection_t *c, + uint32_t context_len, + const char *context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_SET_DEVICE_CREATE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_selinux_set_device_create_context_request_t xcb_out; + + xcb_out.context_len = context_len; + + 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 context */ + xcb_parts[4].iov_base = (char *) context; + xcb_parts[4].iov_len = context_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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_selinux_set_device_create_context (xcb_connection_t *c, + uint32_t context_len, + const char *context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_SET_DEVICE_CREATE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_selinux_set_device_create_context_request_t xcb_out; + + xcb_out.context_len = context_len; + + 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 context */ + xcb_parts[4].iov_base = (char *) context; + xcb_parts[4].iov_len = context_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; +} + +char * +xcb_selinux_set_device_create_context_context (const xcb_selinux_set_device_create_context_request_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_selinux_set_device_create_context_context_length (const xcb_selinux_set_device_create_context_request_t *R) +{ + return R->context_len; +} + +xcb_generic_iterator_t +xcb_selinux_set_device_create_context_context_end (const xcb_selinux_set_device_create_context_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->context_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_selinux_get_device_create_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_selinux_get_device_create_context_reply_t *_aux = (xcb_selinux_get_device_create_context_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_selinux_get_device_create_context_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* context */ + xcb_block_len += _aux->context_len * sizeof(char); + 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_selinux_get_device_create_context_cookie_t +xcb_selinux_get_device_create_context (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_DEVICE_CREATE_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_device_create_context_cookie_t xcb_ret; + xcb_selinux_get_device_create_context_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_selinux_get_device_create_context_cookie_t +xcb_selinux_get_device_create_context_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_DEVICE_CREATE_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_device_create_context_cookie_t xcb_ret; + xcb_selinux_get_device_create_context_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; +} + +char * +xcb_selinux_get_device_create_context_context (const xcb_selinux_get_device_create_context_reply_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_selinux_get_device_create_context_context_length (const xcb_selinux_get_device_create_context_reply_t *R) +{ + return R->context_len; +} + +xcb_generic_iterator_t +xcb_selinux_get_device_create_context_context_end (const xcb_selinux_get_device_create_context_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->context_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_selinux_get_device_create_context_reply_t * +xcb_selinux_get_device_create_context_reply (xcb_connection_t *c, + xcb_selinux_get_device_create_context_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_selinux_get_device_create_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_selinux_set_device_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_selinux_set_device_context_request_t *_aux = (xcb_selinux_set_device_context_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_selinux_set_device_context_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* context */ + xcb_block_len += _aux->context_len * sizeof(char); + 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_selinux_set_device_context_checked (xcb_connection_t *c, + uint32_t device, + uint32_t context_len, + const char *context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_SET_DEVICE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_selinux_set_device_context_request_t xcb_out; + + xcb_out.device = device; + xcb_out.context_len = context_len; + + 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 context */ + xcb_parts[4].iov_base = (char *) context; + xcb_parts[4].iov_len = context_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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_selinux_set_device_context (xcb_connection_t *c, + uint32_t device, + uint32_t context_len, + const char *context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_SET_DEVICE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_selinux_set_device_context_request_t xcb_out; + + xcb_out.device = device; + xcb_out.context_len = context_len; + + 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 context */ + xcb_parts[4].iov_base = (char *) context; + xcb_parts[4].iov_len = context_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; +} + +char * +xcb_selinux_set_device_context_context (const xcb_selinux_set_device_context_request_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_selinux_set_device_context_context_length (const xcb_selinux_set_device_context_request_t *R) +{ + return R->context_len; +} + +xcb_generic_iterator_t +xcb_selinux_set_device_context_context_end (const xcb_selinux_set_device_context_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->context_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_selinux_get_device_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_selinux_get_device_context_reply_t *_aux = (xcb_selinux_get_device_context_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_selinux_get_device_context_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* context */ + xcb_block_len += _aux->context_len * sizeof(char); + 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_selinux_get_device_context_cookie_t +xcb_selinux_get_device_context (xcb_connection_t *c, + uint32_t device) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_DEVICE_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_device_context_cookie_t xcb_ret; + xcb_selinux_get_device_context_request_t xcb_out; + + xcb_out.device = device; + + 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_selinux_get_device_context_cookie_t +xcb_selinux_get_device_context_unchecked (xcb_connection_t *c, + uint32_t device) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_DEVICE_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_device_context_cookie_t xcb_ret; + xcb_selinux_get_device_context_request_t xcb_out; + + xcb_out.device = device; + + 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; +} + +char * +xcb_selinux_get_device_context_context (const xcb_selinux_get_device_context_reply_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_selinux_get_device_context_context_length (const xcb_selinux_get_device_context_reply_t *R) +{ + return R->context_len; +} + +xcb_generic_iterator_t +xcb_selinux_get_device_context_context_end (const xcb_selinux_get_device_context_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->context_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_selinux_get_device_context_reply_t * +xcb_selinux_get_device_context_reply (xcb_connection_t *c, + xcb_selinux_get_device_context_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_selinux_get_device_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_selinux_set_window_create_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_selinux_set_window_create_context_request_t *_aux = (xcb_selinux_set_window_create_context_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_selinux_set_window_create_context_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* context */ + xcb_block_len += _aux->context_len * sizeof(char); + 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_selinux_set_window_create_context_checked (xcb_connection_t *c, + uint32_t context_len, + const char *context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_SET_WINDOW_CREATE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_selinux_set_window_create_context_request_t xcb_out; + + xcb_out.context_len = context_len; + + 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 context */ + xcb_parts[4].iov_base = (char *) context; + xcb_parts[4].iov_len = context_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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_selinux_set_window_create_context (xcb_connection_t *c, + uint32_t context_len, + const char *context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_SET_WINDOW_CREATE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_selinux_set_window_create_context_request_t xcb_out; + + xcb_out.context_len = context_len; + + 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 context */ + xcb_parts[4].iov_base = (char *) context; + xcb_parts[4].iov_len = context_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; +} + +char * +xcb_selinux_set_window_create_context_context (const xcb_selinux_set_window_create_context_request_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_selinux_set_window_create_context_context_length (const xcb_selinux_set_window_create_context_request_t *R) +{ + return R->context_len; +} + +xcb_generic_iterator_t +xcb_selinux_set_window_create_context_context_end (const xcb_selinux_set_window_create_context_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->context_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_selinux_get_window_create_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_selinux_get_window_create_context_reply_t *_aux = (xcb_selinux_get_window_create_context_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_selinux_get_window_create_context_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* context */ + xcb_block_len += _aux->context_len * sizeof(char); + 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_selinux_get_window_create_context_cookie_t +xcb_selinux_get_window_create_context (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_WINDOW_CREATE_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_window_create_context_cookie_t xcb_ret; + xcb_selinux_get_window_create_context_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_selinux_get_window_create_context_cookie_t +xcb_selinux_get_window_create_context_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_WINDOW_CREATE_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_window_create_context_cookie_t xcb_ret; + xcb_selinux_get_window_create_context_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; +} + +char * +xcb_selinux_get_window_create_context_context (const xcb_selinux_get_window_create_context_reply_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_selinux_get_window_create_context_context_length (const xcb_selinux_get_window_create_context_reply_t *R) +{ + return R->context_len; +} + +xcb_generic_iterator_t +xcb_selinux_get_window_create_context_context_end (const xcb_selinux_get_window_create_context_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->context_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_selinux_get_window_create_context_reply_t * +xcb_selinux_get_window_create_context_reply (xcb_connection_t *c, + xcb_selinux_get_window_create_context_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_selinux_get_window_create_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_selinux_get_window_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_selinux_get_window_context_reply_t *_aux = (xcb_selinux_get_window_context_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_selinux_get_window_context_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* context */ + xcb_block_len += _aux->context_len * sizeof(char); + 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_selinux_get_window_context_cookie_t +xcb_selinux_get_window_context (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_WINDOW_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_window_context_cookie_t xcb_ret; + xcb_selinux_get_window_context_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_selinux_get_window_context_cookie_t +xcb_selinux_get_window_context_unchecked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_WINDOW_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_window_context_cookie_t xcb_ret; + xcb_selinux_get_window_context_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; +} + +char * +xcb_selinux_get_window_context_context (const xcb_selinux_get_window_context_reply_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_selinux_get_window_context_context_length (const xcb_selinux_get_window_context_reply_t *R) +{ + return R->context_len; +} + +xcb_generic_iterator_t +xcb_selinux_get_window_context_context_end (const xcb_selinux_get_window_context_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->context_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_selinux_get_window_context_reply_t * +xcb_selinux_get_window_context_reply (xcb_connection_t *c, + xcb_selinux_get_window_context_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_selinux_get_window_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_selinux_list_item_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_selinux_list_item_t *_aux = (xcb_selinux_list_item_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_selinux_list_item_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* object_context */ + xcb_block_len += _aux->object_context_len * sizeof(char); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(char); + xcb_align_to = 4; + /* 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; + /* 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; + /* data_context */ + xcb_block_len += _aux->data_context_len * sizeof(char); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(char); + xcb_align_to = 4; + /* 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; + /* 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; +} + +char * +xcb_selinux_list_item_object_context (const xcb_selinux_list_item_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_selinux_list_item_object_context_length (const xcb_selinux_list_item_t *R) +{ + return R->object_context_len; +} + +xcb_generic_iterator_t +xcb_selinux_list_item_object_context_end (const xcb_selinux_list_item_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->object_context_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +char * +xcb_selinux_list_item_data_context (const xcb_selinux_list_item_t *R) +{ + xcb_generic_iterator_t prev = xcb_selinux_list_item_object_context_end(R); + return (char *) ((char *) prev.data + ((-prev.index) & (4 - 1)) + 0); +} + +int +xcb_selinux_list_item_data_context_length (const xcb_selinux_list_item_t *R) +{ + return R->data_context_len; +} + +xcb_generic_iterator_t +xcb_selinux_list_item_data_context_end (const xcb_selinux_list_item_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_selinux_list_item_object_context_end(R); + i.data = ((char *) ((char*) prev.data + ((-prev.index) & (4 - 1)))) + (R->data_context_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_selinux_list_item_next (xcb_selinux_list_item_iterator_t *i) +{ + xcb_selinux_list_item_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_selinux_list_item_t *)(((char *)R) + xcb_selinux_list_item_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_selinux_list_item_t *) child.data; +} + +xcb_generic_iterator_t +xcb_selinux_list_item_end (xcb_selinux_list_item_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_selinux_list_item_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_selinux_set_property_create_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_selinux_set_property_create_context_request_t *_aux = (xcb_selinux_set_property_create_context_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_selinux_set_property_create_context_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* context */ + xcb_block_len += _aux->context_len * sizeof(char); + 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_selinux_set_property_create_context_checked (xcb_connection_t *c, + uint32_t context_len, + const char *context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_SET_PROPERTY_CREATE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_selinux_set_property_create_context_request_t xcb_out; + + xcb_out.context_len = context_len; + + 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 context */ + xcb_parts[4].iov_base = (char *) context; + xcb_parts[4].iov_len = context_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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_selinux_set_property_create_context (xcb_connection_t *c, + uint32_t context_len, + const char *context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_SET_PROPERTY_CREATE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_selinux_set_property_create_context_request_t xcb_out; + + xcb_out.context_len = context_len; + + 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 context */ + xcb_parts[4].iov_base = (char *) context; + xcb_parts[4].iov_len = context_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; +} + +char * +xcb_selinux_set_property_create_context_context (const xcb_selinux_set_property_create_context_request_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_selinux_set_property_create_context_context_length (const xcb_selinux_set_property_create_context_request_t *R) +{ + return R->context_len; +} + +xcb_generic_iterator_t +xcb_selinux_set_property_create_context_context_end (const xcb_selinux_set_property_create_context_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->context_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_selinux_get_property_create_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_selinux_get_property_create_context_reply_t *_aux = (xcb_selinux_get_property_create_context_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_selinux_get_property_create_context_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* context */ + xcb_block_len += _aux->context_len * sizeof(char); + 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_selinux_get_property_create_context_cookie_t +xcb_selinux_get_property_create_context (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_PROPERTY_CREATE_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_property_create_context_cookie_t xcb_ret; + xcb_selinux_get_property_create_context_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_selinux_get_property_create_context_cookie_t +xcb_selinux_get_property_create_context_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_PROPERTY_CREATE_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_property_create_context_cookie_t xcb_ret; + xcb_selinux_get_property_create_context_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; +} + +char * +xcb_selinux_get_property_create_context_context (const xcb_selinux_get_property_create_context_reply_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_selinux_get_property_create_context_context_length (const xcb_selinux_get_property_create_context_reply_t *R) +{ + return R->context_len; +} + +xcb_generic_iterator_t +xcb_selinux_get_property_create_context_context_end (const xcb_selinux_get_property_create_context_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->context_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_selinux_get_property_create_context_reply_t * +xcb_selinux_get_property_create_context_reply (xcb_connection_t *c, + xcb_selinux_get_property_create_context_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_selinux_get_property_create_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_selinux_set_property_use_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_selinux_set_property_use_context_request_t *_aux = (xcb_selinux_set_property_use_context_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_selinux_set_property_use_context_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* context */ + xcb_block_len += _aux->context_len * sizeof(char); + 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_selinux_set_property_use_context_checked (xcb_connection_t *c, + uint32_t context_len, + const char *context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_SET_PROPERTY_USE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_selinux_set_property_use_context_request_t xcb_out; + + xcb_out.context_len = context_len; + + 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 context */ + xcb_parts[4].iov_base = (char *) context; + xcb_parts[4].iov_len = context_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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_selinux_set_property_use_context (xcb_connection_t *c, + uint32_t context_len, + const char *context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_SET_PROPERTY_USE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_selinux_set_property_use_context_request_t xcb_out; + + xcb_out.context_len = context_len; + + 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 context */ + xcb_parts[4].iov_base = (char *) context; + xcb_parts[4].iov_len = context_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; +} + +char * +xcb_selinux_set_property_use_context_context (const xcb_selinux_set_property_use_context_request_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_selinux_set_property_use_context_context_length (const xcb_selinux_set_property_use_context_request_t *R) +{ + return R->context_len; +} + +xcb_generic_iterator_t +xcb_selinux_set_property_use_context_context_end (const xcb_selinux_set_property_use_context_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->context_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_selinux_get_property_use_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_selinux_get_property_use_context_reply_t *_aux = (xcb_selinux_get_property_use_context_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_selinux_get_property_use_context_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* context */ + xcb_block_len += _aux->context_len * sizeof(char); + 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_selinux_get_property_use_context_cookie_t +xcb_selinux_get_property_use_context (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_PROPERTY_USE_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_property_use_context_cookie_t xcb_ret; + xcb_selinux_get_property_use_context_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_selinux_get_property_use_context_cookie_t +xcb_selinux_get_property_use_context_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_PROPERTY_USE_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_property_use_context_cookie_t xcb_ret; + xcb_selinux_get_property_use_context_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; +} + +char * +xcb_selinux_get_property_use_context_context (const xcb_selinux_get_property_use_context_reply_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_selinux_get_property_use_context_context_length (const xcb_selinux_get_property_use_context_reply_t *R) +{ + return R->context_len; +} + +xcb_generic_iterator_t +xcb_selinux_get_property_use_context_context_end (const xcb_selinux_get_property_use_context_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->context_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_selinux_get_property_use_context_reply_t * +xcb_selinux_get_property_use_context_reply (xcb_connection_t *c, + xcb_selinux_get_property_use_context_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_selinux_get_property_use_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_selinux_get_property_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_selinux_get_property_context_reply_t *_aux = (xcb_selinux_get_property_context_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_selinux_get_property_context_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* context */ + xcb_block_len += _aux->context_len * sizeof(char); + 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_selinux_get_property_context_cookie_t +xcb_selinux_get_property_context (xcb_connection_t *c, + xcb_window_t window, + xcb_atom_t property) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_PROPERTY_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_property_context_cookie_t xcb_ret; + xcb_selinux_get_property_context_request_t xcb_out; + + xcb_out.window = window; + xcb_out.property = property; + + 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_selinux_get_property_context_cookie_t +xcb_selinux_get_property_context_unchecked (xcb_connection_t *c, + xcb_window_t window, + xcb_atom_t property) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_PROPERTY_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_property_context_cookie_t xcb_ret; + xcb_selinux_get_property_context_request_t xcb_out; + + xcb_out.window = window; + xcb_out.property = property; + + 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; +} + +char * +xcb_selinux_get_property_context_context (const xcb_selinux_get_property_context_reply_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_selinux_get_property_context_context_length (const xcb_selinux_get_property_context_reply_t *R) +{ + return R->context_len; +} + +xcb_generic_iterator_t +xcb_selinux_get_property_context_context_end (const xcb_selinux_get_property_context_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->context_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_selinux_get_property_context_reply_t * +xcb_selinux_get_property_context_reply (xcb_connection_t *c, + xcb_selinux_get_property_context_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_selinux_get_property_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_selinux_get_property_data_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_selinux_get_property_data_context_reply_t *_aux = (xcb_selinux_get_property_data_context_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_selinux_get_property_data_context_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* context */ + xcb_block_len += _aux->context_len * sizeof(char); + 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_selinux_get_property_data_context_cookie_t +xcb_selinux_get_property_data_context (xcb_connection_t *c, + xcb_window_t window, + xcb_atom_t property) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_PROPERTY_DATA_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_property_data_context_cookie_t xcb_ret; + xcb_selinux_get_property_data_context_request_t xcb_out; + + xcb_out.window = window; + xcb_out.property = property; + + 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_selinux_get_property_data_context_cookie_t +xcb_selinux_get_property_data_context_unchecked (xcb_connection_t *c, + xcb_window_t window, + xcb_atom_t property) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_PROPERTY_DATA_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_property_data_context_cookie_t xcb_ret; + xcb_selinux_get_property_data_context_request_t xcb_out; + + xcb_out.window = window; + xcb_out.property = property; + + 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; +} + +char * +xcb_selinux_get_property_data_context_context (const xcb_selinux_get_property_data_context_reply_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_selinux_get_property_data_context_context_length (const xcb_selinux_get_property_data_context_reply_t *R) +{ + return R->context_len; +} + +xcb_generic_iterator_t +xcb_selinux_get_property_data_context_context_end (const xcb_selinux_get_property_data_context_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->context_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_selinux_get_property_data_context_reply_t * +xcb_selinux_get_property_data_context_reply (xcb_connection_t *c, + xcb_selinux_get_property_data_context_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_selinux_get_property_data_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_selinux_list_properties_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_selinux_list_properties_reply_t *_aux = (xcb_selinux_list_properties_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_selinux_list_properties_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* properties */ + for(i=0; i<_aux->properties_len; i++) { + xcb_tmp_len = xcb_selinux_list_item_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_selinux_list_item_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_selinux_list_properties_cookie_t +xcb_selinux_list_properties (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_LIST_PROPERTIES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_list_properties_cookie_t xcb_ret; + xcb_selinux_list_properties_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_selinux_list_properties_cookie_t +xcb_selinux_list_properties_unchecked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_LIST_PROPERTIES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_list_properties_cookie_t xcb_ret; + xcb_selinux_list_properties_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; +} + +int +xcb_selinux_list_properties_properties_length (const xcb_selinux_list_properties_reply_t *R) +{ + return R->properties_len; +} + +xcb_selinux_list_item_iterator_t +xcb_selinux_list_properties_properties_iterator (const xcb_selinux_list_properties_reply_t *R) +{ + xcb_selinux_list_item_iterator_t i; + i.data = (xcb_selinux_list_item_t *) (R + 1); + i.rem = R->properties_len; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_selinux_list_properties_reply_t * +xcb_selinux_list_properties_reply (xcb_connection_t *c, + xcb_selinux_list_properties_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_selinux_list_properties_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_selinux_set_selection_create_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_selinux_set_selection_create_context_request_t *_aux = (xcb_selinux_set_selection_create_context_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_selinux_set_selection_create_context_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* context */ + xcb_block_len += _aux->context_len * sizeof(char); + 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_selinux_set_selection_create_context_checked (xcb_connection_t *c, + uint32_t context_len, + const char *context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_SET_SELECTION_CREATE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_selinux_set_selection_create_context_request_t xcb_out; + + xcb_out.context_len = context_len; + + 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 context */ + xcb_parts[4].iov_base = (char *) context; + xcb_parts[4].iov_len = context_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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_selinux_set_selection_create_context (xcb_connection_t *c, + uint32_t context_len, + const char *context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_SET_SELECTION_CREATE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_selinux_set_selection_create_context_request_t xcb_out; + + xcb_out.context_len = context_len; + + 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 context */ + xcb_parts[4].iov_base = (char *) context; + xcb_parts[4].iov_len = context_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; +} + +char * +xcb_selinux_set_selection_create_context_context (const xcb_selinux_set_selection_create_context_request_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_selinux_set_selection_create_context_context_length (const xcb_selinux_set_selection_create_context_request_t *R) +{ + return R->context_len; +} + +xcb_generic_iterator_t +xcb_selinux_set_selection_create_context_context_end (const xcb_selinux_set_selection_create_context_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->context_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_selinux_get_selection_create_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_selinux_get_selection_create_context_reply_t *_aux = (xcb_selinux_get_selection_create_context_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_selinux_get_selection_create_context_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* context */ + xcb_block_len += _aux->context_len * sizeof(char); + 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_selinux_get_selection_create_context_cookie_t +xcb_selinux_get_selection_create_context (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_SELECTION_CREATE_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_selection_create_context_cookie_t xcb_ret; + xcb_selinux_get_selection_create_context_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_selinux_get_selection_create_context_cookie_t +xcb_selinux_get_selection_create_context_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_SELECTION_CREATE_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_selection_create_context_cookie_t xcb_ret; + xcb_selinux_get_selection_create_context_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; +} + +char * +xcb_selinux_get_selection_create_context_context (const xcb_selinux_get_selection_create_context_reply_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_selinux_get_selection_create_context_context_length (const xcb_selinux_get_selection_create_context_reply_t *R) +{ + return R->context_len; +} + +xcb_generic_iterator_t +xcb_selinux_get_selection_create_context_context_end (const xcb_selinux_get_selection_create_context_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->context_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_selinux_get_selection_create_context_reply_t * +xcb_selinux_get_selection_create_context_reply (xcb_connection_t *c, + xcb_selinux_get_selection_create_context_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_selinux_get_selection_create_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_selinux_set_selection_use_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_selinux_set_selection_use_context_request_t *_aux = (xcb_selinux_set_selection_use_context_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_selinux_set_selection_use_context_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* context */ + xcb_block_len += _aux->context_len * sizeof(char); + 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_selinux_set_selection_use_context_checked (xcb_connection_t *c, + uint32_t context_len, + const char *context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_SET_SELECTION_USE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_selinux_set_selection_use_context_request_t xcb_out; + + xcb_out.context_len = context_len; + + 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 context */ + xcb_parts[4].iov_base = (char *) context; + xcb_parts[4].iov_len = context_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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); + return xcb_ret; +} + +xcb_void_cookie_t +xcb_selinux_set_selection_use_context (xcb_connection_t *c, + uint32_t context_len, + const char *context) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_SET_SELECTION_USE_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_selinux_set_selection_use_context_request_t xcb_out; + + xcb_out.context_len = context_len; + + 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 context */ + xcb_parts[4].iov_base = (char *) context; + xcb_parts[4].iov_len = context_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; +} + +char * +xcb_selinux_set_selection_use_context_context (const xcb_selinux_set_selection_use_context_request_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_selinux_set_selection_use_context_context_length (const xcb_selinux_set_selection_use_context_request_t *R) +{ + return R->context_len; +} + +xcb_generic_iterator_t +xcb_selinux_set_selection_use_context_context_end (const xcb_selinux_set_selection_use_context_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->context_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +int +xcb_selinux_get_selection_use_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_selinux_get_selection_use_context_reply_t *_aux = (xcb_selinux_get_selection_use_context_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_selinux_get_selection_use_context_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* context */ + xcb_block_len += _aux->context_len * sizeof(char); + 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_selinux_get_selection_use_context_cookie_t +xcb_selinux_get_selection_use_context (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_SELECTION_USE_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_selection_use_context_cookie_t xcb_ret; + xcb_selinux_get_selection_use_context_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_selinux_get_selection_use_context_cookie_t +xcb_selinux_get_selection_use_context_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_SELECTION_USE_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_selection_use_context_cookie_t xcb_ret; + xcb_selinux_get_selection_use_context_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; +} + +char * +xcb_selinux_get_selection_use_context_context (const xcb_selinux_get_selection_use_context_reply_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_selinux_get_selection_use_context_context_length (const xcb_selinux_get_selection_use_context_reply_t *R) +{ + return R->context_len; +} + +xcb_generic_iterator_t +xcb_selinux_get_selection_use_context_context_end (const xcb_selinux_get_selection_use_context_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->context_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_selinux_get_selection_use_context_reply_t * +xcb_selinux_get_selection_use_context_reply (xcb_connection_t *c, + xcb_selinux_get_selection_use_context_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_selinux_get_selection_use_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_selinux_get_selection_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_selinux_get_selection_context_reply_t *_aux = (xcb_selinux_get_selection_context_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_selinux_get_selection_context_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* context */ + xcb_block_len += _aux->context_len * sizeof(char); + 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_selinux_get_selection_context_cookie_t +xcb_selinux_get_selection_context (xcb_connection_t *c, + xcb_atom_t selection) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_SELECTION_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_selection_context_cookie_t xcb_ret; + xcb_selinux_get_selection_context_request_t xcb_out; + + xcb_out.selection = selection; + + 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_selinux_get_selection_context_cookie_t +xcb_selinux_get_selection_context_unchecked (xcb_connection_t *c, + xcb_atom_t selection) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_SELECTION_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_selection_context_cookie_t xcb_ret; + xcb_selinux_get_selection_context_request_t xcb_out; + + xcb_out.selection = selection; + + 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; +} + +char * +xcb_selinux_get_selection_context_context (const xcb_selinux_get_selection_context_reply_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_selinux_get_selection_context_context_length (const xcb_selinux_get_selection_context_reply_t *R) +{ + return R->context_len; +} + +xcb_generic_iterator_t +xcb_selinux_get_selection_context_context_end (const xcb_selinux_get_selection_context_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->context_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_selinux_get_selection_context_reply_t * +xcb_selinux_get_selection_context_reply (xcb_connection_t *c, + xcb_selinux_get_selection_context_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_selinux_get_selection_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_selinux_get_selection_data_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_selinux_get_selection_data_context_reply_t *_aux = (xcb_selinux_get_selection_data_context_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_selinux_get_selection_data_context_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* context */ + xcb_block_len += _aux->context_len * sizeof(char); + 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_selinux_get_selection_data_context_cookie_t +xcb_selinux_get_selection_data_context (xcb_connection_t *c, + xcb_atom_t selection) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_SELECTION_DATA_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_selection_data_context_cookie_t xcb_ret; + xcb_selinux_get_selection_data_context_request_t xcb_out; + + xcb_out.selection = selection; + + 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_selinux_get_selection_data_context_cookie_t +xcb_selinux_get_selection_data_context_unchecked (xcb_connection_t *c, + xcb_atom_t selection) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_SELECTION_DATA_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_selection_data_context_cookie_t xcb_ret; + xcb_selinux_get_selection_data_context_request_t xcb_out; + + xcb_out.selection = selection; + + 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; +} + +char * +xcb_selinux_get_selection_data_context_context (const xcb_selinux_get_selection_data_context_reply_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_selinux_get_selection_data_context_context_length (const xcb_selinux_get_selection_data_context_reply_t *R) +{ + return R->context_len; +} + +xcb_generic_iterator_t +xcb_selinux_get_selection_data_context_context_end (const xcb_selinux_get_selection_data_context_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->context_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_selinux_get_selection_data_context_reply_t * +xcb_selinux_get_selection_data_context_reply (xcb_connection_t *c, + xcb_selinux_get_selection_data_context_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_selinux_get_selection_data_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_selinux_list_selections_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_selinux_list_selections_reply_t *_aux = (xcb_selinux_list_selections_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_selinux_list_selections_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* selections */ + for(i=0; i<_aux->selections_len; i++) { + xcb_tmp_len = xcb_selinux_list_item_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_selinux_list_item_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_selinux_list_selections_cookie_t +xcb_selinux_list_selections (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_LIST_SELECTIONS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_list_selections_cookie_t xcb_ret; + xcb_selinux_list_selections_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_selinux_list_selections_cookie_t +xcb_selinux_list_selections_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_LIST_SELECTIONS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_list_selections_cookie_t xcb_ret; + xcb_selinux_list_selections_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; +} + +int +xcb_selinux_list_selections_selections_length (const xcb_selinux_list_selections_reply_t *R) +{ + return R->selections_len; +} + +xcb_selinux_list_item_iterator_t +xcb_selinux_list_selections_selections_iterator (const xcb_selinux_list_selections_reply_t *R) +{ + xcb_selinux_list_item_iterator_t i; + i.data = (xcb_selinux_list_item_t *) (R + 1); + i.rem = R->selections_len; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_selinux_list_selections_reply_t * +xcb_selinux_list_selections_reply (xcb_connection_t *c, + xcb_selinux_list_selections_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_selinux_list_selections_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_selinux_get_client_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_selinux_get_client_context_reply_t *_aux = (xcb_selinux_get_client_context_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_selinux_get_client_context_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* context */ + xcb_block_len += _aux->context_len * sizeof(char); + 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_selinux_get_client_context_cookie_t +xcb_selinux_get_client_context (xcb_connection_t *c, + uint32_t resource) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_CLIENT_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_client_context_cookie_t xcb_ret; + xcb_selinux_get_client_context_request_t xcb_out; + + xcb_out.resource = resource; + + 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_selinux_get_client_context_cookie_t +xcb_selinux_get_client_context_unchecked (xcb_connection_t *c, + uint32_t resource) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_selinux_id, + .opcode = XCB_SELINUX_GET_CLIENT_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_selinux_get_client_context_cookie_t xcb_ret; + xcb_selinux_get_client_context_request_t xcb_out; + + xcb_out.resource = resource; + + 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; +} + +char * +xcb_selinux_get_client_context_context (const xcb_selinux_get_client_context_reply_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_selinux_get_client_context_context_length (const xcb_selinux_get_client_context_reply_t *R) +{ + return R->context_len; +} + +xcb_generic_iterator_t +xcb_selinux_get_client_context_context_end (const xcb_selinux_get_client_context_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->context_len); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_selinux_get_client_context_reply_t * +xcb_selinux_get_client_context_reply (xcb_connection_t *c, + xcb_selinux_get_client_context_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_selinux_get_client_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + diff --git a/depends/libxcb/src/xtest.c b/depends/libxcb/src/xtest.c new file mode 100644 index 0000000..1dd5ff6 --- /dev/null +++ b/depends/libxcb/src/xtest.c @@ -0,0 +1,286 @@ +/* + * This file generated automatically from xtest.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "xtest.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) +#include "xproto.h" + +xcb_extension_t xcb_test_id = { "XTEST", 0 }; + +xcb_test_get_version_cookie_t +xcb_test_get_version (xcb_connection_t *c, + uint8_t major_version, + uint16_t minor_version) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_test_id, + .opcode = XCB_TEST_GET_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_test_get_version_cookie_t xcb_ret; + xcb_test_get_version_request_t xcb_out; + + xcb_out.major_version = major_version; + xcb_out.pad0 = 0; + 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_test_get_version_cookie_t +xcb_test_get_version_unchecked (xcb_connection_t *c, + uint8_t major_version, + uint16_t minor_version) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_test_id, + .opcode = XCB_TEST_GET_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_test_get_version_cookie_t xcb_ret; + xcb_test_get_version_request_t xcb_out; + + xcb_out.major_version = major_version; + xcb_out.pad0 = 0; + 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_test_get_version_reply_t * +xcb_test_get_version_reply (xcb_connection_t *c, + xcb_test_get_version_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_test_get_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_test_compare_cursor_cookie_t +xcb_test_compare_cursor (xcb_connection_t *c, + xcb_window_t window, + xcb_cursor_t cursor) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_test_id, + .opcode = XCB_TEST_COMPARE_CURSOR, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_test_compare_cursor_cookie_t xcb_ret; + xcb_test_compare_cursor_request_t xcb_out; + + xcb_out.window = window; + xcb_out.cursor = cursor; + + 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_test_compare_cursor_cookie_t +xcb_test_compare_cursor_unchecked (xcb_connection_t *c, + xcb_window_t window, + xcb_cursor_t cursor) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_test_id, + .opcode = XCB_TEST_COMPARE_CURSOR, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_test_compare_cursor_cookie_t xcb_ret; + xcb_test_compare_cursor_request_t xcb_out; + + xcb_out.window = window; + xcb_out.cursor = cursor; + + 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_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); +} + +xcb_void_cookie_t +xcb_test_fake_input_checked (xcb_connection_t *c, + uint8_t type, + uint8_t detail, + uint32_t time, + xcb_window_t root, + int16_t rootX, + int16_t rootY, + uint8_t deviceid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_test_id, + .opcode = XCB_TEST_FAKE_INPUT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_test_fake_input_request_t xcb_out; + + xcb_out.type = type; + xcb_out.detail = detail; + memset(xcb_out.pad0, 0, 2); + xcb_out.time = time; + xcb_out.root = root; + memset(xcb_out.pad1, 0, 8); + xcb_out.rootX = rootX; + xcb_out.rootY = rootY; + memset(xcb_out.pad2, 0, 7); + xcb_out.deviceid = deviceid; + + 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_test_fake_input (xcb_connection_t *c, + uint8_t type, + uint8_t detail, + uint32_t time, + xcb_window_t root, + int16_t rootX, + int16_t rootY, + uint8_t deviceid) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_test_id, + .opcode = XCB_TEST_FAKE_INPUT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_test_fake_input_request_t xcb_out; + + xcb_out.type = type; + xcb_out.detail = detail; + memset(xcb_out.pad0, 0, 2); + xcb_out.time = time; + xcb_out.root = root; + memset(xcb_out.pad1, 0, 8); + xcb_out.rootX = rootX; + xcb_out.rootY = rootY; + memset(xcb_out.pad2, 0, 7); + xcb_out.deviceid = deviceid; + + 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_test_grab_control_checked (xcb_connection_t *c, + uint8_t impervious) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_test_id, + .opcode = XCB_TEST_GRAB_CONTROL, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_test_grab_control_request_t xcb_out; + + xcb_out.impervious = impervious; + 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_test_grab_control (xcb_connection_t *c, + uint8_t impervious) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_test_id, + .opcode = XCB_TEST_GRAB_CONTROL, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_test_grab_control_request_t xcb_out; + + xcb_out.impervious = impervious; + 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; +} + diff --git a/depends/libxcb/src/xv.c b/depends/libxcb/src/xv.c new file mode 100644 index 0000000..8213803 --- /dev/null +++ b/depends/libxcb/src/xv.c @@ -0,0 +1,2371 @@ +/* + * This file generated automatically from xv.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "xv.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) +#include "xproto.h" +#include "shm.h" + +xcb_extension_t xcb_xv_id = { "XVideo", 0 }; + +void +xcb_xv_port_next (xcb_xv_port_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xv_port_t); +} + +xcb_generic_iterator_t +xcb_xv_port_end (xcb_xv_port_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; +} + +void +xcb_xv_encoding_next (xcb_xv_encoding_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xv_encoding_t); +} + +xcb_generic_iterator_t +xcb_xv_encoding_end (xcb_xv_encoding_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; +} + +void +xcb_xv_rational_next (xcb_xv_rational_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xv_rational_t); +} + +xcb_generic_iterator_t +xcb_xv_rational_end (xcb_xv_rational_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; +} + +void +xcb_xv_format_next (xcb_xv_format_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xv_format_t); +} + +xcb_generic_iterator_t +xcb_xv_format_end (xcb_xv_format_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; +} + +int +xcb_xv_adaptor_info_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xv_adaptor_info_t *_aux = (xcb_xv_adaptor_info_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_xv_adaptor_info_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* name */ + xcb_block_len += _aux->name_size * sizeof(char); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(char); + xcb_align_to = 4; + /* 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; + /* 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; + /* formats */ + xcb_block_len += _aux->num_formats * sizeof(xcb_xv_format_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xv_format_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; +} + +char * +xcb_xv_adaptor_info_name (const xcb_xv_adaptor_info_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_xv_adaptor_info_name_length (const xcb_xv_adaptor_info_t *R) +{ + return R->name_size; +} + +xcb_generic_iterator_t +xcb_xv_adaptor_info_name_end (const xcb_xv_adaptor_info_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->name_size); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xv_format_t * +xcb_xv_adaptor_info_formats (const xcb_xv_adaptor_info_t *R) +{ + xcb_generic_iterator_t prev = xcb_xv_adaptor_info_name_end(R); + return (xcb_xv_format_t *) ((char *) prev.data + ((-prev.index) & (4 - 1)) + 0); +} + +int +xcb_xv_adaptor_info_formats_length (const xcb_xv_adaptor_info_t *R) +{ + return R->num_formats; +} + +xcb_xv_format_iterator_t +xcb_xv_adaptor_info_formats_iterator (const xcb_xv_adaptor_info_t *R) +{ + xcb_xv_format_iterator_t i; + xcb_generic_iterator_t prev = xcb_xv_adaptor_info_name_end(R); + i.data = (xcb_xv_format_t *) ((char *) prev.data + ((-prev.index) & (4 - 1))); + i.rem = R->num_formats; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_xv_adaptor_info_next (xcb_xv_adaptor_info_iterator_t *i) +{ + xcb_xv_adaptor_info_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_xv_adaptor_info_t *)(((char *)R) + xcb_xv_adaptor_info_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_xv_adaptor_info_t *) child.data; +} + +xcb_generic_iterator_t +xcb_xv_adaptor_info_end (xcb_xv_adaptor_info_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_xv_adaptor_info_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_xv_encoding_info_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xv_encoding_info_t *_aux = (xcb_xv_encoding_info_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_xv_encoding_info_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* name */ + xcb_block_len += _aux->name_size * sizeof(char); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(char); + xcb_align_to = 4; + /* 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; + /* 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; +} + +char * +xcb_xv_encoding_info_name (const xcb_xv_encoding_info_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_xv_encoding_info_name_length (const xcb_xv_encoding_info_t *R) +{ + return R->name_size; +} + +xcb_generic_iterator_t +xcb_xv_encoding_info_name_end (const xcb_xv_encoding_info_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->name_size); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_xv_encoding_info_next (xcb_xv_encoding_info_iterator_t *i) +{ + xcb_xv_encoding_info_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_xv_encoding_info_t *)(((char *)R) + xcb_xv_encoding_info_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_xv_encoding_info_t *) child.data; +} + +xcb_generic_iterator_t +xcb_xv_encoding_info_end (xcb_xv_encoding_info_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_xv_encoding_info_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_xv_image_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xv_image_t *_aux = (xcb_xv_image_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_xv_image_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* pitches */ + xcb_block_len += _aux->num_planes * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* offsets */ + xcb_block_len += _aux->num_planes * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* data */ + xcb_block_len += _aux->data_size * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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; +} + +uint32_t * +xcb_xv_image_pitches (const xcb_xv_image_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_xv_image_pitches_length (const xcb_xv_image_t *R) +{ + return R->num_planes; +} + +xcb_generic_iterator_t +xcb_xv_image_pitches_end (const xcb_xv_image_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->num_planes); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +uint32_t * +xcb_xv_image_offsets (const xcb_xv_image_t *R) +{ + xcb_generic_iterator_t prev = xcb_xv_image_pitches_end(R); + return (uint32_t *) ((char *) prev.data + XCB_TYPE_PAD(uint32_t, prev.index) + 0); +} + +int +xcb_xv_image_offsets_length (const xcb_xv_image_t *R) +{ + return R->num_planes; +} + +xcb_generic_iterator_t +xcb_xv_image_offsets_end (const xcb_xv_image_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_xv_image_pitches_end(R); + i.data = ((uint32_t *) ((char*) prev.data + XCB_TYPE_PAD(uint32_t, prev.index))) + (R->num_planes); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +uint8_t * +xcb_xv_image_data (const xcb_xv_image_t *R) +{ + xcb_generic_iterator_t prev = xcb_xv_image_offsets_end(R); + return (uint8_t *) ((char *) prev.data + XCB_TYPE_PAD(uint8_t, prev.index) + 0); +} + +int +xcb_xv_image_data_length (const xcb_xv_image_t *R) +{ + return R->data_size; +} + +xcb_generic_iterator_t +xcb_xv_image_data_end (const xcb_xv_image_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_xv_image_offsets_end(R); + i.data = ((uint8_t *) ((char*) prev.data + XCB_TYPE_PAD(uint8_t, prev.index))) + (R->data_size); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_xv_image_next (xcb_xv_image_iterator_t *i) +{ + xcb_xv_image_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_xv_image_t *)(((char *)R) + xcb_xv_image_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_xv_image_t *) child.data; +} + +xcb_generic_iterator_t +xcb_xv_image_end (xcb_xv_image_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_xv_image_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +int +xcb_xv_attribute_info_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xv_attribute_info_t *_aux = (xcb_xv_attribute_info_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_xv_attribute_info_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* name */ + xcb_block_len += _aux->size * sizeof(char); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(char); + xcb_align_to = 4; + /* 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; + /* 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; +} + +char * +xcb_xv_attribute_info_name (const xcb_xv_attribute_info_t *R) +{ + return (char *) (R + 1); +} + +int +xcb_xv_attribute_info_name_length (const xcb_xv_attribute_info_t *R) +{ + return R->size; +} + +xcb_generic_iterator_t +xcb_xv_attribute_info_name_end (const xcb_xv_attribute_info_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((char *) (R + 1)) + (R->size); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +void +xcb_xv_attribute_info_next (xcb_xv_attribute_info_iterator_t *i) +{ + xcb_xv_attribute_info_t *R = i->data; + xcb_generic_iterator_t child; + child.data = (xcb_xv_attribute_info_t *)(((char *)R) + xcb_xv_attribute_info_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; + --i->rem; + i->data = (xcb_xv_attribute_info_t *) child.data; +} + +xcb_generic_iterator_t +xcb_xv_attribute_info_end (xcb_xv_attribute_info_iterator_t i) +{ + xcb_generic_iterator_t ret; + while(i.rem > 0) + xcb_xv_attribute_info_next(&i); + ret.data = i.data; + ret.rem = i.rem; + ret.index = i.index; + return ret; +} + +void +xcb_xv_image_format_info_next (xcb_xv_image_format_info_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xv_image_format_info_t); +} + +xcb_generic_iterator_t +xcb_xv_image_format_info_end (xcb_xv_image_format_info_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_xv_query_extension_cookie_t +xcb_xv_query_extension (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_QUERY_EXTENSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xv_query_extension_cookie_t xcb_ret; + xcb_xv_query_extension_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_xv_query_extension_cookie_t +xcb_xv_query_extension_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_QUERY_EXTENSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xv_query_extension_cookie_t xcb_ret; + xcb_xv_query_extension_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_xv_query_extension_reply_t * +xcb_xv_query_extension_reply (xcb_connection_t *c, + xcb_xv_query_extension_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xv_query_extension_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_xv_query_adaptors_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xv_query_adaptors_reply_t *_aux = (xcb_xv_query_adaptors_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_xv_query_adaptors_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* info */ + for(i=0; i<_aux->num_adaptors; i++) { + xcb_tmp_len = xcb_xv_adaptor_info_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xv_adaptor_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_xv_query_adaptors_cookie_t +xcb_xv_query_adaptors (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_QUERY_ADAPTORS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xv_query_adaptors_cookie_t xcb_ret; + xcb_xv_query_adaptors_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_xv_query_adaptors_cookie_t +xcb_xv_query_adaptors_unchecked (xcb_connection_t *c, + xcb_window_t window) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_QUERY_ADAPTORS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xv_query_adaptors_cookie_t xcb_ret; + xcb_xv_query_adaptors_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; +} + +int +xcb_xv_query_adaptors_info_length (const xcb_xv_query_adaptors_reply_t *R) +{ + return R->num_adaptors; +} + +xcb_xv_adaptor_info_iterator_t +xcb_xv_query_adaptors_info_iterator (const xcb_xv_query_adaptors_reply_t *R) +{ + xcb_xv_adaptor_info_iterator_t i; + i.data = (xcb_xv_adaptor_info_t *) (R + 1); + i.rem = R->num_adaptors; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xv_query_adaptors_reply_t * +xcb_xv_query_adaptors_reply (xcb_connection_t *c, + xcb_xv_query_adaptors_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xv_query_adaptors_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_xv_query_encodings_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xv_query_encodings_reply_t *_aux = (xcb_xv_query_encodings_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_xv_query_encodings_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* info */ + for(i=0; i<_aux->num_encodings; i++) { + xcb_tmp_len = xcb_xv_encoding_info_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xv_encoding_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_xv_query_encodings_cookie_t +xcb_xv_query_encodings (xcb_connection_t *c, + xcb_xv_port_t port) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_QUERY_ENCODINGS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xv_query_encodings_cookie_t xcb_ret; + xcb_xv_query_encodings_request_t xcb_out; + + xcb_out.port = port; + + 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_xv_query_encodings_cookie_t +xcb_xv_query_encodings_unchecked (xcb_connection_t *c, + xcb_xv_port_t port) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_QUERY_ENCODINGS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xv_query_encodings_cookie_t xcb_ret; + xcb_xv_query_encodings_request_t xcb_out; + + xcb_out.port = port; + + 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_xv_query_encodings_info_length (const xcb_xv_query_encodings_reply_t *R) +{ + return R->num_encodings; +} + +xcb_xv_encoding_info_iterator_t +xcb_xv_query_encodings_info_iterator (const xcb_xv_query_encodings_reply_t *R) +{ + xcb_xv_encoding_info_iterator_t i; + i.data = (xcb_xv_encoding_info_t *) (R + 1); + i.rem = R->num_encodings; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xv_query_encodings_reply_t * +xcb_xv_query_encodings_reply (xcb_connection_t *c, + xcb_xv_query_encodings_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xv_query_encodings_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_xv_grab_port_cookie_t +xcb_xv_grab_port (xcb_connection_t *c, + xcb_xv_port_t port, + xcb_timestamp_t time) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_GRAB_PORT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xv_grab_port_cookie_t xcb_ret; + xcb_xv_grab_port_request_t xcb_out; + + xcb_out.port = port; + xcb_out.time = time; + + 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_xv_grab_port_cookie_t +xcb_xv_grab_port_unchecked (xcb_connection_t *c, + xcb_xv_port_t port, + xcb_timestamp_t time) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_GRAB_PORT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xv_grab_port_cookie_t xcb_ret; + xcb_xv_grab_port_request_t xcb_out; + + xcb_out.port = port; + xcb_out.time = time; + + 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_xv_grab_port_reply_t * +xcb_xv_grab_port_reply (xcb_connection_t *c, + xcb_xv_grab_port_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xv_grab_port_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_xv_ungrab_port_checked (xcb_connection_t *c, + xcb_xv_port_t port, + xcb_timestamp_t time) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_UNGRAB_PORT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xv_ungrab_port_request_t xcb_out; + + xcb_out.port = port; + xcb_out.time = time; + + 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_xv_ungrab_port (xcb_connection_t *c, + xcb_xv_port_t port, + xcb_timestamp_t time) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_UNGRAB_PORT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xv_ungrab_port_request_t xcb_out; + + xcb_out.port = port; + xcb_out.time = time; + + 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_xv_put_video_checked (xcb_connection_t *c, + xcb_xv_port_t port, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + int16_t vid_x, + int16_t vid_y, + uint16_t vid_w, + uint16_t vid_h, + int16_t drw_x, + int16_t drw_y, + uint16_t drw_w, + uint16_t drw_h) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_PUT_VIDEO, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xv_put_video_request_t xcb_out; + + xcb_out.port = port; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + xcb_out.vid_x = vid_x; + xcb_out.vid_y = vid_y; + xcb_out.vid_w = vid_w; + xcb_out.vid_h = vid_h; + xcb_out.drw_x = drw_x; + xcb_out.drw_y = drw_y; + xcb_out.drw_w = drw_w; + xcb_out.drw_h = drw_h; + + 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_xv_put_video (xcb_connection_t *c, + xcb_xv_port_t port, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + int16_t vid_x, + int16_t vid_y, + uint16_t vid_w, + uint16_t vid_h, + int16_t drw_x, + int16_t drw_y, + uint16_t drw_w, + uint16_t drw_h) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_PUT_VIDEO, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xv_put_video_request_t xcb_out; + + xcb_out.port = port; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + xcb_out.vid_x = vid_x; + xcb_out.vid_y = vid_y; + xcb_out.vid_w = vid_w; + xcb_out.vid_h = vid_h; + xcb_out.drw_x = drw_x; + xcb_out.drw_y = drw_y; + xcb_out.drw_w = drw_w; + xcb_out.drw_h = drw_h; + + 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_xv_put_still_checked (xcb_connection_t *c, + xcb_xv_port_t port, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + int16_t vid_x, + int16_t vid_y, + uint16_t vid_w, + uint16_t vid_h, + int16_t drw_x, + int16_t drw_y, + uint16_t drw_w, + uint16_t drw_h) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_PUT_STILL, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xv_put_still_request_t xcb_out; + + xcb_out.port = port; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + xcb_out.vid_x = vid_x; + xcb_out.vid_y = vid_y; + xcb_out.vid_w = vid_w; + xcb_out.vid_h = vid_h; + xcb_out.drw_x = drw_x; + xcb_out.drw_y = drw_y; + xcb_out.drw_w = drw_w; + xcb_out.drw_h = drw_h; + + 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_xv_put_still (xcb_connection_t *c, + xcb_xv_port_t port, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + int16_t vid_x, + int16_t vid_y, + uint16_t vid_w, + uint16_t vid_h, + int16_t drw_x, + int16_t drw_y, + uint16_t drw_w, + uint16_t drw_h) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_PUT_STILL, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xv_put_still_request_t xcb_out; + + xcb_out.port = port; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + xcb_out.vid_x = vid_x; + xcb_out.vid_y = vid_y; + xcb_out.vid_w = vid_w; + xcb_out.vid_h = vid_h; + xcb_out.drw_x = drw_x; + xcb_out.drw_y = drw_y; + xcb_out.drw_w = drw_w; + xcb_out.drw_h = drw_h; + + 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_xv_get_video_checked (xcb_connection_t *c, + xcb_xv_port_t port, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + int16_t vid_x, + int16_t vid_y, + uint16_t vid_w, + uint16_t vid_h, + int16_t drw_x, + int16_t drw_y, + uint16_t drw_w, + uint16_t drw_h) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_GET_VIDEO, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xv_get_video_request_t xcb_out; + + xcb_out.port = port; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + xcb_out.vid_x = vid_x; + xcb_out.vid_y = vid_y; + xcb_out.vid_w = vid_w; + xcb_out.vid_h = vid_h; + xcb_out.drw_x = drw_x; + xcb_out.drw_y = drw_y; + xcb_out.drw_w = drw_w; + xcb_out.drw_h = drw_h; + + 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_xv_get_video (xcb_connection_t *c, + xcb_xv_port_t port, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + int16_t vid_x, + int16_t vid_y, + uint16_t vid_w, + uint16_t vid_h, + int16_t drw_x, + int16_t drw_y, + uint16_t drw_w, + uint16_t drw_h) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_GET_VIDEO, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xv_get_video_request_t xcb_out; + + xcb_out.port = port; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + xcb_out.vid_x = vid_x; + xcb_out.vid_y = vid_y; + xcb_out.vid_w = vid_w; + xcb_out.vid_h = vid_h; + xcb_out.drw_x = drw_x; + xcb_out.drw_y = drw_y; + xcb_out.drw_w = drw_w; + xcb_out.drw_h = drw_h; + + 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_xv_get_still_checked (xcb_connection_t *c, + xcb_xv_port_t port, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + int16_t vid_x, + int16_t vid_y, + uint16_t vid_w, + uint16_t vid_h, + int16_t drw_x, + int16_t drw_y, + uint16_t drw_w, + uint16_t drw_h) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_GET_STILL, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xv_get_still_request_t xcb_out; + + xcb_out.port = port; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + xcb_out.vid_x = vid_x; + xcb_out.vid_y = vid_y; + xcb_out.vid_w = vid_w; + xcb_out.vid_h = vid_h; + xcb_out.drw_x = drw_x; + xcb_out.drw_y = drw_y; + xcb_out.drw_w = drw_w; + xcb_out.drw_h = drw_h; + + 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_xv_get_still (xcb_connection_t *c, + xcb_xv_port_t port, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + int16_t vid_x, + int16_t vid_y, + uint16_t vid_w, + uint16_t vid_h, + int16_t drw_x, + int16_t drw_y, + uint16_t drw_w, + uint16_t drw_h) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_GET_STILL, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xv_get_still_request_t xcb_out; + + xcb_out.port = port; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + xcb_out.vid_x = vid_x; + xcb_out.vid_y = vid_y; + xcb_out.vid_w = vid_w; + xcb_out.vid_h = vid_h; + xcb_out.drw_x = drw_x; + xcb_out.drw_y = drw_y; + xcb_out.drw_w = drw_w; + xcb_out.drw_h = drw_h; + + 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_xv_stop_video_checked (xcb_connection_t *c, + xcb_xv_port_t port, + xcb_drawable_t drawable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_STOP_VIDEO, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xv_stop_video_request_t xcb_out; + + xcb_out.port = port; + 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_xv_stop_video (xcb_connection_t *c, + xcb_xv_port_t port, + xcb_drawable_t drawable) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_STOP_VIDEO, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xv_stop_video_request_t xcb_out; + + xcb_out.port = port; + 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_xv_select_video_notify_checked (xcb_connection_t *c, + xcb_drawable_t drawable, + uint8_t onoff) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_SELECT_VIDEO_NOTIFY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xv_select_video_notify_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.onoff = onoff; + 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_xv_select_video_notify (xcb_connection_t *c, + xcb_drawable_t drawable, + uint8_t onoff) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_SELECT_VIDEO_NOTIFY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xv_select_video_notify_request_t xcb_out; + + xcb_out.drawable = drawable; + xcb_out.onoff = onoff; + 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_xv_select_port_notify_checked (xcb_connection_t *c, + xcb_xv_port_t port, + uint8_t onoff) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_SELECT_PORT_NOTIFY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xv_select_port_notify_request_t xcb_out; + + xcb_out.port = port; + xcb_out.onoff = onoff; + 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_xv_select_port_notify (xcb_connection_t *c, + xcb_xv_port_t port, + uint8_t onoff) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_SELECT_PORT_NOTIFY, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xv_select_port_notify_request_t xcb_out; + + xcb_out.port = port; + xcb_out.onoff = onoff; + 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_xv_query_best_size_cookie_t +xcb_xv_query_best_size (xcb_connection_t *c, + xcb_xv_port_t port, + uint16_t vid_w, + uint16_t vid_h, + uint16_t drw_w, + uint16_t drw_h, + uint8_t motion) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_QUERY_BEST_SIZE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xv_query_best_size_cookie_t xcb_ret; + xcb_xv_query_best_size_request_t xcb_out; + + xcb_out.port = port; + xcb_out.vid_w = vid_w; + xcb_out.vid_h = vid_h; + xcb_out.drw_w = drw_w; + xcb_out.drw_h = drw_h; + xcb_out.motion = motion; + 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_xv_query_best_size_cookie_t +xcb_xv_query_best_size_unchecked (xcb_connection_t *c, + xcb_xv_port_t port, + uint16_t vid_w, + uint16_t vid_h, + uint16_t drw_w, + uint16_t drw_h, + uint8_t motion) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_QUERY_BEST_SIZE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xv_query_best_size_cookie_t xcb_ret; + xcb_xv_query_best_size_request_t xcb_out; + + xcb_out.port = port; + xcb_out.vid_w = vid_w; + xcb_out.vid_h = vid_h; + xcb_out.drw_w = drw_w; + xcb_out.drw_h = drw_h; + xcb_out.motion = motion; + 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_xv_query_best_size_reply_t * +xcb_xv_query_best_size_reply (xcb_connection_t *c, + xcb_xv_query_best_size_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xv_query_best_size_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_xv_set_port_attribute_checked (xcb_connection_t *c, + xcb_xv_port_t port, + xcb_atom_t attribute, + int32_t value) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_SET_PORT_ATTRIBUTE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xv_set_port_attribute_request_t xcb_out; + + xcb_out.port = port; + xcb_out.attribute = attribute; + xcb_out.value = value; + + 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_xv_set_port_attribute (xcb_connection_t *c, + xcb_xv_port_t port, + xcb_atom_t attribute, + int32_t value) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_SET_PORT_ATTRIBUTE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xv_set_port_attribute_request_t xcb_out; + + xcb_out.port = port; + xcb_out.attribute = attribute; + xcb_out.value = value; + + 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_xv_get_port_attribute_cookie_t +xcb_xv_get_port_attribute (xcb_connection_t *c, + xcb_xv_port_t port, + xcb_atom_t attribute) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_GET_PORT_ATTRIBUTE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xv_get_port_attribute_cookie_t xcb_ret; + xcb_xv_get_port_attribute_request_t xcb_out; + + xcb_out.port = port; + xcb_out.attribute = attribute; + + 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_xv_get_port_attribute_cookie_t +xcb_xv_get_port_attribute_unchecked (xcb_connection_t *c, + xcb_xv_port_t port, + xcb_atom_t attribute) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_GET_PORT_ATTRIBUTE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xv_get_port_attribute_cookie_t xcb_ret; + xcb_xv_get_port_attribute_request_t xcb_out; + + xcb_out.port = port; + xcb_out.attribute = attribute; + + 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_xv_get_port_attribute_reply_t * +xcb_xv_get_port_attribute_reply (xcb_connection_t *c, + xcb_xv_get_port_attribute_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xv_get_port_attribute_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_xv_query_port_attributes_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xv_query_port_attributes_reply_t *_aux = (xcb_xv_query_port_attributes_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; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_xv_query_port_attributes_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* attributes */ + for(i=0; i<_aux->num_attributes; i++) { + xcb_tmp_len = xcb_xv_attribute_info_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_xv_attribute_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_xv_query_port_attributes_cookie_t +xcb_xv_query_port_attributes (xcb_connection_t *c, + xcb_xv_port_t port) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_QUERY_PORT_ATTRIBUTES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xv_query_port_attributes_cookie_t xcb_ret; + xcb_xv_query_port_attributes_request_t xcb_out; + + xcb_out.port = port; + + 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_xv_query_port_attributes_cookie_t +xcb_xv_query_port_attributes_unchecked (xcb_connection_t *c, + xcb_xv_port_t port) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_QUERY_PORT_ATTRIBUTES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xv_query_port_attributes_cookie_t xcb_ret; + xcb_xv_query_port_attributes_request_t xcb_out; + + xcb_out.port = port; + + 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_xv_query_port_attributes_attributes_length (const xcb_xv_query_port_attributes_reply_t *R) +{ + return R->num_attributes; +} + +xcb_xv_attribute_info_iterator_t +xcb_xv_query_port_attributes_attributes_iterator (const xcb_xv_query_port_attributes_reply_t *R) +{ + xcb_xv_attribute_info_iterator_t i; + i.data = (xcb_xv_attribute_info_t *) (R + 1); + i.rem = R->num_attributes; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xv_query_port_attributes_reply_t * +xcb_xv_query_port_attributes_reply (xcb_connection_t *c, + xcb_xv_query_port_attributes_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xv_query_port_attributes_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_xv_list_image_formats_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xv_list_image_formats_reply_t *_aux = (xcb_xv_list_image_formats_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_xv_list_image_formats_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* format */ + xcb_block_len += _aux->num_formats * sizeof(xcb_xv_image_format_info_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xv_image_format_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_xv_list_image_formats_cookie_t +xcb_xv_list_image_formats (xcb_connection_t *c, + xcb_xv_port_t port) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_LIST_IMAGE_FORMATS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xv_list_image_formats_cookie_t xcb_ret; + xcb_xv_list_image_formats_request_t xcb_out; + + xcb_out.port = port; + + 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_xv_list_image_formats_cookie_t +xcb_xv_list_image_formats_unchecked (xcb_connection_t *c, + xcb_xv_port_t port) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_LIST_IMAGE_FORMATS, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xv_list_image_formats_cookie_t xcb_ret; + xcb_xv_list_image_formats_request_t xcb_out; + + xcb_out.port = port; + + 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_xv_image_format_info_t * +xcb_xv_list_image_formats_format (const xcb_xv_list_image_formats_reply_t *R) +{ + return (xcb_xv_image_format_info_t *) (R + 1); +} + +int +xcb_xv_list_image_formats_format_length (const xcb_xv_list_image_formats_reply_t *R) +{ + return R->num_formats; +} + +xcb_xv_image_format_info_iterator_t +xcb_xv_list_image_formats_format_iterator (const xcb_xv_list_image_formats_reply_t *R) +{ + xcb_xv_image_format_info_iterator_t i; + i.data = (xcb_xv_image_format_info_t *) (R + 1); + i.rem = R->num_formats; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xv_list_image_formats_reply_t * +xcb_xv_list_image_formats_reply (xcb_connection_t *c, + xcb_xv_list_image_formats_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xv_list_image_formats_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_xv_query_image_attributes_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xv_query_image_attributes_reply_t *_aux = (xcb_xv_query_image_attributes_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_xv_query_image_attributes_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* pitches */ + xcb_block_len += _aux->num_planes * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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; + /* offsets */ + xcb_block_len += _aux->num_planes * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_xv_query_image_attributes_cookie_t +xcb_xv_query_image_attributes (xcb_connection_t *c, + xcb_xv_port_t port, + uint32_t id, + uint16_t width, + uint16_t height) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_QUERY_IMAGE_ATTRIBUTES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xv_query_image_attributes_cookie_t xcb_ret; + xcb_xv_query_image_attributes_request_t xcb_out; + + xcb_out.port = port; + xcb_out.id = id; + xcb_out.width = width; + xcb_out.height = height; + + 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_xv_query_image_attributes_cookie_t +xcb_xv_query_image_attributes_unchecked (xcb_connection_t *c, + xcb_xv_port_t port, + uint32_t id, + uint16_t width, + uint16_t height) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_QUERY_IMAGE_ATTRIBUTES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xv_query_image_attributes_cookie_t xcb_ret; + xcb_xv_query_image_attributes_request_t xcb_out; + + xcb_out.port = port; + xcb_out.id = id; + xcb_out.width = width; + xcb_out.height = height; + + 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; +} + +uint32_t * +xcb_xv_query_image_attributes_pitches (const xcb_xv_query_image_attributes_reply_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_xv_query_image_attributes_pitches_length (const xcb_xv_query_image_attributes_reply_t *R) +{ + return R->num_planes; +} + +xcb_generic_iterator_t +xcb_xv_query_image_attributes_pitches_end (const xcb_xv_query_image_attributes_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->num_planes); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +uint32_t * +xcb_xv_query_image_attributes_offsets (const xcb_xv_query_image_attributes_reply_t *R) +{ + xcb_generic_iterator_t prev = xcb_xv_query_image_attributes_pitches_end(R); + return (uint32_t *) ((char *) prev.data + XCB_TYPE_PAD(uint32_t, prev.index) + 0); +} + +int +xcb_xv_query_image_attributes_offsets_length (const xcb_xv_query_image_attributes_reply_t *R) +{ + return R->num_planes; +} + +xcb_generic_iterator_t +xcb_xv_query_image_attributes_offsets_end (const xcb_xv_query_image_attributes_reply_t *R) +{ + xcb_generic_iterator_t i; + xcb_generic_iterator_t prev = xcb_xv_query_image_attributes_pitches_end(R); + i.data = ((uint32_t *) ((char*) prev.data + XCB_TYPE_PAD(uint32_t, prev.index))) + (R->num_planes); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xv_query_image_attributes_reply_t * +xcb_xv_query_image_attributes_reply (xcb_connection_t *c, + xcb_xv_query_image_attributes_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xv_query_image_attributes_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_xv_put_image_sizeof (const void *_buffer, + uint32_t data_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_xv_put_image_request_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* data */ + xcb_block_len += data_len * sizeof(uint8_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint8_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_xv_put_image_checked (xcb_connection_t *c, + xcb_xv_port_t port, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + uint32_t id, + int16_t src_x, + int16_t src_y, + uint16_t src_w, + uint16_t src_h, + int16_t drw_x, + int16_t drw_y, + uint16_t drw_w, + uint16_t drw_h, + uint16_t width, + uint16_t height, + uint32_t data_len, + const uint8_t *data) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_xv_id, + .opcode = XCB_XV_PUT_IMAGE, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_xv_put_image_request_t xcb_out; + + xcb_out.port = port; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + xcb_out.id = id; + xcb_out.src_x = src_x; + xcb_out.src_y = src_y; + xcb_out.src_w = src_w; + xcb_out.src_h = src_h; + xcb_out.drw_x = drw_x; + xcb_out.drw_y = drw_y; + xcb_out.drw_w = drw_w; + xcb_out.drw_h = drw_h; + xcb_out.width = width; + xcb_out.height = height; + + 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; + /* uint8_t data */ + xcb_parts[4].iov_base = (char *) data; + xcb_parts[4].iov_len = data_len * sizeof(uint8_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_xv_put_image (xcb_connection_t *c, + xcb_xv_port_t port, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + uint32_t id, + int16_t src_x, + int16_t src_y, + uint16_t src_w, + uint16_t src_h, + int16_t drw_x, + int16_t drw_y, + uint16_t drw_w, + uint16_t drw_h, + uint16_t width, + uint16_t height, + uint32_t data_len, + const uint8_t *data) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 4, + .ext = &xcb_xv_id, + .opcode = XCB_XV_PUT_IMAGE, + .isvoid = 1 + }; + + struct iovec xcb_parts[6]; + xcb_void_cookie_t xcb_ret; + xcb_xv_put_image_request_t xcb_out; + + xcb_out.port = port; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + xcb_out.id = id; + xcb_out.src_x = src_x; + xcb_out.src_y = src_y; + xcb_out.src_w = src_w; + xcb_out.src_h = src_h; + xcb_out.drw_x = drw_x; + xcb_out.drw_y = drw_y; + xcb_out.drw_w = drw_w; + xcb_out.drw_h = drw_h; + xcb_out.width = width; + xcb_out.height = height; + + 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; + /* uint8_t data */ + xcb_parts[4].iov_base = (char *) data; + xcb_parts[4].iov_len = data_len * sizeof(uint8_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; +} + +uint8_t * +xcb_xv_put_image_data (const xcb_xv_put_image_request_t *R) +{ + return (uint8_t *) (R + 1); +} + +int +xcb_xv_put_image_data_length (const xcb_xv_put_image_request_t *R) +{ + return (((R->length * 4) - sizeof(xcb_xv_put_image_request_t))/sizeof(uint8_t)); +} + +xcb_generic_iterator_t +xcb_xv_put_image_data_end (const xcb_xv_put_image_request_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint8_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_xv_put_image_request_t))/sizeof(uint8_t))); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_void_cookie_t +xcb_xv_shm_put_image_checked (xcb_connection_t *c, + xcb_xv_port_t port, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + xcb_shm_seg_t shmseg, + uint32_t id, + uint32_t offset, + int16_t src_x, + int16_t src_y, + uint16_t src_w, + uint16_t src_h, + int16_t drw_x, + int16_t drw_y, + uint16_t drw_w, + uint16_t drw_h, + uint16_t width, + uint16_t height, + uint8_t send_event) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_SHM_PUT_IMAGE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xv_shm_put_image_request_t xcb_out; + + xcb_out.port = port; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + xcb_out.shmseg = shmseg; + xcb_out.id = id; + xcb_out.offset = offset; + xcb_out.src_x = src_x; + xcb_out.src_y = src_y; + xcb_out.src_w = src_w; + xcb_out.src_h = src_h; + xcb_out.drw_x = drw_x; + xcb_out.drw_y = drw_y; + xcb_out.drw_w = drw_w; + xcb_out.drw_h = drw_h; + xcb_out.width = width; + xcb_out.height = height; + xcb_out.send_event = send_event; + 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_xv_shm_put_image (xcb_connection_t *c, + xcb_xv_port_t port, + xcb_drawable_t drawable, + xcb_gcontext_t gc, + xcb_shm_seg_t shmseg, + uint32_t id, + uint32_t offset, + int16_t src_x, + int16_t src_y, + uint16_t src_w, + uint16_t src_h, + int16_t drw_x, + int16_t drw_y, + uint16_t drw_w, + uint16_t drw_h, + uint16_t width, + uint16_t height, + uint8_t send_event) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xv_id, + .opcode = XCB_XV_SHM_PUT_IMAGE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xv_shm_put_image_request_t xcb_out; + + xcb_out.port = port; + xcb_out.drawable = drawable; + xcb_out.gc = gc; + xcb_out.shmseg = shmseg; + xcb_out.id = id; + xcb_out.offset = offset; + xcb_out.src_x = src_x; + xcb_out.src_y = src_y; + xcb_out.src_w = src_w; + xcb_out.src_h = src_h; + xcb_out.drw_x = drw_x; + xcb_out.drw_y = drw_y; + xcb_out.drw_w = drw_w; + xcb_out.drw_h = drw_h; + xcb_out.width = width; + xcb_out.height = height; + xcb_out.send_event = send_event; + 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; +} + diff --git a/depends/libxcb/src/xvmc.c b/depends/libxcb/src/xvmc.c new file mode 100644 index 0000000..d0f6923 --- /dev/null +++ b/depends/libxcb/src/xvmc.c @@ -0,0 +1,913 @@ +/* + * This file generated automatically from xvmc.xml by c_client.py. + * Edit at your peril. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <stddef.h> /* for offsetof() */ +#include "xcbext.h" +#include "xvmc.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) +#include "xv.h" + +xcb_extension_t xcb_xvmc_id = { "XVideo-MotionCompensation", 0 }; + +void +xcb_xvmc_context_next (xcb_xvmc_context_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xvmc_context_t); +} + +xcb_generic_iterator_t +xcb_xvmc_context_end (xcb_xvmc_context_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; +} + +void +xcb_xvmc_surface_next (xcb_xvmc_surface_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xvmc_surface_t); +} + +xcb_generic_iterator_t +xcb_xvmc_surface_end (xcb_xvmc_surface_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; +} + +void +xcb_xvmc_subpicture_next (xcb_xvmc_subpicture_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xvmc_subpicture_t); +} + +xcb_generic_iterator_t +xcb_xvmc_subpicture_end (xcb_xvmc_subpicture_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; +} + +void +xcb_xvmc_surface_info_next (xcb_xvmc_surface_info_iterator_t *i) +{ + --i->rem; + ++i->data; + i->index += sizeof(xcb_xvmc_surface_info_t); +} + +xcb_generic_iterator_t +xcb_xvmc_surface_info_end (xcb_xvmc_surface_info_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_xvmc_query_version_cookie_t +xcb_xvmc_query_version (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xvmc_id, + .opcode = XCB_XVMC_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xvmc_query_version_cookie_t xcb_ret; + xcb_xvmc_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_xvmc_query_version_cookie_t +xcb_xvmc_query_version_unchecked (xcb_connection_t *c) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xvmc_id, + .opcode = XCB_XVMC_QUERY_VERSION, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xvmc_query_version_cookie_t xcb_ret; + xcb_xvmc_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_xvmc_query_version_reply_t * +xcb_xvmc_query_version_reply (xcb_connection_t *c, + xcb_xvmc_query_version_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xvmc_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_xvmc_list_surface_types_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xvmc_list_surface_types_reply_t *_aux = (xcb_xvmc_list_surface_types_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_xvmc_list_surface_types_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* surfaces */ + xcb_block_len += _aux->num * sizeof(xcb_xvmc_surface_info_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xvmc_surface_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_xvmc_list_surface_types_cookie_t +xcb_xvmc_list_surface_types (xcb_connection_t *c, + xcb_xv_port_t port_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xvmc_id, + .opcode = XCB_XVMC_LIST_SURFACE_TYPES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xvmc_list_surface_types_cookie_t xcb_ret; + xcb_xvmc_list_surface_types_request_t xcb_out; + + xcb_out.port_id = port_id; + + 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_xvmc_list_surface_types_cookie_t +xcb_xvmc_list_surface_types_unchecked (xcb_connection_t *c, + xcb_xv_port_t port_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xvmc_id, + .opcode = XCB_XVMC_LIST_SURFACE_TYPES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xvmc_list_surface_types_cookie_t xcb_ret; + xcb_xvmc_list_surface_types_request_t xcb_out; + + xcb_out.port_id = port_id; + + 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_xvmc_surface_info_t * +xcb_xvmc_list_surface_types_surfaces (const xcb_xvmc_list_surface_types_reply_t *R) +{ + return (xcb_xvmc_surface_info_t *) (R + 1); +} + +int +xcb_xvmc_list_surface_types_surfaces_length (const xcb_xvmc_list_surface_types_reply_t *R) +{ + return R->num; +} + +xcb_xvmc_surface_info_iterator_t +xcb_xvmc_list_surface_types_surfaces_iterator (const xcb_xvmc_list_surface_types_reply_t *R) +{ + xcb_xvmc_surface_info_iterator_t i; + i.data = (xcb_xvmc_surface_info_t *) (R + 1); + i.rem = R->num; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xvmc_list_surface_types_reply_t * +xcb_xvmc_list_surface_types_reply (xcb_connection_t *c, + xcb_xvmc_list_surface_types_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xvmc_list_surface_types_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +int +xcb_xvmc_create_context_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xvmc_create_context_reply_t *_aux = (xcb_xvmc_create_context_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_xvmc_create_context_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* priv_data */ + xcb_block_len += _aux->length * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_xvmc_create_context_cookie_t +xcb_xvmc_create_context (xcb_connection_t *c, + xcb_xvmc_context_t context_id, + xcb_xv_port_t port_id, + xcb_xvmc_surface_t surface_id, + uint16_t width, + uint16_t height, + uint32_t flags) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xvmc_id, + .opcode = XCB_XVMC_CREATE_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xvmc_create_context_cookie_t xcb_ret; + xcb_xvmc_create_context_request_t xcb_out; + + xcb_out.context_id = context_id; + xcb_out.port_id = port_id; + xcb_out.surface_id = surface_id; + xcb_out.width = width; + xcb_out.height = height; + xcb_out.flags = flags; + + 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_xvmc_create_context_cookie_t +xcb_xvmc_create_context_unchecked (xcb_connection_t *c, + xcb_xvmc_context_t context_id, + xcb_xv_port_t port_id, + xcb_xvmc_surface_t surface_id, + uint16_t width, + uint16_t height, + uint32_t flags) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xvmc_id, + .opcode = XCB_XVMC_CREATE_CONTEXT, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xvmc_create_context_cookie_t xcb_ret; + xcb_xvmc_create_context_request_t xcb_out; + + xcb_out.context_id = context_id; + xcb_out.port_id = port_id; + xcb_out.surface_id = surface_id; + xcb_out.width = width; + xcb_out.height = height; + xcb_out.flags = flags; + + 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; +} + +uint32_t * +xcb_xvmc_create_context_priv_data (const xcb_xvmc_create_context_reply_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_xvmc_create_context_priv_data_length (const xcb_xvmc_create_context_reply_t *R) +{ + return R->length; +} + +xcb_generic_iterator_t +xcb_xvmc_create_context_priv_data_end (const xcb_xvmc_create_context_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->length); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xvmc_create_context_reply_t * +xcb_xvmc_create_context_reply (xcb_connection_t *c, + xcb_xvmc_create_context_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xvmc_create_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_xvmc_destroy_context_checked (xcb_connection_t *c, + xcb_xvmc_context_t context_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xvmc_id, + .opcode = XCB_XVMC_DESTROY_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xvmc_destroy_context_request_t xcb_out; + + xcb_out.context_id = context_id; + + 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_xvmc_destroy_context (xcb_connection_t *c, + xcb_xvmc_context_t context_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xvmc_id, + .opcode = XCB_XVMC_DESTROY_CONTEXT, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xvmc_destroy_context_request_t xcb_out; + + xcb_out.context_id = context_id; + + 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_xvmc_create_surface_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xvmc_create_surface_reply_t *_aux = (xcb_xvmc_create_surface_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_xvmc_create_surface_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* priv_data */ + xcb_block_len += _aux->length * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_xvmc_create_surface_cookie_t +xcb_xvmc_create_surface (xcb_connection_t *c, + xcb_xvmc_surface_t surface_id, + xcb_xvmc_context_t context_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xvmc_id, + .opcode = XCB_XVMC_CREATE_SURFACE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xvmc_create_surface_cookie_t xcb_ret; + xcb_xvmc_create_surface_request_t xcb_out; + + xcb_out.surface_id = surface_id; + xcb_out.context_id = context_id; + + 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_xvmc_create_surface_cookie_t +xcb_xvmc_create_surface_unchecked (xcb_connection_t *c, + xcb_xvmc_surface_t surface_id, + xcb_xvmc_context_t context_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xvmc_id, + .opcode = XCB_XVMC_CREATE_SURFACE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xvmc_create_surface_cookie_t xcb_ret; + xcb_xvmc_create_surface_request_t xcb_out; + + xcb_out.surface_id = surface_id; + xcb_out.context_id = context_id; + + 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; +} + +uint32_t * +xcb_xvmc_create_surface_priv_data (const xcb_xvmc_create_surface_reply_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_xvmc_create_surface_priv_data_length (const xcb_xvmc_create_surface_reply_t *R) +{ + return R->length; +} + +xcb_generic_iterator_t +xcb_xvmc_create_surface_priv_data_end (const xcb_xvmc_create_surface_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->length); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xvmc_create_surface_reply_t * +xcb_xvmc_create_surface_reply (xcb_connection_t *c, + xcb_xvmc_create_surface_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xvmc_create_surface_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_xvmc_destroy_surface_checked (xcb_connection_t *c, + xcb_xvmc_surface_t surface_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xvmc_id, + .opcode = XCB_XVMC_DESTROY_SURFACE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xvmc_destroy_surface_request_t xcb_out; + + xcb_out.surface_id = surface_id; + + 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_xvmc_destroy_surface (xcb_connection_t *c, + xcb_xvmc_surface_t surface_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xvmc_id, + .opcode = XCB_XVMC_DESTROY_SURFACE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xvmc_destroy_surface_request_t xcb_out; + + xcb_out.surface_id = surface_id; + + 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_xvmc_create_subpicture_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xvmc_create_subpicture_reply_t *_aux = (xcb_xvmc_create_subpicture_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_xvmc_create_subpicture_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* priv_data */ + xcb_block_len += _aux->length * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_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_xvmc_create_subpicture_cookie_t +xcb_xvmc_create_subpicture (xcb_connection_t *c, + xcb_xvmc_subpicture_t subpicture_id, + xcb_xvmc_context_t context, + uint32_t xvimage_id, + uint16_t width, + uint16_t height) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xvmc_id, + .opcode = XCB_XVMC_CREATE_SUBPICTURE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xvmc_create_subpicture_cookie_t xcb_ret; + xcb_xvmc_create_subpicture_request_t xcb_out; + + xcb_out.subpicture_id = subpicture_id; + xcb_out.context = context; + xcb_out.xvimage_id = xvimage_id; + xcb_out.width = width; + xcb_out.height = height; + + 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_xvmc_create_subpicture_cookie_t +xcb_xvmc_create_subpicture_unchecked (xcb_connection_t *c, + xcb_xvmc_subpicture_t subpicture_id, + xcb_xvmc_context_t context, + uint32_t xvimage_id, + uint16_t width, + uint16_t height) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xvmc_id, + .opcode = XCB_XVMC_CREATE_SUBPICTURE, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xvmc_create_subpicture_cookie_t xcb_ret; + xcb_xvmc_create_subpicture_request_t xcb_out; + + xcb_out.subpicture_id = subpicture_id; + xcb_out.context = context; + xcb_out.xvimage_id = xvimage_id; + xcb_out.width = width; + xcb_out.height = height; + + 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; +} + +uint32_t * +xcb_xvmc_create_subpicture_priv_data (const xcb_xvmc_create_subpicture_reply_t *R) +{ + return (uint32_t *) (R + 1); +} + +int +xcb_xvmc_create_subpicture_priv_data_length (const xcb_xvmc_create_subpicture_reply_t *R) +{ + return R->length; +} + +xcb_generic_iterator_t +xcb_xvmc_create_subpicture_priv_data_end (const xcb_xvmc_create_subpicture_reply_t *R) +{ + xcb_generic_iterator_t i; + i.data = ((uint32_t *) (R + 1)) + (R->length); + i.rem = 0; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xvmc_create_subpicture_reply_t * +xcb_xvmc_create_subpicture_reply (xcb_connection_t *c, + xcb_xvmc_create_subpicture_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xvmc_create_subpicture_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + +xcb_void_cookie_t +xcb_xvmc_destroy_subpicture_checked (xcb_connection_t *c, + xcb_xvmc_subpicture_t subpicture_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xvmc_id, + .opcode = XCB_XVMC_DESTROY_SUBPICTURE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xvmc_destroy_subpicture_request_t xcb_out; + + xcb_out.subpicture_id = subpicture_id; + + 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_xvmc_destroy_subpicture (xcb_connection_t *c, + xcb_xvmc_subpicture_t subpicture_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xvmc_id, + .opcode = XCB_XVMC_DESTROY_SUBPICTURE, + .isvoid = 1 + }; + + struct iovec xcb_parts[4]; + xcb_void_cookie_t xcb_ret; + xcb_xvmc_destroy_subpicture_request_t xcb_out; + + xcb_out.subpicture_id = subpicture_id; + + 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_xvmc_list_subpicture_types_sizeof (const void *_buffer) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_xvmc_list_subpicture_types_reply_t *_aux = (xcb_xvmc_list_subpicture_types_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_xvmc_list_subpicture_types_reply_t); + xcb_tmp += xcb_block_len; + xcb_buffer_len += xcb_block_len; + xcb_block_len = 0; + /* types */ + xcb_block_len += _aux->num * sizeof(xcb_xv_image_format_info_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_xv_image_format_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_xvmc_list_subpicture_types_cookie_t +xcb_xvmc_list_subpicture_types (xcb_connection_t *c, + xcb_xv_port_t port_id, + xcb_xvmc_surface_t surface_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xvmc_id, + .opcode = XCB_XVMC_LIST_SUBPICTURE_TYPES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xvmc_list_subpicture_types_cookie_t xcb_ret; + xcb_xvmc_list_subpicture_types_request_t xcb_out; + + xcb_out.port_id = port_id; + xcb_out.surface_id = surface_id; + + 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_xvmc_list_subpicture_types_cookie_t +xcb_xvmc_list_subpicture_types_unchecked (xcb_connection_t *c, + xcb_xv_port_t port_id, + xcb_xvmc_surface_t surface_id) +{ + static const xcb_protocol_request_t xcb_req = { + .count = 2, + .ext = &xcb_xvmc_id, + .opcode = XCB_XVMC_LIST_SUBPICTURE_TYPES, + .isvoid = 0 + }; + + struct iovec xcb_parts[4]; + xcb_xvmc_list_subpicture_types_cookie_t xcb_ret; + xcb_xvmc_list_subpicture_types_request_t xcb_out; + + xcb_out.port_id = port_id; + xcb_out.surface_id = surface_id; + + 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_xv_image_format_info_t * +xcb_xvmc_list_subpicture_types_types (const xcb_xvmc_list_subpicture_types_reply_t *R) +{ + return (xcb_xv_image_format_info_t *) (R + 1); +} + +int +xcb_xvmc_list_subpicture_types_types_length (const xcb_xvmc_list_subpicture_types_reply_t *R) +{ + return R->num; +} + +xcb_xv_image_format_info_iterator_t +xcb_xvmc_list_subpicture_types_types_iterator (const xcb_xvmc_list_subpicture_types_reply_t *R) +{ + xcb_xv_image_format_info_iterator_t i; + i.data = (xcb_xv_image_format_info_t *) (R + 1); + i.rem = R->num; + i.index = (char *) i.data - (char *) R; + return i; +} + +xcb_xvmc_list_subpicture_types_reply_t * +xcb_xvmc_list_subpicture_types_reply (xcb_connection_t *c, + xcb_xvmc_list_subpicture_types_cookie_t cookie /**< */, + xcb_generic_error_t **e) +{ + return (xcb_xvmc_list_subpicture_types_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); +} + |