1 /*
2 * This file generated automatically from res.xml by c_client.py.
3 * Edit at your peril.
4 */
5
6 #ifdef HAVE_CONFIG_H
7 #include "config.h"
8 #endif
9 #include <stdlib.h>
10 #include <string.h>
11 #include <assert.h>
12 #include <stddef.h> /* for offsetof() */
13 #include "xcbext.h"
14 #include "res.h"
15
16 #define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member)
17 #include "xproto.h"
18
19 xcb_extension_t xcb_res_id = { "X-Resource", 0 };
20
21 void
xcb_res_client_next(xcb_res_client_iterator_t * i)22 xcb_res_client_next (xcb_res_client_iterator_t *i /**< */)
23 {
24 --i->rem;
25 ++i->data;
26 i->index += sizeof(xcb_res_client_t);
27 }
28
29 xcb_generic_iterator_t
xcb_res_client_end(xcb_res_client_iterator_t i)30 xcb_res_client_end (xcb_res_client_iterator_t i /**< */)
31 {
32 xcb_generic_iterator_t ret;
33 ret.data = i.data + i.rem;
34 ret.index = i.index + ((char *) ret.data - (char *) i.data);
35 ret.rem = 0;
36 return ret;
37 }
38
39 void
xcb_res_type_next(xcb_res_type_iterator_t * i)40 xcb_res_type_next (xcb_res_type_iterator_t *i /**< */)
41 {
42 --i->rem;
43 ++i->data;
44 i->index += sizeof(xcb_res_type_t);
45 }
46
47 xcb_generic_iterator_t
xcb_res_type_end(xcb_res_type_iterator_t i)48 xcb_res_type_end (xcb_res_type_iterator_t i /**< */)
49 {
50 xcb_generic_iterator_t ret;
51 ret.data = i.data + i.rem;
52 ret.index = i.index + ((char *) ret.data - (char *) i.data);
53 ret.rem = 0;
54 return ret;
55 }
56
57 void
xcb_res_client_id_spec_next(xcb_res_client_id_spec_iterator_t * i)58 xcb_res_client_id_spec_next (xcb_res_client_id_spec_iterator_t *i /**< */)
59 {
60 --i->rem;
61 ++i->data;
62 i->index += sizeof(xcb_res_client_id_spec_t);
63 }
64
65 xcb_generic_iterator_t
xcb_res_client_id_spec_end(xcb_res_client_id_spec_iterator_t i)66 xcb_res_client_id_spec_end (xcb_res_client_id_spec_iterator_t i /**< */)
67 {
68 xcb_generic_iterator_t ret;
69 ret.data = i.data + i.rem;
70 ret.index = i.index + ((char *) ret.data - (char *) i.data);
71 ret.rem = 0;
72 return ret;
73 }
74
75 int
xcb_res_client_id_value_sizeof(const void * _buffer)76 xcb_res_client_id_value_sizeof (const void *_buffer /**< */)
77 {
78 char *xcb_tmp = (char *)_buffer;
79 const xcb_res_client_id_value_t *_aux = (xcb_res_client_id_value_t *)_buffer;
80 unsigned int xcb_buffer_len = 0;
81 unsigned int xcb_block_len = 0;
82 unsigned int xcb_pad = 0;
83 unsigned int xcb_align_to = 0;
84
85
86 xcb_block_len += sizeof(xcb_res_client_id_value_t);
87 xcb_tmp += xcb_block_len;
88 xcb_buffer_len += xcb_block_len;
89 xcb_block_len = 0;
90 /* value */
91 xcb_block_len += _aux->length * sizeof(uint32_t);
92 xcb_tmp += xcb_block_len;
93 xcb_align_to = ALIGNOF(uint32_t);
94 /* insert padding */
95 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
96 xcb_buffer_len += xcb_block_len + xcb_pad;
97 if (0 != xcb_pad) {
98 xcb_tmp += xcb_pad;
99 xcb_pad = 0;
100 }
101 xcb_block_len = 0;
102
103 return xcb_buffer_len;
104 }
105
106 uint32_t *
xcb_res_client_id_value_value(const xcb_res_client_id_value_t * R)107 xcb_res_client_id_value_value (const xcb_res_client_id_value_t *R /**< */)
108 {
109 return (uint32_t *) (R + 1);
110 }
111
112 int
xcb_res_client_id_value_value_length(const xcb_res_client_id_value_t * R)113 xcb_res_client_id_value_value_length (const xcb_res_client_id_value_t *R /**< */)
114 {
115 return R->length;
116 }
117
118 xcb_generic_iterator_t
xcb_res_client_id_value_value_end(const xcb_res_client_id_value_t * R)119 xcb_res_client_id_value_value_end (const xcb_res_client_id_value_t *R /**< */)
120 {
121 xcb_generic_iterator_t i;
122 i.data = ((uint32_t *) (R + 1)) + (R->length);
123 i.rem = 0;
124 i.index = (char *) i.data - (char *) R;
125 return i;
126 }
127
128 void
xcb_res_client_id_value_next(xcb_res_client_id_value_iterator_t * i)129 xcb_res_client_id_value_next (xcb_res_client_id_value_iterator_t *i /**< */)
130 {
131 xcb_res_client_id_value_t *R = i->data;
132 xcb_generic_iterator_t child;
133 child.data = (xcb_res_client_id_value_t *)(((char *)R) + xcb_res_client_id_value_sizeof(R));
134 i->index = (char *) child.data - (char *) i->data;
135 --i->rem;
136 i->data = (xcb_res_client_id_value_t *) child.data;
137 }
138
139 xcb_generic_iterator_t
xcb_res_client_id_value_end(xcb_res_client_id_value_iterator_t i)140 xcb_res_client_id_value_end (xcb_res_client_id_value_iterator_t i /**< */)
141 {
142 xcb_generic_iterator_t ret;
143 while(i.rem > 0)
144 xcb_res_client_id_value_next(&i);
145 ret.data = i.data;
146 ret.rem = i.rem;
147 ret.index = i.index;
148 return ret;
149 }
150
151 void
xcb_res_resource_id_spec_next(xcb_res_resource_id_spec_iterator_t * i)152 xcb_res_resource_id_spec_next (xcb_res_resource_id_spec_iterator_t *i /**< */)
153 {
154 --i->rem;
155 ++i->data;
156 i->index += sizeof(xcb_res_resource_id_spec_t);
157 }
158
159 xcb_generic_iterator_t
xcb_res_resource_id_spec_end(xcb_res_resource_id_spec_iterator_t i)160 xcb_res_resource_id_spec_end (xcb_res_resource_id_spec_iterator_t i /**< */)
161 {
162 xcb_generic_iterator_t ret;
163 ret.data = i.data + i.rem;
164 ret.index = i.index + ((char *) ret.data - (char *) i.data);
165 ret.rem = 0;
166 return ret;
167 }
168
169 void
xcb_res_resource_size_spec_next(xcb_res_resource_size_spec_iterator_t * i)170 xcb_res_resource_size_spec_next (xcb_res_resource_size_spec_iterator_t *i /**< */)
171 {
172 --i->rem;
173 ++i->data;
174 i->index += sizeof(xcb_res_resource_size_spec_t);
175 }
176
177 xcb_generic_iterator_t
xcb_res_resource_size_spec_end(xcb_res_resource_size_spec_iterator_t i)178 xcb_res_resource_size_spec_end (xcb_res_resource_size_spec_iterator_t i /**< */)
179 {
180 xcb_generic_iterator_t ret;
181 ret.data = i.data + i.rem;
182 ret.index = i.index + ((char *) ret.data - (char *) i.data);
183 ret.rem = 0;
184 return ret;
185 }
186
187 int
xcb_res_resource_size_value_sizeof(const void * _buffer)188 xcb_res_resource_size_value_sizeof (const void *_buffer /**< */)
189 {
190 char *xcb_tmp = (char *)_buffer;
191 const xcb_res_resource_size_value_t *_aux = (xcb_res_resource_size_value_t *)_buffer;
192 unsigned int xcb_buffer_len = 0;
193 unsigned int xcb_block_len = 0;
194 unsigned int xcb_pad = 0;
195 unsigned int xcb_align_to = 0;
196
197
198 xcb_block_len += sizeof(xcb_res_resource_size_value_t);
199 xcb_tmp += xcb_block_len;
200 xcb_buffer_len += xcb_block_len;
201 xcb_block_len = 0;
202 /* cross_references */
203 xcb_block_len += _aux->num_cross_references * sizeof(xcb_res_resource_size_spec_t);
204 xcb_tmp += xcb_block_len;
205 xcb_align_to = ALIGNOF(xcb_res_resource_size_spec_t);
206 /* insert padding */
207 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
208 xcb_buffer_len += xcb_block_len + xcb_pad;
209 if (0 != xcb_pad) {
210 xcb_tmp += xcb_pad;
211 xcb_pad = 0;
212 }
213 xcb_block_len = 0;
214
215 return xcb_buffer_len;
216 }
217
218 xcb_res_resource_size_spec_t *
xcb_res_resource_size_value_cross_references(const xcb_res_resource_size_value_t * R)219 xcb_res_resource_size_value_cross_references (const xcb_res_resource_size_value_t *R /**< */)
220 {
221 return (xcb_res_resource_size_spec_t *) (R + 1);
222 }
223
224 int
xcb_res_resource_size_value_cross_references_length(const xcb_res_resource_size_value_t * R)225 xcb_res_resource_size_value_cross_references_length (const xcb_res_resource_size_value_t *R /**< */)
226 {
227 return R->num_cross_references;
228 }
229
230 xcb_res_resource_size_spec_iterator_t
xcb_res_resource_size_value_cross_references_iterator(const xcb_res_resource_size_value_t * R)231 xcb_res_resource_size_value_cross_references_iterator (const xcb_res_resource_size_value_t *R /**< */)
232 {
233 xcb_res_resource_size_spec_iterator_t i;
234 i.data = (xcb_res_resource_size_spec_t *) (R + 1);
235 i.rem = R->num_cross_references;
236 i.index = (char *) i.data - (char *) R;
237 return i;
238 }
239
240 void
xcb_res_resource_size_value_next(xcb_res_resource_size_value_iterator_t * i)241 xcb_res_resource_size_value_next (xcb_res_resource_size_value_iterator_t *i /**< */)
242 {
243 xcb_res_resource_size_value_t *R = i->data;
244 xcb_generic_iterator_t child;
245 child.data = (xcb_res_resource_size_value_t *)(((char *)R) + xcb_res_resource_size_value_sizeof(R));
246 i->index = (char *) child.data - (char *) i->data;
247 --i->rem;
248 i->data = (xcb_res_resource_size_value_t *) child.data;
249 }
250
251 xcb_generic_iterator_t
xcb_res_resource_size_value_end(xcb_res_resource_size_value_iterator_t i)252 xcb_res_resource_size_value_end (xcb_res_resource_size_value_iterator_t i /**< */)
253 {
254 xcb_generic_iterator_t ret;
255 while(i.rem > 0)
256 xcb_res_resource_size_value_next(&i);
257 ret.data = i.data;
258 ret.rem = i.rem;
259 ret.index = i.index;
260 return ret;
261 }
262
263 xcb_res_query_version_cookie_t
xcb_res_query_version(xcb_connection_t * c,uint8_t client_major,uint8_t client_minor)264 xcb_res_query_version (xcb_connection_t *c /**< */,
265 uint8_t client_major /**< */,
266 uint8_t client_minor /**< */)
267 {
268 static const xcb_protocol_request_t xcb_req = {
269 /* count */ 2,
270 /* ext */ &xcb_res_id,
271 /* opcode */ XCB_RES_QUERY_VERSION,
272 /* isvoid */ 0
273 };
274
275 struct iovec xcb_parts[4];
276 xcb_res_query_version_cookie_t xcb_ret;
277 xcb_res_query_version_request_t xcb_out;
278
279 xcb_out.client_major = client_major;
280 xcb_out.client_minor = client_minor;
281
282 xcb_parts[2].iov_base = (char *) &xcb_out;
283 xcb_parts[2].iov_len = sizeof(xcb_out);
284 xcb_parts[3].iov_base = 0;
285 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
286
287 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
288 return xcb_ret;
289 }
290
291 xcb_res_query_version_cookie_t
xcb_res_query_version_unchecked(xcb_connection_t * c,uint8_t client_major,uint8_t client_minor)292 xcb_res_query_version_unchecked (xcb_connection_t *c /**< */,
293 uint8_t client_major /**< */,
294 uint8_t client_minor /**< */)
295 {
296 static const xcb_protocol_request_t xcb_req = {
297 /* count */ 2,
298 /* ext */ &xcb_res_id,
299 /* opcode */ XCB_RES_QUERY_VERSION,
300 /* isvoid */ 0
301 };
302
303 struct iovec xcb_parts[4];
304 xcb_res_query_version_cookie_t xcb_ret;
305 xcb_res_query_version_request_t xcb_out;
306
307 xcb_out.client_major = client_major;
308 xcb_out.client_minor = client_minor;
309
310 xcb_parts[2].iov_base = (char *) &xcb_out;
311 xcb_parts[2].iov_len = sizeof(xcb_out);
312 xcb_parts[3].iov_base = 0;
313 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
314
315 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
316 return xcb_ret;
317 }
318
319 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)320 xcb_res_query_version_reply (xcb_connection_t *c /**< */,
321 xcb_res_query_version_cookie_t cookie /**< */,
322 xcb_generic_error_t **e /**< */)
323 {
324 return (xcb_res_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
325 }
326
327 int
xcb_res_query_clients_sizeof(const void * _buffer)328 xcb_res_query_clients_sizeof (const void *_buffer /**< */)
329 {
330 char *xcb_tmp = (char *)_buffer;
331 const xcb_res_query_clients_reply_t *_aux = (xcb_res_query_clients_reply_t *)_buffer;
332 unsigned int xcb_buffer_len = 0;
333 unsigned int xcb_block_len = 0;
334 unsigned int xcb_pad = 0;
335 unsigned int xcb_align_to = 0;
336
337
338 xcb_block_len += sizeof(xcb_res_query_clients_reply_t);
339 xcb_tmp += xcb_block_len;
340 xcb_buffer_len += xcb_block_len;
341 xcb_block_len = 0;
342 /* clients */
343 xcb_block_len += _aux->num_clients * sizeof(xcb_res_client_t);
344 xcb_tmp += xcb_block_len;
345 xcb_align_to = ALIGNOF(xcb_res_client_t);
346 /* insert padding */
347 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
348 xcb_buffer_len += xcb_block_len + xcb_pad;
349 if (0 != xcb_pad) {
350 xcb_tmp += xcb_pad;
351 xcb_pad = 0;
352 }
353 xcb_block_len = 0;
354
355 return xcb_buffer_len;
356 }
357
358 xcb_res_query_clients_cookie_t
xcb_res_query_clients(xcb_connection_t * c)359 xcb_res_query_clients (xcb_connection_t *c /**< */)
360 {
361 static const xcb_protocol_request_t xcb_req = {
362 /* count */ 2,
363 /* ext */ &xcb_res_id,
364 /* opcode */ XCB_RES_QUERY_CLIENTS,
365 /* isvoid */ 0
366 };
367
368 struct iovec xcb_parts[4];
369 xcb_res_query_clients_cookie_t xcb_ret;
370 xcb_res_query_clients_request_t xcb_out;
371
372
373 xcb_parts[2].iov_base = (char *) &xcb_out;
374 xcb_parts[2].iov_len = sizeof(xcb_out);
375 xcb_parts[3].iov_base = 0;
376 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
377
378 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
379 return xcb_ret;
380 }
381
382 xcb_res_query_clients_cookie_t
xcb_res_query_clients_unchecked(xcb_connection_t * c)383 xcb_res_query_clients_unchecked (xcb_connection_t *c /**< */)
384 {
385 static const xcb_protocol_request_t xcb_req = {
386 /* count */ 2,
387 /* ext */ &xcb_res_id,
388 /* opcode */ XCB_RES_QUERY_CLIENTS,
389 /* isvoid */ 0
390 };
391
392 struct iovec xcb_parts[4];
393 xcb_res_query_clients_cookie_t xcb_ret;
394 xcb_res_query_clients_request_t xcb_out;
395
396
397 xcb_parts[2].iov_base = (char *) &xcb_out;
398 xcb_parts[2].iov_len = sizeof(xcb_out);
399 xcb_parts[3].iov_base = 0;
400 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
401
402 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
403 return xcb_ret;
404 }
405
406 xcb_res_client_t *
xcb_res_query_clients_clients(const xcb_res_query_clients_reply_t * R)407 xcb_res_query_clients_clients (const xcb_res_query_clients_reply_t *R /**< */)
408 {
409 return (xcb_res_client_t *) (R + 1);
410 }
411
412 int
xcb_res_query_clients_clients_length(const xcb_res_query_clients_reply_t * R)413 xcb_res_query_clients_clients_length (const xcb_res_query_clients_reply_t *R /**< */)
414 {
415 return R->num_clients;
416 }
417
418 xcb_res_client_iterator_t
xcb_res_query_clients_clients_iterator(const xcb_res_query_clients_reply_t * R)419 xcb_res_query_clients_clients_iterator (const xcb_res_query_clients_reply_t *R /**< */)
420 {
421 xcb_res_client_iterator_t i;
422 i.data = (xcb_res_client_t *) (R + 1);
423 i.rem = R->num_clients;
424 i.index = (char *) i.data - (char *) R;
425 return i;
426 }
427
428 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)429 xcb_res_query_clients_reply (xcb_connection_t *c /**< */,
430 xcb_res_query_clients_cookie_t cookie /**< */,
431 xcb_generic_error_t **e /**< */)
432 {
433 return (xcb_res_query_clients_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
434 }
435
436 int
xcb_res_query_client_resources_sizeof(const void * _buffer)437 xcb_res_query_client_resources_sizeof (const void *_buffer /**< */)
438 {
439 char *xcb_tmp = (char *)_buffer;
440 const xcb_res_query_client_resources_reply_t *_aux = (xcb_res_query_client_resources_reply_t *)_buffer;
441 unsigned int xcb_buffer_len = 0;
442 unsigned int xcb_block_len = 0;
443 unsigned int xcb_pad = 0;
444 unsigned int xcb_align_to = 0;
445
446
447 xcb_block_len += sizeof(xcb_res_query_client_resources_reply_t);
448 xcb_tmp += xcb_block_len;
449 xcb_buffer_len += xcb_block_len;
450 xcb_block_len = 0;
451 /* types */
452 xcb_block_len += _aux->num_types * sizeof(xcb_res_type_t);
453 xcb_tmp += xcb_block_len;
454 xcb_align_to = ALIGNOF(xcb_res_type_t);
455 /* insert padding */
456 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
457 xcb_buffer_len += xcb_block_len + xcb_pad;
458 if (0 != xcb_pad) {
459 xcb_tmp += xcb_pad;
460 xcb_pad = 0;
461 }
462 xcb_block_len = 0;
463
464 return xcb_buffer_len;
465 }
466
467 xcb_res_query_client_resources_cookie_t
xcb_res_query_client_resources(xcb_connection_t * c,uint32_t xid)468 xcb_res_query_client_resources (xcb_connection_t *c /**< */,
469 uint32_t xid /**< */)
470 {
471 static const xcb_protocol_request_t xcb_req = {
472 /* count */ 2,
473 /* ext */ &xcb_res_id,
474 /* opcode */ XCB_RES_QUERY_CLIENT_RESOURCES,
475 /* isvoid */ 0
476 };
477
478 struct iovec xcb_parts[4];
479 xcb_res_query_client_resources_cookie_t xcb_ret;
480 xcb_res_query_client_resources_request_t xcb_out;
481
482 xcb_out.xid = xid;
483
484 xcb_parts[2].iov_base = (char *) &xcb_out;
485 xcb_parts[2].iov_len = sizeof(xcb_out);
486 xcb_parts[3].iov_base = 0;
487 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
488
489 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
490 return xcb_ret;
491 }
492
493 xcb_res_query_client_resources_cookie_t
xcb_res_query_client_resources_unchecked(xcb_connection_t * c,uint32_t xid)494 xcb_res_query_client_resources_unchecked (xcb_connection_t *c /**< */,
495 uint32_t xid /**< */)
496 {
497 static const xcb_protocol_request_t xcb_req = {
498 /* count */ 2,
499 /* ext */ &xcb_res_id,
500 /* opcode */ XCB_RES_QUERY_CLIENT_RESOURCES,
501 /* isvoid */ 0
502 };
503
504 struct iovec xcb_parts[4];
505 xcb_res_query_client_resources_cookie_t xcb_ret;
506 xcb_res_query_client_resources_request_t xcb_out;
507
508 xcb_out.xid = xid;
509
510 xcb_parts[2].iov_base = (char *) &xcb_out;
511 xcb_parts[2].iov_len = sizeof(xcb_out);
512 xcb_parts[3].iov_base = 0;
513 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
514
515 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
516 return xcb_ret;
517 }
518
519 xcb_res_type_t *
xcb_res_query_client_resources_types(const xcb_res_query_client_resources_reply_t * R)520 xcb_res_query_client_resources_types (const xcb_res_query_client_resources_reply_t *R /**< */)
521 {
522 return (xcb_res_type_t *) (R + 1);
523 }
524
525 int
xcb_res_query_client_resources_types_length(const xcb_res_query_client_resources_reply_t * R)526 xcb_res_query_client_resources_types_length (const xcb_res_query_client_resources_reply_t *R /**< */)
527 {
528 return R->num_types;
529 }
530
531 xcb_res_type_iterator_t
xcb_res_query_client_resources_types_iterator(const xcb_res_query_client_resources_reply_t * R)532 xcb_res_query_client_resources_types_iterator (const xcb_res_query_client_resources_reply_t *R /**< */)
533 {
534 xcb_res_type_iterator_t i;
535 i.data = (xcb_res_type_t *) (R + 1);
536 i.rem = R->num_types;
537 i.index = (char *) i.data - (char *) R;
538 return i;
539 }
540
541 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)542 xcb_res_query_client_resources_reply (xcb_connection_t *c /**< */,
543 xcb_res_query_client_resources_cookie_t cookie /**< */,
544 xcb_generic_error_t **e /**< */)
545 {
546 return (xcb_res_query_client_resources_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
547 }
548
549 xcb_res_query_client_pixmap_bytes_cookie_t
xcb_res_query_client_pixmap_bytes(xcb_connection_t * c,uint32_t xid)550 xcb_res_query_client_pixmap_bytes (xcb_connection_t *c /**< */,
551 uint32_t xid /**< */)
552 {
553 static const xcb_protocol_request_t xcb_req = {
554 /* count */ 2,
555 /* ext */ &xcb_res_id,
556 /* opcode */ XCB_RES_QUERY_CLIENT_PIXMAP_BYTES,
557 /* isvoid */ 0
558 };
559
560 struct iovec xcb_parts[4];
561 xcb_res_query_client_pixmap_bytes_cookie_t xcb_ret;
562 xcb_res_query_client_pixmap_bytes_request_t xcb_out;
563
564 xcb_out.xid = xid;
565
566 xcb_parts[2].iov_base = (char *) &xcb_out;
567 xcb_parts[2].iov_len = sizeof(xcb_out);
568 xcb_parts[3].iov_base = 0;
569 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
570
571 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
572 return xcb_ret;
573 }
574
575 xcb_res_query_client_pixmap_bytes_cookie_t
xcb_res_query_client_pixmap_bytes_unchecked(xcb_connection_t * c,uint32_t xid)576 xcb_res_query_client_pixmap_bytes_unchecked (xcb_connection_t *c /**< */,
577 uint32_t xid /**< */)
578 {
579 static const xcb_protocol_request_t xcb_req = {
580 /* count */ 2,
581 /* ext */ &xcb_res_id,
582 /* opcode */ XCB_RES_QUERY_CLIENT_PIXMAP_BYTES,
583 /* isvoid */ 0
584 };
585
586 struct iovec xcb_parts[4];
587 xcb_res_query_client_pixmap_bytes_cookie_t xcb_ret;
588 xcb_res_query_client_pixmap_bytes_request_t xcb_out;
589
590 xcb_out.xid = xid;
591
592 xcb_parts[2].iov_base = (char *) &xcb_out;
593 xcb_parts[2].iov_len = sizeof(xcb_out);
594 xcb_parts[3].iov_base = 0;
595 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
596
597 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
598 return xcb_ret;
599 }
600
601 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)602 xcb_res_query_client_pixmap_bytes_reply (xcb_connection_t *c /**< */,
603 xcb_res_query_client_pixmap_bytes_cookie_t cookie /**< */,
604 xcb_generic_error_t **e /**< */)
605 {
606 return (xcb_res_query_client_pixmap_bytes_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
607 }
608
609 int
xcb_res_query_client_ids_sizeof(const void * _buffer)610 xcb_res_query_client_ids_sizeof (const void *_buffer /**< */)
611 {
612 char *xcb_tmp = (char *)_buffer;
613 const xcb_res_query_client_ids_request_t *_aux = (xcb_res_query_client_ids_request_t *)_buffer;
614 unsigned int xcb_buffer_len = 0;
615 unsigned int xcb_block_len = 0;
616 unsigned int xcb_pad = 0;
617 unsigned int xcb_align_to = 0;
618
619
620 xcb_block_len += sizeof(xcb_res_query_client_ids_request_t);
621 xcb_tmp += xcb_block_len;
622 xcb_buffer_len += xcb_block_len;
623 xcb_block_len = 0;
624 /* specs */
625 xcb_block_len += _aux->num_specs * sizeof(xcb_res_client_id_spec_t);
626 xcb_tmp += xcb_block_len;
627 xcb_align_to = ALIGNOF(xcb_res_client_id_spec_t);
628 /* insert padding */
629 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
630 xcb_buffer_len += xcb_block_len + xcb_pad;
631 if (0 != xcb_pad) {
632 xcb_tmp += xcb_pad;
633 xcb_pad = 0;
634 }
635 xcb_block_len = 0;
636
637 return xcb_buffer_len;
638 }
639
640 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)641 xcb_res_query_client_ids (xcb_connection_t *c /**< */,
642 uint32_t num_specs /**< */,
643 const xcb_res_client_id_spec_t *specs /**< */)
644 {
645 static const xcb_protocol_request_t xcb_req = {
646 /* count */ 4,
647 /* ext */ &xcb_res_id,
648 /* opcode */ XCB_RES_QUERY_CLIENT_IDS,
649 /* isvoid */ 0
650 };
651
652 struct iovec xcb_parts[6];
653 xcb_res_query_client_ids_cookie_t xcb_ret;
654 xcb_res_query_client_ids_request_t xcb_out;
655
656 xcb_out.num_specs = num_specs;
657
658 xcb_parts[2].iov_base = (char *) &xcb_out;
659 xcb_parts[2].iov_len = sizeof(xcb_out);
660 xcb_parts[3].iov_base = 0;
661 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
662 /* xcb_res_client_id_spec_t specs */
663 xcb_parts[4].iov_base = (char *) specs;
664 xcb_parts[4].iov_len = num_specs * sizeof(xcb_res_client_id_spec_t);
665 xcb_parts[5].iov_base = 0;
666 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
667
668 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
669 return xcb_ret;
670 }
671
672 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)673 xcb_res_query_client_ids_unchecked (xcb_connection_t *c /**< */,
674 uint32_t num_specs /**< */,
675 const xcb_res_client_id_spec_t *specs /**< */)
676 {
677 static const xcb_protocol_request_t xcb_req = {
678 /* count */ 4,
679 /* ext */ &xcb_res_id,
680 /* opcode */ XCB_RES_QUERY_CLIENT_IDS,
681 /* isvoid */ 0
682 };
683
684 struct iovec xcb_parts[6];
685 xcb_res_query_client_ids_cookie_t xcb_ret;
686 xcb_res_query_client_ids_request_t xcb_out;
687
688 xcb_out.num_specs = num_specs;
689
690 xcb_parts[2].iov_base = (char *) &xcb_out;
691 xcb_parts[2].iov_len = sizeof(xcb_out);
692 xcb_parts[3].iov_base = 0;
693 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
694 /* xcb_res_client_id_spec_t specs */
695 xcb_parts[4].iov_base = (char *) specs;
696 xcb_parts[4].iov_len = num_specs * sizeof(xcb_res_client_id_spec_t);
697 xcb_parts[5].iov_base = 0;
698 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
699
700 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
701 return xcb_ret;
702 }
703
704 int
xcb_res_query_client_ids_ids_length(const xcb_res_query_client_ids_reply_t * R)705 xcb_res_query_client_ids_ids_length (const xcb_res_query_client_ids_reply_t *R /**< */)
706 {
707 return R->num_ids;
708 }
709
710 xcb_res_client_id_value_iterator_t
xcb_res_query_client_ids_ids_iterator(const xcb_res_query_client_ids_reply_t * R)711 xcb_res_query_client_ids_ids_iterator (const xcb_res_query_client_ids_reply_t *R /**< */)
712 {
713 xcb_res_client_id_value_iterator_t i;
714 i.data = (xcb_res_client_id_value_t *) (R + 1);
715 i.rem = R->num_ids;
716 i.index = (char *) i.data - (char *) R;
717 return i;
718 }
719
720 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)721 xcb_res_query_client_ids_reply (xcb_connection_t *c /**< */,
722 xcb_res_query_client_ids_cookie_t cookie /**< */,
723 xcb_generic_error_t **e /**< */)
724 {
725 return (xcb_res_query_client_ids_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
726 }
727
728 int
xcb_res_query_resource_bytes_sizeof(const void * _buffer)729 xcb_res_query_resource_bytes_sizeof (const void *_buffer /**< */)
730 {
731 char *xcb_tmp = (char *)_buffer;
732 const xcb_res_query_resource_bytes_request_t *_aux = (xcb_res_query_resource_bytes_request_t *)_buffer;
733 unsigned int xcb_buffer_len = 0;
734 unsigned int xcb_block_len = 0;
735 unsigned int xcb_pad = 0;
736 unsigned int xcb_align_to = 0;
737
738
739 xcb_block_len += sizeof(xcb_res_query_resource_bytes_request_t);
740 xcb_tmp += xcb_block_len;
741 xcb_buffer_len += xcb_block_len;
742 xcb_block_len = 0;
743 /* specs */
744 xcb_block_len += _aux->num_specs * sizeof(xcb_res_resource_id_spec_t);
745 xcb_tmp += xcb_block_len;
746 xcb_align_to = ALIGNOF(xcb_res_resource_id_spec_t);
747 /* insert padding */
748 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
749 xcb_buffer_len += xcb_block_len + xcb_pad;
750 if (0 != xcb_pad) {
751 xcb_tmp += xcb_pad;
752 xcb_pad = 0;
753 }
754 xcb_block_len = 0;
755
756 return xcb_buffer_len;
757 }
758
759 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)760 xcb_res_query_resource_bytes (xcb_connection_t *c /**< */,
761 uint32_t client /**< */,
762 uint32_t num_specs /**< */,
763 const xcb_res_resource_id_spec_t *specs /**< */)
764 {
765 static const xcb_protocol_request_t xcb_req = {
766 /* count */ 4,
767 /* ext */ &xcb_res_id,
768 /* opcode */ XCB_RES_QUERY_RESOURCE_BYTES,
769 /* isvoid */ 0
770 };
771
772 struct iovec xcb_parts[6];
773 xcb_res_query_resource_bytes_cookie_t xcb_ret;
774 xcb_res_query_resource_bytes_request_t xcb_out;
775
776 xcb_out.client = client;
777 xcb_out.num_specs = num_specs;
778
779 xcb_parts[2].iov_base = (char *) &xcb_out;
780 xcb_parts[2].iov_len = sizeof(xcb_out);
781 xcb_parts[3].iov_base = 0;
782 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
783 /* xcb_res_resource_id_spec_t specs */
784 xcb_parts[4].iov_base = (char *) specs;
785 xcb_parts[4].iov_len = num_specs * sizeof(xcb_res_resource_id_spec_t);
786 xcb_parts[5].iov_base = 0;
787 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
788
789 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
790 return xcb_ret;
791 }
792
793 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)794 xcb_res_query_resource_bytes_unchecked (xcb_connection_t *c /**< */,
795 uint32_t client /**< */,
796 uint32_t num_specs /**< */,
797 const xcb_res_resource_id_spec_t *specs /**< */)
798 {
799 static const xcb_protocol_request_t xcb_req = {
800 /* count */ 4,
801 /* ext */ &xcb_res_id,
802 /* opcode */ XCB_RES_QUERY_RESOURCE_BYTES,
803 /* isvoid */ 0
804 };
805
806 struct iovec xcb_parts[6];
807 xcb_res_query_resource_bytes_cookie_t xcb_ret;
808 xcb_res_query_resource_bytes_request_t xcb_out;
809
810 xcb_out.client = client;
811 xcb_out.num_specs = num_specs;
812
813 xcb_parts[2].iov_base = (char *) &xcb_out;
814 xcb_parts[2].iov_len = sizeof(xcb_out);
815 xcb_parts[3].iov_base = 0;
816 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
817 /* xcb_res_resource_id_spec_t specs */
818 xcb_parts[4].iov_base = (char *) specs;
819 xcb_parts[4].iov_len = num_specs * sizeof(xcb_res_resource_id_spec_t);
820 xcb_parts[5].iov_base = 0;
821 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
822
823 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
824 return xcb_ret;
825 }
826
827 int
xcb_res_query_resource_bytes_sizes_length(const xcb_res_query_resource_bytes_reply_t * R)828 xcb_res_query_resource_bytes_sizes_length (const xcb_res_query_resource_bytes_reply_t *R /**< */)
829 {
830 return R->num_sizes;
831 }
832
833 xcb_res_resource_size_value_iterator_t
xcb_res_query_resource_bytes_sizes_iterator(const xcb_res_query_resource_bytes_reply_t * R)834 xcb_res_query_resource_bytes_sizes_iterator (const xcb_res_query_resource_bytes_reply_t *R /**< */)
835 {
836 xcb_res_resource_size_value_iterator_t i;
837 i.data = (xcb_res_resource_size_value_t *) (R + 1);
838 i.rem = R->num_sizes;
839 i.index = (char *) i.data - (char *) R;
840 return i;
841 }
842
843 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)844 xcb_res_query_resource_bytes_reply (xcb_connection_t *c /**< */,
845 xcb_res_query_resource_bytes_cookie_t cookie /**< */,
846 xcb_generic_error_t **e /**< */)
847 {
848 return (xcb_res_query_resource_bytes_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
849 }
850
851