diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2018-09-11 19:34:58 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2018-09-11 19:34:58 +0000 |
commit | 5b6cb0ac05beef2969cd97b1bcbc312986e27d63 (patch) | |
tree | 23bf7c589f43111b70ef8445658f28e7a7b1df02 /lib/libxcb/src | |
parent | 26e88f304a40144b9cc2579824a419bd96418454 (diff) |
Update to libxcb 1.13. ok tb@
Diffstat (limited to 'lib/libxcb/src')
-rw-r--r-- | lib/libxcb/src/Makefile | 6 | ||||
-rw-r--r-- | lib/libxcb/src/config.h | 8 | ||||
-rw-r--r-- | lib/libxcb/src/dri3.c | 480 | ||||
-rw-r--r-- | lib/libxcb/src/dri3.h | 325 | ||||
-rw-r--r-- | lib/libxcb/src/present.h | 8 | ||||
-rw-r--r-- | lib/libxcb/src/randr.c | 274 | ||||
-rw-r--r-- | lib/libxcb/src/randr.h | 349 | ||||
-rw-r--r-- | lib/libxcb/src/res.c | 6 | ||||
-rw-r--r-- | lib/libxcb/src/shm.c | 6 | ||||
-rw-r--r-- | lib/libxcb/src/xinput.c | 410 | ||||
-rw-r--r-- | lib/libxcb/src/xinput.h | 249 | ||||
-rw-r--r-- | lib/libxcb/src/xkb.c | 4 | ||||
-rw-r--r-- | lib/libxcb/src/xproto.c | 26 |
13 files changed, 1779 insertions, 372 deletions
diff --git a/lib/libxcb/src/Makefile b/lib/libxcb/src/Makefile index 009d893c4..7ba60ee7d 100644 --- a/lib/libxcb/src/Makefile +++ b/lib/libxcb/src/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.9 2018/07/19 12:45:31 matthieu Exp $ +# $OpenBSD: Makefile,v 1.10 2018/09/11 19:34:57 matthieu Exp $ # This Makefile is used to generate the sources files with xcbgen # The x11/py-xcbgen package needs to be installed @@ -6,7 +6,7 @@ DATADIR= ${X11BASE}/share PYTHON= python${PYTHON_VERSION} -MANOPTIONS= -c 'libxcb 1.12' -l 'X Version 11' -s 3 +MANOPTIONS= -c 'libxcb 1.13' -l 'X Version 11' -s 3 SRCS= \ bigreq.c \ @@ -26,13 +26,11 @@ SRCS= \ shm.c \ sync.c \ xc_misc.c \ - xevie.c \ xf86dri.c \ xfixes.c \ xinerama.c \ xinput.c \ xkb.c \ - xprint.c \ xproto.c \ xselinux.c \ xtest.c \ diff --git a/lib/libxcb/src/config.h b/lib/libxcb/src/config.h index 030b6ef4e..acd2bfa43 100644 --- a/lib/libxcb/src/config.h +++ b/lib/libxcb/src/config.h @@ -77,7 +77,7 @@ #define PACKAGE_NAME "libxcb" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "libxcb 1.12" +#define PACKAGE_STRING "libxcb 1.13" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "libxcb" @@ -86,13 +86,13 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.12" +#define PACKAGE_VERSION "1.13" /* Major version of this package */ #define PACKAGE_VERSION_MAJOR 1 /* Minor version of this package */ -#define PACKAGE_VERSION_MINOR 12 +#define PACKAGE_VERSION_MINOR 13 /* Patch version of this package */ #define PACKAGE_VERSION_PATCHLEVEL 0 @@ -126,7 +126,7 @@ /* Version number of package */ -#define VERSION "1.12" +#define VERSION "1.13" /* XCB buffer queue size */ #define XCB_QUEUE_BUFFER_SIZE 16384 diff --git a/lib/libxcb/src/dri3.c b/lib/libxcb/src/dri3.c index 255f5c634..e00536d31 100644 --- a/lib/libxcb/src/dri3.c +++ b/lib/libxcb/src/dri3.c @@ -176,6 +176,7 @@ xcb_dri3_pixmap_from_buffer_checked (xcb_connection_t *c, 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; @@ -191,7 +192,7 @@ xcb_dri3_pixmap_from_buffer_checked (xcb_connection_t *c, xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; - fds[0] = pixmap_fd; + 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; } @@ -219,6 +220,7 @@ xcb_dri3_pixmap_from_buffer (xcb_connection_t *c, 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; @@ -234,7 +236,7 @@ xcb_dri3_pixmap_from_buffer (xcb_connection_t *c, xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; - fds[0] = pixmap_fd; + 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; } @@ -324,6 +326,7 @@ xcb_dri3_fence_from_fd_checked (xcb_connection_t *c, 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; @@ -335,7 +338,7 @@ xcb_dri3_fence_from_fd_checked (xcb_connection_t *c, xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; - fds[0] = fence_fd; + 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; } @@ -358,6 +361,7 @@ xcb_dri3_fence_from_fd (xcb_connection_t *c, 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; @@ -369,7 +373,7 @@ xcb_dri3_fence_from_fd (xcb_connection_t *c, xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; - fds[0] = fence_fd; + 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; } @@ -445,3 +449,471 @@ xcb_dri3_fd_from_fence_reply_fds (xcb_connection_t *c /**< */, 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); +} + diff --git a/lib/libxcb/src/dri3.h b/lib/libxcb/src/dri3.h index bfc2ea54d..30f6dbcb1 100644 --- a/lib/libxcb/src/dri3.h +++ b/lib/libxcb/src/dri3.h @@ -20,7 +20,7 @@ extern "C" { #endif #define XCB_DRI3_MAJOR_VERSION 1 -#define XCB_DRI3_MINOR_VERSION 0 +#define XCB_DRI3_MINOR_VERSION 2 extern xcb_extension_t xcb_dri3_id; @@ -195,6 +195,109 @@ typedef struct xcb_dri3_fd_from_fence_reply_t { } xcb_dri3_fd_from_fence_reply_t; /** + * @brief xcb_dri3_get_supported_modifiers_cookie_t + **/ +typedef struct xcb_dri3_get_supported_modifiers_cookie_t { + unsigned int sequence; +} xcb_dri3_get_supported_modifiers_cookie_t; + +/** Opcode for xcb_dri3_get_supported_modifiers. */ +#define XCB_DRI3_GET_SUPPORTED_MODIFIERS 6 + +/** + * @brief xcb_dri3_get_supported_modifiers_request_t + **/ +typedef struct xcb_dri3_get_supported_modifiers_request_t { + uint8_t major_opcode; + uint8_t minor_opcode; + uint16_t length; + uint32_t window; + uint8_t depth; + uint8_t bpp; + uint8_t pad0[2]; +} xcb_dri3_get_supported_modifiers_request_t; + +/** + * @brief xcb_dri3_get_supported_modifiers_reply_t + **/ +typedef struct xcb_dri3_get_supported_modifiers_reply_t { + uint8_t response_type; + uint8_t pad0; + uint16_t sequence; + uint32_t length; + uint32_t num_window_modifiers; + uint32_t num_screen_modifiers; + uint8_t pad1[16]; +} xcb_dri3_get_supported_modifiers_reply_t; + +/** Opcode for xcb_dri3_pixmap_from_buffers. */ +#define XCB_DRI3_PIXMAP_FROM_BUFFERS 7 + +/** + * @brief xcb_dri3_pixmap_from_buffers_request_t + **/ +typedef struct xcb_dri3_pixmap_from_buffers_request_t { + uint8_t major_opcode; + uint8_t minor_opcode; + uint16_t length; + xcb_pixmap_t pixmap; + xcb_window_t window; + uint8_t num_buffers; + uint8_t pad0[3]; + 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; + uint8_t pad1[2]; + uint64_t modifier; +} xcb_dri3_pixmap_from_buffers_request_t; + +/** + * @brief xcb_dri3_buffers_from_pixmap_cookie_t + **/ +typedef struct xcb_dri3_buffers_from_pixmap_cookie_t { + unsigned int sequence; +} xcb_dri3_buffers_from_pixmap_cookie_t; + +/** Opcode for xcb_dri3_buffers_from_pixmap. */ +#define XCB_DRI3_BUFFERS_FROM_PIXMAP 8 + +/** + * @brief xcb_dri3_buffers_from_pixmap_request_t + **/ +typedef struct xcb_dri3_buffers_from_pixmap_request_t { + uint8_t major_opcode; + uint8_t minor_opcode; + uint16_t length; + xcb_pixmap_t pixmap; +} xcb_dri3_buffers_from_pixmap_request_t; + +/** + * @brief xcb_dri3_buffers_from_pixmap_reply_t + **/ +typedef struct xcb_dri3_buffers_from_pixmap_reply_t { + uint8_t response_type; + uint8_t nfd; + uint16_t sequence; + uint32_t length; + uint16_t width; + uint16_t height; + uint8_t pad0[4]; + uint64_t modifier; + uint8_t depth; + uint8_t bpp; + uint8_t pad1[6]; +} xcb_dri3_buffers_from_pixmap_reply_t; + +/** * * @param c The connection * @return A cookie @@ -499,6 +602,226 @@ int * xcb_dri3_fd_from_fence_reply_fds (xcb_connection_t *c /**< */, xcb_dri3_fd_from_fence_reply_t *reply); +int +xcb_dri3_get_supported_modifiers_sizeof (const void *_buffer); + +/** + * + * @param c The connection + * @return A cookie + * + * Delivers a request to the X server. + * + */ +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); + +/** + * + * @param c The connection + * @return A cookie + * + * Delivers a request to the X server. + * + * This form can be used only if the request will cause + * a reply to be generated. Any returned error will be + * placed in the event queue. + */ +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); + +uint64_t * +xcb_dri3_get_supported_modifiers_window_modifiers (const xcb_dri3_get_supported_modifiers_reply_t *R); + +int +xcb_dri3_get_supported_modifiers_window_modifiers_length (const xcb_dri3_get_supported_modifiers_reply_t *R); + +xcb_generic_iterator_t +xcb_dri3_get_supported_modifiers_window_modifiers_end (const xcb_dri3_get_supported_modifiers_reply_t *R); + +uint64_t * +xcb_dri3_get_supported_modifiers_screen_modifiers (const xcb_dri3_get_supported_modifiers_reply_t *R); + +int +xcb_dri3_get_supported_modifiers_screen_modifiers_length (const xcb_dri3_get_supported_modifiers_reply_t *R); + +xcb_generic_iterator_t +xcb_dri3_get_supported_modifiers_screen_modifiers_end (const xcb_dri3_get_supported_modifiers_reply_t *R); + +/** + * Return the reply + * @param c The connection + * @param cookie The cookie + * @param e The xcb_generic_error_t supplied + * + * Returns the reply of the request asked by + * + * The parameter @p e supplied to this function must be NULL if + * xcb_dri3_get_supported_modifiers_unchecked(). is used. + * Otherwise, it stores the error if any. + * + * The returned value must be freed by the caller using free(). + */ +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); + +/** + * + * @param c The connection + * @return A cookie + * + * Delivers a request to the X server. + * + * This form can be used only if the request will not cause + * a reply to be generated. Any returned error will be + * saved for handling by xcb_request_check(). + */ +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); + +/** + * + * @param c The connection + * @return A cookie + * + * Delivers a request to the X server. + * + */ +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); + +int +xcb_dri3_buffers_from_pixmap_sizeof (const void *_buffer, + int32_t buffers); + +/** + * + * @param c The connection + * @return A cookie + * + * Delivers a request to the X server. + * + */ +xcb_dri3_buffers_from_pixmap_cookie_t +xcb_dri3_buffers_from_pixmap (xcb_connection_t *c, + xcb_pixmap_t pixmap); + +/** + * + * @param c The connection + * @return A cookie + * + * Delivers a request to the X server. + * + * This form can be used only if the request will cause + * a reply to be generated. Any returned error will be + * placed in the event queue. + */ +xcb_dri3_buffers_from_pixmap_cookie_t +xcb_dri3_buffers_from_pixmap_unchecked (xcb_connection_t *c, + xcb_pixmap_t pixmap); + +uint32_t * +xcb_dri3_buffers_from_pixmap_strides (const xcb_dri3_buffers_from_pixmap_reply_t *R); + +int +xcb_dri3_buffers_from_pixmap_strides_length (const xcb_dri3_buffers_from_pixmap_reply_t *R); + +xcb_generic_iterator_t +xcb_dri3_buffers_from_pixmap_strides_end (const xcb_dri3_buffers_from_pixmap_reply_t *R); + +uint32_t * +xcb_dri3_buffers_from_pixmap_offsets (const xcb_dri3_buffers_from_pixmap_reply_t *R); + +int +xcb_dri3_buffers_from_pixmap_offsets_length (const xcb_dri3_buffers_from_pixmap_reply_t *R); + +xcb_generic_iterator_t +xcb_dri3_buffers_from_pixmap_offsets_end (const xcb_dri3_buffers_from_pixmap_reply_t *R); + +int32_t * +xcb_dri3_buffers_from_pixmap_buffers (const xcb_dri3_buffers_from_pixmap_reply_t *R); + +int +xcb_dri3_buffers_from_pixmap_buffers_length (const xcb_dri3_buffers_from_pixmap_reply_t *R); + +xcb_generic_iterator_t +xcb_dri3_buffers_from_pixmap_buffers_end (const xcb_dri3_buffers_from_pixmap_reply_t *R); + +/** + * Return the reply + * @param c The connection + * @param cookie The cookie + * @param e The xcb_generic_error_t supplied + * + * Returns the reply of the request asked by + * + * The parameter @p e supplied to this function must be NULL if + * xcb_dri3_buffers_from_pixmap_unchecked(). is used. + * Otherwise, it stores the error if any. + * + * The returned value must be freed by the caller using free(). + */ +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 the reply fds + * @param c The connection + * @param reply The reply + * + * Returns the array of reply fds of the request asked by + * + * The returned value must be freed by the caller using free(). + */ +int * +xcb_dri3_buffers_from_pixmap_reply_fds (xcb_connection_t *c /**< */, + xcb_dri3_buffers_from_pixmap_reply_t *reply); + #ifdef __cplusplus } diff --git a/lib/libxcb/src/present.h b/lib/libxcb/src/present.h index 3ae6ecb24..e366330a0 100644 --- a/lib/libxcb/src/present.h +++ b/lib/libxcb/src/present.h @@ -23,7 +23,7 @@ extern "C" { #endif #define XCB_PRESENT_MAJOR_VERSION 1 -#define XCB_PRESENT_MINOR_VERSION 0 +#define XCB_PRESENT_MINOR_VERSION 2 extern xcb_extension_t xcb_present_id; @@ -46,7 +46,8 @@ typedef enum xcb_present_option_t { XCB_PRESENT_OPTION_NONE = 0, XCB_PRESENT_OPTION_ASYNC = 1, XCB_PRESENT_OPTION_COPY = 2, - XCB_PRESENT_OPTION_UST = 4 + XCB_PRESENT_OPTION_UST = 4, + XCB_PRESENT_OPTION_SUBOPTIMAL = 8 } xcb_present_option_t; typedef enum xcb_present_capability_t { @@ -64,7 +65,8 @@ typedef enum xcb_present_complete_kind_t { typedef enum xcb_present_complete_mode_t { XCB_PRESENT_COMPLETE_MODE_COPY = 0, XCB_PRESENT_COMPLETE_MODE_FLIP = 1, - XCB_PRESENT_COMPLETE_MODE_SKIP = 2 + XCB_PRESENT_COMPLETE_MODE_SKIP = 2, + XCB_PRESENT_COMPLETE_MODE_SUBOPTIMAL_COPY = 3 } xcb_present_complete_mode_t; /** diff --git a/lib/libxcb/src/randr.c b/lib/libxcb/src/randr.c index 181d05cb7..efff1aa6c 100644 --- a/lib/libxcb/src/randr.c +++ b/lib/libxcb/src/randr.c @@ -92,6 +92,24 @@ xcb_randr_provider_end (xcb_randr_provider_iterator_t i) } 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; @@ -5080,24 +5098,6 @@ xcb_randr_resource_change_end (xcb_randr_resource_change_iterator_t i) 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; -} - int xcb_randr_monitor_info_sizeof (const void *_buffer) { @@ -5444,3 +5444,241 @@ xcb_randr_delete_monitor (xcb_connection_t *c, 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/lib/libxcb/src/randr.h b/lib/libxcb/src/randr.h index 3be747038..6235638f4 100644 --- a/lib/libxcb/src/randr.h +++ b/lib/libxcb/src/randr.h @@ -21,7 +21,7 @@ extern "C" { #endif #define XCB_RANDR_MAJOR_VERSION 1 -#define XCB_RANDR_MINOR_VERSION 5 +#define XCB_RANDR_MINOR_VERSION 6 extern xcb_extension_t xcb_randr_id; @@ -69,6 +69,17 @@ typedef struct xcb_randr_provider_iterator_t { int index; } xcb_randr_provider_iterator_t; +typedef uint32_t xcb_randr_lease_t; + +/** + * @brief xcb_randr_lease_iterator_t + **/ +typedef struct xcb_randr_lease_iterator_t { + xcb_randr_lease_t *data; + int rem; + int index; +} xcb_randr_lease_iterator_t; + /** Opcode for xcb_randr_bad_output. */ #define XCB_RANDR_BAD_OUTPUT 0 @@ -250,7 +261,8 @@ typedef enum xcb_randr_notify_mask_t { XCB_RANDR_NOTIFY_MASK_OUTPUT_PROPERTY = 8, XCB_RANDR_NOTIFY_MASK_PROVIDER_CHANGE = 16, XCB_RANDR_NOTIFY_MASK_PROVIDER_PROPERTY = 32, - XCB_RANDR_NOTIFY_MASK_RESOURCE_CHANGE = 64 + XCB_RANDR_NOTIFY_MASK_RESOURCE_CHANGE = 64, + XCB_RANDR_NOTIFY_MASK_LEASE = 128 } xcb_randr_notify_mask_t; /** Opcode for xcb_randr_select_input. */ @@ -1405,7 +1417,8 @@ typedef enum xcb_randr_notify_t { XCB_RANDR_NOTIFY_OUTPUT_PROPERTY = 2, XCB_RANDR_NOTIFY_PROVIDER_CHANGE = 3, XCB_RANDR_NOTIFY_PROVIDER_PROPERTY = 4, - XCB_RANDR_NOTIFY_RESOURCE_CHANGE = 5 + XCB_RANDR_NOTIFY_RESOURCE_CHANGE = 5, + XCB_RANDR_NOTIFY_LEASE = 6 } xcb_randr_notify_t; /** @@ -1537,40 +1550,6 @@ typedef struct xcb_randr_resource_change_iterator_t { } xcb_randr_resource_change_iterator_t; /** - * @brief xcb_randr_notify_data_t - **/ -typedef union xcb_randr_notify_data_t { - xcb_randr_crtc_change_t cc; - xcb_randr_output_change_t oc; - xcb_randr_output_property_t op; - xcb_randr_provider_change_t pc; - xcb_randr_provider_property_t pp; - xcb_randr_resource_change_t rc; -} xcb_randr_notify_data_t; - -/** - * @brief xcb_randr_notify_data_iterator_t - **/ -typedef struct xcb_randr_notify_data_iterator_t { - xcb_randr_notify_data_t *data; - int rem; - int index; -} xcb_randr_notify_data_iterator_t; - -/** Opcode for xcb_randr_notify. */ -#define XCB_RANDR_NOTIFY 1 - -/** - * @brief xcb_randr_notify_event_t - **/ -typedef struct xcb_randr_notify_event_t { - uint8_t response_type; - uint8_t subCode; - uint16_t sequence; - xcb_randr_notify_data_t u; -} xcb_randr_notify_event_t; - -/** * @brief xcb_randr_monitor_info_t **/ typedef struct xcb_randr_monitor_info_t { @@ -1658,6 +1637,109 @@ typedef struct xcb_randr_delete_monitor_request_t { } xcb_randr_delete_monitor_request_t; /** + * @brief xcb_randr_create_lease_cookie_t + **/ +typedef struct xcb_randr_create_lease_cookie_t { + unsigned int sequence; +} xcb_randr_create_lease_cookie_t; + +/** Opcode for xcb_randr_create_lease. */ +#define XCB_RANDR_CREATE_LEASE 45 + +/** + * @brief xcb_randr_create_lease_request_t + **/ +typedef struct xcb_randr_create_lease_request_t { + uint8_t major_opcode; + uint8_t minor_opcode; + uint16_t length; + xcb_window_t window; + xcb_randr_lease_t lid; + uint16_t num_crtcs; + uint16_t num_outputs; +} xcb_randr_create_lease_request_t; + +/** + * @brief xcb_randr_create_lease_reply_t + **/ +typedef struct xcb_randr_create_lease_reply_t { + uint8_t response_type; + uint8_t nfd; + uint16_t sequence; + uint32_t length; + uint8_t pad0[24]; +} xcb_randr_create_lease_reply_t; + +/** Opcode for xcb_randr_free_lease. */ +#define XCB_RANDR_FREE_LEASE 46 + +/** + * @brief xcb_randr_free_lease_request_t + **/ +typedef struct xcb_randr_free_lease_request_t { + uint8_t major_opcode; + uint8_t minor_opcode; + uint16_t length; + xcb_randr_lease_t lid; + uint8_t terminate; +} xcb_randr_free_lease_request_t; + +/** + * @brief xcb_randr_lease_notify_t + **/ +typedef struct xcb_randr_lease_notify_t { + xcb_timestamp_t timestamp; + xcb_window_t window; + xcb_randr_lease_t lease; + uint8_t created; + uint8_t pad0[15]; +} xcb_randr_lease_notify_t; + +/** + * @brief xcb_randr_lease_notify_iterator_t + **/ +typedef struct xcb_randr_lease_notify_iterator_t { + xcb_randr_lease_notify_t *data; + int rem; + int index; +} xcb_randr_lease_notify_iterator_t; + +/** + * @brief xcb_randr_notify_data_t + **/ +typedef union xcb_randr_notify_data_t { + xcb_randr_crtc_change_t cc; + xcb_randr_output_change_t oc; + xcb_randr_output_property_t op; + xcb_randr_provider_change_t pc; + xcb_randr_provider_property_t pp; + xcb_randr_resource_change_t rc; + xcb_randr_lease_notify_t lc; +} xcb_randr_notify_data_t; + +/** + * @brief xcb_randr_notify_data_iterator_t + **/ +typedef struct xcb_randr_notify_data_iterator_t { + xcb_randr_notify_data_t *data; + int rem; + int index; +} xcb_randr_notify_data_iterator_t; + +/** Opcode for xcb_randr_notify. */ +#define XCB_RANDR_NOTIFY 1 + +/** + * @brief xcb_randr_notify_event_t + **/ +typedef struct xcb_randr_notify_event_t { + uint8_t response_type; + uint8_t subCode; + uint16_t sequence; + xcb_randr_notify_data_t u; +} xcb_randr_notify_event_t; + +/** * Get the next element of the iterator * @param i Pointer to a xcb_randr_mode_iterator_t * @@ -1751,6 +1833,29 @@ xcb_randr_provider_end (xcb_randr_provider_iterator_t i); /** * Get the next element of the iterator + * @param i Pointer to a xcb_randr_lease_iterator_t + * + * Get the next element in the iterator. The member rem is + * decreased by one. The member data points to the next + * element. The member index is increased by sizeof(xcb_randr_lease_t) + */ +void +xcb_randr_lease_next (xcb_randr_lease_iterator_t *i); + +/** + * Return the iterator pointing to the last element + * @param i An xcb_randr_lease_iterator_t + * @return The iterator pointing to the last element + * + * Set the current element in the iterator to the last element. + * The member rem is set to 0. The member data points to the + * last element. + */ +xcb_generic_iterator_t +xcb_randr_lease_end (xcb_randr_lease_iterator_t i); + +/** + * Get the next element of the iterator * @param i Pointer to a xcb_randr_screen_size_iterator_t * * Get the next element in the iterator. The member rem is @@ -4155,29 +4260,6 @@ xcb_randr_resource_change_next (xcb_randr_resource_change_iterator_t *i); xcb_generic_iterator_t xcb_randr_resource_change_end (xcb_randr_resource_change_iterator_t i); -/** - * Get the next element of the iterator - * @param i Pointer to a xcb_randr_notify_data_iterator_t - * - * Get the next element in the iterator. The member rem is - * decreased by one. The member data points to the next - * element. The member index is increased by sizeof(xcb_randr_notify_data_t) - */ -void -xcb_randr_notify_data_next (xcb_randr_notify_data_iterator_t *i); - -/** - * Return the iterator pointing to the last element - * @param i An xcb_randr_notify_data_iterator_t - * @return The iterator pointing to the last element - * - * Set the current element in the iterator to the last element. - * The member rem is set to 0. The member data points to the - * last element. - */ -xcb_generic_iterator_t -xcb_randr_notify_data_end (xcb_randr_notify_data_iterator_t i); - int xcb_randr_monitor_info_sizeof (const void *_buffer); @@ -4334,6 +4416,153 @@ xcb_randr_delete_monitor (xcb_connection_t *c, xcb_window_t window, xcb_atom_t name); +int +xcb_randr_create_lease_sizeof (const void *_buffer); + +/** + * + * @param c The connection + * @return A cookie + * + * Delivers a request to the X server. + * + */ +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); + +/** + * + * @param c The connection + * @return A cookie + * + * Delivers a request to the X server. + * + * This form can be used only if the request will cause + * a reply to be generated. Any returned error will be + * placed in the event queue. + */ +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); + +/** + * Return the reply + * @param c The connection + * @param cookie The cookie + * @param e The xcb_generic_error_t supplied + * + * Returns the reply of the request asked by + * + * The parameter @p e supplied to this function must be NULL if + * xcb_randr_create_lease_unchecked(). is used. + * Otherwise, it stores the error if any. + * + * The returned value must be freed by the caller using free(). + */ +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 the reply fds + * @param c The connection + * @param reply The reply + * + * Returns the array of reply fds of the request asked by + * + * The returned value must be freed by the caller using free(). + */ +int * +xcb_randr_create_lease_reply_fds (xcb_connection_t *c /**< */, + xcb_randr_create_lease_reply_t *reply); + +/** + * + * @param c The connection + * @return A cookie + * + * Delivers a request to the X server. + * + * This form can be used only if the request will not cause + * a reply to be generated. Any returned error will be + * saved for handling by xcb_request_check(). + */ +xcb_void_cookie_t +xcb_randr_free_lease_checked (xcb_connection_t *c, + xcb_randr_lease_t lid, + uint8_t terminate); + +/** + * + * @param c The connection + * @return A cookie + * + * Delivers a request to the X server. + * + */ +xcb_void_cookie_t +xcb_randr_free_lease (xcb_connection_t *c, + xcb_randr_lease_t lid, + uint8_t terminate); + +/** + * Get the next element of the iterator + * @param i Pointer to a xcb_randr_lease_notify_iterator_t + * + * Get the next element in the iterator. The member rem is + * decreased by one. The member data points to the next + * element. The member index is increased by sizeof(xcb_randr_lease_notify_t) + */ +void +xcb_randr_lease_notify_next (xcb_randr_lease_notify_iterator_t *i); + +/** + * Return the iterator pointing to the last element + * @param i An xcb_randr_lease_notify_iterator_t + * @return The iterator pointing to the last element + * + * Set the current element in the iterator to the last element. + * The member rem is set to 0. The member data points to the + * last element. + */ +xcb_generic_iterator_t +xcb_randr_lease_notify_end (xcb_randr_lease_notify_iterator_t i); + +/** + * Get the next element of the iterator + * @param i Pointer to a xcb_randr_notify_data_iterator_t + * + * Get the next element in the iterator. The member rem is + * decreased by one. The member data points to the next + * element. The member index is increased by sizeof(xcb_randr_notify_data_t) + */ +void +xcb_randr_notify_data_next (xcb_randr_notify_data_iterator_t *i); + +/** + * Return the iterator pointing to the last element + * @param i An xcb_randr_notify_data_iterator_t + * @return The iterator pointing to the last element + * + * Set the current element in the iterator to the last element. + * The member rem is set to 0. The member data points to the + * last element. + */ +xcb_generic_iterator_t +xcb_randr_notify_data_end (xcb_randr_notify_data_iterator_t i); + #ifdef __cplusplus } diff --git a/lib/libxcb/src/res.c b/lib/libxcb/src/res.c index 9f737ab9f..5b5da8187 100644 --- a/lib/libxcb/src/res.c +++ b/lib/libxcb/src/res.c @@ -88,7 +88,7 @@ xcb_res_client_id_value_sizeof (const void *_buffer) xcb_buffer_len += xcb_block_len; xcb_block_len = 0; /* value */ - xcb_block_len += _aux->length * sizeof(uint32_t); + xcb_block_len += (_aux->length / 4) * sizeof(uint32_t); xcb_tmp += xcb_block_len; xcb_align_to = ALIGNOF(uint32_t); /* insert padding */ @@ -112,14 +112,14 @@ xcb_res_client_id_value_value (const xcb_res_client_id_value_t *R) int xcb_res_client_id_value_value_length (const xcb_res_client_id_value_t *R) { - return R->length; + 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); + i.data = ((uint32_t *) (R + 1)) + ((R->length / 4)); i.rem = 0; i.index = (char *) i.data - (char *) R; return i; diff --git a/lib/libxcb/src/shm.c b/lib/libxcb/src/shm.c index eb4c8d480..f51c9e56d 100644 --- a/lib/libxcb/src/shm.c +++ b/lib/libxcb/src/shm.c @@ -505,6 +505,7 @@ xcb_shm_attach_fd_checked (xcb_connection_t *c, 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; @@ -515,7 +516,7 @@ xcb_shm_attach_fd_checked (xcb_connection_t *c, xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; - fds[0] = shm_fd; + 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; } @@ -537,6 +538,7 @@ xcb_shm_attach_fd (xcb_connection_t *c, 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; @@ -547,7 +549,7 @@ xcb_shm_attach_fd (xcb_connection_t *c, xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; - fds[0] = shm_fd; + 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; } diff --git a/lib/libxcb/src/xinput.c b/lib/libxcb/src/xinput.c index 5ec5b637b..9c3648f37 100644 --- a/lib/libxcb/src/xinput.c +++ b/lib/libxcb/src/xinput.c @@ -958,6 +958,24 @@ xcb_input_list_input_devices_reply (xcb_connection_t *c, } 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; @@ -5608,189 +5626,6 @@ xcb_input_query_device_state_reply (xcb_connection_t *c, return (xcb_input_query_device_state_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); } -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 * 32) * 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; - /* 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 uint8_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; - /* uint8_t events */ - xcb_parts[4].iov_base = (char *) events; - xcb_parts[4].iov_len = (num_events * 32) * sizeof(uint8_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 uint8_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; - /* uint8_t events */ - xcb_parts[4].iov_base = (char *) events; - xcb_parts[4].iov_len = (num_events * 32) * sizeof(uint8_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; -} - -uint8_t * -xcb_input_send_extension_event_events (const xcb_input_send_extension_event_request_t *R) -{ - return (uint8_t *) (R + 1); -} - -int -xcb_input_send_extension_event_events_length (const xcb_input_send_extension_event_request_t *R) -{ - return (R->num_events * 32); -} - -xcb_generic_iterator_t -xcb_input_send_extension_event_events_end (const xcb_input_send_extension_event_request_t *R) -{ - xcb_generic_iterator_t i; - i.data = ((uint8_t *) (R + 1)) + ((R->num_events * 32)); - i.rem = 0; - 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_send_extension_event_events_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_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_send_extension_event_events_end(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; -} - xcb_void_cookie_t xcb_input_device_bell_checked (xcb_connection_t *c, uint8_t device_id, @@ -9516,9 +9351,9 @@ xcb_input_xi_change_hierarchy_checked (xcb_connection_t *c, struct iovec xcb_parts[6]; xcb_void_cookie_t xcb_ret; xcb_input_xi_change_hierarchy_request_t xcb_out; - unsigned int i; unsigned int xcb_tmp_len; char *xcb_tmp; + unsigned int i; xcb_out.num_changes = num_changes; memset(xcb_out.pad0, 0, 3); @@ -9558,9 +9393,9 @@ xcb_input_xi_change_hierarchy (xcb_connection_t *c, struct iovec xcb_parts[6]; xcb_void_cookie_t xcb_ret; xcb_input_xi_change_hierarchy_request_t xcb_out; - unsigned int i; unsigned int xcb_tmp_len; char *xcb_tmp; + unsigned int i; xcb_out.num_changes = num_changes; memset(xcb_out.pad0, 0, 3); @@ -9847,9 +9682,9 @@ xcb_input_xi_select_events_checked (xcb_connection_t *c, struct iovec xcb_parts[6]; xcb_void_cookie_t xcb_ret; xcb_input_xi_select_events_request_t xcb_out; - unsigned int i; unsigned int xcb_tmp_len; char *xcb_tmp; + unsigned int i; xcb_out.window = window; xcb_out.num_mask = num_mask; @@ -9891,9 +9726,9 @@ xcb_input_xi_select_events (xcb_connection_t *c, struct iovec xcb_parts[6]; xcb_void_cookie_t xcb_ret; xcb_input_xi_select_events_request_t xcb_out; - unsigned int i; unsigned int xcb_tmp_len; char *xcb_tmp; + unsigned int i; xcb_out.window = window; xcb_out.num_mask = num_mask; @@ -14455,3 +14290,204 @@ 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/lib/libxcb/src/xinput.h b/lib/libxcb/src/xinput.h index d5ca67638..0a06d710d 100644 --- a/lib/libxcb/src/xinput.h +++ b/lib/libxcb/src/xinput.h @@ -328,12 +328,23 @@ typedef struct xcb_input_list_input_devices_reply_t { uint8_t pad0[23]; } xcb_input_list_input_devices_reply_t; +typedef uint8_t xcb_input_event_type_base_t; + +/** + * @brief xcb_input_event_type_base_iterator_t + **/ +typedef struct xcb_input_event_type_base_iterator_t { + xcb_input_event_type_base_t *data; + int rem; + int index; +} xcb_input_event_type_base_iterator_t; + /** * @brief xcb_input_input_class_info_t **/ typedef struct xcb_input_input_class_info_t { - uint8_t class_id; - uint8_t event_type_base; + uint8_t class_id; + xcb_input_event_type_base_t event_type_base; } xcb_input_input_class_info_t; /** @@ -1646,24 +1657,6 @@ typedef struct xcb_input_query_device_state_reply_t { uint8_t pad0[23]; } xcb_input_query_device_state_reply_t; -/** Opcode for xcb_input_send_extension_event. */ -#define XCB_INPUT_SEND_EXTENSION_EVENT 31 - -/** - * @brief xcb_input_send_extension_event_request_t - **/ -typedef struct xcb_input_send_extension_event_request_t { - uint8_t major_opcode; - uint8_t minor_opcode; - uint16_t length; - xcb_window_t destination; - uint8_t device_id; - uint8_t propagate; - uint16_t num_classes; - uint8_t num_events; - uint8_t pad0[3]; -} xcb_input_send_extension_event_request_t; - /** Opcode for xcb_input_device_bell. */ #define XCB_INPUT_DEVICE_BELL 32 @@ -4040,6 +4033,56 @@ typedef struct xcb_input_barrier_hit_event_t { typedef xcb_input_barrier_hit_event_t xcb_input_barrier_leave_event_t; +/** + * @brief xcb_input_event_for_send_t + **/ +typedef union xcb_input_event_for_send_t { + xcb_input_device_valuator_event_t device_valuator; + xcb_input_device_key_press_event_t device_key_press; + xcb_input_device_key_release_event_t device_key_release; + xcb_input_device_button_press_event_t device_button_press; + xcb_input_device_button_release_event_t device_button_release; + xcb_input_device_motion_notify_event_t device_motion_notify; + xcb_input_device_focus_in_event_t device_focus_in; + xcb_input_device_focus_out_event_t device_focus_out; + xcb_input_proximity_in_event_t proximity_in; + xcb_input_proximity_out_event_t proximity_out; + xcb_input_device_state_notify_event_t device_state_notify; + xcb_input_device_mapping_notify_event_t device_mapping_notify; + xcb_input_change_device_notify_event_t change_device_notify; + xcb_input_device_key_state_notify_event_t device_key_state_notify; + xcb_input_device_button_state_notify_event_t device_button_state_notify; + xcb_input_device_presence_notify_event_t device_presence_notify; + xcb_raw_generic_event_t event_header; +} xcb_input_event_for_send_t; + +/** + * @brief xcb_input_event_for_send_iterator_t + **/ +typedef struct xcb_input_event_for_send_iterator_t { + xcb_input_event_for_send_t *data; + int rem; + int index; +} xcb_input_event_for_send_iterator_t; + +/** Opcode for xcb_input_send_extension_event. */ +#define XCB_INPUT_SEND_EXTENSION_EVENT 31 + +/** + * @brief xcb_input_send_extension_event_request_t + **/ +typedef struct xcb_input_send_extension_event_request_t { + uint8_t major_opcode; + uint8_t minor_opcode; + uint16_t length; + xcb_window_t destination; + uint8_t device_id; + uint8_t propagate; + uint16_t num_classes; + uint8_t num_events; + uint8_t pad0[3]; +} xcb_input_send_extension_event_request_t; + /** Opcode for xcb_input_device. */ #define XCB_INPUT_DEVICE 0 @@ -4549,6 +4592,29 @@ xcb_input_list_input_devices_reply (xcb_connection_t *c, /** * Get the next element of the iterator + * @param i Pointer to a xcb_input_event_type_base_iterator_t + * + * Get the next element in the iterator. The member rem is + * decreased by one. The member data points to the next + * element. The member index is increased by sizeof(xcb_input_event_type_base_t) + */ +void +xcb_input_event_type_base_next (xcb_input_event_type_base_iterator_t *i); + +/** + * Return the iterator pointing to the last element + * @param i An xcb_input_event_type_base_iterator_t + * @return The iterator pointing to the last element + * + * Set the current element in the iterator to the last element. + * The member rem is set to 0. The member data points to the + * last element. + */ +xcb_generic_iterator_t +xcb_input_event_type_base_end (xcb_input_event_type_base_iterator_t i); + +/** + * Get the next element of the iterator * @param i Pointer to a xcb_input_input_class_info_iterator_t * * Get the next element in the iterator. The member rem is @@ -6509,66 +6575,6 @@ xcb_input_query_device_state_reply (xcb_connection_t *c, xcb_input_query_device_state_cookie_t cookie /**< */, xcb_generic_error_t **e); -int -xcb_input_send_extension_event_sizeof (const void *_buffer); - -/** - * - * @param c The connection - * @return A cookie - * - * Delivers a request to the X server. - * - * This form can be used only if the request will not cause - * a reply to be generated. Any returned error will be - * saved for handling by xcb_request_check(). - */ -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 uint8_t *events, - const xcb_input_event_class_t *classes); - -/** - * - * @param c The connection - * @return A cookie - * - * Delivers a request to the X server. - * - */ -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 uint8_t *events, - const xcb_input_event_class_t *classes); - -uint8_t * -xcb_input_send_extension_event_events (const xcb_input_send_extension_event_request_t *R); - -int -xcb_input_send_extension_event_events_length (const xcb_input_send_extension_event_request_t *R); - -xcb_generic_iterator_t -xcb_input_send_extension_event_events_end (const xcb_input_send_extension_event_request_t *R); - -xcb_input_event_class_t * -xcb_input_send_extension_event_classes (const xcb_input_send_extension_event_request_t *R); - -int -xcb_input_send_extension_event_classes_length (const xcb_input_send_extension_event_request_t *R); - -xcb_generic_iterator_t -xcb_input_send_extension_event_classes_end (const xcb_input_send_extension_event_request_t *R); - /** * * @param c The connection @@ -9468,6 +9474,89 @@ xcb_input_raw_touch_update_sizeof (const void *_buffer /**< */); int xcb_input_raw_touch_end_sizeof (const void *_buffer /**< */); +/** + * Get the next element of the iterator + * @param i Pointer to a xcb_input_event_for_send_iterator_t + * + * Get the next element in the iterator. The member rem is + * decreased by one. The member data points to the next + * element. The member index is increased by sizeof(xcb_input_event_for_send_t) + */ +void +xcb_input_event_for_send_next (xcb_input_event_for_send_iterator_t *i); + +/** + * Return the iterator pointing to the last element + * @param i An xcb_input_event_for_send_iterator_t + * @return The iterator pointing to the last element + * + * Set the current element in the iterator to the last element. + * The member rem is set to 0. The member data points to the + * last element. + */ +xcb_generic_iterator_t +xcb_input_event_for_send_end (xcb_input_event_for_send_iterator_t i); + +int +xcb_input_send_extension_event_sizeof (const void *_buffer); + +/** + * + * @param c The connection + * @return A cookie + * + * Delivers a request to the X server. + * + * This form can be used only if the request will not cause + * a reply to be generated. Any returned error will be + * saved for handling by xcb_request_check(). + */ +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); + +/** + * + * @param c The connection + * @return A cookie + * + * Delivers a request to the X server. + * + */ +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); + +xcb_input_event_for_send_t * +xcb_input_send_extension_event_events (const xcb_input_send_extension_event_request_t *R); + +int +xcb_input_send_extension_event_events_length (const xcb_input_send_extension_event_request_t *R); + +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_class_t * +xcb_input_send_extension_event_classes (const xcb_input_send_extension_event_request_t *R); + +int +xcb_input_send_extension_event_classes_length (const xcb_input_send_extension_event_request_t *R); + +xcb_generic_iterator_t +xcb_input_send_extension_event_classes_end (const xcb_input_send_extension_event_request_t *R); + #ifdef __cplusplus } diff --git a/lib/libxcb/src/xkb.c b/lib/libxcb/src/xkb.c index e4621b147..6aee96419 100644 --- a/lib/libxcb/src/xkb.c +++ b/lib/libxcb/src/xkb.c @@ -11373,9 +11373,9 @@ xcb_xkb_set_device_info_checked (xcb_connection_t *c, struct iovec xcb_parts[8]; xcb_void_cookie_t xcb_ret; xcb_xkb_set_device_info_request_t xcb_out; - unsigned int i; unsigned int xcb_tmp_len; char *xcb_tmp; + unsigned int i; xcb_out.deviceSpec = deviceSpec; xcb_out.firstBtn = firstBtn; @@ -11428,9 +11428,9 @@ xcb_xkb_set_device_info (xcb_connection_t *c, struct iovec xcb_parts[8]; xcb_void_cookie_t xcb_ret; xcb_xkb_set_device_info_request_t xcb_out; - unsigned int i; unsigned int xcb_tmp_len; char *xcb_tmp; + unsigned int i; xcb_out.deviceSpec = deviceSpec; xcb_out.firstBtn = firstBtn; diff --git a/lib/libxcb/src/xproto.c b/lib/libxcb/src/xproto.c index fcb0d2679..d87420d66 100644 --- a/lib/libxcb/src/xproto.c +++ b/lib/libxcb/src/xproto.c @@ -581,6 +581,15 @@ xcb_setup_request_sizeof (const void *_buffer) 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; @@ -593,6 +602,15 @@ xcb_setup_request_sizeof (const void *_buffer) 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; @@ -631,7 +649,7 @@ 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 + XCB_TYPE_PAD(char, prev.index) + 0); + return (char *) ((char *) prev.data + ((-prev.index) & (4 - 1)) + 0); } int @@ -645,7 +663,7 @@ 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 + XCB_TYPE_PAD(char, prev.index))) + (R->authorization_protocol_data_len); + 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; @@ -6261,9 +6279,9 @@ xcb_set_font_path_checked (xcb_connection_t *c, struct iovec xcb_parts[6]; xcb_void_cookie_t xcb_ret; xcb_set_font_path_request_t xcb_out; - unsigned int i; unsigned int xcb_tmp_len; char *xcb_tmp; + unsigned int i; xcb_out.pad0 = 0; xcb_out.font_qty = font_qty; @@ -6304,9 +6322,9 @@ xcb_set_font_path (xcb_connection_t *c, struct iovec xcb_parts[6]; xcb_void_cookie_t xcb_ret; xcb_set_font_path_request_t xcb_out; - unsigned int i; unsigned int xcb_tmp_len; char *xcb_tmp; + unsigned int i; xcb_out.pad0 = 0; xcb_out.font_qty = font_qty; |