summaryrefslogtreecommitdiff
path: root/lib/libxcb/src/res.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libxcb/src/res.c')
-rw-r--r--lib/libxcb/src/res.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/lib/libxcb/src/res.c b/lib/libxcb/src/res.c
index e08af792f..a5b76e73c 100644
--- a/lib/libxcb/src/res.c
+++ b/lib/libxcb/src/res.c
@@ -3,10 +3,17 @@
* 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 };
@@ -122,6 +129,7 @@ xcb_res_query_version (xcb_connection_t *c /**< */,
xcb_parts[2].iov_len = sizeof(xcb_out);
xcb_parts[3].iov_base = 0;
xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
+
xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
return xcb_ret;
}
@@ -161,6 +169,7 @@ xcb_res_query_version_unchecked (xcb_connection_t *c /**< */,
xcb_parts[2].iov_len = sizeof(xcb_out);
xcb_parts[3].iov_base = 0;
xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
+
xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
return xcb_ret;
}
@@ -185,6 +194,35 @@ xcb_res_query_version_reply (xcb_connection_t *c /**< */,
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;
+
+
+ xcb_block_len += sizeof(xcb_res_query_clients_reply_t);
+ xcb_tmp += xcb_block_len;
+ /* 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;
+}
+
/*****************************************************************************
**
@@ -214,6 +252,7 @@ xcb_res_query_clients (xcb_connection_t *c /**< */)
xcb_parts[2].iov_len = sizeof(xcb_out);
xcb_parts[3].iov_base = 0;
xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
+
xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
return xcb_ret;
}
@@ -247,6 +286,7 @@ xcb_res_query_clients_unchecked (xcb_connection_t *c /**< */)
xcb_parts[2].iov_len = sizeof(xcb_out);
xcb_parts[3].iov_base = 0;
xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
+
xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
return xcb_ret;
}
@@ -323,6 +363,35 @@ xcb_res_query_clients_reply (xcb_connection_t *c /**< */,
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;
+
+
+ xcb_block_len += sizeof(xcb_res_query_client_resources_reply_t);
+ xcb_tmp += xcb_block_len;
+ /* 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;
+}
+
/*****************************************************************************
**
@@ -355,6 +424,7 @@ xcb_res_query_client_resources (xcb_connection_t *c /**< */,
xcb_parts[2].iov_len = sizeof(xcb_out);
xcb_parts[3].iov_base = 0;
xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
+
xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
return xcb_ret;
}
@@ -391,6 +461,7 @@ xcb_res_query_client_resources_unchecked (xcb_connection_t *c /**< */,
xcb_parts[2].iov_len = sizeof(xcb_out);
xcb_parts[3].iov_base = 0;
xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
+
xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
return xcb_ret;
}
@@ -499,6 +570,7 @@ xcb_res_query_client_pixmap_bytes (xcb_connection_t *c /**< */,
xcb_parts[2].iov_len = sizeof(xcb_out);
xcb_parts[3].iov_base = 0;
xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
+
xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
return xcb_ret;
}
@@ -535,6 +607,7 @@ xcb_res_query_client_pixmap_bytes_unchecked (xcb_connection_t *c /**< */,
xcb_parts[2].iov_len = sizeof(xcb_out);
xcb_parts[3].iov_base = 0;
xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
+
xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
return xcb_ret;
}