xref: /minix3/external/mit/xorg/lib/libxcb/files/res.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1971bb1a5SLionel Sambuc /*
2971bb1a5SLionel Sambuc  * This file generated automatically from res.xml by c_client.py.
3971bb1a5SLionel Sambuc  * Edit at your peril.
4971bb1a5SLionel Sambuc  */
5971bb1a5SLionel Sambuc 
6971bb1a5SLionel Sambuc #ifdef HAVE_CONFIG_H
7971bb1a5SLionel Sambuc #include "config.h"
8971bb1a5SLionel Sambuc #endif
9971bb1a5SLionel Sambuc #include <stdlib.h>
10971bb1a5SLionel Sambuc #include <string.h>
11971bb1a5SLionel Sambuc #include <assert.h>
12971bb1a5SLionel Sambuc #include <stddef.h>  /* for offsetof() */
13971bb1a5SLionel Sambuc #include "xcbext.h"
14971bb1a5SLionel Sambuc #include "res.h"
15971bb1a5SLionel Sambuc 
16971bb1a5SLionel Sambuc #define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member)
17971bb1a5SLionel Sambuc #include "xproto.h"
18971bb1a5SLionel Sambuc 
19971bb1a5SLionel Sambuc xcb_extension_t xcb_res_id = { "X-Resource", 0 };
20971bb1a5SLionel Sambuc 
21971bb1a5SLionel Sambuc void
xcb_res_client_next(xcb_res_client_iterator_t * i)22971bb1a5SLionel Sambuc xcb_res_client_next (xcb_res_client_iterator_t *i  /**< */)
23971bb1a5SLionel Sambuc {
24971bb1a5SLionel Sambuc     --i->rem;
25971bb1a5SLionel Sambuc     ++i->data;
26971bb1a5SLionel Sambuc     i->index += sizeof(xcb_res_client_t);
27971bb1a5SLionel Sambuc }
28971bb1a5SLionel Sambuc 
29971bb1a5SLionel Sambuc xcb_generic_iterator_t
xcb_res_client_end(xcb_res_client_iterator_t i)30971bb1a5SLionel Sambuc xcb_res_client_end (xcb_res_client_iterator_t i  /**< */)
31971bb1a5SLionel Sambuc {
32971bb1a5SLionel Sambuc     xcb_generic_iterator_t ret;
33971bb1a5SLionel Sambuc     ret.data = i.data + i.rem;
34971bb1a5SLionel Sambuc     ret.index = i.index + ((char *) ret.data - (char *) i.data);
35971bb1a5SLionel Sambuc     ret.rem = 0;
36971bb1a5SLionel Sambuc     return ret;
37971bb1a5SLionel Sambuc }
38971bb1a5SLionel Sambuc 
39971bb1a5SLionel Sambuc void
xcb_res_type_next(xcb_res_type_iterator_t * i)40971bb1a5SLionel Sambuc xcb_res_type_next (xcb_res_type_iterator_t *i  /**< */)
41971bb1a5SLionel Sambuc {
42971bb1a5SLionel Sambuc     --i->rem;
43971bb1a5SLionel Sambuc     ++i->data;
44971bb1a5SLionel Sambuc     i->index += sizeof(xcb_res_type_t);
45971bb1a5SLionel Sambuc }
46971bb1a5SLionel Sambuc 
47971bb1a5SLionel Sambuc xcb_generic_iterator_t
xcb_res_type_end(xcb_res_type_iterator_t i)48971bb1a5SLionel Sambuc xcb_res_type_end (xcb_res_type_iterator_t i  /**< */)
49971bb1a5SLionel Sambuc {
50971bb1a5SLionel Sambuc     xcb_generic_iterator_t ret;
51971bb1a5SLionel Sambuc     ret.data = i.data + i.rem;
52971bb1a5SLionel Sambuc     ret.index = i.index + ((char *) ret.data - (char *) i.data);
53971bb1a5SLionel Sambuc     ret.rem = 0;
54971bb1a5SLionel Sambuc     return ret;
55971bb1a5SLionel Sambuc }
56971bb1a5SLionel Sambuc 
57*0a6a1f1dSLionel Sambuc void
xcb_res_client_id_spec_next(xcb_res_client_id_spec_iterator_t * i)58*0a6a1f1dSLionel Sambuc xcb_res_client_id_spec_next (xcb_res_client_id_spec_iterator_t *i  /**< */)
59*0a6a1f1dSLionel Sambuc {
60*0a6a1f1dSLionel Sambuc     --i->rem;
61*0a6a1f1dSLionel Sambuc     ++i->data;
62*0a6a1f1dSLionel Sambuc     i->index += sizeof(xcb_res_client_id_spec_t);
63*0a6a1f1dSLionel Sambuc }
64971bb1a5SLionel Sambuc 
65*0a6a1f1dSLionel Sambuc xcb_generic_iterator_t
xcb_res_client_id_spec_end(xcb_res_client_id_spec_iterator_t i)66*0a6a1f1dSLionel Sambuc xcb_res_client_id_spec_end (xcb_res_client_id_spec_iterator_t i  /**< */)
67*0a6a1f1dSLionel Sambuc {
68*0a6a1f1dSLionel Sambuc     xcb_generic_iterator_t ret;
69*0a6a1f1dSLionel Sambuc     ret.data = i.data + i.rem;
70*0a6a1f1dSLionel Sambuc     ret.index = i.index + ((char *) ret.data - (char *) i.data);
71*0a6a1f1dSLionel Sambuc     ret.rem = 0;
72*0a6a1f1dSLionel Sambuc     return ret;
73*0a6a1f1dSLionel Sambuc }
74*0a6a1f1dSLionel Sambuc 
75*0a6a1f1dSLionel Sambuc int
xcb_res_client_id_value_sizeof(const void * _buffer)76*0a6a1f1dSLionel Sambuc xcb_res_client_id_value_sizeof (const void  *_buffer  /**< */)
77*0a6a1f1dSLionel Sambuc {
78*0a6a1f1dSLionel Sambuc     char *xcb_tmp = (char *)_buffer;
79*0a6a1f1dSLionel Sambuc     const xcb_res_client_id_value_t *_aux = (xcb_res_client_id_value_t *)_buffer;
80*0a6a1f1dSLionel Sambuc     unsigned int xcb_buffer_len = 0;
81*0a6a1f1dSLionel Sambuc     unsigned int xcb_block_len = 0;
82*0a6a1f1dSLionel Sambuc     unsigned int xcb_pad = 0;
83*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
84*0a6a1f1dSLionel Sambuc 
85*0a6a1f1dSLionel Sambuc 
86*0a6a1f1dSLionel Sambuc     xcb_block_len += sizeof(xcb_res_client_id_value_t);
87*0a6a1f1dSLionel Sambuc     xcb_tmp += xcb_block_len;
88*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
89*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
90*0a6a1f1dSLionel Sambuc     /* value */
91*0a6a1f1dSLionel Sambuc     xcb_block_len += _aux->length * sizeof(uint32_t);
92*0a6a1f1dSLionel Sambuc     xcb_tmp += xcb_block_len;
93*0a6a1f1dSLionel Sambuc     xcb_align_to = ALIGNOF(uint32_t);
94*0a6a1f1dSLionel Sambuc     /* insert padding */
95*0a6a1f1dSLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
96*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
97*0a6a1f1dSLionel Sambuc     if (0 != xcb_pad) {
98*0a6a1f1dSLionel Sambuc         xcb_tmp += xcb_pad;
99*0a6a1f1dSLionel Sambuc         xcb_pad = 0;
100*0a6a1f1dSLionel Sambuc     }
101*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
102*0a6a1f1dSLionel Sambuc 
103*0a6a1f1dSLionel Sambuc     return xcb_buffer_len;
104*0a6a1f1dSLionel Sambuc }
105*0a6a1f1dSLionel Sambuc 
106*0a6a1f1dSLionel Sambuc uint32_t *
xcb_res_client_id_value_value(const xcb_res_client_id_value_t * R)107*0a6a1f1dSLionel Sambuc xcb_res_client_id_value_value (const xcb_res_client_id_value_t *R  /**< */)
108*0a6a1f1dSLionel Sambuc {
109*0a6a1f1dSLionel Sambuc     return (uint32_t *) (R + 1);
110*0a6a1f1dSLionel Sambuc }
111*0a6a1f1dSLionel Sambuc 
112*0a6a1f1dSLionel Sambuc int
xcb_res_client_id_value_value_length(const xcb_res_client_id_value_t * R)113*0a6a1f1dSLionel Sambuc xcb_res_client_id_value_value_length (const xcb_res_client_id_value_t *R  /**< */)
114*0a6a1f1dSLionel Sambuc {
115*0a6a1f1dSLionel Sambuc     return R->length;
116*0a6a1f1dSLionel Sambuc }
117*0a6a1f1dSLionel Sambuc 
118*0a6a1f1dSLionel Sambuc xcb_generic_iterator_t
xcb_res_client_id_value_value_end(const xcb_res_client_id_value_t * R)119*0a6a1f1dSLionel Sambuc xcb_res_client_id_value_value_end (const xcb_res_client_id_value_t *R  /**< */)
120*0a6a1f1dSLionel Sambuc {
121*0a6a1f1dSLionel Sambuc     xcb_generic_iterator_t i;
122*0a6a1f1dSLionel Sambuc     i.data = ((uint32_t *) (R + 1)) + (R->length);
123*0a6a1f1dSLionel Sambuc     i.rem = 0;
124*0a6a1f1dSLionel Sambuc     i.index = (char *) i.data - (char *) R;
125*0a6a1f1dSLionel Sambuc     return i;
126*0a6a1f1dSLionel Sambuc }
127*0a6a1f1dSLionel Sambuc 
128*0a6a1f1dSLionel Sambuc void
xcb_res_client_id_value_next(xcb_res_client_id_value_iterator_t * i)129*0a6a1f1dSLionel Sambuc xcb_res_client_id_value_next (xcb_res_client_id_value_iterator_t *i  /**< */)
130*0a6a1f1dSLionel Sambuc {
131*0a6a1f1dSLionel Sambuc     xcb_res_client_id_value_t *R = i->data;
132*0a6a1f1dSLionel Sambuc     xcb_generic_iterator_t child;
133*0a6a1f1dSLionel Sambuc     child.data = (xcb_res_client_id_value_t *)(((char *)R) + xcb_res_client_id_value_sizeof(R));
134*0a6a1f1dSLionel Sambuc     i->index = (char *) child.data - (char *) i->data;
135*0a6a1f1dSLionel Sambuc     --i->rem;
136*0a6a1f1dSLionel Sambuc     i->data = (xcb_res_client_id_value_t *) child.data;
137*0a6a1f1dSLionel Sambuc }
138*0a6a1f1dSLionel Sambuc 
139*0a6a1f1dSLionel Sambuc xcb_generic_iterator_t
xcb_res_client_id_value_end(xcb_res_client_id_value_iterator_t i)140*0a6a1f1dSLionel Sambuc xcb_res_client_id_value_end (xcb_res_client_id_value_iterator_t i  /**< */)
141*0a6a1f1dSLionel Sambuc {
142*0a6a1f1dSLionel Sambuc     xcb_generic_iterator_t ret;
143*0a6a1f1dSLionel Sambuc     while(i.rem > 0)
144*0a6a1f1dSLionel Sambuc         xcb_res_client_id_value_next(&i);
145*0a6a1f1dSLionel Sambuc     ret.data = i.data;
146*0a6a1f1dSLionel Sambuc     ret.rem = i.rem;
147*0a6a1f1dSLionel Sambuc     ret.index = i.index;
148*0a6a1f1dSLionel Sambuc     return ret;
149*0a6a1f1dSLionel Sambuc }
150*0a6a1f1dSLionel Sambuc 
151*0a6a1f1dSLionel Sambuc void
xcb_res_resource_id_spec_next(xcb_res_resource_id_spec_iterator_t * i)152*0a6a1f1dSLionel Sambuc xcb_res_resource_id_spec_next (xcb_res_resource_id_spec_iterator_t *i  /**< */)
153*0a6a1f1dSLionel Sambuc {
154*0a6a1f1dSLionel Sambuc     --i->rem;
155*0a6a1f1dSLionel Sambuc     ++i->data;
156*0a6a1f1dSLionel Sambuc     i->index += sizeof(xcb_res_resource_id_spec_t);
157*0a6a1f1dSLionel Sambuc }
158*0a6a1f1dSLionel Sambuc 
159*0a6a1f1dSLionel Sambuc xcb_generic_iterator_t
xcb_res_resource_id_spec_end(xcb_res_resource_id_spec_iterator_t i)160*0a6a1f1dSLionel Sambuc xcb_res_resource_id_spec_end (xcb_res_resource_id_spec_iterator_t i  /**< */)
161*0a6a1f1dSLionel Sambuc {
162*0a6a1f1dSLionel Sambuc     xcb_generic_iterator_t ret;
163*0a6a1f1dSLionel Sambuc     ret.data = i.data + i.rem;
164*0a6a1f1dSLionel Sambuc     ret.index = i.index + ((char *) ret.data - (char *) i.data);
165*0a6a1f1dSLionel Sambuc     ret.rem = 0;
166*0a6a1f1dSLionel Sambuc     return ret;
167*0a6a1f1dSLionel Sambuc }
168*0a6a1f1dSLionel Sambuc 
169*0a6a1f1dSLionel Sambuc void
xcb_res_resource_size_spec_next(xcb_res_resource_size_spec_iterator_t * i)170*0a6a1f1dSLionel Sambuc xcb_res_resource_size_spec_next (xcb_res_resource_size_spec_iterator_t *i  /**< */)
171*0a6a1f1dSLionel Sambuc {
172*0a6a1f1dSLionel Sambuc     --i->rem;
173*0a6a1f1dSLionel Sambuc     ++i->data;
174*0a6a1f1dSLionel Sambuc     i->index += sizeof(xcb_res_resource_size_spec_t);
175*0a6a1f1dSLionel Sambuc }
176*0a6a1f1dSLionel Sambuc 
177*0a6a1f1dSLionel Sambuc xcb_generic_iterator_t
xcb_res_resource_size_spec_end(xcb_res_resource_size_spec_iterator_t i)178*0a6a1f1dSLionel Sambuc xcb_res_resource_size_spec_end (xcb_res_resource_size_spec_iterator_t i  /**< */)
179*0a6a1f1dSLionel Sambuc {
180*0a6a1f1dSLionel Sambuc     xcb_generic_iterator_t ret;
181*0a6a1f1dSLionel Sambuc     ret.data = i.data + i.rem;
182*0a6a1f1dSLionel Sambuc     ret.index = i.index + ((char *) ret.data - (char *) i.data);
183*0a6a1f1dSLionel Sambuc     ret.rem = 0;
184*0a6a1f1dSLionel Sambuc     return ret;
185*0a6a1f1dSLionel Sambuc }
186*0a6a1f1dSLionel Sambuc 
187*0a6a1f1dSLionel Sambuc int
xcb_res_resource_size_value_sizeof(const void * _buffer)188*0a6a1f1dSLionel Sambuc xcb_res_resource_size_value_sizeof (const void  *_buffer  /**< */)
189*0a6a1f1dSLionel Sambuc {
190*0a6a1f1dSLionel Sambuc     char *xcb_tmp = (char *)_buffer;
191*0a6a1f1dSLionel Sambuc     const xcb_res_resource_size_value_t *_aux = (xcb_res_resource_size_value_t *)_buffer;
192*0a6a1f1dSLionel Sambuc     unsigned int xcb_buffer_len = 0;
193*0a6a1f1dSLionel Sambuc     unsigned int xcb_block_len = 0;
194*0a6a1f1dSLionel Sambuc     unsigned int xcb_pad = 0;
195*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
196*0a6a1f1dSLionel Sambuc 
197*0a6a1f1dSLionel Sambuc 
198*0a6a1f1dSLionel Sambuc     xcb_block_len += sizeof(xcb_res_resource_size_value_t);
199*0a6a1f1dSLionel Sambuc     xcb_tmp += xcb_block_len;
200*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
201*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
202*0a6a1f1dSLionel Sambuc     /* cross_references */
203*0a6a1f1dSLionel Sambuc     xcb_block_len += _aux->num_cross_references * sizeof(xcb_res_resource_size_spec_t);
204*0a6a1f1dSLionel Sambuc     xcb_tmp += xcb_block_len;
205*0a6a1f1dSLionel Sambuc     xcb_align_to = ALIGNOF(xcb_res_resource_size_spec_t);
206*0a6a1f1dSLionel Sambuc     /* insert padding */
207*0a6a1f1dSLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
208*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
209*0a6a1f1dSLionel Sambuc     if (0 != xcb_pad) {
210*0a6a1f1dSLionel Sambuc         xcb_tmp += xcb_pad;
211*0a6a1f1dSLionel Sambuc         xcb_pad = 0;
212*0a6a1f1dSLionel Sambuc     }
213*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
214*0a6a1f1dSLionel Sambuc 
215*0a6a1f1dSLionel Sambuc     return xcb_buffer_len;
216*0a6a1f1dSLionel Sambuc }
217*0a6a1f1dSLionel Sambuc 
218*0a6a1f1dSLionel Sambuc xcb_res_resource_size_spec_t *
xcb_res_resource_size_value_cross_references(const xcb_res_resource_size_value_t * R)219*0a6a1f1dSLionel Sambuc xcb_res_resource_size_value_cross_references (const xcb_res_resource_size_value_t *R  /**< */)
220*0a6a1f1dSLionel Sambuc {
221*0a6a1f1dSLionel Sambuc     return (xcb_res_resource_size_spec_t *) (R + 1);
222*0a6a1f1dSLionel Sambuc }
223*0a6a1f1dSLionel Sambuc 
224*0a6a1f1dSLionel Sambuc int
xcb_res_resource_size_value_cross_references_length(const xcb_res_resource_size_value_t * R)225*0a6a1f1dSLionel Sambuc xcb_res_resource_size_value_cross_references_length (const xcb_res_resource_size_value_t *R  /**< */)
226*0a6a1f1dSLionel Sambuc {
227*0a6a1f1dSLionel Sambuc     return R->num_cross_references;
228*0a6a1f1dSLionel Sambuc }
229*0a6a1f1dSLionel Sambuc 
230*0a6a1f1dSLionel Sambuc xcb_res_resource_size_spec_iterator_t
xcb_res_resource_size_value_cross_references_iterator(const xcb_res_resource_size_value_t * R)231*0a6a1f1dSLionel Sambuc xcb_res_resource_size_value_cross_references_iterator (const xcb_res_resource_size_value_t *R  /**< */)
232*0a6a1f1dSLionel Sambuc {
233*0a6a1f1dSLionel Sambuc     xcb_res_resource_size_spec_iterator_t i;
234*0a6a1f1dSLionel Sambuc     i.data = (xcb_res_resource_size_spec_t *) (R + 1);
235*0a6a1f1dSLionel Sambuc     i.rem = R->num_cross_references;
236*0a6a1f1dSLionel Sambuc     i.index = (char *) i.data - (char *) R;
237*0a6a1f1dSLionel Sambuc     return i;
238*0a6a1f1dSLionel Sambuc }
239*0a6a1f1dSLionel Sambuc 
240*0a6a1f1dSLionel Sambuc void
xcb_res_resource_size_value_next(xcb_res_resource_size_value_iterator_t * i)241*0a6a1f1dSLionel Sambuc xcb_res_resource_size_value_next (xcb_res_resource_size_value_iterator_t *i  /**< */)
242*0a6a1f1dSLionel Sambuc {
243*0a6a1f1dSLionel Sambuc     xcb_res_resource_size_value_t *R = i->data;
244*0a6a1f1dSLionel Sambuc     xcb_generic_iterator_t child;
245*0a6a1f1dSLionel Sambuc     child.data = (xcb_res_resource_size_value_t *)(((char *)R) + xcb_res_resource_size_value_sizeof(R));
246*0a6a1f1dSLionel Sambuc     i->index = (char *) child.data - (char *) i->data;
247*0a6a1f1dSLionel Sambuc     --i->rem;
248*0a6a1f1dSLionel Sambuc     i->data = (xcb_res_resource_size_value_t *) child.data;
249*0a6a1f1dSLionel Sambuc }
250*0a6a1f1dSLionel Sambuc 
251*0a6a1f1dSLionel Sambuc xcb_generic_iterator_t
xcb_res_resource_size_value_end(xcb_res_resource_size_value_iterator_t i)252*0a6a1f1dSLionel Sambuc xcb_res_resource_size_value_end (xcb_res_resource_size_value_iterator_t i  /**< */)
253*0a6a1f1dSLionel Sambuc {
254*0a6a1f1dSLionel Sambuc     xcb_generic_iterator_t ret;
255*0a6a1f1dSLionel Sambuc     while(i.rem > 0)
256*0a6a1f1dSLionel Sambuc         xcb_res_resource_size_value_next(&i);
257*0a6a1f1dSLionel Sambuc     ret.data = i.data;
258*0a6a1f1dSLionel Sambuc     ret.rem = i.rem;
259*0a6a1f1dSLionel Sambuc     ret.index = i.index;
260*0a6a1f1dSLionel Sambuc     return ret;
261*0a6a1f1dSLionel Sambuc }
262971bb1a5SLionel Sambuc 
263971bb1a5SLionel Sambuc xcb_res_query_version_cookie_t
xcb_res_query_version(xcb_connection_t * c,uint8_t client_major,uint8_t client_minor)264971bb1a5SLionel Sambuc xcb_res_query_version (xcb_connection_t *c  /**< */,
265971bb1a5SLionel Sambuc                        uint8_t           client_major  /**< */,
266971bb1a5SLionel Sambuc                        uint8_t           client_minor  /**< */)
267971bb1a5SLionel Sambuc {
268971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
269971bb1a5SLionel Sambuc         /* count */ 2,
270971bb1a5SLionel Sambuc         /* ext */ &xcb_res_id,
271971bb1a5SLionel Sambuc         /* opcode */ XCB_RES_QUERY_VERSION,
272971bb1a5SLionel Sambuc         /* isvoid */ 0
273971bb1a5SLionel Sambuc     };
274971bb1a5SLionel Sambuc 
275971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
276971bb1a5SLionel Sambuc     xcb_res_query_version_cookie_t xcb_ret;
277971bb1a5SLionel Sambuc     xcb_res_query_version_request_t xcb_out;
278971bb1a5SLionel Sambuc 
279971bb1a5SLionel Sambuc     xcb_out.client_major = client_major;
280971bb1a5SLionel Sambuc     xcb_out.client_minor = client_minor;
281971bb1a5SLionel Sambuc 
282971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
283971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
284971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
285971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
286971bb1a5SLionel Sambuc 
287971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
288971bb1a5SLionel Sambuc     return xcb_ret;
289971bb1a5SLionel Sambuc }
290971bb1a5SLionel Sambuc 
291971bb1a5SLionel Sambuc xcb_res_query_version_cookie_t
xcb_res_query_version_unchecked(xcb_connection_t * c,uint8_t client_major,uint8_t client_minor)292971bb1a5SLionel Sambuc xcb_res_query_version_unchecked (xcb_connection_t *c  /**< */,
293971bb1a5SLionel Sambuc                                  uint8_t           client_major  /**< */,
294971bb1a5SLionel Sambuc                                  uint8_t           client_minor  /**< */)
295971bb1a5SLionel Sambuc {
296971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
297971bb1a5SLionel Sambuc         /* count */ 2,
298971bb1a5SLionel Sambuc         /* ext */ &xcb_res_id,
299971bb1a5SLionel Sambuc         /* opcode */ XCB_RES_QUERY_VERSION,
300971bb1a5SLionel Sambuc         /* isvoid */ 0
301971bb1a5SLionel Sambuc     };
302971bb1a5SLionel Sambuc 
303971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
304971bb1a5SLionel Sambuc     xcb_res_query_version_cookie_t xcb_ret;
305971bb1a5SLionel Sambuc     xcb_res_query_version_request_t xcb_out;
306971bb1a5SLionel Sambuc 
307971bb1a5SLionel Sambuc     xcb_out.client_major = client_major;
308971bb1a5SLionel Sambuc     xcb_out.client_minor = client_minor;
309971bb1a5SLionel Sambuc 
310971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
311971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
312971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
313971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
314971bb1a5SLionel Sambuc 
315971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
316971bb1a5SLionel Sambuc     return xcb_ret;
317971bb1a5SLionel Sambuc }
318971bb1a5SLionel Sambuc 
319971bb1a5SLionel Sambuc 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)320971bb1a5SLionel Sambuc xcb_res_query_version_reply (xcb_connection_t                *c  /**< */,
321971bb1a5SLionel Sambuc                              xcb_res_query_version_cookie_t   cookie  /**< */,
322971bb1a5SLionel Sambuc                              xcb_generic_error_t            **e  /**< */)
323971bb1a5SLionel Sambuc {
324971bb1a5SLionel Sambuc     return (xcb_res_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
325971bb1a5SLionel Sambuc }
326971bb1a5SLionel Sambuc 
327971bb1a5SLionel Sambuc int
xcb_res_query_clients_sizeof(const void * _buffer)328971bb1a5SLionel Sambuc xcb_res_query_clients_sizeof (const void  *_buffer  /**< */)
329971bb1a5SLionel Sambuc {
330971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
331971bb1a5SLionel Sambuc     const xcb_res_query_clients_reply_t *_aux = (xcb_res_query_clients_reply_t *)_buffer;
332971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
333971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
334971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
335*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
336971bb1a5SLionel Sambuc 
337971bb1a5SLionel Sambuc 
338971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_res_query_clients_reply_t);
339971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
340*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
341*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
342971bb1a5SLionel Sambuc     /* clients */
343971bb1a5SLionel Sambuc     xcb_block_len += _aux->num_clients * sizeof(xcb_res_client_t);
344971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
345971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(xcb_res_client_t);
346971bb1a5SLionel Sambuc     /* insert padding */
347971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
348971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
349971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
350971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
351971bb1a5SLionel Sambuc         xcb_pad = 0;
352971bb1a5SLionel Sambuc     }
353971bb1a5SLionel Sambuc     xcb_block_len = 0;
354971bb1a5SLionel Sambuc 
355971bb1a5SLionel Sambuc     return xcb_buffer_len;
356971bb1a5SLionel Sambuc }
357971bb1a5SLionel Sambuc 
358971bb1a5SLionel Sambuc xcb_res_query_clients_cookie_t
xcb_res_query_clients(xcb_connection_t * c)359971bb1a5SLionel Sambuc xcb_res_query_clients (xcb_connection_t *c  /**< */)
360971bb1a5SLionel Sambuc {
361971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
362971bb1a5SLionel Sambuc         /* count */ 2,
363971bb1a5SLionel Sambuc         /* ext */ &xcb_res_id,
364971bb1a5SLionel Sambuc         /* opcode */ XCB_RES_QUERY_CLIENTS,
365971bb1a5SLionel Sambuc         /* isvoid */ 0
366971bb1a5SLionel Sambuc     };
367971bb1a5SLionel Sambuc 
368971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
369971bb1a5SLionel Sambuc     xcb_res_query_clients_cookie_t xcb_ret;
370971bb1a5SLionel Sambuc     xcb_res_query_clients_request_t xcb_out;
371971bb1a5SLionel Sambuc 
372971bb1a5SLionel Sambuc 
373971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
374971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
375971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
376971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
377971bb1a5SLionel Sambuc 
378971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
379971bb1a5SLionel Sambuc     return xcb_ret;
380971bb1a5SLionel Sambuc }
381971bb1a5SLionel Sambuc 
382971bb1a5SLionel Sambuc xcb_res_query_clients_cookie_t
xcb_res_query_clients_unchecked(xcb_connection_t * c)383971bb1a5SLionel Sambuc xcb_res_query_clients_unchecked (xcb_connection_t *c  /**< */)
384971bb1a5SLionel Sambuc {
385971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
386971bb1a5SLionel Sambuc         /* count */ 2,
387971bb1a5SLionel Sambuc         /* ext */ &xcb_res_id,
388971bb1a5SLionel Sambuc         /* opcode */ XCB_RES_QUERY_CLIENTS,
389971bb1a5SLionel Sambuc         /* isvoid */ 0
390971bb1a5SLionel Sambuc     };
391971bb1a5SLionel Sambuc 
392971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
393971bb1a5SLionel Sambuc     xcb_res_query_clients_cookie_t xcb_ret;
394971bb1a5SLionel Sambuc     xcb_res_query_clients_request_t xcb_out;
395971bb1a5SLionel Sambuc 
396971bb1a5SLionel Sambuc 
397971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
398971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
399971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
400971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
401971bb1a5SLionel Sambuc 
402971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
403971bb1a5SLionel Sambuc     return xcb_ret;
404971bb1a5SLionel Sambuc }
405971bb1a5SLionel Sambuc 
406971bb1a5SLionel Sambuc xcb_res_client_t *
xcb_res_query_clients_clients(const xcb_res_query_clients_reply_t * R)407971bb1a5SLionel Sambuc xcb_res_query_clients_clients (const xcb_res_query_clients_reply_t *R  /**< */)
408971bb1a5SLionel Sambuc {
409971bb1a5SLionel Sambuc     return (xcb_res_client_t *) (R + 1);
410971bb1a5SLionel Sambuc }
411971bb1a5SLionel Sambuc 
412971bb1a5SLionel Sambuc int
xcb_res_query_clients_clients_length(const xcb_res_query_clients_reply_t * R)413971bb1a5SLionel Sambuc xcb_res_query_clients_clients_length (const xcb_res_query_clients_reply_t *R  /**< */)
414971bb1a5SLionel Sambuc {
415971bb1a5SLionel Sambuc     return R->num_clients;
416971bb1a5SLionel Sambuc }
417971bb1a5SLionel Sambuc 
418971bb1a5SLionel Sambuc xcb_res_client_iterator_t
xcb_res_query_clients_clients_iterator(const xcb_res_query_clients_reply_t * R)419971bb1a5SLionel Sambuc xcb_res_query_clients_clients_iterator (const xcb_res_query_clients_reply_t *R  /**< */)
420971bb1a5SLionel Sambuc {
421971bb1a5SLionel Sambuc     xcb_res_client_iterator_t i;
422971bb1a5SLionel Sambuc     i.data = (xcb_res_client_t *) (R + 1);
423971bb1a5SLionel Sambuc     i.rem = R->num_clients;
424971bb1a5SLionel Sambuc     i.index = (char *) i.data - (char *) R;
425971bb1a5SLionel Sambuc     return i;
426971bb1a5SLionel Sambuc }
427971bb1a5SLionel Sambuc 
428971bb1a5SLionel Sambuc 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)429971bb1a5SLionel Sambuc xcb_res_query_clients_reply (xcb_connection_t                *c  /**< */,
430971bb1a5SLionel Sambuc                              xcb_res_query_clients_cookie_t   cookie  /**< */,
431971bb1a5SLionel Sambuc                              xcb_generic_error_t            **e  /**< */)
432971bb1a5SLionel Sambuc {
433971bb1a5SLionel Sambuc     return (xcb_res_query_clients_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
434971bb1a5SLionel Sambuc }
435971bb1a5SLionel Sambuc 
436971bb1a5SLionel Sambuc int
xcb_res_query_client_resources_sizeof(const void * _buffer)437971bb1a5SLionel Sambuc xcb_res_query_client_resources_sizeof (const void  *_buffer  /**< */)
438971bb1a5SLionel Sambuc {
439971bb1a5SLionel Sambuc     char *xcb_tmp = (char *)_buffer;
440971bb1a5SLionel Sambuc     const xcb_res_query_client_resources_reply_t *_aux = (xcb_res_query_client_resources_reply_t *)_buffer;
441971bb1a5SLionel Sambuc     unsigned int xcb_buffer_len = 0;
442971bb1a5SLionel Sambuc     unsigned int xcb_block_len = 0;
443971bb1a5SLionel Sambuc     unsigned int xcb_pad = 0;
444*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
445971bb1a5SLionel Sambuc 
446971bb1a5SLionel Sambuc 
447971bb1a5SLionel Sambuc     xcb_block_len += sizeof(xcb_res_query_client_resources_reply_t);
448971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
449*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
450*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
451971bb1a5SLionel Sambuc     /* types */
452971bb1a5SLionel Sambuc     xcb_block_len += _aux->num_types * sizeof(xcb_res_type_t);
453971bb1a5SLionel Sambuc     xcb_tmp += xcb_block_len;
454971bb1a5SLionel Sambuc     xcb_align_to = ALIGNOF(xcb_res_type_t);
455971bb1a5SLionel Sambuc     /* insert padding */
456971bb1a5SLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
457971bb1a5SLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
458971bb1a5SLionel Sambuc     if (0 != xcb_pad) {
459971bb1a5SLionel Sambuc         xcb_tmp += xcb_pad;
460971bb1a5SLionel Sambuc         xcb_pad = 0;
461971bb1a5SLionel Sambuc     }
462971bb1a5SLionel Sambuc     xcb_block_len = 0;
463971bb1a5SLionel Sambuc 
464971bb1a5SLionel Sambuc     return xcb_buffer_len;
465971bb1a5SLionel Sambuc }
466971bb1a5SLionel Sambuc 
467971bb1a5SLionel Sambuc xcb_res_query_client_resources_cookie_t
xcb_res_query_client_resources(xcb_connection_t * c,uint32_t xid)468971bb1a5SLionel Sambuc xcb_res_query_client_resources (xcb_connection_t *c  /**< */,
469971bb1a5SLionel Sambuc                                 uint32_t          xid  /**< */)
470971bb1a5SLionel Sambuc {
471971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
472971bb1a5SLionel Sambuc         /* count */ 2,
473971bb1a5SLionel Sambuc         /* ext */ &xcb_res_id,
474971bb1a5SLionel Sambuc         /* opcode */ XCB_RES_QUERY_CLIENT_RESOURCES,
475971bb1a5SLionel Sambuc         /* isvoid */ 0
476971bb1a5SLionel Sambuc     };
477971bb1a5SLionel Sambuc 
478971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
479971bb1a5SLionel Sambuc     xcb_res_query_client_resources_cookie_t xcb_ret;
480971bb1a5SLionel Sambuc     xcb_res_query_client_resources_request_t xcb_out;
481971bb1a5SLionel Sambuc 
482971bb1a5SLionel Sambuc     xcb_out.xid = xid;
483971bb1a5SLionel Sambuc 
484971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
485971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
486971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
487971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
488971bb1a5SLionel Sambuc 
489971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
490971bb1a5SLionel Sambuc     return xcb_ret;
491971bb1a5SLionel Sambuc }
492971bb1a5SLionel Sambuc 
493971bb1a5SLionel Sambuc xcb_res_query_client_resources_cookie_t
xcb_res_query_client_resources_unchecked(xcb_connection_t * c,uint32_t xid)494971bb1a5SLionel Sambuc xcb_res_query_client_resources_unchecked (xcb_connection_t *c  /**< */,
495971bb1a5SLionel Sambuc                                           uint32_t          xid  /**< */)
496971bb1a5SLionel Sambuc {
497971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
498971bb1a5SLionel Sambuc         /* count */ 2,
499971bb1a5SLionel Sambuc         /* ext */ &xcb_res_id,
500971bb1a5SLionel Sambuc         /* opcode */ XCB_RES_QUERY_CLIENT_RESOURCES,
501971bb1a5SLionel Sambuc         /* isvoid */ 0
502971bb1a5SLionel Sambuc     };
503971bb1a5SLionel Sambuc 
504971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
505971bb1a5SLionel Sambuc     xcb_res_query_client_resources_cookie_t xcb_ret;
506971bb1a5SLionel Sambuc     xcb_res_query_client_resources_request_t xcb_out;
507971bb1a5SLionel Sambuc 
508971bb1a5SLionel Sambuc     xcb_out.xid = xid;
509971bb1a5SLionel Sambuc 
510971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
511971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
512971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
513971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
514971bb1a5SLionel Sambuc 
515971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
516971bb1a5SLionel Sambuc     return xcb_ret;
517971bb1a5SLionel Sambuc }
518971bb1a5SLionel Sambuc 
519971bb1a5SLionel Sambuc xcb_res_type_t *
xcb_res_query_client_resources_types(const xcb_res_query_client_resources_reply_t * R)520971bb1a5SLionel Sambuc xcb_res_query_client_resources_types (const xcb_res_query_client_resources_reply_t *R  /**< */)
521971bb1a5SLionel Sambuc {
522971bb1a5SLionel Sambuc     return (xcb_res_type_t *) (R + 1);
523971bb1a5SLionel Sambuc }
524971bb1a5SLionel Sambuc 
525971bb1a5SLionel Sambuc int
xcb_res_query_client_resources_types_length(const xcb_res_query_client_resources_reply_t * R)526971bb1a5SLionel Sambuc xcb_res_query_client_resources_types_length (const xcb_res_query_client_resources_reply_t *R  /**< */)
527971bb1a5SLionel Sambuc {
528971bb1a5SLionel Sambuc     return R->num_types;
529971bb1a5SLionel Sambuc }
530971bb1a5SLionel Sambuc 
531971bb1a5SLionel Sambuc xcb_res_type_iterator_t
xcb_res_query_client_resources_types_iterator(const xcb_res_query_client_resources_reply_t * R)532971bb1a5SLionel Sambuc xcb_res_query_client_resources_types_iterator (const xcb_res_query_client_resources_reply_t *R  /**< */)
533971bb1a5SLionel Sambuc {
534971bb1a5SLionel Sambuc     xcb_res_type_iterator_t i;
535971bb1a5SLionel Sambuc     i.data = (xcb_res_type_t *) (R + 1);
536971bb1a5SLionel Sambuc     i.rem = R->num_types;
537971bb1a5SLionel Sambuc     i.index = (char *) i.data - (char *) R;
538971bb1a5SLionel Sambuc     return i;
539971bb1a5SLionel Sambuc }
540971bb1a5SLionel Sambuc 
541971bb1a5SLionel Sambuc 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)542971bb1a5SLionel Sambuc xcb_res_query_client_resources_reply (xcb_connection_t                         *c  /**< */,
543971bb1a5SLionel Sambuc                                       xcb_res_query_client_resources_cookie_t   cookie  /**< */,
544971bb1a5SLionel Sambuc                                       xcb_generic_error_t                     **e  /**< */)
545971bb1a5SLionel Sambuc {
546971bb1a5SLionel Sambuc     return (xcb_res_query_client_resources_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
547971bb1a5SLionel Sambuc }
548971bb1a5SLionel Sambuc 
549971bb1a5SLionel Sambuc xcb_res_query_client_pixmap_bytes_cookie_t
xcb_res_query_client_pixmap_bytes(xcb_connection_t * c,uint32_t xid)550971bb1a5SLionel Sambuc xcb_res_query_client_pixmap_bytes (xcb_connection_t *c  /**< */,
551971bb1a5SLionel Sambuc                                    uint32_t          xid  /**< */)
552971bb1a5SLionel Sambuc {
553971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
554971bb1a5SLionel Sambuc         /* count */ 2,
555971bb1a5SLionel Sambuc         /* ext */ &xcb_res_id,
556971bb1a5SLionel Sambuc         /* opcode */ XCB_RES_QUERY_CLIENT_PIXMAP_BYTES,
557971bb1a5SLionel Sambuc         /* isvoid */ 0
558971bb1a5SLionel Sambuc     };
559971bb1a5SLionel Sambuc 
560971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
561971bb1a5SLionel Sambuc     xcb_res_query_client_pixmap_bytes_cookie_t xcb_ret;
562971bb1a5SLionel Sambuc     xcb_res_query_client_pixmap_bytes_request_t xcb_out;
563971bb1a5SLionel Sambuc 
564971bb1a5SLionel Sambuc     xcb_out.xid = xid;
565971bb1a5SLionel Sambuc 
566971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
567971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
568971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
569971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
570971bb1a5SLionel Sambuc 
571971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
572971bb1a5SLionel Sambuc     return xcb_ret;
573971bb1a5SLionel Sambuc }
574971bb1a5SLionel Sambuc 
575971bb1a5SLionel Sambuc xcb_res_query_client_pixmap_bytes_cookie_t
xcb_res_query_client_pixmap_bytes_unchecked(xcb_connection_t * c,uint32_t xid)576971bb1a5SLionel Sambuc xcb_res_query_client_pixmap_bytes_unchecked (xcb_connection_t *c  /**< */,
577971bb1a5SLionel Sambuc                                              uint32_t          xid  /**< */)
578971bb1a5SLionel Sambuc {
579971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
580971bb1a5SLionel Sambuc         /* count */ 2,
581971bb1a5SLionel Sambuc         /* ext */ &xcb_res_id,
582971bb1a5SLionel Sambuc         /* opcode */ XCB_RES_QUERY_CLIENT_PIXMAP_BYTES,
583971bb1a5SLionel Sambuc         /* isvoid */ 0
584971bb1a5SLionel Sambuc     };
585971bb1a5SLionel Sambuc 
586971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
587971bb1a5SLionel Sambuc     xcb_res_query_client_pixmap_bytes_cookie_t xcb_ret;
588971bb1a5SLionel Sambuc     xcb_res_query_client_pixmap_bytes_request_t xcb_out;
589971bb1a5SLionel Sambuc 
590971bb1a5SLionel Sambuc     xcb_out.xid = xid;
591971bb1a5SLionel Sambuc 
592971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
593971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
594971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
595971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
596971bb1a5SLionel Sambuc 
597971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
598971bb1a5SLionel Sambuc     return xcb_ret;
599971bb1a5SLionel Sambuc }
600971bb1a5SLionel Sambuc 
601971bb1a5SLionel Sambuc 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)602971bb1a5SLionel Sambuc xcb_res_query_client_pixmap_bytes_reply (xcb_connection_t                            *c  /**< */,
603971bb1a5SLionel Sambuc                                          xcb_res_query_client_pixmap_bytes_cookie_t   cookie  /**< */,
604971bb1a5SLionel Sambuc                                          xcb_generic_error_t                        **e  /**< */)
605971bb1a5SLionel Sambuc {
606971bb1a5SLionel Sambuc     return (xcb_res_query_client_pixmap_bytes_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
607971bb1a5SLionel Sambuc }
608971bb1a5SLionel Sambuc 
609*0a6a1f1dSLionel Sambuc int
xcb_res_query_client_ids_sizeof(const void * _buffer)610*0a6a1f1dSLionel Sambuc xcb_res_query_client_ids_sizeof (const void  *_buffer  /**< */)
611*0a6a1f1dSLionel Sambuc {
612*0a6a1f1dSLionel Sambuc     char *xcb_tmp = (char *)_buffer;
613*0a6a1f1dSLionel Sambuc     const xcb_res_query_client_ids_request_t *_aux = (xcb_res_query_client_ids_request_t *)_buffer;
614*0a6a1f1dSLionel Sambuc     unsigned int xcb_buffer_len = 0;
615*0a6a1f1dSLionel Sambuc     unsigned int xcb_block_len = 0;
616*0a6a1f1dSLionel Sambuc     unsigned int xcb_pad = 0;
617*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
618*0a6a1f1dSLionel Sambuc 
619*0a6a1f1dSLionel Sambuc 
620*0a6a1f1dSLionel Sambuc     xcb_block_len += sizeof(xcb_res_query_client_ids_request_t);
621*0a6a1f1dSLionel Sambuc     xcb_tmp += xcb_block_len;
622*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
623*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
624*0a6a1f1dSLionel Sambuc     /* specs */
625*0a6a1f1dSLionel Sambuc     xcb_block_len += _aux->num_specs * sizeof(xcb_res_client_id_spec_t);
626*0a6a1f1dSLionel Sambuc     xcb_tmp += xcb_block_len;
627*0a6a1f1dSLionel Sambuc     xcb_align_to = ALIGNOF(xcb_res_client_id_spec_t);
628*0a6a1f1dSLionel Sambuc     /* insert padding */
629*0a6a1f1dSLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
630*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
631*0a6a1f1dSLionel Sambuc     if (0 != xcb_pad) {
632*0a6a1f1dSLionel Sambuc         xcb_tmp += xcb_pad;
633*0a6a1f1dSLionel Sambuc         xcb_pad = 0;
634*0a6a1f1dSLionel Sambuc     }
635*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
636*0a6a1f1dSLionel Sambuc 
637*0a6a1f1dSLionel Sambuc     return xcb_buffer_len;
638*0a6a1f1dSLionel Sambuc }
639*0a6a1f1dSLionel Sambuc 
640*0a6a1f1dSLionel Sambuc 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*0a6a1f1dSLionel Sambuc xcb_res_query_client_ids (xcb_connection_t               *c  /**< */,
642*0a6a1f1dSLionel Sambuc                           uint32_t                        num_specs  /**< */,
643*0a6a1f1dSLionel Sambuc                           const xcb_res_client_id_spec_t *specs  /**< */)
644*0a6a1f1dSLionel Sambuc {
645*0a6a1f1dSLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
646*0a6a1f1dSLionel Sambuc         /* count */ 4,
647*0a6a1f1dSLionel Sambuc         /* ext */ &xcb_res_id,
648*0a6a1f1dSLionel Sambuc         /* opcode */ XCB_RES_QUERY_CLIENT_IDS,
649*0a6a1f1dSLionel Sambuc         /* isvoid */ 0
650*0a6a1f1dSLionel Sambuc     };
651*0a6a1f1dSLionel Sambuc 
652*0a6a1f1dSLionel Sambuc     struct iovec xcb_parts[6];
653*0a6a1f1dSLionel Sambuc     xcb_res_query_client_ids_cookie_t xcb_ret;
654*0a6a1f1dSLionel Sambuc     xcb_res_query_client_ids_request_t xcb_out;
655*0a6a1f1dSLionel Sambuc 
656*0a6a1f1dSLionel Sambuc     xcb_out.num_specs = num_specs;
657*0a6a1f1dSLionel Sambuc 
658*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
659*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
660*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_base = 0;
661*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
662*0a6a1f1dSLionel Sambuc     /* xcb_res_client_id_spec_t specs */
663*0a6a1f1dSLionel Sambuc     xcb_parts[4].iov_base = (char *) specs;
664*0a6a1f1dSLionel Sambuc     xcb_parts[4].iov_len = num_specs * sizeof(xcb_res_client_id_spec_t);
665*0a6a1f1dSLionel Sambuc     xcb_parts[5].iov_base = 0;
666*0a6a1f1dSLionel Sambuc     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
667*0a6a1f1dSLionel Sambuc 
668*0a6a1f1dSLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
669*0a6a1f1dSLionel Sambuc     return xcb_ret;
670*0a6a1f1dSLionel Sambuc }
671*0a6a1f1dSLionel Sambuc 
672*0a6a1f1dSLionel Sambuc 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*0a6a1f1dSLionel Sambuc xcb_res_query_client_ids_unchecked (xcb_connection_t               *c  /**< */,
674*0a6a1f1dSLionel Sambuc                                     uint32_t                        num_specs  /**< */,
675*0a6a1f1dSLionel Sambuc                                     const xcb_res_client_id_spec_t *specs  /**< */)
676*0a6a1f1dSLionel Sambuc {
677*0a6a1f1dSLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
678*0a6a1f1dSLionel Sambuc         /* count */ 4,
679*0a6a1f1dSLionel Sambuc         /* ext */ &xcb_res_id,
680*0a6a1f1dSLionel Sambuc         /* opcode */ XCB_RES_QUERY_CLIENT_IDS,
681*0a6a1f1dSLionel Sambuc         /* isvoid */ 0
682*0a6a1f1dSLionel Sambuc     };
683*0a6a1f1dSLionel Sambuc 
684*0a6a1f1dSLionel Sambuc     struct iovec xcb_parts[6];
685*0a6a1f1dSLionel Sambuc     xcb_res_query_client_ids_cookie_t xcb_ret;
686*0a6a1f1dSLionel Sambuc     xcb_res_query_client_ids_request_t xcb_out;
687*0a6a1f1dSLionel Sambuc 
688*0a6a1f1dSLionel Sambuc     xcb_out.num_specs = num_specs;
689*0a6a1f1dSLionel Sambuc 
690*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
691*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
692*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_base = 0;
693*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
694*0a6a1f1dSLionel Sambuc     /* xcb_res_client_id_spec_t specs */
695*0a6a1f1dSLionel Sambuc     xcb_parts[4].iov_base = (char *) specs;
696*0a6a1f1dSLionel Sambuc     xcb_parts[4].iov_len = num_specs * sizeof(xcb_res_client_id_spec_t);
697*0a6a1f1dSLionel Sambuc     xcb_parts[5].iov_base = 0;
698*0a6a1f1dSLionel Sambuc     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
699*0a6a1f1dSLionel Sambuc 
700*0a6a1f1dSLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
701*0a6a1f1dSLionel Sambuc     return xcb_ret;
702*0a6a1f1dSLionel Sambuc }
703*0a6a1f1dSLionel Sambuc 
704*0a6a1f1dSLionel Sambuc int
xcb_res_query_client_ids_ids_length(const xcb_res_query_client_ids_reply_t * R)705*0a6a1f1dSLionel Sambuc xcb_res_query_client_ids_ids_length (const xcb_res_query_client_ids_reply_t *R  /**< */)
706*0a6a1f1dSLionel Sambuc {
707*0a6a1f1dSLionel Sambuc     return R->num_ids;
708*0a6a1f1dSLionel Sambuc }
709*0a6a1f1dSLionel Sambuc 
710*0a6a1f1dSLionel Sambuc xcb_res_client_id_value_iterator_t
xcb_res_query_client_ids_ids_iterator(const xcb_res_query_client_ids_reply_t * R)711*0a6a1f1dSLionel Sambuc xcb_res_query_client_ids_ids_iterator (const xcb_res_query_client_ids_reply_t *R  /**< */)
712*0a6a1f1dSLionel Sambuc {
713*0a6a1f1dSLionel Sambuc     xcb_res_client_id_value_iterator_t i;
714*0a6a1f1dSLionel Sambuc     i.data = (xcb_res_client_id_value_t *) (R + 1);
715*0a6a1f1dSLionel Sambuc     i.rem = R->num_ids;
716*0a6a1f1dSLionel Sambuc     i.index = (char *) i.data - (char *) R;
717*0a6a1f1dSLionel Sambuc     return i;
718*0a6a1f1dSLionel Sambuc }
719*0a6a1f1dSLionel Sambuc 
720*0a6a1f1dSLionel Sambuc 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*0a6a1f1dSLionel Sambuc xcb_res_query_client_ids_reply (xcb_connection_t                   *c  /**< */,
722*0a6a1f1dSLionel Sambuc                                 xcb_res_query_client_ids_cookie_t   cookie  /**< */,
723*0a6a1f1dSLionel Sambuc                                 xcb_generic_error_t               **e  /**< */)
724*0a6a1f1dSLionel Sambuc {
725*0a6a1f1dSLionel Sambuc     return (xcb_res_query_client_ids_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
726*0a6a1f1dSLionel Sambuc }
727*0a6a1f1dSLionel Sambuc 
728*0a6a1f1dSLionel Sambuc int
xcb_res_query_resource_bytes_sizeof(const void * _buffer)729*0a6a1f1dSLionel Sambuc xcb_res_query_resource_bytes_sizeof (const void  *_buffer  /**< */)
730*0a6a1f1dSLionel Sambuc {
731*0a6a1f1dSLionel Sambuc     char *xcb_tmp = (char *)_buffer;
732*0a6a1f1dSLionel Sambuc     const xcb_res_query_resource_bytes_request_t *_aux = (xcb_res_query_resource_bytes_request_t *)_buffer;
733*0a6a1f1dSLionel Sambuc     unsigned int xcb_buffer_len = 0;
734*0a6a1f1dSLionel Sambuc     unsigned int xcb_block_len = 0;
735*0a6a1f1dSLionel Sambuc     unsigned int xcb_pad = 0;
736*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
737*0a6a1f1dSLionel Sambuc 
738*0a6a1f1dSLionel Sambuc 
739*0a6a1f1dSLionel Sambuc     xcb_block_len += sizeof(xcb_res_query_resource_bytes_request_t);
740*0a6a1f1dSLionel Sambuc     xcb_tmp += xcb_block_len;
741*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
742*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
743*0a6a1f1dSLionel Sambuc     /* specs */
744*0a6a1f1dSLionel Sambuc     xcb_block_len += _aux->num_specs * sizeof(xcb_res_resource_id_spec_t);
745*0a6a1f1dSLionel Sambuc     xcb_tmp += xcb_block_len;
746*0a6a1f1dSLionel Sambuc     xcb_align_to = ALIGNOF(xcb_res_resource_id_spec_t);
747*0a6a1f1dSLionel Sambuc     /* insert padding */
748*0a6a1f1dSLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
749*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
750*0a6a1f1dSLionel Sambuc     if (0 != xcb_pad) {
751*0a6a1f1dSLionel Sambuc         xcb_tmp += xcb_pad;
752*0a6a1f1dSLionel Sambuc         xcb_pad = 0;
753*0a6a1f1dSLionel Sambuc     }
754*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
755*0a6a1f1dSLionel Sambuc 
756*0a6a1f1dSLionel Sambuc     return xcb_buffer_len;
757*0a6a1f1dSLionel Sambuc }
758*0a6a1f1dSLionel Sambuc 
759*0a6a1f1dSLionel Sambuc 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*0a6a1f1dSLionel Sambuc xcb_res_query_resource_bytes (xcb_connection_t                 *c  /**< */,
761*0a6a1f1dSLionel Sambuc                               uint32_t                          client  /**< */,
762*0a6a1f1dSLionel Sambuc                               uint32_t                          num_specs  /**< */,
763*0a6a1f1dSLionel Sambuc                               const xcb_res_resource_id_spec_t *specs  /**< */)
764*0a6a1f1dSLionel Sambuc {
765*0a6a1f1dSLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
766*0a6a1f1dSLionel Sambuc         /* count */ 4,
767*0a6a1f1dSLionel Sambuc         /* ext */ &xcb_res_id,
768*0a6a1f1dSLionel Sambuc         /* opcode */ XCB_RES_QUERY_RESOURCE_BYTES,
769*0a6a1f1dSLionel Sambuc         /* isvoid */ 0
770*0a6a1f1dSLionel Sambuc     };
771*0a6a1f1dSLionel Sambuc 
772*0a6a1f1dSLionel Sambuc     struct iovec xcb_parts[6];
773*0a6a1f1dSLionel Sambuc     xcb_res_query_resource_bytes_cookie_t xcb_ret;
774*0a6a1f1dSLionel Sambuc     xcb_res_query_resource_bytes_request_t xcb_out;
775*0a6a1f1dSLionel Sambuc 
776*0a6a1f1dSLionel Sambuc     xcb_out.client = client;
777*0a6a1f1dSLionel Sambuc     xcb_out.num_specs = num_specs;
778*0a6a1f1dSLionel Sambuc 
779*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
780*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
781*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_base = 0;
782*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
783*0a6a1f1dSLionel Sambuc     /* xcb_res_resource_id_spec_t specs */
784*0a6a1f1dSLionel Sambuc     xcb_parts[4].iov_base = (char *) specs;
785*0a6a1f1dSLionel Sambuc     xcb_parts[4].iov_len = num_specs * sizeof(xcb_res_resource_id_spec_t);
786*0a6a1f1dSLionel Sambuc     xcb_parts[5].iov_base = 0;
787*0a6a1f1dSLionel Sambuc     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
788*0a6a1f1dSLionel Sambuc 
789*0a6a1f1dSLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
790*0a6a1f1dSLionel Sambuc     return xcb_ret;
791*0a6a1f1dSLionel Sambuc }
792*0a6a1f1dSLionel Sambuc 
793*0a6a1f1dSLionel Sambuc 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*0a6a1f1dSLionel Sambuc xcb_res_query_resource_bytes_unchecked (xcb_connection_t                 *c  /**< */,
795*0a6a1f1dSLionel Sambuc                                         uint32_t                          client  /**< */,
796*0a6a1f1dSLionel Sambuc                                         uint32_t                          num_specs  /**< */,
797*0a6a1f1dSLionel Sambuc                                         const xcb_res_resource_id_spec_t *specs  /**< */)
798*0a6a1f1dSLionel Sambuc {
799*0a6a1f1dSLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
800*0a6a1f1dSLionel Sambuc         /* count */ 4,
801*0a6a1f1dSLionel Sambuc         /* ext */ &xcb_res_id,
802*0a6a1f1dSLionel Sambuc         /* opcode */ XCB_RES_QUERY_RESOURCE_BYTES,
803*0a6a1f1dSLionel Sambuc         /* isvoid */ 0
804*0a6a1f1dSLionel Sambuc     };
805*0a6a1f1dSLionel Sambuc 
806*0a6a1f1dSLionel Sambuc     struct iovec xcb_parts[6];
807*0a6a1f1dSLionel Sambuc     xcb_res_query_resource_bytes_cookie_t xcb_ret;
808*0a6a1f1dSLionel Sambuc     xcb_res_query_resource_bytes_request_t xcb_out;
809*0a6a1f1dSLionel Sambuc 
810*0a6a1f1dSLionel Sambuc     xcb_out.client = client;
811*0a6a1f1dSLionel Sambuc     xcb_out.num_specs = num_specs;
812*0a6a1f1dSLionel Sambuc 
813*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
814*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
815*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_base = 0;
816*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
817*0a6a1f1dSLionel Sambuc     /* xcb_res_resource_id_spec_t specs */
818*0a6a1f1dSLionel Sambuc     xcb_parts[4].iov_base = (char *) specs;
819*0a6a1f1dSLionel Sambuc     xcb_parts[4].iov_len = num_specs * sizeof(xcb_res_resource_id_spec_t);
820*0a6a1f1dSLionel Sambuc     xcb_parts[5].iov_base = 0;
821*0a6a1f1dSLionel Sambuc     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
822*0a6a1f1dSLionel Sambuc 
823*0a6a1f1dSLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
824*0a6a1f1dSLionel Sambuc     return xcb_ret;
825*0a6a1f1dSLionel Sambuc }
826*0a6a1f1dSLionel Sambuc 
827*0a6a1f1dSLionel Sambuc int
xcb_res_query_resource_bytes_sizes_length(const xcb_res_query_resource_bytes_reply_t * R)828*0a6a1f1dSLionel Sambuc xcb_res_query_resource_bytes_sizes_length (const xcb_res_query_resource_bytes_reply_t *R  /**< */)
829*0a6a1f1dSLionel Sambuc {
830*0a6a1f1dSLionel Sambuc     return R->num_sizes;
831*0a6a1f1dSLionel Sambuc }
832*0a6a1f1dSLionel Sambuc 
833*0a6a1f1dSLionel Sambuc xcb_res_resource_size_value_iterator_t
xcb_res_query_resource_bytes_sizes_iterator(const xcb_res_query_resource_bytes_reply_t * R)834*0a6a1f1dSLionel Sambuc xcb_res_query_resource_bytes_sizes_iterator (const xcb_res_query_resource_bytes_reply_t *R  /**< */)
835*0a6a1f1dSLionel Sambuc {
836*0a6a1f1dSLionel Sambuc     xcb_res_resource_size_value_iterator_t i;
837*0a6a1f1dSLionel Sambuc     i.data = (xcb_res_resource_size_value_t *) (R + 1);
838*0a6a1f1dSLionel Sambuc     i.rem = R->num_sizes;
839*0a6a1f1dSLionel Sambuc     i.index = (char *) i.data - (char *) R;
840*0a6a1f1dSLionel Sambuc     return i;
841*0a6a1f1dSLionel Sambuc }
842*0a6a1f1dSLionel Sambuc 
843*0a6a1f1dSLionel Sambuc 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*0a6a1f1dSLionel Sambuc xcb_res_query_resource_bytes_reply (xcb_connection_t                       *c  /**< */,
845*0a6a1f1dSLionel Sambuc                                     xcb_res_query_resource_bytes_cookie_t   cookie  /**< */,
846*0a6a1f1dSLionel Sambuc                                     xcb_generic_error_t                   **e  /**< */)
847*0a6a1f1dSLionel Sambuc {
848*0a6a1f1dSLionel Sambuc     return (xcb_res_query_resource_bytes_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
849*0a6a1f1dSLionel Sambuc }
850*0a6a1f1dSLionel Sambuc 
851