1 /*
2 * This file generated automatically from randr.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 "randr.h"
15
16 #define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member)
17 #include "xproto.h"
18 #include "render.h"
19
20 xcb_extension_t xcb_randr_id = { "RANDR", 0 };
21
22 void
xcb_randr_mode_next(xcb_randr_mode_iterator_t * i)23 xcb_randr_mode_next (xcb_randr_mode_iterator_t *i)
24 {
25 --i->rem;
26 ++i->data;
27 i->index += sizeof(xcb_randr_mode_t);
28 }
29
30 xcb_generic_iterator_t
xcb_randr_mode_end(xcb_randr_mode_iterator_t i)31 xcb_randr_mode_end (xcb_randr_mode_iterator_t i)
32 {
33 xcb_generic_iterator_t ret;
34 ret.data = i.data + i.rem;
35 ret.index = i.index + ((char *) ret.data - (char *) i.data);
36 ret.rem = 0;
37 return ret;
38 }
39
40 void
xcb_randr_crtc_next(xcb_randr_crtc_iterator_t * i)41 xcb_randr_crtc_next (xcb_randr_crtc_iterator_t *i)
42 {
43 --i->rem;
44 ++i->data;
45 i->index += sizeof(xcb_randr_crtc_t);
46 }
47
48 xcb_generic_iterator_t
xcb_randr_crtc_end(xcb_randr_crtc_iterator_t i)49 xcb_randr_crtc_end (xcb_randr_crtc_iterator_t i)
50 {
51 xcb_generic_iterator_t ret;
52 ret.data = i.data + i.rem;
53 ret.index = i.index + ((char *) ret.data - (char *) i.data);
54 ret.rem = 0;
55 return ret;
56 }
57
58 void
xcb_randr_output_next(xcb_randr_output_iterator_t * i)59 xcb_randr_output_next (xcb_randr_output_iterator_t *i)
60 {
61 --i->rem;
62 ++i->data;
63 i->index += sizeof(xcb_randr_output_t);
64 }
65
66 xcb_generic_iterator_t
xcb_randr_output_end(xcb_randr_output_iterator_t i)67 xcb_randr_output_end (xcb_randr_output_iterator_t i)
68 {
69 xcb_generic_iterator_t ret;
70 ret.data = i.data + i.rem;
71 ret.index = i.index + ((char *) ret.data - (char *) i.data);
72 ret.rem = 0;
73 return ret;
74 }
75
76 void
xcb_randr_provider_next(xcb_randr_provider_iterator_t * i)77 xcb_randr_provider_next (xcb_randr_provider_iterator_t *i)
78 {
79 --i->rem;
80 ++i->data;
81 i->index += sizeof(xcb_randr_provider_t);
82 }
83
84 xcb_generic_iterator_t
xcb_randr_provider_end(xcb_randr_provider_iterator_t i)85 xcb_randr_provider_end (xcb_randr_provider_iterator_t i)
86 {
87 xcb_generic_iterator_t ret;
88 ret.data = i.data + i.rem;
89 ret.index = i.index + ((char *) ret.data - (char *) i.data);
90 ret.rem = 0;
91 return ret;
92 }
93
94 void
xcb_randr_lease_next(xcb_randr_lease_iterator_t * i)95 xcb_randr_lease_next (xcb_randr_lease_iterator_t *i)
96 {
97 --i->rem;
98 ++i->data;
99 i->index += sizeof(xcb_randr_lease_t);
100 }
101
102 xcb_generic_iterator_t
xcb_randr_lease_end(xcb_randr_lease_iterator_t i)103 xcb_randr_lease_end (xcb_randr_lease_iterator_t i)
104 {
105 xcb_generic_iterator_t ret;
106 ret.data = i.data + i.rem;
107 ret.index = i.index + ((char *) ret.data - (char *) i.data);
108 ret.rem = 0;
109 return ret;
110 }
111
112 void
xcb_randr_screen_size_next(xcb_randr_screen_size_iterator_t * i)113 xcb_randr_screen_size_next (xcb_randr_screen_size_iterator_t *i)
114 {
115 --i->rem;
116 ++i->data;
117 i->index += sizeof(xcb_randr_screen_size_t);
118 }
119
120 xcb_generic_iterator_t
xcb_randr_screen_size_end(xcb_randr_screen_size_iterator_t i)121 xcb_randr_screen_size_end (xcb_randr_screen_size_iterator_t i)
122 {
123 xcb_generic_iterator_t ret;
124 ret.data = i.data + i.rem;
125 ret.index = i.index + ((char *) ret.data - (char *) i.data);
126 ret.rem = 0;
127 return ret;
128 }
129
130 int
xcb_randr_refresh_rates_sizeof(const void * _buffer)131 xcb_randr_refresh_rates_sizeof (const void *_buffer)
132 {
133 char *xcb_tmp = (char *)_buffer;
134 const xcb_randr_refresh_rates_t *_aux = (xcb_randr_refresh_rates_t *)_buffer;
135 unsigned int xcb_buffer_len = 0;
136 unsigned int xcb_block_len = 0;
137 unsigned int xcb_pad = 0;
138 unsigned int xcb_align_to = 0;
139
140
141 xcb_block_len += sizeof(xcb_randr_refresh_rates_t);
142 xcb_tmp += xcb_block_len;
143 xcb_buffer_len += xcb_block_len;
144 xcb_block_len = 0;
145 /* rates */
146 xcb_block_len += _aux->nRates * sizeof(uint16_t);
147 xcb_tmp += xcb_block_len;
148 xcb_align_to = ALIGNOF(uint16_t);
149 /* insert padding */
150 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
151 xcb_buffer_len += xcb_block_len + xcb_pad;
152 if (0 != xcb_pad) {
153 xcb_tmp += xcb_pad;
154 xcb_pad = 0;
155 }
156 xcb_block_len = 0;
157
158 return xcb_buffer_len;
159 }
160
161 uint16_t *
xcb_randr_refresh_rates_rates(const xcb_randr_refresh_rates_t * R)162 xcb_randr_refresh_rates_rates (const xcb_randr_refresh_rates_t *R)
163 {
164 return (uint16_t *) (R + 1);
165 }
166
167 int
xcb_randr_refresh_rates_rates_length(const xcb_randr_refresh_rates_t * R)168 xcb_randr_refresh_rates_rates_length (const xcb_randr_refresh_rates_t *R)
169 {
170 return R->nRates;
171 }
172
173 xcb_generic_iterator_t
xcb_randr_refresh_rates_rates_end(const xcb_randr_refresh_rates_t * R)174 xcb_randr_refresh_rates_rates_end (const xcb_randr_refresh_rates_t *R)
175 {
176 xcb_generic_iterator_t i;
177 i.data = ((uint16_t *) (R + 1)) + (R->nRates);
178 i.rem = 0;
179 i.index = (char *) i.data - (char *) R;
180 return i;
181 }
182
183 void
xcb_randr_refresh_rates_next(xcb_randr_refresh_rates_iterator_t * i)184 xcb_randr_refresh_rates_next (xcb_randr_refresh_rates_iterator_t *i)
185 {
186 xcb_randr_refresh_rates_t *R = i->data;
187 xcb_generic_iterator_t child;
188 child.data = (xcb_randr_refresh_rates_t *)(((char *)R) + xcb_randr_refresh_rates_sizeof(R));
189 i->index = (char *) child.data - (char *) i->data;
190 --i->rem;
191 i->data = (xcb_randr_refresh_rates_t *) child.data;
192 }
193
194 xcb_generic_iterator_t
xcb_randr_refresh_rates_end(xcb_randr_refresh_rates_iterator_t i)195 xcb_randr_refresh_rates_end (xcb_randr_refresh_rates_iterator_t i)
196 {
197 xcb_generic_iterator_t ret;
198 while(i.rem > 0)
199 xcb_randr_refresh_rates_next(&i);
200 ret.data = i.data;
201 ret.rem = i.rem;
202 ret.index = i.index;
203 return ret;
204 }
205
206 xcb_randr_query_version_cookie_t
xcb_randr_query_version(xcb_connection_t * c,uint32_t major_version,uint32_t minor_version)207 xcb_randr_query_version (xcb_connection_t *c,
208 uint32_t major_version,
209 uint32_t minor_version)
210 {
211 static const xcb_protocol_request_t xcb_req = {
212 .count = 2,
213 .ext = &xcb_randr_id,
214 .opcode = XCB_RANDR_QUERY_VERSION,
215 .isvoid = 0
216 };
217
218 struct iovec xcb_parts[4];
219 xcb_randr_query_version_cookie_t xcb_ret;
220 xcb_randr_query_version_request_t xcb_out;
221
222 xcb_out.major_version = major_version;
223 xcb_out.minor_version = minor_version;
224
225 xcb_parts[2].iov_base = (char *) &xcb_out;
226 xcb_parts[2].iov_len = sizeof(xcb_out);
227 xcb_parts[3].iov_base = 0;
228 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
229
230 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
231 return xcb_ret;
232 }
233
234 xcb_randr_query_version_cookie_t
xcb_randr_query_version_unchecked(xcb_connection_t * c,uint32_t major_version,uint32_t minor_version)235 xcb_randr_query_version_unchecked (xcb_connection_t *c,
236 uint32_t major_version,
237 uint32_t minor_version)
238 {
239 static const xcb_protocol_request_t xcb_req = {
240 .count = 2,
241 .ext = &xcb_randr_id,
242 .opcode = XCB_RANDR_QUERY_VERSION,
243 .isvoid = 0
244 };
245
246 struct iovec xcb_parts[4];
247 xcb_randr_query_version_cookie_t xcb_ret;
248 xcb_randr_query_version_request_t xcb_out;
249
250 xcb_out.major_version = major_version;
251 xcb_out.minor_version = minor_version;
252
253 xcb_parts[2].iov_base = (char *) &xcb_out;
254 xcb_parts[2].iov_len = sizeof(xcb_out);
255 xcb_parts[3].iov_base = 0;
256 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
257
258 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
259 return xcb_ret;
260 }
261
262 xcb_randr_query_version_reply_t *
xcb_randr_query_version_reply(xcb_connection_t * c,xcb_randr_query_version_cookie_t cookie,xcb_generic_error_t ** e)263 xcb_randr_query_version_reply (xcb_connection_t *c,
264 xcb_randr_query_version_cookie_t cookie /**< */,
265 xcb_generic_error_t **e)
266 {
267 return (xcb_randr_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
268 }
269
270 xcb_randr_set_screen_config_cookie_t
xcb_randr_set_screen_config(xcb_connection_t * c,xcb_window_t window,xcb_timestamp_t timestamp,xcb_timestamp_t config_timestamp,uint16_t sizeID,uint16_t rotation,uint16_t rate)271 xcb_randr_set_screen_config (xcb_connection_t *c,
272 xcb_window_t window,
273 xcb_timestamp_t timestamp,
274 xcb_timestamp_t config_timestamp,
275 uint16_t sizeID,
276 uint16_t rotation,
277 uint16_t rate)
278 {
279 static const xcb_protocol_request_t xcb_req = {
280 .count = 2,
281 .ext = &xcb_randr_id,
282 .opcode = XCB_RANDR_SET_SCREEN_CONFIG,
283 .isvoid = 0
284 };
285
286 struct iovec xcb_parts[4];
287 xcb_randr_set_screen_config_cookie_t xcb_ret;
288 xcb_randr_set_screen_config_request_t xcb_out;
289
290 xcb_out.window = window;
291 xcb_out.timestamp = timestamp;
292 xcb_out.config_timestamp = config_timestamp;
293 xcb_out.sizeID = sizeID;
294 xcb_out.rotation = rotation;
295 xcb_out.rate = rate;
296 memset(xcb_out.pad0, 0, 2);
297
298 xcb_parts[2].iov_base = (char *) &xcb_out;
299 xcb_parts[2].iov_len = sizeof(xcb_out);
300 xcb_parts[3].iov_base = 0;
301 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
302
303 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
304 return xcb_ret;
305 }
306
307 xcb_randr_set_screen_config_cookie_t
xcb_randr_set_screen_config_unchecked(xcb_connection_t * c,xcb_window_t window,xcb_timestamp_t timestamp,xcb_timestamp_t config_timestamp,uint16_t sizeID,uint16_t rotation,uint16_t rate)308 xcb_randr_set_screen_config_unchecked (xcb_connection_t *c,
309 xcb_window_t window,
310 xcb_timestamp_t timestamp,
311 xcb_timestamp_t config_timestamp,
312 uint16_t sizeID,
313 uint16_t rotation,
314 uint16_t rate)
315 {
316 static const xcb_protocol_request_t xcb_req = {
317 .count = 2,
318 .ext = &xcb_randr_id,
319 .opcode = XCB_RANDR_SET_SCREEN_CONFIG,
320 .isvoid = 0
321 };
322
323 struct iovec xcb_parts[4];
324 xcb_randr_set_screen_config_cookie_t xcb_ret;
325 xcb_randr_set_screen_config_request_t xcb_out;
326
327 xcb_out.window = window;
328 xcb_out.timestamp = timestamp;
329 xcb_out.config_timestamp = config_timestamp;
330 xcb_out.sizeID = sizeID;
331 xcb_out.rotation = rotation;
332 xcb_out.rate = rate;
333 memset(xcb_out.pad0, 0, 2);
334
335 xcb_parts[2].iov_base = (char *) &xcb_out;
336 xcb_parts[2].iov_len = sizeof(xcb_out);
337 xcb_parts[3].iov_base = 0;
338 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
339
340 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
341 return xcb_ret;
342 }
343
344 xcb_randr_set_screen_config_reply_t *
xcb_randr_set_screen_config_reply(xcb_connection_t * c,xcb_randr_set_screen_config_cookie_t cookie,xcb_generic_error_t ** e)345 xcb_randr_set_screen_config_reply (xcb_connection_t *c,
346 xcb_randr_set_screen_config_cookie_t cookie /**< */,
347 xcb_generic_error_t **e)
348 {
349 return (xcb_randr_set_screen_config_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
350 }
351
352 xcb_void_cookie_t
xcb_randr_select_input_checked(xcb_connection_t * c,xcb_window_t window,uint16_t enable)353 xcb_randr_select_input_checked (xcb_connection_t *c,
354 xcb_window_t window,
355 uint16_t enable)
356 {
357 static const xcb_protocol_request_t xcb_req = {
358 .count = 2,
359 .ext = &xcb_randr_id,
360 .opcode = XCB_RANDR_SELECT_INPUT,
361 .isvoid = 1
362 };
363
364 struct iovec xcb_parts[4];
365 xcb_void_cookie_t xcb_ret;
366 xcb_randr_select_input_request_t xcb_out;
367
368 xcb_out.window = window;
369 xcb_out.enable = enable;
370 memset(xcb_out.pad0, 0, 2);
371
372 xcb_parts[2].iov_base = (char *) &xcb_out;
373 xcb_parts[2].iov_len = sizeof(xcb_out);
374 xcb_parts[3].iov_base = 0;
375 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
376
377 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
378 return xcb_ret;
379 }
380
381 xcb_void_cookie_t
xcb_randr_select_input(xcb_connection_t * c,xcb_window_t window,uint16_t enable)382 xcb_randr_select_input (xcb_connection_t *c,
383 xcb_window_t window,
384 uint16_t enable)
385 {
386 static const xcb_protocol_request_t xcb_req = {
387 .count = 2,
388 .ext = &xcb_randr_id,
389 .opcode = XCB_RANDR_SELECT_INPUT,
390 .isvoid = 1
391 };
392
393 struct iovec xcb_parts[4];
394 xcb_void_cookie_t xcb_ret;
395 xcb_randr_select_input_request_t xcb_out;
396
397 xcb_out.window = window;
398 xcb_out.enable = enable;
399 memset(xcb_out.pad0, 0, 2);
400
401 xcb_parts[2].iov_base = (char *) &xcb_out;
402 xcb_parts[2].iov_len = sizeof(xcb_out);
403 xcb_parts[3].iov_base = 0;
404 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
405
406 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
407 return xcb_ret;
408 }
409
410 int
xcb_randr_get_screen_info_sizeof(const void * _buffer)411 xcb_randr_get_screen_info_sizeof (const void *_buffer)
412 {
413 char *xcb_tmp = (char *)_buffer;
414 const xcb_randr_get_screen_info_reply_t *_aux = (xcb_randr_get_screen_info_reply_t *)_buffer;
415 unsigned int xcb_buffer_len = 0;
416 unsigned int xcb_block_len = 0;
417 unsigned int xcb_pad = 0;
418 unsigned int xcb_align_to = 0;
419
420 unsigned int i;
421 unsigned int xcb_tmp_len;
422
423 xcb_block_len += sizeof(xcb_randr_get_screen_info_reply_t);
424 xcb_tmp += xcb_block_len;
425 xcb_buffer_len += xcb_block_len;
426 xcb_block_len = 0;
427 /* sizes */
428 xcb_block_len += _aux->nSizes * sizeof(xcb_randr_screen_size_t);
429 xcb_tmp += xcb_block_len;
430 xcb_align_to = ALIGNOF(xcb_randr_screen_size_t);
431 /* insert padding */
432 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
433 xcb_buffer_len += xcb_block_len + xcb_pad;
434 if (0 != xcb_pad) {
435 xcb_tmp += xcb_pad;
436 xcb_pad = 0;
437 }
438 xcb_block_len = 0;
439 /* rates */
440 for(i=0; i<(_aux->nInfo - _aux->nSizes); i++) {
441 xcb_tmp_len = xcb_randr_refresh_rates_sizeof(xcb_tmp);
442 xcb_block_len += xcb_tmp_len;
443 xcb_tmp += xcb_tmp_len;
444 }
445 xcb_align_to = ALIGNOF(xcb_randr_refresh_rates_t);
446 /* insert padding */
447 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
448 xcb_buffer_len += xcb_block_len + xcb_pad;
449 if (0 != xcb_pad) {
450 xcb_tmp += xcb_pad;
451 xcb_pad = 0;
452 }
453 xcb_block_len = 0;
454
455 return xcb_buffer_len;
456 }
457
458 xcb_randr_get_screen_info_cookie_t
xcb_randr_get_screen_info(xcb_connection_t * c,xcb_window_t window)459 xcb_randr_get_screen_info (xcb_connection_t *c,
460 xcb_window_t window)
461 {
462 static const xcb_protocol_request_t xcb_req = {
463 .count = 2,
464 .ext = &xcb_randr_id,
465 .opcode = XCB_RANDR_GET_SCREEN_INFO,
466 .isvoid = 0
467 };
468
469 struct iovec xcb_parts[4];
470 xcb_randr_get_screen_info_cookie_t xcb_ret;
471 xcb_randr_get_screen_info_request_t xcb_out;
472
473 xcb_out.window = window;
474
475 xcb_parts[2].iov_base = (char *) &xcb_out;
476 xcb_parts[2].iov_len = sizeof(xcb_out);
477 xcb_parts[3].iov_base = 0;
478 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
479
480 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
481 return xcb_ret;
482 }
483
484 xcb_randr_get_screen_info_cookie_t
xcb_randr_get_screen_info_unchecked(xcb_connection_t * c,xcb_window_t window)485 xcb_randr_get_screen_info_unchecked (xcb_connection_t *c,
486 xcb_window_t window)
487 {
488 static const xcb_protocol_request_t xcb_req = {
489 .count = 2,
490 .ext = &xcb_randr_id,
491 .opcode = XCB_RANDR_GET_SCREEN_INFO,
492 .isvoid = 0
493 };
494
495 struct iovec xcb_parts[4];
496 xcb_randr_get_screen_info_cookie_t xcb_ret;
497 xcb_randr_get_screen_info_request_t xcb_out;
498
499 xcb_out.window = window;
500
501 xcb_parts[2].iov_base = (char *) &xcb_out;
502 xcb_parts[2].iov_len = sizeof(xcb_out);
503 xcb_parts[3].iov_base = 0;
504 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
505
506 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
507 return xcb_ret;
508 }
509
510 xcb_randr_screen_size_t *
xcb_randr_get_screen_info_sizes(const xcb_randr_get_screen_info_reply_t * R)511 xcb_randr_get_screen_info_sizes (const xcb_randr_get_screen_info_reply_t *R)
512 {
513 return (xcb_randr_screen_size_t *) (R + 1);
514 }
515
516 int
xcb_randr_get_screen_info_sizes_length(const xcb_randr_get_screen_info_reply_t * R)517 xcb_randr_get_screen_info_sizes_length (const xcb_randr_get_screen_info_reply_t *R)
518 {
519 return R->nSizes;
520 }
521
522 xcb_randr_screen_size_iterator_t
xcb_randr_get_screen_info_sizes_iterator(const xcb_randr_get_screen_info_reply_t * R)523 xcb_randr_get_screen_info_sizes_iterator (const xcb_randr_get_screen_info_reply_t *R)
524 {
525 xcb_randr_screen_size_iterator_t i;
526 i.data = (xcb_randr_screen_size_t *) (R + 1);
527 i.rem = R->nSizes;
528 i.index = (char *) i.data - (char *) R;
529 return i;
530 }
531
532 int
xcb_randr_get_screen_info_rates_length(const xcb_randr_get_screen_info_reply_t * R)533 xcb_randr_get_screen_info_rates_length (const xcb_randr_get_screen_info_reply_t *R)
534 {
535 return (R->nInfo - R->nSizes);
536 }
537
538 xcb_randr_refresh_rates_iterator_t
xcb_randr_get_screen_info_rates_iterator(const xcb_randr_get_screen_info_reply_t * R)539 xcb_randr_get_screen_info_rates_iterator (const xcb_randr_get_screen_info_reply_t *R)
540 {
541 xcb_randr_refresh_rates_iterator_t i;
542 xcb_generic_iterator_t prev = xcb_randr_screen_size_end(xcb_randr_get_screen_info_sizes_iterator(R));
543 i.data = (xcb_randr_refresh_rates_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_refresh_rates_t, prev.index));
544 i.rem = (R->nInfo - R->nSizes);
545 i.index = (char *) i.data - (char *) R;
546 return i;
547 }
548
549 xcb_randr_get_screen_info_reply_t *
xcb_randr_get_screen_info_reply(xcb_connection_t * c,xcb_randr_get_screen_info_cookie_t cookie,xcb_generic_error_t ** e)550 xcb_randr_get_screen_info_reply (xcb_connection_t *c,
551 xcb_randr_get_screen_info_cookie_t cookie /**< */,
552 xcb_generic_error_t **e)
553 {
554 return (xcb_randr_get_screen_info_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
555 }
556
557 xcb_randr_get_screen_size_range_cookie_t
xcb_randr_get_screen_size_range(xcb_connection_t * c,xcb_window_t window)558 xcb_randr_get_screen_size_range (xcb_connection_t *c,
559 xcb_window_t window)
560 {
561 static const xcb_protocol_request_t xcb_req = {
562 .count = 2,
563 .ext = &xcb_randr_id,
564 .opcode = XCB_RANDR_GET_SCREEN_SIZE_RANGE,
565 .isvoid = 0
566 };
567
568 struct iovec xcb_parts[4];
569 xcb_randr_get_screen_size_range_cookie_t xcb_ret;
570 xcb_randr_get_screen_size_range_request_t xcb_out;
571
572 xcb_out.window = window;
573
574 xcb_parts[2].iov_base = (char *) &xcb_out;
575 xcb_parts[2].iov_len = sizeof(xcb_out);
576 xcb_parts[3].iov_base = 0;
577 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
578
579 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
580 return xcb_ret;
581 }
582
583 xcb_randr_get_screen_size_range_cookie_t
xcb_randr_get_screen_size_range_unchecked(xcb_connection_t * c,xcb_window_t window)584 xcb_randr_get_screen_size_range_unchecked (xcb_connection_t *c,
585 xcb_window_t window)
586 {
587 static const xcb_protocol_request_t xcb_req = {
588 .count = 2,
589 .ext = &xcb_randr_id,
590 .opcode = XCB_RANDR_GET_SCREEN_SIZE_RANGE,
591 .isvoid = 0
592 };
593
594 struct iovec xcb_parts[4];
595 xcb_randr_get_screen_size_range_cookie_t xcb_ret;
596 xcb_randr_get_screen_size_range_request_t xcb_out;
597
598 xcb_out.window = window;
599
600 xcb_parts[2].iov_base = (char *) &xcb_out;
601 xcb_parts[2].iov_len = sizeof(xcb_out);
602 xcb_parts[3].iov_base = 0;
603 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
604
605 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
606 return xcb_ret;
607 }
608
609 xcb_randr_get_screen_size_range_reply_t *
xcb_randr_get_screen_size_range_reply(xcb_connection_t * c,xcb_randr_get_screen_size_range_cookie_t cookie,xcb_generic_error_t ** e)610 xcb_randr_get_screen_size_range_reply (xcb_connection_t *c,
611 xcb_randr_get_screen_size_range_cookie_t cookie /**< */,
612 xcb_generic_error_t **e)
613 {
614 return (xcb_randr_get_screen_size_range_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
615 }
616
617 xcb_void_cookie_t
xcb_randr_set_screen_size_checked(xcb_connection_t * c,xcb_window_t window,uint16_t width,uint16_t height,uint32_t mm_width,uint32_t mm_height)618 xcb_randr_set_screen_size_checked (xcb_connection_t *c,
619 xcb_window_t window,
620 uint16_t width,
621 uint16_t height,
622 uint32_t mm_width,
623 uint32_t mm_height)
624 {
625 static const xcb_protocol_request_t xcb_req = {
626 .count = 2,
627 .ext = &xcb_randr_id,
628 .opcode = XCB_RANDR_SET_SCREEN_SIZE,
629 .isvoid = 1
630 };
631
632 struct iovec xcb_parts[4];
633 xcb_void_cookie_t xcb_ret;
634 xcb_randr_set_screen_size_request_t xcb_out;
635
636 xcb_out.window = window;
637 xcb_out.width = width;
638 xcb_out.height = height;
639 xcb_out.mm_width = mm_width;
640 xcb_out.mm_height = mm_height;
641
642 xcb_parts[2].iov_base = (char *) &xcb_out;
643 xcb_parts[2].iov_len = sizeof(xcb_out);
644 xcb_parts[3].iov_base = 0;
645 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
646
647 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
648 return xcb_ret;
649 }
650
651 xcb_void_cookie_t
xcb_randr_set_screen_size(xcb_connection_t * c,xcb_window_t window,uint16_t width,uint16_t height,uint32_t mm_width,uint32_t mm_height)652 xcb_randr_set_screen_size (xcb_connection_t *c,
653 xcb_window_t window,
654 uint16_t width,
655 uint16_t height,
656 uint32_t mm_width,
657 uint32_t mm_height)
658 {
659 static const xcb_protocol_request_t xcb_req = {
660 .count = 2,
661 .ext = &xcb_randr_id,
662 .opcode = XCB_RANDR_SET_SCREEN_SIZE,
663 .isvoid = 1
664 };
665
666 struct iovec xcb_parts[4];
667 xcb_void_cookie_t xcb_ret;
668 xcb_randr_set_screen_size_request_t xcb_out;
669
670 xcb_out.window = window;
671 xcb_out.width = width;
672 xcb_out.height = height;
673 xcb_out.mm_width = mm_width;
674 xcb_out.mm_height = mm_height;
675
676 xcb_parts[2].iov_base = (char *) &xcb_out;
677 xcb_parts[2].iov_len = sizeof(xcb_out);
678 xcb_parts[3].iov_base = 0;
679 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
680
681 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
682 return xcb_ret;
683 }
684
685 void
xcb_randr_mode_info_next(xcb_randr_mode_info_iterator_t * i)686 xcb_randr_mode_info_next (xcb_randr_mode_info_iterator_t *i)
687 {
688 --i->rem;
689 ++i->data;
690 i->index += sizeof(xcb_randr_mode_info_t);
691 }
692
693 xcb_generic_iterator_t
xcb_randr_mode_info_end(xcb_randr_mode_info_iterator_t i)694 xcb_randr_mode_info_end (xcb_randr_mode_info_iterator_t i)
695 {
696 xcb_generic_iterator_t ret;
697 ret.data = i.data + i.rem;
698 ret.index = i.index + ((char *) ret.data - (char *) i.data);
699 ret.rem = 0;
700 return ret;
701 }
702
703 int
xcb_randr_get_screen_resources_sizeof(const void * _buffer)704 xcb_randr_get_screen_resources_sizeof (const void *_buffer)
705 {
706 char *xcb_tmp = (char *)_buffer;
707 const xcb_randr_get_screen_resources_reply_t *_aux = (xcb_randr_get_screen_resources_reply_t *)_buffer;
708 unsigned int xcb_buffer_len = 0;
709 unsigned int xcb_block_len = 0;
710 unsigned int xcb_pad = 0;
711 unsigned int xcb_align_to = 0;
712
713
714 xcb_block_len += sizeof(xcb_randr_get_screen_resources_reply_t);
715 xcb_tmp += xcb_block_len;
716 xcb_buffer_len += xcb_block_len;
717 xcb_block_len = 0;
718 /* crtcs */
719 xcb_block_len += _aux->num_crtcs * sizeof(uint32_t);
720 xcb_tmp += xcb_block_len;
721 xcb_align_to = ALIGNOF(xcb_randr_crtc_t);
722 /* insert padding */
723 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
724 xcb_buffer_len += xcb_block_len + xcb_pad;
725 if (0 != xcb_pad) {
726 xcb_tmp += xcb_pad;
727 xcb_pad = 0;
728 }
729 xcb_block_len = 0;
730 /* outputs */
731 xcb_block_len += _aux->num_outputs * sizeof(uint32_t);
732 xcb_tmp += xcb_block_len;
733 xcb_align_to = ALIGNOF(xcb_randr_output_t);
734 /* insert padding */
735 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
736 xcb_buffer_len += xcb_block_len + xcb_pad;
737 if (0 != xcb_pad) {
738 xcb_tmp += xcb_pad;
739 xcb_pad = 0;
740 }
741 xcb_block_len = 0;
742 /* modes */
743 xcb_block_len += _aux->num_modes * sizeof(xcb_randr_mode_info_t);
744 xcb_tmp += xcb_block_len;
745 xcb_align_to = ALIGNOF(xcb_randr_mode_info_t);
746 /* insert padding */
747 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
748 xcb_buffer_len += xcb_block_len + xcb_pad;
749 if (0 != xcb_pad) {
750 xcb_tmp += xcb_pad;
751 xcb_pad = 0;
752 }
753 xcb_block_len = 0;
754 /* names */
755 xcb_block_len += _aux->names_len * sizeof(uint8_t);
756 xcb_tmp += xcb_block_len;
757 xcb_align_to = ALIGNOF(uint8_t);
758 /* insert padding */
759 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
760 xcb_buffer_len += xcb_block_len + xcb_pad;
761 if (0 != xcb_pad) {
762 xcb_tmp += xcb_pad;
763 xcb_pad = 0;
764 }
765 xcb_block_len = 0;
766
767 return xcb_buffer_len;
768 }
769
770 xcb_randr_get_screen_resources_cookie_t
xcb_randr_get_screen_resources(xcb_connection_t * c,xcb_window_t window)771 xcb_randr_get_screen_resources (xcb_connection_t *c,
772 xcb_window_t window)
773 {
774 static const xcb_protocol_request_t xcb_req = {
775 .count = 2,
776 .ext = &xcb_randr_id,
777 .opcode = XCB_RANDR_GET_SCREEN_RESOURCES,
778 .isvoid = 0
779 };
780
781 struct iovec xcb_parts[4];
782 xcb_randr_get_screen_resources_cookie_t xcb_ret;
783 xcb_randr_get_screen_resources_request_t xcb_out;
784
785 xcb_out.window = window;
786
787 xcb_parts[2].iov_base = (char *) &xcb_out;
788 xcb_parts[2].iov_len = sizeof(xcb_out);
789 xcb_parts[3].iov_base = 0;
790 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
791
792 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
793 return xcb_ret;
794 }
795
796 xcb_randr_get_screen_resources_cookie_t
xcb_randr_get_screen_resources_unchecked(xcb_connection_t * c,xcb_window_t window)797 xcb_randr_get_screen_resources_unchecked (xcb_connection_t *c,
798 xcb_window_t window)
799 {
800 static const xcb_protocol_request_t xcb_req = {
801 .count = 2,
802 .ext = &xcb_randr_id,
803 .opcode = XCB_RANDR_GET_SCREEN_RESOURCES,
804 .isvoid = 0
805 };
806
807 struct iovec xcb_parts[4];
808 xcb_randr_get_screen_resources_cookie_t xcb_ret;
809 xcb_randr_get_screen_resources_request_t xcb_out;
810
811 xcb_out.window = window;
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
818 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
819 return xcb_ret;
820 }
821
822 xcb_randr_crtc_t *
xcb_randr_get_screen_resources_crtcs(const xcb_randr_get_screen_resources_reply_t * R)823 xcb_randr_get_screen_resources_crtcs (const xcb_randr_get_screen_resources_reply_t *R)
824 {
825 return (xcb_randr_crtc_t *) (R + 1);
826 }
827
828 int
xcb_randr_get_screen_resources_crtcs_length(const xcb_randr_get_screen_resources_reply_t * R)829 xcb_randr_get_screen_resources_crtcs_length (const xcb_randr_get_screen_resources_reply_t *R)
830 {
831 return R->num_crtcs;
832 }
833
834 xcb_generic_iterator_t
xcb_randr_get_screen_resources_crtcs_end(const xcb_randr_get_screen_resources_reply_t * R)835 xcb_randr_get_screen_resources_crtcs_end (const xcb_randr_get_screen_resources_reply_t *R)
836 {
837 xcb_generic_iterator_t i;
838 i.data = ((xcb_randr_crtc_t *) (R + 1)) + (R->num_crtcs);
839 i.rem = 0;
840 i.index = (char *) i.data - (char *) R;
841 return i;
842 }
843
844 xcb_randr_output_t *
xcb_randr_get_screen_resources_outputs(const xcb_randr_get_screen_resources_reply_t * R)845 xcb_randr_get_screen_resources_outputs (const xcb_randr_get_screen_resources_reply_t *R)
846 {
847 xcb_generic_iterator_t prev = xcb_randr_get_screen_resources_crtcs_end(R);
848 return (xcb_randr_output_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_output_t, prev.index) + 0);
849 }
850
851 int
xcb_randr_get_screen_resources_outputs_length(const xcb_randr_get_screen_resources_reply_t * R)852 xcb_randr_get_screen_resources_outputs_length (const xcb_randr_get_screen_resources_reply_t *R)
853 {
854 return R->num_outputs;
855 }
856
857 xcb_generic_iterator_t
xcb_randr_get_screen_resources_outputs_end(const xcb_randr_get_screen_resources_reply_t * R)858 xcb_randr_get_screen_resources_outputs_end (const xcb_randr_get_screen_resources_reply_t *R)
859 {
860 xcb_generic_iterator_t i;
861 xcb_generic_iterator_t prev = xcb_randr_get_screen_resources_crtcs_end(R);
862 i.data = ((xcb_randr_output_t *) ((char*) prev.data + XCB_TYPE_PAD(xcb_randr_output_t, prev.index))) + (R->num_outputs);
863 i.rem = 0;
864 i.index = (char *) i.data - (char *) R;
865 return i;
866 }
867
868 xcb_randr_mode_info_t *
xcb_randr_get_screen_resources_modes(const xcb_randr_get_screen_resources_reply_t * R)869 xcb_randr_get_screen_resources_modes (const xcb_randr_get_screen_resources_reply_t *R)
870 {
871 xcb_generic_iterator_t prev = xcb_randr_get_screen_resources_outputs_end(R);
872 return (xcb_randr_mode_info_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_mode_info_t, prev.index) + 0);
873 }
874
875 int
xcb_randr_get_screen_resources_modes_length(const xcb_randr_get_screen_resources_reply_t * R)876 xcb_randr_get_screen_resources_modes_length (const xcb_randr_get_screen_resources_reply_t *R)
877 {
878 return R->num_modes;
879 }
880
881 xcb_randr_mode_info_iterator_t
xcb_randr_get_screen_resources_modes_iterator(const xcb_randr_get_screen_resources_reply_t * R)882 xcb_randr_get_screen_resources_modes_iterator (const xcb_randr_get_screen_resources_reply_t *R)
883 {
884 xcb_randr_mode_info_iterator_t i;
885 xcb_generic_iterator_t prev = xcb_randr_get_screen_resources_outputs_end(R);
886 i.data = (xcb_randr_mode_info_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_mode_info_t, prev.index));
887 i.rem = R->num_modes;
888 i.index = (char *) i.data - (char *) R;
889 return i;
890 }
891
892 uint8_t *
xcb_randr_get_screen_resources_names(const xcb_randr_get_screen_resources_reply_t * R)893 xcb_randr_get_screen_resources_names (const xcb_randr_get_screen_resources_reply_t *R)
894 {
895 xcb_generic_iterator_t prev = xcb_randr_mode_info_end(xcb_randr_get_screen_resources_modes_iterator(R));
896 return (uint8_t *) ((char *) prev.data + XCB_TYPE_PAD(uint8_t, prev.index) + 0);
897 }
898
899 int
xcb_randr_get_screen_resources_names_length(const xcb_randr_get_screen_resources_reply_t * R)900 xcb_randr_get_screen_resources_names_length (const xcb_randr_get_screen_resources_reply_t *R)
901 {
902 return R->names_len;
903 }
904
905 xcb_generic_iterator_t
xcb_randr_get_screen_resources_names_end(const xcb_randr_get_screen_resources_reply_t * R)906 xcb_randr_get_screen_resources_names_end (const xcb_randr_get_screen_resources_reply_t *R)
907 {
908 xcb_generic_iterator_t i;
909 xcb_generic_iterator_t prev = xcb_randr_mode_info_end(xcb_randr_get_screen_resources_modes_iterator(R));
910 i.data = ((uint8_t *) ((char*) prev.data + XCB_TYPE_PAD(uint8_t, prev.index))) + (R->names_len);
911 i.rem = 0;
912 i.index = (char *) i.data - (char *) R;
913 return i;
914 }
915
916 xcb_randr_get_screen_resources_reply_t *
xcb_randr_get_screen_resources_reply(xcb_connection_t * c,xcb_randr_get_screen_resources_cookie_t cookie,xcb_generic_error_t ** e)917 xcb_randr_get_screen_resources_reply (xcb_connection_t *c,
918 xcb_randr_get_screen_resources_cookie_t cookie /**< */,
919 xcb_generic_error_t **e)
920 {
921 return (xcb_randr_get_screen_resources_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
922 }
923
924 int
xcb_randr_get_output_info_sizeof(const void * _buffer)925 xcb_randr_get_output_info_sizeof (const void *_buffer)
926 {
927 char *xcb_tmp = (char *)_buffer;
928 const xcb_randr_get_output_info_reply_t *_aux = (xcb_randr_get_output_info_reply_t *)_buffer;
929 unsigned int xcb_buffer_len = 0;
930 unsigned int xcb_block_len = 0;
931 unsigned int xcb_pad = 0;
932 unsigned int xcb_align_to = 0;
933
934
935 xcb_block_len += sizeof(xcb_randr_get_output_info_reply_t);
936 xcb_tmp += xcb_block_len;
937 xcb_buffer_len += xcb_block_len;
938 xcb_block_len = 0;
939 /* crtcs */
940 xcb_block_len += _aux->num_crtcs * sizeof(xcb_randr_output_t);
941 xcb_tmp += xcb_block_len;
942 xcb_align_to = ALIGNOF(xcb_randr_crtc_t);
943 /* insert padding */
944 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
945 xcb_buffer_len += xcb_block_len + xcb_pad;
946 if (0 != xcb_pad) {
947 xcb_tmp += xcb_pad;
948 xcb_pad = 0;
949 }
950 xcb_block_len = 0;
951 /* modes */
952 xcb_block_len += _aux->num_modes * sizeof(xcb_randr_output_t);
953 xcb_tmp += xcb_block_len;
954 xcb_align_to = ALIGNOF(xcb_randr_mode_t);
955 /* insert padding */
956 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
957 xcb_buffer_len += xcb_block_len + xcb_pad;
958 if (0 != xcb_pad) {
959 xcb_tmp += xcb_pad;
960 xcb_pad = 0;
961 }
962 xcb_block_len = 0;
963 /* clones */
964 xcb_block_len += _aux->num_clones * sizeof(xcb_randr_output_t);
965 xcb_tmp += xcb_block_len;
966 xcb_align_to = ALIGNOF(xcb_randr_output_t);
967 /* insert padding */
968 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
969 xcb_buffer_len += xcb_block_len + xcb_pad;
970 if (0 != xcb_pad) {
971 xcb_tmp += xcb_pad;
972 xcb_pad = 0;
973 }
974 xcb_block_len = 0;
975 /* name */
976 xcb_block_len += _aux->name_len * sizeof(uint8_t);
977 xcb_tmp += xcb_block_len;
978 xcb_align_to = ALIGNOF(uint8_t);
979 /* insert padding */
980 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
981 xcb_buffer_len += xcb_block_len + xcb_pad;
982 if (0 != xcb_pad) {
983 xcb_tmp += xcb_pad;
984 xcb_pad = 0;
985 }
986 xcb_block_len = 0;
987
988 return xcb_buffer_len;
989 }
990
991 xcb_randr_get_output_info_cookie_t
xcb_randr_get_output_info(xcb_connection_t * c,xcb_randr_output_t output,xcb_timestamp_t config_timestamp)992 xcb_randr_get_output_info (xcb_connection_t *c,
993 xcb_randr_output_t output,
994 xcb_timestamp_t config_timestamp)
995 {
996 static const xcb_protocol_request_t xcb_req = {
997 .count = 2,
998 .ext = &xcb_randr_id,
999 .opcode = XCB_RANDR_GET_OUTPUT_INFO,
1000 .isvoid = 0
1001 };
1002
1003 struct iovec xcb_parts[4];
1004 xcb_randr_get_output_info_cookie_t xcb_ret;
1005 xcb_randr_get_output_info_request_t xcb_out;
1006
1007 xcb_out.output = output;
1008 xcb_out.config_timestamp = config_timestamp;
1009
1010 xcb_parts[2].iov_base = (char *) &xcb_out;
1011 xcb_parts[2].iov_len = sizeof(xcb_out);
1012 xcb_parts[3].iov_base = 0;
1013 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1014
1015 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1016 return xcb_ret;
1017 }
1018
1019 xcb_randr_get_output_info_cookie_t
xcb_randr_get_output_info_unchecked(xcb_connection_t * c,xcb_randr_output_t output,xcb_timestamp_t config_timestamp)1020 xcb_randr_get_output_info_unchecked (xcb_connection_t *c,
1021 xcb_randr_output_t output,
1022 xcb_timestamp_t config_timestamp)
1023 {
1024 static const xcb_protocol_request_t xcb_req = {
1025 .count = 2,
1026 .ext = &xcb_randr_id,
1027 .opcode = XCB_RANDR_GET_OUTPUT_INFO,
1028 .isvoid = 0
1029 };
1030
1031 struct iovec xcb_parts[4];
1032 xcb_randr_get_output_info_cookie_t xcb_ret;
1033 xcb_randr_get_output_info_request_t xcb_out;
1034
1035 xcb_out.output = output;
1036 xcb_out.config_timestamp = config_timestamp;
1037
1038 xcb_parts[2].iov_base = (char *) &xcb_out;
1039 xcb_parts[2].iov_len = sizeof(xcb_out);
1040 xcb_parts[3].iov_base = 0;
1041 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1042
1043 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1044 return xcb_ret;
1045 }
1046
1047 xcb_randr_crtc_t *
xcb_randr_get_output_info_crtcs(const xcb_randr_get_output_info_reply_t * R)1048 xcb_randr_get_output_info_crtcs (const xcb_randr_get_output_info_reply_t *R)
1049 {
1050 return (xcb_randr_crtc_t *) (R + 1);
1051 }
1052
1053 int
xcb_randr_get_output_info_crtcs_length(const xcb_randr_get_output_info_reply_t * R)1054 xcb_randr_get_output_info_crtcs_length (const xcb_randr_get_output_info_reply_t *R)
1055 {
1056 return R->num_crtcs;
1057 }
1058
1059 xcb_generic_iterator_t
xcb_randr_get_output_info_crtcs_end(const xcb_randr_get_output_info_reply_t * R)1060 xcb_randr_get_output_info_crtcs_end (const xcb_randr_get_output_info_reply_t *R)
1061 {
1062 xcb_generic_iterator_t i;
1063 i.data = ((xcb_randr_crtc_t *) (R + 1)) + (R->num_crtcs);
1064 i.rem = 0;
1065 i.index = (char *) i.data - (char *) R;
1066 return i;
1067 }
1068
1069 xcb_randr_mode_t *
xcb_randr_get_output_info_modes(const xcb_randr_get_output_info_reply_t * R)1070 xcb_randr_get_output_info_modes (const xcb_randr_get_output_info_reply_t *R)
1071 {
1072 xcb_generic_iterator_t prev = xcb_randr_get_output_info_crtcs_end(R);
1073 return (xcb_randr_mode_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_mode_t, prev.index) + 0);
1074 }
1075
1076 int
xcb_randr_get_output_info_modes_length(const xcb_randr_get_output_info_reply_t * R)1077 xcb_randr_get_output_info_modes_length (const xcb_randr_get_output_info_reply_t *R)
1078 {
1079 return R->num_modes;
1080 }
1081
1082 xcb_generic_iterator_t
xcb_randr_get_output_info_modes_end(const xcb_randr_get_output_info_reply_t * R)1083 xcb_randr_get_output_info_modes_end (const xcb_randr_get_output_info_reply_t *R)
1084 {
1085 xcb_generic_iterator_t i;
1086 xcb_generic_iterator_t prev = xcb_randr_get_output_info_crtcs_end(R);
1087 i.data = ((xcb_randr_mode_t *) ((char*) prev.data + XCB_TYPE_PAD(xcb_randr_mode_t, prev.index))) + (R->num_modes);
1088 i.rem = 0;
1089 i.index = (char *) i.data - (char *) R;
1090 return i;
1091 }
1092
1093 xcb_randr_output_t *
xcb_randr_get_output_info_clones(const xcb_randr_get_output_info_reply_t * R)1094 xcb_randr_get_output_info_clones (const xcb_randr_get_output_info_reply_t *R)
1095 {
1096 xcb_generic_iterator_t prev = xcb_randr_get_output_info_modes_end(R);
1097 return (xcb_randr_output_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_output_t, prev.index) + 0);
1098 }
1099
1100 int
xcb_randr_get_output_info_clones_length(const xcb_randr_get_output_info_reply_t * R)1101 xcb_randr_get_output_info_clones_length (const xcb_randr_get_output_info_reply_t *R)
1102 {
1103 return R->num_clones;
1104 }
1105
1106 xcb_generic_iterator_t
xcb_randr_get_output_info_clones_end(const xcb_randr_get_output_info_reply_t * R)1107 xcb_randr_get_output_info_clones_end (const xcb_randr_get_output_info_reply_t *R)
1108 {
1109 xcb_generic_iterator_t i;
1110 xcb_generic_iterator_t prev = xcb_randr_get_output_info_modes_end(R);
1111 i.data = ((xcb_randr_output_t *) ((char*) prev.data + XCB_TYPE_PAD(xcb_randr_output_t, prev.index))) + (R->num_clones);
1112 i.rem = 0;
1113 i.index = (char *) i.data - (char *) R;
1114 return i;
1115 }
1116
1117 uint8_t *
xcb_randr_get_output_info_name(const xcb_randr_get_output_info_reply_t * R)1118 xcb_randr_get_output_info_name (const xcb_randr_get_output_info_reply_t *R)
1119 {
1120 xcb_generic_iterator_t prev = xcb_randr_get_output_info_clones_end(R);
1121 return (uint8_t *) ((char *) prev.data + XCB_TYPE_PAD(uint8_t, prev.index) + 0);
1122 }
1123
1124 int
xcb_randr_get_output_info_name_length(const xcb_randr_get_output_info_reply_t * R)1125 xcb_randr_get_output_info_name_length (const xcb_randr_get_output_info_reply_t *R)
1126 {
1127 return R->name_len;
1128 }
1129
1130 xcb_generic_iterator_t
xcb_randr_get_output_info_name_end(const xcb_randr_get_output_info_reply_t * R)1131 xcb_randr_get_output_info_name_end (const xcb_randr_get_output_info_reply_t *R)
1132 {
1133 xcb_generic_iterator_t i;
1134 xcb_generic_iterator_t prev = xcb_randr_get_output_info_clones_end(R);
1135 i.data = ((uint8_t *) ((char*) prev.data + XCB_TYPE_PAD(uint8_t, prev.index))) + (R->name_len);
1136 i.rem = 0;
1137 i.index = (char *) i.data - (char *) R;
1138 return i;
1139 }
1140
1141 xcb_randr_get_output_info_reply_t *
xcb_randr_get_output_info_reply(xcb_connection_t * c,xcb_randr_get_output_info_cookie_t cookie,xcb_generic_error_t ** e)1142 xcb_randr_get_output_info_reply (xcb_connection_t *c,
1143 xcb_randr_get_output_info_cookie_t cookie /**< */,
1144 xcb_generic_error_t **e)
1145 {
1146 return (xcb_randr_get_output_info_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
1147 }
1148
1149 int
xcb_randr_list_output_properties_sizeof(const void * _buffer)1150 xcb_randr_list_output_properties_sizeof (const void *_buffer)
1151 {
1152 char *xcb_tmp = (char *)_buffer;
1153 const xcb_randr_list_output_properties_reply_t *_aux = (xcb_randr_list_output_properties_reply_t *)_buffer;
1154 unsigned int xcb_buffer_len = 0;
1155 unsigned int xcb_block_len = 0;
1156 unsigned int xcb_pad = 0;
1157 unsigned int xcb_align_to = 0;
1158
1159
1160 xcb_block_len += sizeof(xcb_randr_list_output_properties_reply_t);
1161 xcb_tmp += xcb_block_len;
1162 xcb_buffer_len += xcb_block_len;
1163 xcb_block_len = 0;
1164 /* atoms */
1165 xcb_block_len += _aux->num_atoms * sizeof(xcb_atom_t);
1166 xcb_tmp += xcb_block_len;
1167 xcb_align_to = ALIGNOF(xcb_atom_t);
1168 /* insert padding */
1169 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
1170 xcb_buffer_len += xcb_block_len + xcb_pad;
1171 if (0 != xcb_pad) {
1172 xcb_tmp += xcb_pad;
1173 xcb_pad = 0;
1174 }
1175 xcb_block_len = 0;
1176
1177 return xcb_buffer_len;
1178 }
1179
1180 xcb_randr_list_output_properties_cookie_t
xcb_randr_list_output_properties(xcb_connection_t * c,xcb_randr_output_t output)1181 xcb_randr_list_output_properties (xcb_connection_t *c,
1182 xcb_randr_output_t output)
1183 {
1184 static const xcb_protocol_request_t xcb_req = {
1185 .count = 2,
1186 .ext = &xcb_randr_id,
1187 .opcode = XCB_RANDR_LIST_OUTPUT_PROPERTIES,
1188 .isvoid = 0
1189 };
1190
1191 struct iovec xcb_parts[4];
1192 xcb_randr_list_output_properties_cookie_t xcb_ret;
1193 xcb_randr_list_output_properties_request_t xcb_out;
1194
1195 xcb_out.output = output;
1196
1197 xcb_parts[2].iov_base = (char *) &xcb_out;
1198 xcb_parts[2].iov_len = sizeof(xcb_out);
1199 xcb_parts[3].iov_base = 0;
1200 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1201
1202 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1203 return xcb_ret;
1204 }
1205
1206 xcb_randr_list_output_properties_cookie_t
xcb_randr_list_output_properties_unchecked(xcb_connection_t * c,xcb_randr_output_t output)1207 xcb_randr_list_output_properties_unchecked (xcb_connection_t *c,
1208 xcb_randr_output_t output)
1209 {
1210 static const xcb_protocol_request_t xcb_req = {
1211 .count = 2,
1212 .ext = &xcb_randr_id,
1213 .opcode = XCB_RANDR_LIST_OUTPUT_PROPERTIES,
1214 .isvoid = 0
1215 };
1216
1217 struct iovec xcb_parts[4];
1218 xcb_randr_list_output_properties_cookie_t xcb_ret;
1219 xcb_randr_list_output_properties_request_t xcb_out;
1220
1221 xcb_out.output = output;
1222
1223 xcb_parts[2].iov_base = (char *) &xcb_out;
1224 xcb_parts[2].iov_len = sizeof(xcb_out);
1225 xcb_parts[3].iov_base = 0;
1226 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1227
1228 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1229 return xcb_ret;
1230 }
1231
1232 xcb_atom_t *
xcb_randr_list_output_properties_atoms(const xcb_randr_list_output_properties_reply_t * R)1233 xcb_randr_list_output_properties_atoms (const xcb_randr_list_output_properties_reply_t *R)
1234 {
1235 return (xcb_atom_t *) (R + 1);
1236 }
1237
1238 int
xcb_randr_list_output_properties_atoms_length(const xcb_randr_list_output_properties_reply_t * R)1239 xcb_randr_list_output_properties_atoms_length (const xcb_randr_list_output_properties_reply_t *R)
1240 {
1241 return R->num_atoms;
1242 }
1243
1244 xcb_generic_iterator_t
xcb_randr_list_output_properties_atoms_end(const xcb_randr_list_output_properties_reply_t * R)1245 xcb_randr_list_output_properties_atoms_end (const xcb_randr_list_output_properties_reply_t *R)
1246 {
1247 xcb_generic_iterator_t i;
1248 i.data = ((xcb_atom_t *) (R + 1)) + (R->num_atoms);
1249 i.rem = 0;
1250 i.index = (char *) i.data - (char *) R;
1251 return i;
1252 }
1253
1254 xcb_randr_list_output_properties_reply_t *
xcb_randr_list_output_properties_reply(xcb_connection_t * c,xcb_randr_list_output_properties_cookie_t cookie,xcb_generic_error_t ** e)1255 xcb_randr_list_output_properties_reply (xcb_connection_t *c,
1256 xcb_randr_list_output_properties_cookie_t cookie /**< */,
1257 xcb_generic_error_t **e)
1258 {
1259 return (xcb_randr_list_output_properties_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
1260 }
1261
1262 int
xcb_randr_query_output_property_sizeof(const void * _buffer)1263 xcb_randr_query_output_property_sizeof (const void *_buffer)
1264 {
1265 char *xcb_tmp = (char *)_buffer;
1266 const xcb_randr_query_output_property_reply_t *_aux = (xcb_randr_query_output_property_reply_t *)_buffer;
1267 unsigned int xcb_buffer_len = 0;
1268 unsigned int xcb_block_len = 0;
1269 unsigned int xcb_pad = 0;
1270 unsigned int xcb_align_to = 0;
1271
1272
1273 xcb_block_len += sizeof(xcb_randr_query_output_property_reply_t);
1274 xcb_tmp += xcb_block_len;
1275 xcb_buffer_len += xcb_block_len;
1276 xcb_block_len = 0;
1277 /* validValues */
1278 xcb_block_len += _aux->length * sizeof(int32_t);
1279 xcb_tmp += xcb_block_len;
1280 xcb_align_to = ALIGNOF(int32_t);
1281 /* insert padding */
1282 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
1283 xcb_buffer_len += xcb_block_len + xcb_pad;
1284 if (0 != xcb_pad) {
1285 xcb_tmp += xcb_pad;
1286 xcb_pad = 0;
1287 }
1288 xcb_block_len = 0;
1289
1290 return xcb_buffer_len;
1291 }
1292
1293 xcb_randr_query_output_property_cookie_t
xcb_randr_query_output_property(xcb_connection_t * c,xcb_randr_output_t output,xcb_atom_t property)1294 xcb_randr_query_output_property (xcb_connection_t *c,
1295 xcb_randr_output_t output,
1296 xcb_atom_t property)
1297 {
1298 static const xcb_protocol_request_t xcb_req = {
1299 .count = 2,
1300 .ext = &xcb_randr_id,
1301 .opcode = XCB_RANDR_QUERY_OUTPUT_PROPERTY,
1302 .isvoid = 0
1303 };
1304
1305 struct iovec xcb_parts[4];
1306 xcb_randr_query_output_property_cookie_t xcb_ret;
1307 xcb_randr_query_output_property_request_t xcb_out;
1308
1309 xcb_out.output = output;
1310 xcb_out.property = property;
1311
1312 xcb_parts[2].iov_base = (char *) &xcb_out;
1313 xcb_parts[2].iov_len = sizeof(xcb_out);
1314 xcb_parts[3].iov_base = 0;
1315 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1316
1317 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1318 return xcb_ret;
1319 }
1320
1321 xcb_randr_query_output_property_cookie_t
xcb_randr_query_output_property_unchecked(xcb_connection_t * c,xcb_randr_output_t output,xcb_atom_t property)1322 xcb_randr_query_output_property_unchecked (xcb_connection_t *c,
1323 xcb_randr_output_t output,
1324 xcb_atom_t property)
1325 {
1326 static const xcb_protocol_request_t xcb_req = {
1327 .count = 2,
1328 .ext = &xcb_randr_id,
1329 .opcode = XCB_RANDR_QUERY_OUTPUT_PROPERTY,
1330 .isvoid = 0
1331 };
1332
1333 struct iovec xcb_parts[4];
1334 xcb_randr_query_output_property_cookie_t xcb_ret;
1335 xcb_randr_query_output_property_request_t xcb_out;
1336
1337 xcb_out.output = output;
1338 xcb_out.property = property;
1339
1340 xcb_parts[2].iov_base = (char *) &xcb_out;
1341 xcb_parts[2].iov_len = sizeof(xcb_out);
1342 xcb_parts[3].iov_base = 0;
1343 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1344
1345 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1346 return xcb_ret;
1347 }
1348
1349 int32_t *
xcb_randr_query_output_property_valid_values(const xcb_randr_query_output_property_reply_t * R)1350 xcb_randr_query_output_property_valid_values (const xcb_randr_query_output_property_reply_t *R)
1351 {
1352 return (int32_t *) (R + 1);
1353 }
1354
1355 int
xcb_randr_query_output_property_valid_values_length(const xcb_randr_query_output_property_reply_t * R)1356 xcb_randr_query_output_property_valid_values_length (const xcb_randr_query_output_property_reply_t *R)
1357 {
1358 return R->length;
1359 }
1360
1361 xcb_generic_iterator_t
xcb_randr_query_output_property_valid_values_end(const xcb_randr_query_output_property_reply_t * R)1362 xcb_randr_query_output_property_valid_values_end (const xcb_randr_query_output_property_reply_t *R)
1363 {
1364 xcb_generic_iterator_t i;
1365 i.data = ((int32_t *) (R + 1)) + (R->length);
1366 i.rem = 0;
1367 i.index = (char *) i.data - (char *) R;
1368 return i;
1369 }
1370
1371 xcb_randr_query_output_property_reply_t *
xcb_randr_query_output_property_reply(xcb_connection_t * c,xcb_randr_query_output_property_cookie_t cookie,xcb_generic_error_t ** e)1372 xcb_randr_query_output_property_reply (xcb_connection_t *c,
1373 xcb_randr_query_output_property_cookie_t cookie /**< */,
1374 xcb_generic_error_t **e)
1375 {
1376 return (xcb_randr_query_output_property_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
1377 }
1378
1379 int
xcb_randr_configure_output_property_sizeof(const void * _buffer,uint32_t values_len)1380 xcb_randr_configure_output_property_sizeof (const void *_buffer,
1381 uint32_t values_len)
1382 {
1383 char *xcb_tmp = (char *)_buffer;
1384 unsigned int xcb_buffer_len = 0;
1385 unsigned int xcb_block_len = 0;
1386 unsigned int xcb_pad = 0;
1387 unsigned int xcb_align_to = 0;
1388
1389
1390 xcb_block_len += sizeof(xcb_randr_configure_output_property_request_t);
1391 xcb_tmp += xcb_block_len;
1392 xcb_buffer_len += xcb_block_len;
1393 xcb_block_len = 0;
1394 /* values */
1395 xcb_block_len += values_len * sizeof(int32_t);
1396 xcb_tmp += xcb_block_len;
1397 xcb_align_to = ALIGNOF(int32_t);
1398 /* insert padding */
1399 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
1400 xcb_buffer_len += xcb_block_len + xcb_pad;
1401 if (0 != xcb_pad) {
1402 xcb_tmp += xcb_pad;
1403 xcb_pad = 0;
1404 }
1405 xcb_block_len = 0;
1406
1407 return xcb_buffer_len;
1408 }
1409
1410 xcb_void_cookie_t
xcb_randr_configure_output_property_checked(xcb_connection_t * c,xcb_randr_output_t output,xcb_atom_t property,uint8_t pending,uint8_t range,uint32_t values_len,const int32_t * values)1411 xcb_randr_configure_output_property_checked (xcb_connection_t *c,
1412 xcb_randr_output_t output,
1413 xcb_atom_t property,
1414 uint8_t pending,
1415 uint8_t range,
1416 uint32_t values_len,
1417 const int32_t *values)
1418 {
1419 static const xcb_protocol_request_t xcb_req = {
1420 .count = 4,
1421 .ext = &xcb_randr_id,
1422 .opcode = XCB_RANDR_CONFIGURE_OUTPUT_PROPERTY,
1423 .isvoid = 1
1424 };
1425
1426 struct iovec xcb_parts[6];
1427 xcb_void_cookie_t xcb_ret;
1428 xcb_randr_configure_output_property_request_t xcb_out;
1429
1430 xcb_out.output = output;
1431 xcb_out.property = property;
1432 xcb_out.pending = pending;
1433 xcb_out.range = range;
1434 memset(xcb_out.pad0, 0, 2);
1435
1436 xcb_parts[2].iov_base = (char *) &xcb_out;
1437 xcb_parts[2].iov_len = sizeof(xcb_out);
1438 xcb_parts[3].iov_base = 0;
1439 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1440 /* int32_t values */
1441 xcb_parts[4].iov_base = (char *) values;
1442 xcb_parts[4].iov_len = values_len * sizeof(int32_t);
1443 xcb_parts[5].iov_base = 0;
1444 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
1445
1446 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1447 return xcb_ret;
1448 }
1449
1450 xcb_void_cookie_t
xcb_randr_configure_output_property(xcb_connection_t * c,xcb_randr_output_t output,xcb_atom_t property,uint8_t pending,uint8_t range,uint32_t values_len,const int32_t * values)1451 xcb_randr_configure_output_property (xcb_connection_t *c,
1452 xcb_randr_output_t output,
1453 xcb_atom_t property,
1454 uint8_t pending,
1455 uint8_t range,
1456 uint32_t values_len,
1457 const int32_t *values)
1458 {
1459 static const xcb_protocol_request_t xcb_req = {
1460 .count = 4,
1461 .ext = &xcb_randr_id,
1462 .opcode = XCB_RANDR_CONFIGURE_OUTPUT_PROPERTY,
1463 .isvoid = 1
1464 };
1465
1466 struct iovec xcb_parts[6];
1467 xcb_void_cookie_t xcb_ret;
1468 xcb_randr_configure_output_property_request_t xcb_out;
1469
1470 xcb_out.output = output;
1471 xcb_out.property = property;
1472 xcb_out.pending = pending;
1473 xcb_out.range = range;
1474 memset(xcb_out.pad0, 0, 2);
1475
1476 xcb_parts[2].iov_base = (char *) &xcb_out;
1477 xcb_parts[2].iov_len = sizeof(xcb_out);
1478 xcb_parts[3].iov_base = 0;
1479 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1480 /* int32_t values */
1481 xcb_parts[4].iov_base = (char *) values;
1482 xcb_parts[4].iov_len = values_len * sizeof(int32_t);
1483 xcb_parts[5].iov_base = 0;
1484 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
1485
1486 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1487 return xcb_ret;
1488 }
1489
1490 int32_t *
xcb_randr_configure_output_property_values(const xcb_randr_configure_output_property_request_t * R)1491 xcb_randr_configure_output_property_values (const xcb_randr_configure_output_property_request_t *R)
1492 {
1493 return (int32_t *) (R + 1);
1494 }
1495
1496 int
xcb_randr_configure_output_property_values_length(const xcb_randr_configure_output_property_request_t * R)1497 xcb_randr_configure_output_property_values_length (const xcb_randr_configure_output_property_request_t *R)
1498 {
1499 return (((R->length * 4) - sizeof(xcb_randr_configure_output_property_request_t))/sizeof(int32_t));
1500 }
1501
1502 xcb_generic_iterator_t
xcb_randr_configure_output_property_values_end(const xcb_randr_configure_output_property_request_t * R)1503 xcb_randr_configure_output_property_values_end (const xcb_randr_configure_output_property_request_t *R)
1504 {
1505 xcb_generic_iterator_t i;
1506 i.data = ((int32_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_randr_configure_output_property_request_t))/sizeof(int32_t)));
1507 i.rem = 0;
1508 i.index = (char *) i.data - (char *) R;
1509 return i;
1510 }
1511
1512 int
xcb_randr_change_output_property_sizeof(const void * _buffer)1513 xcb_randr_change_output_property_sizeof (const void *_buffer)
1514 {
1515 char *xcb_tmp = (char *)_buffer;
1516 const xcb_randr_change_output_property_request_t *_aux = (xcb_randr_change_output_property_request_t *)_buffer;
1517 unsigned int xcb_buffer_len = 0;
1518 unsigned int xcb_block_len = 0;
1519 unsigned int xcb_pad = 0;
1520 unsigned int xcb_align_to = 0;
1521
1522
1523 xcb_block_len += sizeof(xcb_randr_change_output_property_request_t);
1524 xcb_tmp += xcb_block_len;
1525 xcb_buffer_len += xcb_block_len;
1526 xcb_block_len = 0;
1527 /* data */
1528 xcb_block_len += ((_aux->num_units * _aux->format) / 8) * sizeof(char);
1529 xcb_tmp += xcb_block_len;
1530 xcb_align_to = ALIGNOF(char);
1531 /* insert padding */
1532 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
1533 xcb_buffer_len += xcb_block_len + xcb_pad;
1534 if (0 != xcb_pad) {
1535 xcb_tmp += xcb_pad;
1536 xcb_pad = 0;
1537 }
1538 xcb_block_len = 0;
1539
1540 return xcb_buffer_len;
1541 }
1542
1543 xcb_void_cookie_t
xcb_randr_change_output_property_checked(xcb_connection_t * c,xcb_randr_output_t output,xcb_atom_t property,xcb_atom_t type,uint8_t format,uint8_t mode,uint32_t num_units,const void * data)1544 xcb_randr_change_output_property_checked (xcb_connection_t *c,
1545 xcb_randr_output_t output,
1546 xcb_atom_t property,
1547 xcb_atom_t type,
1548 uint8_t format,
1549 uint8_t mode,
1550 uint32_t num_units,
1551 const void *data)
1552 {
1553 static const xcb_protocol_request_t xcb_req = {
1554 .count = 4,
1555 .ext = &xcb_randr_id,
1556 .opcode = XCB_RANDR_CHANGE_OUTPUT_PROPERTY,
1557 .isvoid = 1
1558 };
1559
1560 struct iovec xcb_parts[6];
1561 xcb_void_cookie_t xcb_ret;
1562 xcb_randr_change_output_property_request_t xcb_out;
1563
1564 xcb_out.output = output;
1565 xcb_out.property = property;
1566 xcb_out.type = type;
1567 xcb_out.format = format;
1568 xcb_out.mode = mode;
1569 memset(xcb_out.pad0, 0, 2);
1570 xcb_out.num_units = num_units;
1571
1572 xcb_parts[2].iov_base = (char *) &xcb_out;
1573 xcb_parts[2].iov_len = sizeof(xcb_out);
1574 xcb_parts[3].iov_base = 0;
1575 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1576 /* void data */
1577 xcb_parts[4].iov_base = (char *) data;
1578 xcb_parts[4].iov_len = ((num_units * format) / 8) * sizeof(char);
1579 xcb_parts[5].iov_base = 0;
1580 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
1581
1582 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1583 return xcb_ret;
1584 }
1585
1586 xcb_void_cookie_t
xcb_randr_change_output_property(xcb_connection_t * c,xcb_randr_output_t output,xcb_atom_t property,xcb_atom_t type,uint8_t format,uint8_t mode,uint32_t num_units,const void * data)1587 xcb_randr_change_output_property (xcb_connection_t *c,
1588 xcb_randr_output_t output,
1589 xcb_atom_t property,
1590 xcb_atom_t type,
1591 uint8_t format,
1592 uint8_t mode,
1593 uint32_t num_units,
1594 const void *data)
1595 {
1596 static const xcb_protocol_request_t xcb_req = {
1597 .count = 4,
1598 .ext = &xcb_randr_id,
1599 .opcode = XCB_RANDR_CHANGE_OUTPUT_PROPERTY,
1600 .isvoid = 1
1601 };
1602
1603 struct iovec xcb_parts[6];
1604 xcb_void_cookie_t xcb_ret;
1605 xcb_randr_change_output_property_request_t xcb_out;
1606
1607 xcb_out.output = output;
1608 xcb_out.property = property;
1609 xcb_out.type = type;
1610 xcb_out.format = format;
1611 xcb_out.mode = mode;
1612 memset(xcb_out.pad0, 0, 2);
1613 xcb_out.num_units = num_units;
1614
1615 xcb_parts[2].iov_base = (char *) &xcb_out;
1616 xcb_parts[2].iov_len = sizeof(xcb_out);
1617 xcb_parts[3].iov_base = 0;
1618 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1619 /* void data */
1620 xcb_parts[4].iov_base = (char *) data;
1621 xcb_parts[4].iov_len = ((num_units * format) / 8) * sizeof(char);
1622 xcb_parts[5].iov_base = 0;
1623 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
1624
1625 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1626 return xcb_ret;
1627 }
1628
1629 void *
xcb_randr_change_output_property_data(const xcb_randr_change_output_property_request_t * R)1630 xcb_randr_change_output_property_data (const xcb_randr_change_output_property_request_t *R)
1631 {
1632 return (void *) (R + 1);
1633 }
1634
1635 int
xcb_randr_change_output_property_data_length(const xcb_randr_change_output_property_request_t * R)1636 xcb_randr_change_output_property_data_length (const xcb_randr_change_output_property_request_t *R)
1637 {
1638 return ((R->num_units * R->format) / 8);
1639 }
1640
1641 xcb_generic_iterator_t
xcb_randr_change_output_property_data_end(const xcb_randr_change_output_property_request_t * R)1642 xcb_randr_change_output_property_data_end (const xcb_randr_change_output_property_request_t *R)
1643 {
1644 xcb_generic_iterator_t i;
1645 i.data = ((char *) (R + 1)) + (((R->num_units * R->format) / 8));
1646 i.rem = 0;
1647 i.index = (char *) i.data - (char *) R;
1648 return i;
1649 }
1650
1651 xcb_void_cookie_t
xcb_randr_delete_output_property_checked(xcb_connection_t * c,xcb_randr_output_t output,xcb_atom_t property)1652 xcb_randr_delete_output_property_checked (xcb_connection_t *c,
1653 xcb_randr_output_t output,
1654 xcb_atom_t property)
1655 {
1656 static const xcb_protocol_request_t xcb_req = {
1657 .count = 2,
1658 .ext = &xcb_randr_id,
1659 .opcode = XCB_RANDR_DELETE_OUTPUT_PROPERTY,
1660 .isvoid = 1
1661 };
1662
1663 struct iovec xcb_parts[4];
1664 xcb_void_cookie_t xcb_ret;
1665 xcb_randr_delete_output_property_request_t xcb_out;
1666
1667 xcb_out.output = output;
1668 xcb_out.property = property;
1669
1670 xcb_parts[2].iov_base = (char *) &xcb_out;
1671 xcb_parts[2].iov_len = sizeof(xcb_out);
1672 xcb_parts[3].iov_base = 0;
1673 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1674
1675 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1676 return xcb_ret;
1677 }
1678
1679 xcb_void_cookie_t
xcb_randr_delete_output_property(xcb_connection_t * c,xcb_randr_output_t output,xcb_atom_t property)1680 xcb_randr_delete_output_property (xcb_connection_t *c,
1681 xcb_randr_output_t output,
1682 xcb_atom_t property)
1683 {
1684 static const xcb_protocol_request_t xcb_req = {
1685 .count = 2,
1686 .ext = &xcb_randr_id,
1687 .opcode = XCB_RANDR_DELETE_OUTPUT_PROPERTY,
1688 .isvoid = 1
1689 };
1690
1691 struct iovec xcb_parts[4];
1692 xcb_void_cookie_t xcb_ret;
1693 xcb_randr_delete_output_property_request_t xcb_out;
1694
1695 xcb_out.output = output;
1696 xcb_out.property = property;
1697
1698 xcb_parts[2].iov_base = (char *) &xcb_out;
1699 xcb_parts[2].iov_len = sizeof(xcb_out);
1700 xcb_parts[3].iov_base = 0;
1701 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1702
1703 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1704 return xcb_ret;
1705 }
1706
1707 int
xcb_randr_get_output_property_sizeof(const void * _buffer)1708 xcb_randr_get_output_property_sizeof (const void *_buffer)
1709 {
1710 char *xcb_tmp = (char *)_buffer;
1711 const xcb_randr_get_output_property_reply_t *_aux = (xcb_randr_get_output_property_reply_t *)_buffer;
1712 unsigned int xcb_buffer_len = 0;
1713 unsigned int xcb_block_len = 0;
1714 unsigned int xcb_pad = 0;
1715 unsigned int xcb_align_to = 0;
1716
1717
1718 xcb_block_len += sizeof(xcb_randr_get_output_property_reply_t);
1719 xcb_tmp += xcb_block_len;
1720 xcb_buffer_len += xcb_block_len;
1721 xcb_block_len = 0;
1722 /* data */
1723 xcb_block_len += (_aux->num_items * (_aux->format / 8)) * sizeof(uint8_t);
1724 xcb_tmp += xcb_block_len;
1725 xcb_align_to = ALIGNOF(uint8_t);
1726 /* insert padding */
1727 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
1728 xcb_buffer_len += xcb_block_len + xcb_pad;
1729 if (0 != xcb_pad) {
1730 xcb_tmp += xcb_pad;
1731 xcb_pad = 0;
1732 }
1733 xcb_block_len = 0;
1734
1735 return xcb_buffer_len;
1736 }
1737
1738 xcb_randr_get_output_property_cookie_t
xcb_randr_get_output_property(xcb_connection_t * c,xcb_randr_output_t output,xcb_atom_t property,xcb_atom_t type,uint32_t long_offset,uint32_t long_length,uint8_t _delete,uint8_t pending)1739 xcb_randr_get_output_property (xcb_connection_t *c,
1740 xcb_randr_output_t output,
1741 xcb_atom_t property,
1742 xcb_atom_t type,
1743 uint32_t long_offset,
1744 uint32_t long_length,
1745 uint8_t _delete,
1746 uint8_t pending)
1747 {
1748 static const xcb_protocol_request_t xcb_req = {
1749 .count = 2,
1750 .ext = &xcb_randr_id,
1751 .opcode = XCB_RANDR_GET_OUTPUT_PROPERTY,
1752 .isvoid = 0
1753 };
1754
1755 struct iovec xcb_parts[4];
1756 xcb_randr_get_output_property_cookie_t xcb_ret;
1757 xcb_randr_get_output_property_request_t xcb_out;
1758
1759 xcb_out.output = output;
1760 xcb_out.property = property;
1761 xcb_out.type = type;
1762 xcb_out.long_offset = long_offset;
1763 xcb_out.long_length = long_length;
1764 xcb_out._delete = _delete;
1765 xcb_out.pending = pending;
1766 memset(xcb_out.pad0, 0, 2);
1767
1768 xcb_parts[2].iov_base = (char *) &xcb_out;
1769 xcb_parts[2].iov_len = sizeof(xcb_out);
1770 xcb_parts[3].iov_base = 0;
1771 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1772
1773 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1774 return xcb_ret;
1775 }
1776
1777 xcb_randr_get_output_property_cookie_t
xcb_randr_get_output_property_unchecked(xcb_connection_t * c,xcb_randr_output_t output,xcb_atom_t property,xcb_atom_t type,uint32_t long_offset,uint32_t long_length,uint8_t _delete,uint8_t pending)1778 xcb_randr_get_output_property_unchecked (xcb_connection_t *c,
1779 xcb_randr_output_t output,
1780 xcb_atom_t property,
1781 xcb_atom_t type,
1782 uint32_t long_offset,
1783 uint32_t long_length,
1784 uint8_t _delete,
1785 uint8_t pending)
1786 {
1787 static const xcb_protocol_request_t xcb_req = {
1788 .count = 2,
1789 .ext = &xcb_randr_id,
1790 .opcode = XCB_RANDR_GET_OUTPUT_PROPERTY,
1791 .isvoid = 0
1792 };
1793
1794 struct iovec xcb_parts[4];
1795 xcb_randr_get_output_property_cookie_t xcb_ret;
1796 xcb_randr_get_output_property_request_t xcb_out;
1797
1798 xcb_out.output = output;
1799 xcb_out.property = property;
1800 xcb_out.type = type;
1801 xcb_out.long_offset = long_offset;
1802 xcb_out.long_length = long_length;
1803 xcb_out._delete = _delete;
1804 xcb_out.pending = pending;
1805 memset(xcb_out.pad0, 0, 2);
1806
1807 xcb_parts[2].iov_base = (char *) &xcb_out;
1808 xcb_parts[2].iov_len = sizeof(xcb_out);
1809 xcb_parts[3].iov_base = 0;
1810 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1811
1812 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1813 return xcb_ret;
1814 }
1815
1816 uint8_t *
xcb_randr_get_output_property_data(const xcb_randr_get_output_property_reply_t * R)1817 xcb_randr_get_output_property_data (const xcb_randr_get_output_property_reply_t *R)
1818 {
1819 return (uint8_t *) (R + 1);
1820 }
1821
1822 int
xcb_randr_get_output_property_data_length(const xcb_randr_get_output_property_reply_t * R)1823 xcb_randr_get_output_property_data_length (const xcb_randr_get_output_property_reply_t *R)
1824 {
1825 return (R->num_items * (R->format / 8));
1826 }
1827
1828 xcb_generic_iterator_t
xcb_randr_get_output_property_data_end(const xcb_randr_get_output_property_reply_t * R)1829 xcb_randr_get_output_property_data_end (const xcb_randr_get_output_property_reply_t *R)
1830 {
1831 xcb_generic_iterator_t i;
1832 i.data = ((uint8_t *) (R + 1)) + ((R->num_items * (R->format / 8)));
1833 i.rem = 0;
1834 i.index = (char *) i.data - (char *) R;
1835 return i;
1836 }
1837
1838 xcb_randr_get_output_property_reply_t *
xcb_randr_get_output_property_reply(xcb_connection_t * c,xcb_randr_get_output_property_cookie_t cookie,xcb_generic_error_t ** e)1839 xcb_randr_get_output_property_reply (xcb_connection_t *c,
1840 xcb_randr_get_output_property_cookie_t cookie /**< */,
1841 xcb_generic_error_t **e)
1842 {
1843 return (xcb_randr_get_output_property_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
1844 }
1845
1846 int
xcb_randr_create_mode_sizeof(const void * _buffer,uint32_t name_len)1847 xcb_randr_create_mode_sizeof (const void *_buffer,
1848 uint32_t name_len)
1849 {
1850 char *xcb_tmp = (char *)_buffer;
1851 unsigned int xcb_buffer_len = 0;
1852 unsigned int xcb_block_len = 0;
1853 unsigned int xcb_pad = 0;
1854 unsigned int xcb_align_to = 0;
1855
1856
1857 xcb_block_len += sizeof(xcb_randr_create_mode_request_t);
1858 xcb_tmp += xcb_block_len;
1859 xcb_buffer_len += xcb_block_len;
1860 xcb_block_len = 0;
1861 /* name */
1862 xcb_block_len += name_len * sizeof(char);
1863 xcb_tmp += xcb_block_len;
1864 xcb_align_to = ALIGNOF(char);
1865 /* insert padding */
1866 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
1867 xcb_buffer_len += xcb_block_len + xcb_pad;
1868 if (0 != xcb_pad) {
1869 xcb_tmp += xcb_pad;
1870 xcb_pad = 0;
1871 }
1872 xcb_block_len = 0;
1873
1874 return xcb_buffer_len;
1875 }
1876
1877 xcb_randr_create_mode_cookie_t
xcb_randr_create_mode(xcb_connection_t * c,xcb_window_t window,xcb_randr_mode_info_t mode_info,uint32_t name_len,const char * name)1878 xcb_randr_create_mode (xcb_connection_t *c,
1879 xcb_window_t window,
1880 xcb_randr_mode_info_t mode_info,
1881 uint32_t name_len,
1882 const char *name)
1883 {
1884 static const xcb_protocol_request_t xcb_req = {
1885 .count = 4,
1886 .ext = &xcb_randr_id,
1887 .opcode = XCB_RANDR_CREATE_MODE,
1888 .isvoid = 0
1889 };
1890
1891 struct iovec xcb_parts[6];
1892 xcb_randr_create_mode_cookie_t xcb_ret;
1893 xcb_randr_create_mode_request_t xcb_out;
1894
1895 xcb_out.window = window;
1896 xcb_out.mode_info = mode_info;
1897
1898 xcb_parts[2].iov_base = (char *) &xcb_out;
1899 xcb_parts[2].iov_len = sizeof(xcb_out);
1900 xcb_parts[3].iov_base = 0;
1901 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1902 /* char name */
1903 xcb_parts[4].iov_base = (char *) name;
1904 xcb_parts[4].iov_len = name_len * sizeof(char);
1905 xcb_parts[5].iov_base = 0;
1906 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
1907
1908 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1909 return xcb_ret;
1910 }
1911
1912 xcb_randr_create_mode_cookie_t
xcb_randr_create_mode_unchecked(xcb_connection_t * c,xcb_window_t window,xcb_randr_mode_info_t mode_info,uint32_t name_len,const char * name)1913 xcb_randr_create_mode_unchecked (xcb_connection_t *c,
1914 xcb_window_t window,
1915 xcb_randr_mode_info_t mode_info,
1916 uint32_t name_len,
1917 const char *name)
1918 {
1919 static const xcb_protocol_request_t xcb_req = {
1920 .count = 4,
1921 .ext = &xcb_randr_id,
1922 .opcode = XCB_RANDR_CREATE_MODE,
1923 .isvoid = 0
1924 };
1925
1926 struct iovec xcb_parts[6];
1927 xcb_randr_create_mode_cookie_t xcb_ret;
1928 xcb_randr_create_mode_request_t xcb_out;
1929
1930 xcb_out.window = window;
1931 xcb_out.mode_info = mode_info;
1932
1933 xcb_parts[2].iov_base = (char *) &xcb_out;
1934 xcb_parts[2].iov_len = sizeof(xcb_out);
1935 xcb_parts[3].iov_base = 0;
1936 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1937 /* char name */
1938 xcb_parts[4].iov_base = (char *) name;
1939 xcb_parts[4].iov_len = name_len * sizeof(char);
1940 xcb_parts[5].iov_base = 0;
1941 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
1942
1943 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1944 return xcb_ret;
1945 }
1946
1947 xcb_randr_create_mode_reply_t *
xcb_randr_create_mode_reply(xcb_connection_t * c,xcb_randr_create_mode_cookie_t cookie,xcb_generic_error_t ** e)1948 xcb_randr_create_mode_reply (xcb_connection_t *c,
1949 xcb_randr_create_mode_cookie_t cookie /**< */,
1950 xcb_generic_error_t **e)
1951 {
1952 return (xcb_randr_create_mode_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
1953 }
1954
1955 xcb_void_cookie_t
xcb_randr_destroy_mode_checked(xcb_connection_t * c,xcb_randr_mode_t mode)1956 xcb_randr_destroy_mode_checked (xcb_connection_t *c,
1957 xcb_randr_mode_t mode)
1958 {
1959 static const xcb_protocol_request_t xcb_req = {
1960 .count = 2,
1961 .ext = &xcb_randr_id,
1962 .opcode = XCB_RANDR_DESTROY_MODE,
1963 .isvoid = 1
1964 };
1965
1966 struct iovec xcb_parts[4];
1967 xcb_void_cookie_t xcb_ret;
1968 xcb_randr_destroy_mode_request_t xcb_out;
1969
1970 xcb_out.mode = mode;
1971
1972 xcb_parts[2].iov_base = (char *) &xcb_out;
1973 xcb_parts[2].iov_len = sizeof(xcb_out);
1974 xcb_parts[3].iov_base = 0;
1975 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1976
1977 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1978 return xcb_ret;
1979 }
1980
1981 xcb_void_cookie_t
xcb_randr_destroy_mode(xcb_connection_t * c,xcb_randr_mode_t mode)1982 xcb_randr_destroy_mode (xcb_connection_t *c,
1983 xcb_randr_mode_t mode)
1984 {
1985 static const xcb_protocol_request_t xcb_req = {
1986 .count = 2,
1987 .ext = &xcb_randr_id,
1988 .opcode = XCB_RANDR_DESTROY_MODE,
1989 .isvoid = 1
1990 };
1991
1992 struct iovec xcb_parts[4];
1993 xcb_void_cookie_t xcb_ret;
1994 xcb_randr_destroy_mode_request_t xcb_out;
1995
1996 xcb_out.mode = mode;
1997
1998 xcb_parts[2].iov_base = (char *) &xcb_out;
1999 xcb_parts[2].iov_len = sizeof(xcb_out);
2000 xcb_parts[3].iov_base = 0;
2001 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2002
2003 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2004 return xcb_ret;
2005 }
2006
2007 xcb_void_cookie_t
xcb_randr_add_output_mode_checked(xcb_connection_t * c,xcb_randr_output_t output,xcb_randr_mode_t mode)2008 xcb_randr_add_output_mode_checked (xcb_connection_t *c,
2009 xcb_randr_output_t output,
2010 xcb_randr_mode_t mode)
2011 {
2012 static const xcb_protocol_request_t xcb_req = {
2013 .count = 2,
2014 .ext = &xcb_randr_id,
2015 .opcode = XCB_RANDR_ADD_OUTPUT_MODE,
2016 .isvoid = 1
2017 };
2018
2019 struct iovec xcb_parts[4];
2020 xcb_void_cookie_t xcb_ret;
2021 xcb_randr_add_output_mode_request_t xcb_out;
2022
2023 xcb_out.output = output;
2024 xcb_out.mode = mode;
2025
2026 xcb_parts[2].iov_base = (char *) &xcb_out;
2027 xcb_parts[2].iov_len = sizeof(xcb_out);
2028 xcb_parts[3].iov_base = 0;
2029 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2030
2031 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2032 return xcb_ret;
2033 }
2034
2035 xcb_void_cookie_t
xcb_randr_add_output_mode(xcb_connection_t * c,xcb_randr_output_t output,xcb_randr_mode_t mode)2036 xcb_randr_add_output_mode (xcb_connection_t *c,
2037 xcb_randr_output_t output,
2038 xcb_randr_mode_t mode)
2039 {
2040 static const xcb_protocol_request_t xcb_req = {
2041 .count = 2,
2042 .ext = &xcb_randr_id,
2043 .opcode = XCB_RANDR_ADD_OUTPUT_MODE,
2044 .isvoid = 1
2045 };
2046
2047 struct iovec xcb_parts[4];
2048 xcb_void_cookie_t xcb_ret;
2049 xcb_randr_add_output_mode_request_t xcb_out;
2050
2051 xcb_out.output = output;
2052 xcb_out.mode = mode;
2053
2054 xcb_parts[2].iov_base = (char *) &xcb_out;
2055 xcb_parts[2].iov_len = sizeof(xcb_out);
2056 xcb_parts[3].iov_base = 0;
2057 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2058
2059 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2060 return xcb_ret;
2061 }
2062
2063 xcb_void_cookie_t
xcb_randr_delete_output_mode_checked(xcb_connection_t * c,xcb_randr_output_t output,xcb_randr_mode_t mode)2064 xcb_randr_delete_output_mode_checked (xcb_connection_t *c,
2065 xcb_randr_output_t output,
2066 xcb_randr_mode_t mode)
2067 {
2068 static const xcb_protocol_request_t xcb_req = {
2069 .count = 2,
2070 .ext = &xcb_randr_id,
2071 .opcode = XCB_RANDR_DELETE_OUTPUT_MODE,
2072 .isvoid = 1
2073 };
2074
2075 struct iovec xcb_parts[4];
2076 xcb_void_cookie_t xcb_ret;
2077 xcb_randr_delete_output_mode_request_t xcb_out;
2078
2079 xcb_out.output = output;
2080 xcb_out.mode = mode;
2081
2082 xcb_parts[2].iov_base = (char *) &xcb_out;
2083 xcb_parts[2].iov_len = sizeof(xcb_out);
2084 xcb_parts[3].iov_base = 0;
2085 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2086
2087 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2088 return xcb_ret;
2089 }
2090
2091 xcb_void_cookie_t
xcb_randr_delete_output_mode(xcb_connection_t * c,xcb_randr_output_t output,xcb_randr_mode_t mode)2092 xcb_randr_delete_output_mode (xcb_connection_t *c,
2093 xcb_randr_output_t output,
2094 xcb_randr_mode_t mode)
2095 {
2096 static const xcb_protocol_request_t xcb_req = {
2097 .count = 2,
2098 .ext = &xcb_randr_id,
2099 .opcode = XCB_RANDR_DELETE_OUTPUT_MODE,
2100 .isvoid = 1
2101 };
2102
2103 struct iovec xcb_parts[4];
2104 xcb_void_cookie_t xcb_ret;
2105 xcb_randr_delete_output_mode_request_t xcb_out;
2106
2107 xcb_out.output = output;
2108 xcb_out.mode = mode;
2109
2110 xcb_parts[2].iov_base = (char *) &xcb_out;
2111 xcb_parts[2].iov_len = sizeof(xcb_out);
2112 xcb_parts[3].iov_base = 0;
2113 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2114
2115 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2116 return xcb_ret;
2117 }
2118
2119 int
xcb_randr_get_crtc_info_sizeof(const void * _buffer)2120 xcb_randr_get_crtc_info_sizeof (const void *_buffer)
2121 {
2122 char *xcb_tmp = (char *)_buffer;
2123 const xcb_randr_get_crtc_info_reply_t *_aux = (xcb_randr_get_crtc_info_reply_t *)_buffer;
2124 unsigned int xcb_buffer_len = 0;
2125 unsigned int xcb_block_len = 0;
2126 unsigned int xcb_pad = 0;
2127 unsigned int xcb_align_to = 0;
2128
2129
2130 xcb_block_len += sizeof(xcb_randr_get_crtc_info_reply_t);
2131 xcb_tmp += xcb_block_len;
2132 xcb_buffer_len += xcb_block_len;
2133 xcb_block_len = 0;
2134 /* outputs */
2135 xcb_block_len += _aux->num_outputs * sizeof(xcb_randr_output_t);
2136 xcb_tmp += xcb_block_len;
2137 xcb_align_to = ALIGNOF(xcb_randr_output_t);
2138 /* insert padding */
2139 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
2140 xcb_buffer_len += xcb_block_len + xcb_pad;
2141 if (0 != xcb_pad) {
2142 xcb_tmp += xcb_pad;
2143 xcb_pad = 0;
2144 }
2145 xcb_block_len = 0;
2146 /* possible */
2147 xcb_block_len += _aux->num_possible_outputs * sizeof(xcb_randr_output_t);
2148 xcb_tmp += xcb_block_len;
2149 xcb_align_to = ALIGNOF(xcb_randr_output_t);
2150 /* insert padding */
2151 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
2152 xcb_buffer_len += xcb_block_len + xcb_pad;
2153 if (0 != xcb_pad) {
2154 xcb_tmp += xcb_pad;
2155 xcb_pad = 0;
2156 }
2157 xcb_block_len = 0;
2158
2159 return xcb_buffer_len;
2160 }
2161
2162 xcb_randr_get_crtc_info_cookie_t
xcb_randr_get_crtc_info(xcb_connection_t * c,xcb_randr_crtc_t crtc,xcb_timestamp_t config_timestamp)2163 xcb_randr_get_crtc_info (xcb_connection_t *c,
2164 xcb_randr_crtc_t crtc,
2165 xcb_timestamp_t config_timestamp)
2166 {
2167 static const xcb_protocol_request_t xcb_req = {
2168 .count = 2,
2169 .ext = &xcb_randr_id,
2170 .opcode = XCB_RANDR_GET_CRTC_INFO,
2171 .isvoid = 0
2172 };
2173
2174 struct iovec xcb_parts[4];
2175 xcb_randr_get_crtc_info_cookie_t xcb_ret;
2176 xcb_randr_get_crtc_info_request_t xcb_out;
2177
2178 xcb_out.crtc = crtc;
2179 xcb_out.config_timestamp = config_timestamp;
2180
2181 xcb_parts[2].iov_base = (char *) &xcb_out;
2182 xcb_parts[2].iov_len = sizeof(xcb_out);
2183 xcb_parts[3].iov_base = 0;
2184 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2185
2186 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2187 return xcb_ret;
2188 }
2189
2190 xcb_randr_get_crtc_info_cookie_t
xcb_randr_get_crtc_info_unchecked(xcb_connection_t * c,xcb_randr_crtc_t crtc,xcb_timestamp_t config_timestamp)2191 xcb_randr_get_crtc_info_unchecked (xcb_connection_t *c,
2192 xcb_randr_crtc_t crtc,
2193 xcb_timestamp_t config_timestamp)
2194 {
2195 static const xcb_protocol_request_t xcb_req = {
2196 .count = 2,
2197 .ext = &xcb_randr_id,
2198 .opcode = XCB_RANDR_GET_CRTC_INFO,
2199 .isvoid = 0
2200 };
2201
2202 struct iovec xcb_parts[4];
2203 xcb_randr_get_crtc_info_cookie_t xcb_ret;
2204 xcb_randr_get_crtc_info_request_t xcb_out;
2205
2206 xcb_out.crtc = crtc;
2207 xcb_out.config_timestamp = config_timestamp;
2208
2209 xcb_parts[2].iov_base = (char *) &xcb_out;
2210 xcb_parts[2].iov_len = sizeof(xcb_out);
2211 xcb_parts[3].iov_base = 0;
2212 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2213
2214 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2215 return xcb_ret;
2216 }
2217
2218 xcb_randr_output_t *
xcb_randr_get_crtc_info_outputs(const xcb_randr_get_crtc_info_reply_t * R)2219 xcb_randr_get_crtc_info_outputs (const xcb_randr_get_crtc_info_reply_t *R)
2220 {
2221 return (xcb_randr_output_t *) (R + 1);
2222 }
2223
2224 int
xcb_randr_get_crtc_info_outputs_length(const xcb_randr_get_crtc_info_reply_t * R)2225 xcb_randr_get_crtc_info_outputs_length (const xcb_randr_get_crtc_info_reply_t *R)
2226 {
2227 return R->num_outputs;
2228 }
2229
2230 xcb_generic_iterator_t
xcb_randr_get_crtc_info_outputs_end(const xcb_randr_get_crtc_info_reply_t * R)2231 xcb_randr_get_crtc_info_outputs_end (const xcb_randr_get_crtc_info_reply_t *R)
2232 {
2233 xcb_generic_iterator_t i;
2234 i.data = ((xcb_randr_output_t *) (R + 1)) + (R->num_outputs);
2235 i.rem = 0;
2236 i.index = (char *) i.data - (char *) R;
2237 return i;
2238 }
2239
2240 xcb_randr_output_t *
xcb_randr_get_crtc_info_possible(const xcb_randr_get_crtc_info_reply_t * R)2241 xcb_randr_get_crtc_info_possible (const xcb_randr_get_crtc_info_reply_t *R)
2242 {
2243 xcb_generic_iterator_t prev = xcb_randr_get_crtc_info_outputs_end(R);
2244 return (xcb_randr_output_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_output_t, prev.index) + 0);
2245 }
2246
2247 int
xcb_randr_get_crtc_info_possible_length(const xcb_randr_get_crtc_info_reply_t * R)2248 xcb_randr_get_crtc_info_possible_length (const xcb_randr_get_crtc_info_reply_t *R)
2249 {
2250 return R->num_possible_outputs;
2251 }
2252
2253 xcb_generic_iterator_t
xcb_randr_get_crtc_info_possible_end(const xcb_randr_get_crtc_info_reply_t * R)2254 xcb_randr_get_crtc_info_possible_end (const xcb_randr_get_crtc_info_reply_t *R)
2255 {
2256 xcb_generic_iterator_t i;
2257 xcb_generic_iterator_t prev = xcb_randr_get_crtc_info_outputs_end(R);
2258 i.data = ((xcb_randr_output_t *) ((char*) prev.data + XCB_TYPE_PAD(xcb_randr_output_t, prev.index))) + (R->num_possible_outputs);
2259 i.rem = 0;
2260 i.index = (char *) i.data - (char *) R;
2261 return i;
2262 }
2263
2264 xcb_randr_get_crtc_info_reply_t *
xcb_randr_get_crtc_info_reply(xcb_connection_t * c,xcb_randr_get_crtc_info_cookie_t cookie,xcb_generic_error_t ** e)2265 xcb_randr_get_crtc_info_reply (xcb_connection_t *c,
2266 xcb_randr_get_crtc_info_cookie_t cookie /**< */,
2267 xcb_generic_error_t **e)
2268 {
2269 return (xcb_randr_get_crtc_info_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
2270 }
2271
2272 int
xcb_randr_set_crtc_config_sizeof(const void * _buffer,uint32_t outputs_len)2273 xcb_randr_set_crtc_config_sizeof (const void *_buffer,
2274 uint32_t outputs_len)
2275 {
2276 char *xcb_tmp = (char *)_buffer;
2277 unsigned int xcb_buffer_len = 0;
2278 unsigned int xcb_block_len = 0;
2279 unsigned int xcb_pad = 0;
2280 unsigned int xcb_align_to = 0;
2281
2282
2283 xcb_block_len += sizeof(xcb_randr_set_crtc_config_request_t);
2284 xcb_tmp += xcb_block_len;
2285 xcb_buffer_len += xcb_block_len;
2286 xcb_block_len = 0;
2287 /* outputs */
2288 xcb_block_len += outputs_len * sizeof(xcb_randr_output_t);
2289 xcb_tmp += xcb_block_len;
2290 xcb_align_to = ALIGNOF(xcb_randr_output_t);
2291 /* insert padding */
2292 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
2293 xcb_buffer_len += xcb_block_len + xcb_pad;
2294 if (0 != xcb_pad) {
2295 xcb_tmp += xcb_pad;
2296 xcb_pad = 0;
2297 }
2298 xcb_block_len = 0;
2299
2300 return xcb_buffer_len;
2301 }
2302
2303 xcb_randr_set_crtc_config_cookie_t
xcb_randr_set_crtc_config(xcb_connection_t * c,xcb_randr_crtc_t crtc,xcb_timestamp_t timestamp,xcb_timestamp_t config_timestamp,int16_t x,int16_t y,xcb_randr_mode_t mode,uint16_t rotation,uint32_t outputs_len,const xcb_randr_output_t * outputs)2304 xcb_randr_set_crtc_config (xcb_connection_t *c,
2305 xcb_randr_crtc_t crtc,
2306 xcb_timestamp_t timestamp,
2307 xcb_timestamp_t config_timestamp,
2308 int16_t x,
2309 int16_t y,
2310 xcb_randr_mode_t mode,
2311 uint16_t rotation,
2312 uint32_t outputs_len,
2313 const xcb_randr_output_t *outputs)
2314 {
2315 static const xcb_protocol_request_t xcb_req = {
2316 .count = 4,
2317 .ext = &xcb_randr_id,
2318 .opcode = XCB_RANDR_SET_CRTC_CONFIG,
2319 .isvoid = 0
2320 };
2321
2322 struct iovec xcb_parts[6];
2323 xcb_randr_set_crtc_config_cookie_t xcb_ret;
2324 xcb_randr_set_crtc_config_request_t xcb_out;
2325
2326 xcb_out.crtc = crtc;
2327 xcb_out.timestamp = timestamp;
2328 xcb_out.config_timestamp = config_timestamp;
2329 xcb_out.x = x;
2330 xcb_out.y = y;
2331 xcb_out.mode = mode;
2332 xcb_out.rotation = rotation;
2333 memset(xcb_out.pad0, 0, 2);
2334
2335 xcb_parts[2].iov_base = (char *) &xcb_out;
2336 xcb_parts[2].iov_len = sizeof(xcb_out);
2337 xcb_parts[3].iov_base = 0;
2338 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2339 /* xcb_randr_output_t outputs */
2340 xcb_parts[4].iov_base = (char *) outputs;
2341 xcb_parts[4].iov_len = outputs_len * sizeof(xcb_timestamp_t);
2342 xcb_parts[5].iov_base = 0;
2343 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
2344
2345 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2346 return xcb_ret;
2347 }
2348
2349 xcb_randr_set_crtc_config_cookie_t
xcb_randr_set_crtc_config_unchecked(xcb_connection_t * c,xcb_randr_crtc_t crtc,xcb_timestamp_t timestamp,xcb_timestamp_t config_timestamp,int16_t x,int16_t y,xcb_randr_mode_t mode,uint16_t rotation,uint32_t outputs_len,const xcb_randr_output_t * outputs)2350 xcb_randr_set_crtc_config_unchecked (xcb_connection_t *c,
2351 xcb_randr_crtc_t crtc,
2352 xcb_timestamp_t timestamp,
2353 xcb_timestamp_t config_timestamp,
2354 int16_t x,
2355 int16_t y,
2356 xcb_randr_mode_t mode,
2357 uint16_t rotation,
2358 uint32_t outputs_len,
2359 const xcb_randr_output_t *outputs)
2360 {
2361 static const xcb_protocol_request_t xcb_req = {
2362 .count = 4,
2363 .ext = &xcb_randr_id,
2364 .opcode = XCB_RANDR_SET_CRTC_CONFIG,
2365 .isvoid = 0
2366 };
2367
2368 struct iovec xcb_parts[6];
2369 xcb_randr_set_crtc_config_cookie_t xcb_ret;
2370 xcb_randr_set_crtc_config_request_t xcb_out;
2371
2372 xcb_out.crtc = crtc;
2373 xcb_out.timestamp = timestamp;
2374 xcb_out.config_timestamp = config_timestamp;
2375 xcb_out.x = x;
2376 xcb_out.y = y;
2377 xcb_out.mode = mode;
2378 xcb_out.rotation = rotation;
2379 memset(xcb_out.pad0, 0, 2);
2380
2381 xcb_parts[2].iov_base = (char *) &xcb_out;
2382 xcb_parts[2].iov_len = sizeof(xcb_out);
2383 xcb_parts[3].iov_base = 0;
2384 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2385 /* xcb_randr_output_t outputs */
2386 xcb_parts[4].iov_base = (char *) outputs;
2387 xcb_parts[4].iov_len = outputs_len * sizeof(xcb_timestamp_t);
2388 xcb_parts[5].iov_base = 0;
2389 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
2390
2391 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2392 return xcb_ret;
2393 }
2394
2395 xcb_randr_set_crtc_config_reply_t *
xcb_randr_set_crtc_config_reply(xcb_connection_t * c,xcb_randr_set_crtc_config_cookie_t cookie,xcb_generic_error_t ** e)2396 xcb_randr_set_crtc_config_reply (xcb_connection_t *c,
2397 xcb_randr_set_crtc_config_cookie_t cookie /**< */,
2398 xcb_generic_error_t **e)
2399 {
2400 return (xcb_randr_set_crtc_config_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
2401 }
2402
2403 xcb_randr_get_crtc_gamma_size_cookie_t
xcb_randr_get_crtc_gamma_size(xcb_connection_t * c,xcb_randr_crtc_t crtc)2404 xcb_randr_get_crtc_gamma_size (xcb_connection_t *c,
2405 xcb_randr_crtc_t crtc)
2406 {
2407 static const xcb_protocol_request_t xcb_req = {
2408 .count = 2,
2409 .ext = &xcb_randr_id,
2410 .opcode = XCB_RANDR_GET_CRTC_GAMMA_SIZE,
2411 .isvoid = 0
2412 };
2413
2414 struct iovec xcb_parts[4];
2415 xcb_randr_get_crtc_gamma_size_cookie_t xcb_ret;
2416 xcb_randr_get_crtc_gamma_size_request_t xcb_out;
2417
2418 xcb_out.crtc = crtc;
2419
2420 xcb_parts[2].iov_base = (char *) &xcb_out;
2421 xcb_parts[2].iov_len = sizeof(xcb_out);
2422 xcb_parts[3].iov_base = 0;
2423 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2424
2425 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2426 return xcb_ret;
2427 }
2428
2429 xcb_randr_get_crtc_gamma_size_cookie_t
xcb_randr_get_crtc_gamma_size_unchecked(xcb_connection_t * c,xcb_randr_crtc_t crtc)2430 xcb_randr_get_crtc_gamma_size_unchecked (xcb_connection_t *c,
2431 xcb_randr_crtc_t crtc)
2432 {
2433 static const xcb_protocol_request_t xcb_req = {
2434 .count = 2,
2435 .ext = &xcb_randr_id,
2436 .opcode = XCB_RANDR_GET_CRTC_GAMMA_SIZE,
2437 .isvoid = 0
2438 };
2439
2440 struct iovec xcb_parts[4];
2441 xcb_randr_get_crtc_gamma_size_cookie_t xcb_ret;
2442 xcb_randr_get_crtc_gamma_size_request_t xcb_out;
2443
2444 xcb_out.crtc = crtc;
2445
2446 xcb_parts[2].iov_base = (char *) &xcb_out;
2447 xcb_parts[2].iov_len = sizeof(xcb_out);
2448 xcb_parts[3].iov_base = 0;
2449 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2450
2451 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2452 return xcb_ret;
2453 }
2454
2455 xcb_randr_get_crtc_gamma_size_reply_t *
xcb_randr_get_crtc_gamma_size_reply(xcb_connection_t * c,xcb_randr_get_crtc_gamma_size_cookie_t cookie,xcb_generic_error_t ** e)2456 xcb_randr_get_crtc_gamma_size_reply (xcb_connection_t *c,
2457 xcb_randr_get_crtc_gamma_size_cookie_t cookie /**< */,
2458 xcb_generic_error_t **e)
2459 {
2460 return (xcb_randr_get_crtc_gamma_size_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
2461 }
2462
2463 int
xcb_randr_get_crtc_gamma_sizeof(const void * _buffer)2464 xcb_randr_get_crtc_gamma_sizeof (const void *_buffer)
2465 {
2466 char *xcb_tmp = (char *)_buffer;
2467 const xcb_randr_get_crtc_gamma_reply_t *_aux = (xcb_randr_get_crtc_gamma_reply_t *)_buffer;
2468 unsigned int xcb_buffer_len = 0;
2469 unsigned int xcb_block_len = 0;
2470 unsigned int xcb_pad = 0;
2471 unsigned int xcb_align_to = 0;
2472
2473
2474 xcb_block_len += sizeof(xcb_randr_get_crtc_gamma_reply_t);
2475 xcb_tmp += xcb_block_len;
2476 xcb_buffer_len += xcb_block_len;
2477 xcb_block_len = 0;
2478 /* red */
2479 xcb_block_len += _aux->size * sizeof(uint16_t);
2480 xcb_tmp += xcb_block_len;
2481 xcb_align_to = ALIGNOF(uint16_t);
2482 /* insert padding */
2483 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
2484 xcb_buffer_len += xcb_block_len + xcb_pad;
2485 if (0 != xcb_pad) {
2486 xcb_tmp += xcb_pad;
2487 xcb_pad = 0;
2488 }
2489 xcb_block_len = 0;
2490 /* green */
2491 xcb_block_len += _aux->size * sizeof(uint16_t);
2492 xcb_tmp += xcb_block_len;
2493 xcb_align_to = ALIGNOF(uint16_t);
2494 /* insert padding */
2495 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
2496 xcb_buffer_len += xcb_block_len + xcb_pad;
2497 if (0 != xcb_pad) {
2498 xcb_tmp += xcb_pad;
2499 xcb_pad = 0;
2500 }
2501 xcb_block_len = 0;
2502 /* blue */
2503 xcb_block_len += _aux->size * sizeof(uint16_t);
2504 xcb_tmp += xcb_block_len;
2505 xcb_align_to = ALIGNOF(uint16_t);
2506 /* insert padding */
2507 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
2508 xcb_buffer_len += xcb_block_len + xcb_pad;
2509 if (0 != xcb_pad) {
2510 xcb_tmp += xcb_pad;
2511 xcb_pad = 0;
2512 }
2513 xcb_block_len = 0;
2514
2515 return xcb_buffer_len;
2516 }
2517
2518 xcb_randr_get_crtc_gamma_cookie_t
xcb_randr_get_crtc_gamma(xcb_connection_t * c,xcb_randr_crtc_t crtc)2519 xcb_randr_get_crtc_gamma (xcb_connection_t *c,
2520 xcb_randr_crtc_t crtc)
2521 {
2522 static const xcb_protocol_request_t xcb_req = {
2523 .count = 2,
2524 .ext = &xcb_randr_id,
2525 .opcode = XCB_RANDR_GET_CRTC_GAMMA,
2526 .isvoid = 0
2527 };
2528
2529 struct iovec xcb_parts[4];
2530 xcb_randr_get_crtc_gamma_cookie_t xcb_ret;
2531 xcb_randr_get_crtc_gamma_request_t xcb_out;
2532
2533 xcb_out.crtc = crtc;
2534
2535 xcb_parts[2].iov_base = (char *) &xcb_out;
2536 xcb_parts[2].iov_len = sizeof(xcb_out);
2537 xcb_parts[3].iov_base = 0;
2538 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2539
2540 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2541 return xcb_ret;
2542 }
2543
2544 xcb_randr_get_crtc_gamma_cookie_t
xcb_randr_get_crtc_gamma_unchecked(xcb_connection_t * c,xcb_randr_crtc_t crtc)2545 xcb_randr_get_crtc_gamma_unchecked (xcb_connection_t *c,
2546 xcb_randr_crtc_t crtc)
2547 {
2548 static const xcb_protocol_request_t xcb_req = {
2549 .count = 2,
2550 .ext = &xcb_randr_id,
2551 .opcode = XCB_RANDR_GET_CRTC_GAMMA,
2552 .isvoid = 0
2553 };
2554
2555 struct iovec xcb_parts[4];
2556 xcb_randr_get_crtc_gamma_cookie_t xcb_ret;
2557 xcb_randr_get_crtc_gamma_request_t xcb_out;
2558
2559 xcb_out.crtc = crtc;
2560
2561 xcb_parts[2].iov_base = (char *) &xcb_out;
2562 xcb_parts[2].iov_len = sizeof(xcb_out);
2563 xcb_parts[3].iov_base = 0;
2564 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2565
2566 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2567 return xcb_ret;
2568 }
2569
2570 uint16_t *
xcb_randr_get_crtc_gamma_red(const xcb_randr_get_crtc_gamma_reply_t * R)2571 xcb_randr_get_crtc_gamma_red (const xcb_randr_get_crtc_gamma_reply_t *R)
2572 {
2573 return (uint16_t *) (R + 1);
2574 }
2575
2576 int
xcb_randr_get_crtc_gamma_red_length(const xcb_randr_get_crtc_gamma_reply_t * R)2577 xcb_randr_get_crtc_gamma_red_length (const xcb_randr_get_crtc_gamma_reply_t *R)
2578 {
2579 return R->size;
2580 }
2581
2582 xcb_generic_iterator_t
xcb_randr_get_crtc_gamma_red_end(const xcb_randr_get_crtc_gamma_reply_t * R)2583 xcb_randr_get_crtc_gamma_red_end (const xcb_randr_get_crtc_gamma_reply_t *R)
2584 {
2585 xcb_generic_iterator_t i;
2586 i.data = ((uint16_t *) (R + 1)) + (R->size);
2587 i.rem = 0;
2588 i.index = (char *) i.data - (char *) R;
2589 return i;
2590 }
2591
2592 uint16_t *
xcb_randr_get_crtc_gamma_green(const xcb_randr_get_crtc_gamma_reply_t * R)2593 xcb_randr_get_crtc_gamma_green (const xcb_randr_get_crtc_gamma_reply_t *R)
2594 {
2595 xcb_generic_iterator_t prev = xcb_randr_get_crtc_gamma_red_end(R);
2596 return (uint16_t *) ((char *) prev.data + XCB_TYPE_PAD(uint16_t, prev.index) + 0);
2597 }
2598
2599 int
xcb_randr_get_crtc_gamma_green_length(const xcb_randr_get_crtc_gamma_reply_t * R)2600 xcb_randr_get_crtc_gamma_green_length (const xcb_randr_get_crtc_gamma_reply_t *R)
2601 {
2602 return R->size;
2603 }
2604
2605 xcb_generic_iterator_t
xcb_randr_get_crtc_gamma_green_end(const xcb_randr_get_crtc_gamma_reply_t * R)2606 xcb_randr_get_crtc_gamma_green_end (const xcb_randr_get_crtc_gamma_reply_t *R)
2607 {
2608 xcb_generic_iterator_t i;
2609 xcb_generic_iterator_t prev = xcb_randr_get_crtc_gamma_red_end(R);
2610 i.data = ((uint16_t *) ((char*) prev.data + XCB_TYPE_PAD(uint16_t, prev.index))) + (R->size);
2611 i.rem = 0;
2612 i.index = (char *) i.data - (char *) R;
2613 return i;
2614 }
2615
2616 uint16_t *
xcb_randr_get_crtc_gamma_blue(const xcb_randr_get_crtc_gamma_reply_t * R)2617 xcb_randr_get_crtc_gamma_blue (const xcb_randr_get_crtc_gamma_reply_t *R)
2618 {
2619 xcb_generic_iterator_t prev = xcb_randr_get_crtc_gamma_green_end(R);
2620 return (uint16_t *) ((char *) prev.data + XCB_TYPE_PAD(uint16_t, prev.index) + 0);
2621 }
2622
2623 int
xcb_randr_get_crtc_gamma_blue_length(const xcb_randr_get_crtc_gamma_reply_t * R)2624 xcb_randr_get_crtc_gamma_blue_length (const xcb_randr_get_crtc_gamma_reply_t *R)
2625 {
2626 return R->size;
2627 }
2628
2629 xcb_generic_iterator_t
xcb_randr_get_crtc_gamma_blue_end(const xcb_randr_get_crtc_gamma_reply_t * R)2630 xcb_randr_get_crtc_gamma_blue_end (const xcb_randr_get_crtc_gamma_reply_t *R)
2631 {
2632 xcb_generic_iterator_t i;
2633 xcb_generic_iterator_t prev = xcb_randr_get_crtc_gamma_green_end(R);
2634 i.data = ((uint16_t *) ((char*) prev.data + XCB_TYPE_PAD(uint16_t, prev.index))) + (R->size);
2635 i.rem = 0;
2636 i.index = (char *) i.data - (char *) R;
2637 return i;
2638 }
2639
2640 xcb_randr_get_crtc_gamma_reply_t *
xcb_randr_get_crtc_gamma_reply(xcb_connection_t * c,xcb_randr_get_crtc_gamma_cookie_t cookie,xcb_generic_error_t ** e)2641 xcb_randr_get_crtc_gamma_reply (xcb_connection_t *c,
2642 xcb_randr_get_crtc_gamma_cookie_t cookie /**< */,
2643 xcb_generic_error_t **e)
2644 {
2645 return (xcb_randr_get_crtc_gamma_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
2646 }
2647
2648 int
xcb_randr_set_crtc_gamma_sizeof(const void * _buffer)2649 xcb_randr_set_crtc_gamma_sizeof (const void *_buffer)
2650 {
2651 char *xcb_tmp = (char *)_buffer;
2652 const xcb_randr_set_crtc_gamma_request_t *_aux = (xcb_randr_set_crtc_gamma_request_t *)_buffer;
2653 unsigned int xcb_buffer_len = 0;
2654 unsigned int xcb_block_len = 0;
2655 unsigned int xcb_pad = 0;
2656 unsigned int xcb_align_to = 0;
2657
2658
2659 xcb_block_len += sizeof(xcb_randr_set_crtc_gamma_request_t);
2660 xcb_tmp += xcb_block_len;
2661 xcb_buffer_len += xcb_block_len;
2662 xcb_block_len = 0;
2663 /* red */
2664 xcb_block_len += _aux->size * sizeof(uint16_t);
2665 xcb_tmp += xcb_block_len;
2666 xcb_align_to = ALIGNOF(uint16_t);
2667 /* insert padding */
2668 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
2669 xcb_buffer_len += xcb_block_len + xcb_pad;
2670 if (0 != xcb_pad) {
2671 xcb_tmp += xcb_pad;
2672 xcb_pad = 0;
2673 }
2674 xcb_block_len = 0;
2675 /* green */
2676 xcb_block_len += _aux->size * sizeof(uint16_t);
2677 xcb_tmp += xcb_block_len;
2678 xcb_align_to = ALIGNOF(uint16_t);
2679 /* insert padding */
2680 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
2681 xcb_buffer_len += xcb_block_len + xcb_pad;
2682 if (0 != xcb_pad) {
2683 xcb_tmp += xcb_pad;
2684 xcb_pad = 0;
2685 }
2686 xcb_block_len = 0;
2687 /* blue */
2688 xcb_block_len += _aux->size * sizeof(uint16_t);
2689 xcb_tmp += xcb_block_len;
2690 xcb_align_to = ALIGNOF(uint16_t);
2691 /* insert padding */
2692 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
2693 xcb_buffer_len += xcb_block_len + xcb_pad;
2694 if (0 != xcb_pad) {
2695 xcb_tmp += xcb_pad;
2696 xcb_pad = 0;
2697 }
2698 xcb_block_len = 0;
2699
2700 return xcb_buffer_len;
2701 }
2702
2703 xcb_void_cookie_t
xcb_randr_set_crtc_gamma_checked(xcb_connection_t * c,xcb_randr_crtc_t crtc,uint16_t size,const uint16_t * red,const uint16_t * green,const uint16_t * blue)2704 xcb_randr_set_crtc_gamma_checked (xcb_connection_t *c,
2705 xcb_randr_crtc_t crtc,
2706 uint16_t size,
2707 const uint16_t *red,
2708 const uint16_t *green,
2709 const uint16_t *blue)
2710 {
2711 static const xcb_protocol_request_t xcb_req = {
2712 .count = 8,
2713 .ext = &xcb_randr_id,
2714 .opcode = XCB_RANDR_SET_CRTC_GAMMA,
2715 .isvoid = 1
2716 };
2717
2718 struct iovec xcb_parts[10];
2719 xcb_void_cookie_t xcb_ret;
2720 xcb_randr_set_crtc_gamma_request_t xcb_out;
2721
2722 xcb_out.crtc = crtc;
2723 xcb_out.size = size;
2724 memset(xcb_out.pad0, 0, 2);
2725
2726 xcb_parts[2].iov_base = (char *) &xcb_out;
2727 xcb_parts[2].iov_len = sizeof(xcb_out);
2728 xcb_parts[3].iov_base = 0;
2729 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2730 /* uint16_t red */
2731 xcb_parts[4].iov_base = (char *) red;
2732 xcb_parts[4].iov_len = size * sizeof(uint16_t);
2733 xcb_parts[5].iov_base = 0;
2734 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
2735 /* uint16_t green */
2736 xcb_parts[6].iov_base = (char *) green;
2737 xcb_parts[6].iov_len = size * sizeof(uint16_t);
2738 xcb_parts[7].iov_base = 0;
2739 xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3;
2740 /* uint16_t blue */
2741 xcb_parts[8].iov_base = (char *) blue;
2742 xcb_parts[8].iov_len = size * sizeof(uint16_t);
2743 xcb_parts[9].iov_base = 0;
2744 xcb_parts[9].iov_len = -xcb_parts[8].iov_len & 3;
2745
2746 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2747 return xcb_ret;
2748 }
2749
2750 xcb_void_cookie_t
xcb_randr_set_crtc_gamma(xcb_connection_t * c,xcb_randr_crtc_t crtc,uint16_t size,const uint16_t * red,const uint16_t * green,const uint16_t * blue)2751 xcb_randr_set_crtc_gamma (xcb_connection_t *c,
2752 xcb_randr_crtc_t crtc,
2753 uint16_t size,
2754 const uint16_t *red,
2755 const uint16_t *green,
2756 const uint16_t *blue)
2757 {
2758 static const xcb_protocol_request_t xcb_req = {
2759 .count = 8,
2760 .ext = &xcb_randr_id,
2761 .opcode = XCB_RANDR_SET_CRTC_GAMMA,
2762 .isvoid = 1
2763 };
2764
2765 struct iovec xcb_parts[10];
2766 xcb_void_cookie_t xcb_ret;
2767 xcb_randr_set_crtc_gamma_request_t xcb_out;
2768
2769 xcb_out.crtc = crtc;
2770 xcb_out.size = size;
2771 memset(xcb_out.pad0, 0, 2);
2772
2773 xcb_parts[2].iov_base = (char *) &xcb_out;
2774 xcb_parts[2].iov_len = sizeof(xcb_out);
2775 xcb_parts[3].iov_base = 0;
2776 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2777 /* uint16_t red */
2778 xcb_parts[4].iov_base = (char *) red;
2779 xcb_parts[4].iov_len = size * sizeof(uint16_t);
2780 xcb_parts[5].iov_base = 0;
2781 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
2782 /* uint16_t green */
2783 xcb_parts[6].iov_base = (char *) green;
2784 xcb_parts[6].iov_len = size * sizeof(uint16_t);
2785 xcb_parts[7].iov_base = 0;
2786 xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3;
2787 /* uint16_t blue */
2788 xcb_parts[8].iov_base = (char *) blue;
2789 xcb_parts[8].iov_len = size * sizeof(uint16_t);
2790 xcb_parts[9].iov_base = 0;
2791 xcb_parts[9].iov_len = -xcb_parts[8].iov_len & 3;
2792
2793 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2794 return xcb_ret;
2795 }
2796
2797 uint16_t *
xcb_randr_set_crtc_gamma_red(const xcb_randr_set_crtc_gamma_request_t * R)2798 xcb_randr_set_crtc_gamma_red (const xcb_randr_set_crtc_gamma_request_t *R)
2799 {
2800 return (uint16_t *) (R + 1);
2801 }
2802
2803 int
xcb_randr_set_crtc_gamma_red_length(const xcb_randr_set_crtc_gamma_request_t * R)2804 xcb_randr_set_crtc_gamma_red_length (const xcb_randr_set_crtc_gamma_request_t *R)
2805 {
2806 return R->size;
2807 }
2808
2809 xcb_generic_iterator_t
xcb_randr_set_crtc_gamma_red_end(const xcb_randr_set_crtc_gamma_request_t * R)2810 xcb_randr_set_crtc_gamma_red_end (const xcb_randr_set_crtc_gamma_request_t *R)
2811 {
2812 xcb_generic_iterator_t i;
2813 i.data = ((uint16_t *) (R + 1)) + (R->size);
2814 i.rem = 0;
2815 i.index = (char *) i.data - (char *) R;
2816 return i;
2817 }
2818
2819 uint16_t *
xcb_randr_set_crtc_gamma_green(const xcb_randr_set_crtc_gamma_request_t * R)2820 xcb_randr_set_crtc_gamma_green (const xcb_randr_set_crtc_gamma_request_t *R)
2821 {
2822 xcb_generic_iterator_t prev = xcb_randr_set_crtc_gamma_red_end(R);
2823 return (uint16_t *) ((char *) prev.data + XCB_TYPE_PAD(uint16_t, prev.index) + 0);
2824 }
2825
2826 int
xcb_randr_set_crtc_gamma_green_length(const xcb_randr_set_crtc_gamma_request_t * R)2827 xcb_randr_set_crtc_gamma_green_length (const xcb_randr_set_crtc_gamma_request_t *R)
2828 {
2829 return R->size;
2830 }
2831
2832 xcb_generic_iterator_t
xcb_randr_set_crtc_gamma_green_end(const xcb_randr_set_crtc_gamma_request_t * R)2833 xcb_randr_set_crtc_gamma_green_end (const xcb_randr_set_crtc_gamma_request_t *R)
2834 {
2835 xcb_generic_iterator_t i;
2836 xcb_generic_iterator_t prev = xcb_randr_set_crtc_gamma_red_end(R);
2837 i.data = ((uint16_t *) ((char*) prev.data + XCB_TYPE_PAD(uint16_t, prev.index))) + (R->size);
2838 i.rem = 0;
2839 i.index = (char *) i.data - (char *) R;
2840 return i;
2841 }
2842
2843 uint16_t *
xcb_randr_set_crtc_gamma_blue(const xcb_randr_set_crtc_gamma_request_t * R)2844 xcb_randr_set_crtc_gamma_blue (const xcb_randr_set_crtc_gamma_request_t *R)
2845 {
2846 xcb_generic_iterator_t prev = xcb_randr_set_crtc_gamma_green_end(R);
2847 return (uint16_t *) ((char *) prev.data + XCB_TYPE_PAD(uint16_t, prev.index) + 0);
2848 }
2849
2850 int
xcb_randr_set_crtc_gamma_blue_length(const xcb_randr_set_crtc_gamma_request_t * R)2851 xcb_randr_set_crtc_gamma_blue_length (const xcb_randr_set_crtc_gamma_request_t *R)
2852 {
2853 return R->size;
2854 }
2855
2856 xcb_generic_iterator_t
xcb_randr_set_crtc_gamma_blue_end(const xcb_randr_set_crtc_gamma_request_t * R)2857 xcb_randr_set_crtc_gamma_blue_end (const xcb_randr_set_crtc_gamma_request_t *R)
2858 {
2859 xcb_generic_iterator_t i;
2860 xcb_generic_iterator_t prev = xcb_randr_set_crtc_gamma_green_end(R);
2861 i.data = ((uint16_t *) ((char*) prev.data + XCB_TYPE_PAD(uint16_t, prev.index))) + (R->size);
2862 i.rem = 0;
2863 i.index = (char *) i.data - (char *) R;
2864 return i;
2865 }
2866
2867 int
xcb_randr_get_screen_resources_current_sizeof(const void * _buffer)2868 xcb_randr_get_screen_resources_current_sizeof (const void *_buffer)
2869 {
2870 char *xcb_tmp = (char *)_buffer;
2871 const xcb_randr_get_screen_resources_current_reply_t *_aux = (xcb_randr_get_screen_resources_current_reply_t *)_buffer;
2872 unsigned int xcb_buffer_len = 0;
2873 unsigned int xcb_block_len = 0;
2874 unsigned int xcb_pad = 0;
2875 unsigned int xcb_align_to = 0;
2876
2877
2878 xcb_block_len += sizeof(xcb_randr_get_screen_resources_current_reply_t);
2879 xcb_tmp += xcb_block_len;
2880 xcb_buffer_len += xcb_block_len;
2881 xcb_block_len = 0;
2882 /* crtcs */
2883 xcb_block_len += _aux->num_crtcs * sizeof(uint32_t);
2884 xcb_tmp += xcb_block_len;
2885 xcb_align_to = ALIGNOF(xcb_randr_crtc_t);
2886 /* insert padding */
2887 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
2888 xcb_buffer_len += xcb_block_len + xcb_pad;
2889 if (0 != xcb_pad) {
2890 xcb_tmp += xcb_pad;
2891 xcb_pad = 0;
2892 }
2893 xcb_block_len = 0;
2894 /* outputs */
2895 xcb_block_len += _aux->num_outputs * sizeof(uint32_t);
2896 xcb_tmp += xcb_block_len;
2897 xcb_align_to = ALIGNOF(xcb_randr_output_t);
2898 /* insert padding */
2899 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
2900 xcb_buffer_len += xcb_block_len + xcb_pad;
2901 if (0 != xcb_pad) {
2902 xcb_tmp += xcb_pad;
2903 xcb_pad = 0;
2904 }
2905 xcb_block_len = 0;
2906 /* modes */
2907 xcb_block_len += _aux->num_modes * sizeof(xcb_randr_mode_info_t);
2908 xcb_tmp += xcb_block_len;
2909 xcb_align_to = ALIGNOF(xcb_randr_mode_info_t);
2910 /* insert padding */
2911 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
2912 xcb_buffer_len += xcb_block_len + xcb_pad;
2913 if (0 != xcb_pad) {
2914 xcb_tmp += xcb_pad;
2915 xcb_pad = 0;
2916 }
2917 xcb_block_len = 0;
2918 /* names */
2919 xcb_block_len += _aux->names_len * sizeof(uint8_t);
2920 xcb_tmp += xcb_block_len;
2921 xcb_align_to = ALIGNOF(uint8_t);
2922 /* insert padding */
2923 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
2924 xcb_buffer_len += xcb_block_len + xcb_pad;
2925 if (0 != xcb_pad) {
2926 xcb_tmp += xcb_pad;
2927 xcb_pad = 0;
2928 }
2929 xcb_block_len = 0;
2930
2931 return xcb_buffer_len;
2932 }
2933
2934 xcb_randr_get_screen_resources_current_cookie_t
xcb_randr_get_screen_resources_current(xcb_connection_t * c,xcb_window_t window)2935 xcb_randr_get_screen_resources_current (xcb_connection_t *c,
2936 xcb_window_t window)
2937 {
2938 static const xcb_protocol_request_t xcb_req = {
2939 .count = 2,
2940 .ext = &xcb_randr_id,
2941 .opcode = XCB_RANDR_GET_SCREEN_RESOURCES_CURRENT,
2942 .isvoid = 0
2943 };
2944
2945 struct iovec xcb_parts[4];
2946 xcb_randr_get_screen_resources_current_cookie_t xcb_ret;
2947 xcb_randr_get_screen_resources_current_request_t xcb_out;
2948
2949 xcb_out.window = window;
2950
2951 xcb_parts[2].iov_base = (char *) &xcb_out;
2952 xcb_parts[2].iov_len = sizeof(xcb_out);
2953 xcb_parts[3].iov_base = 0;
2954 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2955
2956 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2957 return xcb_ret;
2958 }
2959
2960 xcb_randr_get_screen_resources_current_cookie_t
xcb_randr_get_screen_resources_current_unchecked(xcb_connection_t * c,xcb_window_t window)2961 xcb_randr_get_screen_resources_current_unchecked (xcb_connection_t *c,
2962 xcb_window_t window)
2963 {
2964 static const xcb_protocol_request_t xcb_req = {
2965 .count = 2,
2966 .ext = &xcb_randr_id,
2967 .opcode = XCB_RANDR_GET_SCREEN_RESOURCES_CURRENT,
2968 .isvoid = 0
2969 };
2970
2971 struct iovec xcb_parts[4];
2972 xcb_randr_get_screen_resources_current_cookie_t xcb_ret;
2973 xcb_randr_get_screen_resources_current_request_t xcb_out;
2974
2975 xcb_out.window = window;
2976
2977 xcb_parts[2].iov_base = (char *) &xcb_out;
2978 xcb_parts[2].iov_len = sizeof(xcb_out);
2979 xcb_parts[3].iov_base = 0;
2980 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2981
2982 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2983 return xcb_ret;
2984 }
2985
2986 xcb_randr_crtc_t *
xcb_randr_get_screen_resources_current_crtcs(const xcb_randr_get_screen_resources_current_reply_t * R)2987 xcb_randr_get_screen_resources_current_crtcs (const xcb_randr_get_screen_resources_current_reply_t *R)
2988 {
2989 return (xcb_randr_crtc_t *) (R + 1);
2990 }
2991
2992 int
xcb_randr_get_screen_resources_current_crtcs_length(const xcb_randr_get_screen_resources_current_reply_t * R)2993 xcb_randr_get_screen_resources_current_crtcs_length (const xcb_randr_get_screen_resources_current_reply_t *R)
2994 {
2995 return R->num_crtcs;
2996 }
2997
2998 xcb_generic_iterator_t
xcb_randr_get_screen_resources_current_crtcs_end(const xcb_randr_get_screen_resources_current_reply_t * R)2999 xcb_randr_get_screen_resources_current_crtcs_end (const xcb_randr_get_screen_resources_current_reply_t *R)
3000 {
3001 xcb_generic_iterator_t i;
3002 i.data = ((xcb_randr_crtc_t *) (R + 1)) + (R->num_crtcs);
3003 i.rem = 0;
3004 i.index = (char *) i.data - (char *) R;
3005 return i;
3006 }
3007
3008 xcb_randr_output_t *
xcb_randr_get_screen_resources_current_outputs(const xcb_randr_get_screen_resources_current_reply_t * R)3009 xcb_randr_get_screen_resources_current_outputs (const xcb_randr_get_screen_resources_current_reply_t *R)
3010 {
3011 xcb_generic_iterator_t prev = xcb_randr_get_screen_resources_current_crtcs_end(R);
3012 return (xcb_randr_output_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_output_t, prev.index) + 0);
3013 }
3014
3015 int
xcb_randr_get_screen_resources_current_outputs_length(const xcb_randr_get_screen_resources_current_reply_t * R)3016 xcb_randr_get_screen_resources_current_outputs_length (const xcb_randr_get_screen_resources_current_reply_t *R)
3017 {
3018 return R->num_outputs;
3019 }
3020
3021 xcb_generic_iterator_t
xcb_randr_get_screen_resources_current_outputs_end(const xcb_randr_get_screen_resources_current_reply_t * R)3022 xcb_randr_get_screen_resources_current_outputs_end (const xcb_randr_get_screen_resources_current_reply_t *R)
3023 {
3024 xcb_generic_iterator_t i;
3025 xcb_generic_iterator_t prev = xcb_randr_get_screen_resources_current_crtcs_end(R);
3026 i.data = ((xcb_randr_output_t *) ((char*) prev.data + XCB_TYPE_PAD(xcb_randr_output_t, prev.index))) + (R->num_outputs);
3027 i.rem = 0;
3028 i.index = (char *) i.data - (char *) R;
3029 return i;
3030 }
3031
3032 xcb_randr_mode_info_t *
xcb_randr_get_screen_resources_current_modes(const xcb_randr_get_screen_resources_current_reply_t * R)3033 xcb_randr_get_screen_resources_current_modes (const xcb_randr_get_screen_resources_current_reply_t *R)
3034 {
3035 xcb_generic_iterator_t prev = xcb_randr_get_screen_resources_current_outputs_end(R);
3036 return (xcb_randr_mode_info_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_mode_info_t, prev.index) + 0);
3037 }
3038
3039 int
xcb_randr_get_screen_resources_current_modes_length(const xcb_randr_get_screen_resources_current_reply_t * R)3040 xcb_randr_get_screen_resources_current_modes_length (const xcb_randr_get_screen_resources_current_reply_t *R)
3041 {
3042 return R->num_modes;
3043 }
3044
3045 xcb_randr_mode_info_iterator_t
xcb_randr_get_screen_resources_current_modes_iterator(const xcb_randr_get_screen_resources_current_reply_t * R)3046 xcb_randr_get_screen_resources_current_modes_iterator (const xcb_randr_get_screen_resources_current_reply_t *R)
3047 {
3048 xcb_randr_mode_info_iterator_t i;
3049 xcb_generic_iterator_t prev = xcb_randr_get_screen_resources_current_outputs_end(R);
3050 i.data = (xcb_randr_mode_info_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_mode_info_t, prev.index));
3051 i.rem = R->num_modes;
3052 i.index = (char *) i.data - (char *) R;
3053 return i;
3054 }
3055
3056 uint8_t *
xcb_randr_get_screen_resources_current_names(const xcb_randr_get_screen_resources_current_reply_t * R)3057 xcb_randr_get_screen_resources_current_names (const xcb_randr_get_screen_resources_current_reply_t *R)
3058 {
3059 xcb_generic_iterator_t prev = xcb_randr_mode_info_end(xcb_randr_get_screen_resources_current_modes_iterator(R));
3060 return (uint8_t *) ((char *) prev.data + XCB_TYPE_PAD(uint8_t, prev.index) + 0);
3061 }
3062
3063 int
xcb_randr_get_screen_resources_current_names_length(const xcb_randr_get_screen_resources_current_reply_t * R)3064 xcb_randr_get_screen_resources_current_names_length (const xcb_randr_get_screen_resources_current_reply_t *R)
3065 {
3066 return R->names_len;
3067 }
3068
3069 xcb_generic_iterator_t
xcb_randr_get_screen_resources_current_names_end(const xcb_randr_get_screen_resources_current_reply_t * R)3070 xcb_randr_get_screen_resources_current_names_end (const xcb_randr_get_screen_resources_current_reply_t *R)
3071 {
3072 xcb_generic_iterator_t i;
3073 xcb_generic_iterator_t prev = xcb_randr_mode_info_end(xcb_randr_get_screen_resources_current_modes_iterator(R));
3074 i.data = ((uint8_t *) ((char*) prev.data + XCB_TYPE_PAD(uint8_t, prev.index))) + (R->names_len);
3075 i.rem = 0;
3076 i.index = (char *) i.data - (char *) R;
3077 return i;
3078 }
3079
3080 xcb_randr_get_screen_resources_current_reply_t *
xcb_randr_get_screen_resources_current_reply(xcb_connection_t * c,xcb_randr_get_screen_resources_current_cookie_t cookie,xcb_generic_error_t ** e)3081 xcb_randr_get_screen_resources_current_reply (xcb_connection_t *c,
3082 xcb_randr_get_screen_resources_current_cookie_t cookie /**< */,
3083 xcb_generic_error_t **e)
3084 {
3085 return (xcb_randr_get_screen_resources_current_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
3086 }
3087
3088 int
xcb_randr_set_crtc_transform_sizeof(const void * _buffer,uint32_t filter_params_len)3089 xcb_randr_set_crtc_transform_sizeof (const void *_buffer,
3090 uint32_t filter_params_len)
3091 {
3092 char *xcb_tmp = (char *)_buffer;
3093 const xcb_randr_set_crtc_transform_request_t *_aux = (xcb_randr_set_crtc_transform_request_t *)_buffer;
3094 unsigned int xcb_buffer_len = 0;
3095 unsigned int xcb_block_len = 0;
3096 unsigned int xcb_pad = 0;
3097 unsigned int xcb_align_to = 0;
3098
3099
3100 xcb_block_len += sizeof(xcb_randr_set_crtc_transform_request_t);
3101 xcb_tmp += xcb_block_len;
3102 xcb_buffer_len += xcb_block_len;
3103 xcb_block_len = 0;
3104 /* filter_name */
3105 xcb_block_len += _aux->filter_len * sizeof(char);
3106 xcb_tmp += xcb_block_len;
3107 xcb_align_to = ALIGNOF(char);
3108 xcb_align_to = 4;
3109 /* insert padding */
3110 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
3111 xcb_buffer_len += xcb_block_len + xcb_pad;
3112 if (0 != xcb_pad) {
3113 xcb_tmp += xcb_pad;
3114 xcb_pad = 0;
3115 }
3116 xcb_block_len = 0;
3117 /* insert padding */
3118 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
3119 xcb_buffer_len += xcb_block_len + xcb_pad;
3120 if (0 != xcb_pad) {
3121 xcb_tmp += xcb_pad;
3122 xcb_pad = 0;
3123 }
3124 xcb_block_len = 0;
3125 /* filter_params */
3126 xcb_block_len += filter_params_len * sizeof(xcb_render_fixed_t);
3127 xcb_tmp += xcb_block_len;
3128 xcb_align_to = ALIGNOF(xcb_render_fixed_t);
3129 /* insert padding */
3130 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
3131 xcb_buffer_len += xcb_block_len + xcb_pad;
3132 if (0 != xcb_pad) {
3133 xcb_tmp += xcb_pad;
3134 xcb_pad = 0;
3135 }
3136 xcb_block_len = 0;
3137
3138 return xcb_buffer_len;
3139 }
3140
3141 xcb_void_cookie_t
xcb_randr_set_crtc_transform_checked(xcb_connection_t * c,xcb_randr_crtc_t crtc,xcb_render_transform_t transform,uint16_t filter_len,const char * filter_name,uint32_t filter_params_len,const xcb_render_fixed_t * filter_params)3142 xcb_randr_set_crtc_transform_checked (xcb_connection_t *c,
3143 xcb_randr_crtc_t crtc,
3144 xcb_render_transform_t transform,
3145 uint16_t filter_len,
3146 const char *filter_name,
3147 uint32_t filter_params_len,
3148 const xcb_render_fixed_t *filter_params)
3149 {
3150 static const xcb_protocol_request_t xcb_req = {
3151 .count = 6,
3152 .ext = &xcb_randr_id,
3153 .opcode = XCB_RANDR_SET_CRTC_TRANSFORM,
3154 .isvoid = 1
3155 };
3156
3157 struct iovec xcb_parts[8];
3158 xcb_void_cookie_t xcb_ret;
3159 xcb_randr_set_crtc_transform_request_t xcb_out;
3160
3161 xcb_out.crtc = crtc;
3162 xcb_out.transform = transform;
3163 xcb_out.filter_len = filter_len;
3164 memset(xcb_out.pad0, 0, 2);
3165
3166 xcb_parts[2].iov_base = (char *) &xcb_out;
3167 xcb_parts[2].iov_len = sizeof(xcb_out);
3168 xcb_parts[3].iov_base = 0;
3169 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3170 /* char filter_name */
3171 xcb_parts[4].iov_base = (char *) filter_name;
3172 xcb_parts[4].iov_len = filter_len * sizeof(char);
3173 xcb_parts[5].iov_base = 0;
3174 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
3175 /* xcb_render_fixed_t filter_params */
3176 xcb_parts[6].iov_base = (char *) filter_params;
3177 xcb_parts[6].iov_len = filter_params_len * sizeof(xcb_render_fixed_t);
3178 xcb_parts[7].iov_base = 0;
3179 xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3;
3180
3181 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
3182 return xcb_ret;
3183 }
3184
3185 xcb_void_cookie_t
xcb_randr_set_crtc_transform(xcb_connection_t * c,xcb_randr_crtc_t crtc,xcb_render_transform_t transform,uint16_t filter_len,const char * filter_name,uint32_t filter_params_len,const xcb_render_fixed_t * filter_params)3186 xcb_randr_set_crtc_transform (xcb_connection_t *c,
3187 xcb_randr_crtc_t crtc,
3188 xcb_render_transform_t transform,
3189 uint16_t filter_len,
3190 const char *filter_name,
3191 uint32_t filter_params_len,
3192 const xcb_render_fixed_t *filter_params)
3193 {
3194 static const xcb_protocol_request_t xcb_req = {
3195 .count = 6,
3196 .ext = &xcb_randr_id,
3197 .opcode = XCB_RANDR_SET_CRTC_TRANSFORM,
3198 .isvoid = 1
3199 };
3200
3201 struct iovec xcb_parts[8];
3202 xcb_void_cookie_t xcb_ret;
3203 xcb_randr_set_crtc_transform_request_t xcb_out;
3204
3205 xcb_out.crtc = crtc;
3206 xcb_out.transform = transform;
3207 xcb_out.filter_len = filter_len;
3208 memset(xcb_out.pad0, 0, 2);
3209
3210 xcb_parts[2].iov_base = (char *) &xcb_out;
3211 xcb_parts[2].iov_len = sizeof(xcb_out);
3212 xcb_parts[3].iov_base = 0;
3213 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3214 /* char filter_name */
3215 xcb_parts[4].iov_base = (char *) filter_name;
3216 xcb_parts[4].iov_len = filter_len * sizeof(char);
3217 xcb_parts[5].iov_base = 0;
3218 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
3219 /* xcb_render_fixed_t filter_params */
3220 xcb_parts[6].iov_base = (char *) filter_params;
3221 xcb_parts[6].iov_len = filter_params_len * sizeof(xcb_render_fixed_t);
3222 xcb_parts[7].iov_base = 0;
3223 xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3;
3224
3225 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
3226 return xcb_ret;
3227 }
3228
3229 char *
xcb_randr_set_crtc_transform_filter_name(const xcb_randr_set_crtc_transform_request_t * R)3230 xcb_randr_set_crtc_transform_filter_name (const xcb_randr_set_crtc_transform_request_t *R)
3231 {
3232 return (char *) (R + 1);
3233 }
3234
3235 int
xcb_randr_set_crtc_transform_filter_name_length(const xcb_randr_set_crtc_transform_request_t * R)3236 xcb_randr_set_crtc_transform_filter_name_length (const xcb_randr_set_crtc_transform_request_t *R)
3237 {
3238 return R->filter_len;
3239 }
3240
3241 xcb_generic_iterator_t
xcb_randr_set_crtc_transform_filter_name_end(const xcb_randr_set_crtc_transform_request_t * R)3242 xcb_randr_set_crtc_transform_filter_name_end (const xcb_randr_set_crtc_transform_request_t *R)
3243 {
3244 xcb_generic_iterator_t i;
3245 i.data = ((char *) (R + 1)) + (R->filter_len);
3246 i.rem = 0;
3247 i.index = (char *) i.data - (char *) R;
3248 return i;
3249 }
3250
3251 xcb_render_fixed_t *
xcb_randr_set_crtc_transform_filter_params(const xcb_randr_set_crtc_transform_request_t * R)3252 xcb_randr_set_crtc_transform_filter_params (const xcb_randr_set_crtc_transform_request_t *R)
3253 {
3254 xcb_generic_iterator_t prev = xcb_randr_set_crtc_transform_filter_name_end(R);
3255 return (xcb_render_fixed_t *) ((char *) prev.data + ((-prev.index) & (4 - 1)) + 0);
3256 }
3257
3258 int
xcb_randr_set_crtc_transform_filter_params_length(const xcb_randr_set_crtc_transform_request_t * R)3259 xcb_randr_set_crtc_transform_filter_params_length (const xcb_randr_set_crtc_transform_request_t *R)
3260 {
3261 return ((((char*)R) + R->length * 4) - (char*)(xcb_randr_set_crtc_transform_filter_params(R))) / sizeof(xcb_render_fixed_t);
3262 }
3263
3264 xcb_generic_iterator_t
xcb_randr_set_crtc_transform_filter_params_end(const xcb_randr_set_crtc_transform_request_t * R)3265 xcb_randr_set_crtc_transform_filter_params_end (const xcb_randr_set_crtc_transform_request_t *R)
3266 {
3267 xcb_generic_iterator_t i;
3268 xcb_generic_iterator_t prev = xcb_randr_set_crtc_transform_filter_name_end(R);
3269 i.data = ((xcb_render_fixed_t *) ((char*) prev.data + ((-prev.index) & (4 - 1)))) + (((((char*)R) + R->length * 4) - (char*)(xcb_randr_set_crtc_transform_filter_params(R))) / sizeof(xcb_render_fixed_t));
3270 i.rem = 0;
3271 i.index = (char *) i.data - (char *) R;
3272 return i;
3273 }
3274
3275 int
xcb_randr_get_crtc_transform_sizeof(const void * _buffer)3276 xcb_randr_get_crtc_transform_sizeof (const void *_buffer)
3277 {
3278 char *xcb_tmp = (char *)_buffer;
3279 const xcb_randr_get_crtc_transform_reply_t *_aux = (xcb_randr_get_crtc_transform_reply_t *)_buffer;
3280 unsigned int xcb_buffer_len = 0;
3281 unsigned int xcb_block_len = 0;
3282 unsigned int xcb_pad = 0;
3283 unsigned int xcb_align_to = 0;
3284
3285
3286 xcb_block_len += sizeof(xcb_randr_get_crtc_transform_reply_t);
3287 xcb_tmp += xcb_block_len;
3288 xcb_buffer_len += xcb_block_len;
3289 xcb_block_len = 0;
3290 /* pending_filter_name */
3291 xcb_block_len += _aux->pending_len * sizeof(char);
3292 xcb_tmp += xcb_block_len;
3293 xcb_align_to = ALIGNOF(char);
3294 xcb_align_to = 4;
3295 /* insert padding */
3296 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
3297 xcb_buffer_len += xcb_block_len + xcb_pad;
3298 if (0 != xcb_pad) {
3299 xcb_tmp += xcb_pad;
3300 xcb_pad = 0;
3301 }
3302 xcb_block_len = 0;
3303 /* insert padding */
3304 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
3305 xcb_buffer_len += xcb_block_len + xcb_pad;
3306 if (0 != xcb_pad) {
3307 xcb_tmp += xcb_pad;
3308 xcb_pad = 0;
3309 }
3310 xcb_block_len = 0;
3311 /* pending_params */
3312 xcb_block_len += _aux->pending_nparams * sizeof(xcb_render_fixed_t);
3313 xcb_tmp += xcb_block_len;
3314 xcb_align_to = ALIGNOF(xcb_render_fixed_t);
3315 /* insert padding */
3316 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
3317 xcb_buffer_len += xcb_block_len + xcb_pad;
3318 if (0 != xcb_pad) {
3319 xcb_tmp += xcb_pad;
3320 xcb_pad = 0;
3321 }
3322 xcb_block_len = 0;
3323 /* current_filter_name */
3324 xcb_block_len += _aux->current_len * sizeof(char);
3325 xcb_tmp += xcb_block_len;
3326 xcb_align_to = ALIGNOF(char);
3327 xcb_align_to = 4;
3328 /* insert padding */
3329 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
3330 xcb_buffer_len += xcb_block_len + xcb_pad;
3331 if (0 != xcb_pad) {
3332 xcb_tmp += xcb_pad;
3333 xcb_pad = 0;
3334 }
3335 xcb_block_len = 0;
3336 /* insert padding */
3337 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
3338 xcb_buffer_len += xcb_block_len + xcb_pad;
3339 if (0 != xcb_pad) {
3340 xcb_tmp += xcb_pad;
3341 xcb_pad = 0;
3342 }
3343 xcb_block_len = 0;
3344 /* current_params */
3345 xcb_block_len += _aux->current_nparams * sizeof(xcb_render_fixed_t);
3346 xcb_tmp += xcb_block_len;
3347 xcb_align_to = ALIGNOF(xcb_render_fixed_t);
3348 /* insert padding */
3349 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
3350 xcb_buffer_len += xcb_block_len + xcb_pad;
3351 if (0 != xcb_pad) {
3352 xcb_tmp += xcb_pad;
3353 xcb_pad = 0;
3354 }
3355 xcb_block_len = 0;
3356
3357 return xcb_buffer_len;
3358 }
3359
3360 xcb_randr_get_crtc_transform_cookie_t
xcb_randr_get_crtc_transform(xcb_connection_t * c,xcb_randr_crtc_t crtc)3361 xcb_randr_get_crtc_transform (xcb_connection_t *c,
3362 xcb_randr_crtc_t crtc)
3363 {
3364 static const xcb_protocol_request_t xcb_req = {
3365 .count = 2,
3366 .ext = &xcb_randr_id,
3367 .opcode = XCB_RANDR_GET_CRTC_TRANSFORM,
3368 .isvoid = 0
3369 };
3370
3371 struct iovec xcb_parts[4];
3372 xcb_randr_get_crtc_transform_cookie_t xcb_ret;
3373 xcb_randr_get_crtc_transform_request_t xcb_out;
3374
3375 xcb_out.crtc = crtc;
3376
3377 xcb_parts[2].iov_base = (char *) &xcb_out;
3378 xcb_parts[2].iov_len = sizeof(xcb_out);
3379 xcb_parts[3].iov_base = 0;
3380 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3381
3382 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
3383 return xcb_ret;
3384 }
3385
3386 xcb_randr_get_crtc_transform_cookie_t
xcb_randr_get_crtc_transform_unchecked(xcb_connection_t * c,xcb_randr_crtc_t crtc)3387 xcb_randr_get_crtc_transform_unchecked (xcb_connection_t *c,
3388 xcb_randr_crtc_t crtc)
3389 {
3390 static const xcb_protocol_request_t xcb_req = {
3391 .count = 2,
3392 .ext = &xcb_randr_id,
3393 .opcode = XCB_RANDR_GET_CRTC_TRANSFORM,
3394 .isvoid = 0
3395 };
3396
3397 struct iovec xcb_parts[4];
3398 xcb_randr_get_crtc_transform_cookie_t xcb_ret;
3399 xcb_randr_get_crtc_transform_request_t xcb_out;
3400
3401 xcb_out.crtc = crtc;
3402
3403 xcb_parts[2].iov_base = (char *) &xcb_out;
3404 xcb_parts[2].iov_len = sizeof(xcb_out);
3405 xcb_parts[3].iov_base = 0;
3406 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3407
3408 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
3409 return xcb_ret;
3410 }
3411
3412 char *
xcb_randr_get_crtc_transform_pending_filter_name(const xcb_randr_get_crtc_transform_reply_t * R)3413 xcb_randr_get_crtc_transform_pending_filter_name (const xcb_randr_get_crtc_transform_reply_t *R)
3414 {
3415 return (char *) (R + 1);
3416 }
3417
3418 int
xcb_randr_get_crtc_transform_pending_filter_name_length(const xcb_randr_get_crtc_transform_reply_t * R)3419 xcb_randr_get_crtc_transform_pending_filter_name_length (const xcb_randr_get_crtc_transform_reply_t *R)
3420 {
3421 return R->pending_len;
3422 }
3423
3424 xcb_generic_iterator_t
xcb_randr_get_crtc_transform_pending_filter_name_end(const xcb_randr_get_crtc_transform_reply_t * R)3425 xcb_randr_get_crtc_transform_pending_filter_name_end (const xcb_randr_get_crtc_transform_reply_t *R)
3426 {
3427 xcb_generic_iterator_t i;
3428 i.data = ((char *) (R + 1)) + (R->pending_len);
3429 i.rem = 0;
3430 i.index = (char *) i.data - (char *) R;
3431 return i;
3432 }
3433
3434 xcb_render_fixed_t *
xcb_randr_get_crtc_transform_pending_params(const xcb_randr_get_crtc_transform_reply_t * R)3435 xcb_randr_get_crtc_transform_pending_params (const xcb_randr_get_crtc_transform_reply_t *R)
3436 {
3437 xcb_generic_iterator_t prev = xcb_randr_get_crtc_transform_pending_filter_name_end(R);
3438 return (xcb_render_fixed_t *) ((char *) prev.data + ((-prev.index) & (4 - 1)) + 0);
3439 }
3440
3441 int
xcb_randr_get_crtc_transform_pending_params_length(const xcb_randr_get_crtc_transform_reply_t * R)3442 xcb_randr_get_crtc_transform_pending_params_length (const xcb_randr_get_crtc_transform_reply_t *R)
3443 {
3444 return R->pending_nparams;
3445 }
3446
3447 xcb_generic_iterator_t
xcb_randr_get_crtc_transform_pending_params_end(const xcb_randr_get_crtc_transform_reply_t * R)3448 xcb_randr_get_crtc_transform_pending_params_end (const xcb_randr_get_crtc_transform_reply_t *R)
3449 {
3450 xcb_generic_iterator_t i;
3451 xcb_generic_iterator_t prev = xcb_randr_get_crtc_transform_pending_filter_name_end(R);
3452 i.data = ((xcb_render_fixed_t *) ((char*) prev.data + ((-prev.index) & (4 - 1)))) + (R->pending_nparams);
3453 i.rem = 0;
3454 i.index = (char *) i.data - (char *) R;
3455 return i;
3456 }
3457
3458 char *
xcb_randr_get_crtc_transform_current_filter_name(const xcb_randr_get_crtc_transform_reply_t * R)3459 xcb_randr_get_crtc_transform_current_filter_name (const xcb_randr_get_crtc_transform_reply_t *R)
3460 {
3461 xcb_generic_iterator_t prev = xcb_randr_get_crtc_transform_pending_params_end(R);
3462 return (char *) ((char *) prev.data + XCB_TYPE_PAD(char, prev.index) + 0);
3463 }
3464
3465 int
xcb_randr_get_crtc_transform_current_filter_name_length(const xcb_randr_get_crtc_transform_reply_t * R)3466 xcb_randr_get_crtc_transform_current_filter_name_length (const xcb_randr_get_crtc_transform_reply_t *R)
3467 {
3468 return R->current_len;
3469 }
3470
3471 xcb_generic_iterator_t
xcb_randr_get_crtc_transform_current_filter_name_end(const xcb_randr_get_crtc_transform_reply_t * R)3472 xcb_randr_get_crtc_transform_current_filter_name_end (const xcb_randr_get_crtc_transform_reply_t *R)
3473 {
3474 xcb_generic_iterator_t i;
3475 xcb_generic_iterator_t prev = xcb_randr_get_crtc_transform_pending_params_end(R);
3476 i.data = ((char *) ((char*) prev.data + XCB_TYPE_PAD(char, prev.index))) + (R->current_len);
3477 i.rem = 0;
3478 i.index = (char *) i.data - (char *) R;
3479 return i;
3480 }
3481
3482 xcb_render_fixed_t *
xcb_randr_get_crtc_transform_current_params(const xcb_randr_get_crtc_transform_reply_t * R)3483 xcb_randr_get_crtc_transform_current_params (const xcb_randr_get_crtc_transform_reply_t *R)
3484 {
3485 xcb_generic_iterator_t prev = xcb_randr_get_crtc_transform_current_filter_name_end(R);
3486 return (xcb_render_fixed_t *) ((char *) prev.data + ((-prev.index) & (4 - 1)) + 0);
3487 }
3488
3489 int
xcb_randr_get_crtc_transform_current_params_length(const xcb_randr_get_crtc_transform_reply_t * R)3490 xcb_randr_get_crtc_transform_current_params_length (const xcb_randr_get_crtc_transform_reply_t *R)
3491 {
3492 return R->current_nparams;
3493 }
3494
3495 xcb_generic_iterator_t
xcb_randr_get_crtc_transform_current_params_end(const xcb_randr_get_crtc_transform_reply_t * R)3496 xcb_randr_get_crtc_transform_current_params_end (const xcb_randr_get_crtc_transform_reply_t *R)
3497 {
3498 xcb_generic_iterator_t i;
3499 xcb_generic_iterator_t prev = xcb_randr_get_crtc_transform_current_filter_name_end(R);
3500 i.data = ((xcb_render_fixed_t *) ((char*) prev.data + ((-prev.index) & (4 - 1)))) + (R->current_nparams);
3501 i.rem = 0;
3502 i.index = (char *) i.data - (char *) R;
3503 return i;
3504 }
3505
3506 xcb_randr_get_crtc_transform_reply_t *
xcb_randr_get_crtc_transform_reply(xcb_connection_t * c,xcb_randr_get_crtc_transform_cookie_t cookie,xcb_generic_error_t ** e)3507 xcb_randr_get_crtc_transform_reply (xcb_connection_t *c,
3508 xcb_randr_get_crtc_transform_cookie_t cookie /**< */,
3509 xcb_generic_error_t **e)
3510 {
3511 return (xcb_randr_get_crtc_transform_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
3512 }
3513
3514 xcb_randr_get_panning_cookie_t
xcb_randr_get_panning(xcb_connection_t * c,xcb_randr_crtc_t crtc)3515 xcb_randr_get_panning (xcb_connection_t *c,
3516 xcb_randr_crtc_t crtc)
3517 {
3518 static const xcb_protocol_request_t xcb_req = {
3519 .count = 2,
3520 .ext = &xcb_randr_id,
3521 .opcode = XCB_RANDR_GET_PANNING,
3522 .isvoid = 0
3523 };
3524
3525 struct iovec xcb_parts[4];
3526 xcb_randr_get_panning_cookie_t xcb_ret;
3527 xcb_randr_get_panning_request_t xcb_out;
3528
3529 xcb_out.crtc = crtc;
3530
3531 xcb_parts[2].iov_base = (char *) &xcb_out;
3532 xcb_parts[2].iov_len = sizeof(xcb_out);
3533 xcb_parts[3].iov_base = 0;
3534 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3535
3536 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
3537 return xcb_ret;
3538 }
3539
3540 xcb_randr_get_panning_cookie_t
xcb_randr_get_panning_unchecked(xcb_connection_t * c,xcb_randr_crtc_t crtc)3541 xcb_randr_get_panning_unchecked (xcb_connection_t *c,
3542 xcb_randr_crtc_t crtc)
3543 {
3544 static const xcb_protocol_request_t xcb_req = {
3545 .count = 2,
3546 .ext = &xcb_randr_id,
3547 .opcode = XCB_RANDR_GET_PANNING,
3548 .isvoid = 0
3549 };
3550
3551 struct iovec xcb_parts[4];
3552 xcb_randr_get_panning_cookie_t xcb_ret;
3553 xcb_randr_get_panning_request_t xcb_out;
3554
3555 xcb_out.crtc = crtc;
3556
3557 xcb_parts[2].iov_base = (char *) &xcb_out;
3558 xcb_parts[2].iov_len = sizeof(xcb_out);
3559 xcb_parts[3].iov_base = 0;
3560 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3561
3562 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
3563 return xcb_ret;
3564 }
3565
3566 xcb_randr_get_panning_reply_t *
xcb_randr_get_panning_reply(xcb_connection_t * c,xcb_randr_get_panning_cookie_t cookie,xcb_generic_error_t ** e)3567 xcb_randr_get_panning_reply (xcb_connection_t *c,
3568 xcb_randr_get_panning_cookie_t cookie /**< */,
3569 xcb_generic_error_t **e)
3570 {
3571 return (xcb_randr_get_panning_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
3572 }
3573
3574 xcb_randr_set_panning_cookie_t
xcb_randr_set_panning(xcb_connection_t * c,xcb_randr_crtc_t crtc,xcb_timestamp_t timestamp,uint16_t left,uint16_t top,uint16_t width,uint16_t height,uint16_t track_left,uint16_t track_top,uint16_t track_width,uint16_t track_height,int16_t border_left,int16_t border_top,int16_t border_right,int16_t border_bottom)3575 xcb_randr_set_panning (xcb_connection_t *c,
3576 xcb_randr_crtc_t crtc,
3577 xcb_timestamp_t timestamp,
3578 uint16_t left,
3579 uint16_t top,
3580 uint16_t width,
3581 uint16_t height,
3582 uint16_t track_left,
3583 uint16_t track_top,
3584 uint16_t track_width,
3585 uint16_t track_height,
3586 int16_t border_left,
3587 int16_t border_top,
3588 int16_t border_right,
3589 int16_t border_bottom)
3590 {
3591 static const xcb_protocol_request_t xcb_req = {
3592 .count = 2,
3593 .ext = &xcb_randr_id,
3594 .opcode = XCB_RANDR_SET_PANNING,
3595 .isvoid = 0
3596 };
3597
3598 struct iovec xcb_parts[4];
3599 xcb_randr_set_panning_cookie_t xcb_ret;
3600 xcb_randr_set_panning_request_t xcb_out;
3601
3602 xcb_out.crtc = crtc;
3603 xcb_out.timestamp = timestamp;
3604 xcb_out.left = left;
3605 xcb_out.top = top;
3606 xcb_out.width = width;
3607 xcb_out.height = height;
3608 xcb_out.track_left = track_left;
3609 xcb_out.track_top = track_top;
3610 xcb_out.track_width = track_width;
3611 xcb_out.track_height = track_height;
3612 xcb_out.border_left = border_left;
3613 xcb_out.border_top = border_top;
3614 xcb_out.border_right = border_right;
3615 xcb_out.border_bottom = border_bottom;
3616
3617 xcb_parts[2].iov_base = (char *) &xcb_out;
3618 xcb_parts[2].iov_len = sizeof(xcb_out);
3619 xcb_parts[3].iov_base = 0;
3620 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3621
3622 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
3623 return xcb_ret;
3624 }
3625
3626 xcb_randr_set_panning_cookie_t
xcb_randr_set_panning_unchecked(xcb_connection_t * c,xcb_randr_crtc_t crtc,xcb_timestamp_t timestamp,uint16_t left,uint16_t top,uint16_t width,uint16_t height,uint16_t track_left,uint16_t track_top,uint16_t track_width,uint16_t track_height,int16_t border_left,int16_t border_top,int16_t border_right,int16_t border_bottom)3627 xcb_randr_set_panning_unchecked (xcb_connection_t *c,
3628 xcb_randr_crtc_t crtc,
3629 xcb_timestamp_t timestamp,
3630 uint16_t left,
3631 uint16_t top,
3632 uint16_t width,
3633 uint16_t height,
3634 uint16_t track_left,
3635 uint16_t track_top,
3636 uint16_t track_width,
3637 uint16_t track_height,
3638 int16_t border_left,
3639 int16_t border_top,
3640 int16_t border_right,
3641 int16_t border_bottom)
3642 {
3643 static const xcb_protocol_request_t xcb_req = {
3644 .count = 2,
3645 .ext = &xcb_randr_id,
3646 .opcode = XCB_RANDR_SET_PANNING,
3647 .isvoid = 0
3648 };
3649
3650 struct iovec xcb_parts[4];
3651 xcb_randr_set_panning_cookie_t xcb_ret;
3652 xcb_randr_set_panning_request_t xcb_out;
3653
3654 xcb_out.crtc = crtc;
3655 xcb_out.timestamp = timestamp;
3656 xcb_out.left = left;
3657 xcb_out.top = top;
3658 xcb_out.width = width;
3659 xcb_out.height = height;
3660 xcb_out.track_left = track_left;
3661 xcb_out.track_top = track_top;
3662 xcb_out.track_width = track_width;
3663 xcb_out.track_height = track_height;
3664 xcb_out.border_left = border_left;
3665 xcb_out.border_top = border_top;
3666 xcb_out.border_right = border_right;
3667 xcb_out.border_bottom = border_bottom;
3668
3669 xcb_parts[2].iov_base = (char *) &xcb_out;
3670 xcb_parts[2].iov_len = sizeof(xcb_out);
3671 xcb_parts[3].iov_base = 0;
3672 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3673
3674 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
3675 return xcb_ret;
3676 }
3677
3678 xcb_randr_set_panning_reply_t *
xcb_randr_set_panning_reply(xcb_connection_t * c,xcb_randr_set_panning_cookie_t cookie,xcb_generic_error_t ** e)3679 xcb_randr_set_panning_reply (xcb_connection_t *c,
3680 xcb_randr_set_panning_cookie_t cookie /**< */,
3681 xcb_generic_error_t **e)
3682 {
3683 return (xcb_randr_set_panning_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
3684 }
3685
3686 xcb_void_cookie_t
xcb_randr_set_output_primary_checked(xcb_connection_t * c,xcb_window_t window,xcb_randr_output_t output)3687 xcb_randr_set_output_primary_checked (xcb_connection_t *c,
3688 xcb_window_t window,
3689 xcb_randr_output_t output)
3690 {
3691 static const xcb_protocol_request_t xcb_req = {
3692 .count = 2,
3693 .ext = &xcb_randr_id,
3694 .opcode = XCB_RANDR_SET_OUTPUT_PRIMARY,
3695 .isvoid = 1
3696 };
3697
3698 struct iovec xcb_parts[4];
3699 xcb_void_cookie_t xcb_ret;
3700 xcb_randr_set_output_primary_request_t xcb_out;
3701
3702 xcb_out.window = window;
3703 xcb_out.output = output;
3704
3705 xcb_parts[2].iov_base = (char *) &xcb_out;
3706 xcb_parts[2].iov_len = sizeof(xcb_out);
3707 xcb_parts[3].iov_base = 0;
3708 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3709
3710 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
3711 return xcb_ret;
3712 }
3713
3714 xcb_void_cookie_t
xcb_randr_set_output_primary(xcb_connection_t * c,xcb_window_t window,xcb_randr_output_t output)3715 xcb_randr_set_output_primary (xcb_connection_t *c,
3716 xcb_window_t window,
3717 xcb_randr_output_t output)
3718 {
3719 static const xcb_protocol_request_t xcb_req = {
3720 .count = 2,
3721 .ext = &xcb_randr_id,
3722 .opcode = XCB_RANDR_SET_OUTPUT_PRIMARY,
3723 .isvoid = 1
3724 };
3725
3726 struct iovec xcb_parts[4];
3727 xcb_void_cookie_t xcb_ret;
3728 xcb_randr_set_output_primary_request_t xcb_out;
3729
3730 xcb_out.window = window;
3731 xcb_out.output = output;
3732
3733 xcb_parts[2].iov_base = (char *) &xcb_out;
3734 xcb_parts[2].iov_len = sizeof(xcb_out);
3735 xcb_parts[3].iov_base = 0;
3736 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3737
3738 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
3739 return xcb_ret;
3740 }
3741
3742 xcb_randr_get_output_primary_cookie_t
xcb_randr_get_output_primary(xcb_connection_t * c,xcb_window_t window)3743 xcb_randr_get_output_primary (xcb_connection_t *c,
3744 xcb_window_t window)
3745 {
3746 static const xcb_protocol_request_t xcb_req = {
3747 .count = 2,
3748 .ext = &xcb_randr_id,
3749 .opcode = XCB_RANDR_GET_OUTPUT_PRIMARY,
3750 .isvoid = 0
3751 };
3752
3753 struct iovec xcb_parts[4];
3754 xcb_randr_get_output_primary_cookie_t xcb_ret;
3755 xcb_randr_get_output_primary_request_t xcb_out;
3756
3757 xcb_out.window = window;
3758
3759 xcb_parts[2].iov_base = (char *) &xcb_out;
3760 xcb_parts[2].iov_len = sizeof(xcb_out);
3761 xcb_parts[3].iov_base = 0;
3762 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3763
3764 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
3765 return xcb_ret;
3766 }
3767
3768 xcb_randr_get_output_primary_cookie_t
xcb_randr_get_output_primary_unchecked(xcb_connection_t * c,xcb_window_t window)3769 xcb_randr_get_output_primary_unchecked (xcb_connection_t *c,
3770 xcb_window_t window)
3771 {
3772 static const xcb_protocol_request_t xcb_req = {
3773 .count = 2,
3774 .ext = &xcb_randr_id,
3775 .opcode = XCB_RANDR_GET_OUTPUT_PRIMARY,
3776 .isvoid = 0
3777 };
3778
3779 struct iovec xcb_parts[4];
3780 xcb_randr_get_output_primary_cookie_t xcb_ret;
3781 xcb_randr_get_output_primary_request_t xcb_out;
3782
3783 xcb_out.window = window;
3784
3785 xcb_parts[2].iov_base = (char *) &xcb_out;
3786 xcb_parts[2].iov_len = sizeof(xcb_out);
3787 xcb_parts[3].iov_base = 0;
3788 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3789
3790 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
3791 return xcb_ret;
3792 }
3793
3794 xcb_randr_get_output_primary_reply_t *
xcb_randr_get_output_primary_reply(xcb_connection_t * c,xcb_randr_get_output_primary_cookie_t cookie,xcb_generic_error_t ** e)3795 xcb_randr_get_output_primary_reply (xcb_connection_t *c,
3796 xcb_randr_get_output_primary_cookie_t cookie /**< */,
3797 xcb_generic_error_t **e)
3798 {
3799 return (xcb_randr_get_output_primary_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
3800 }
3801
3802 int
xcb_randr_get_providers_sizeof(const void * _buffer)3803 xcb_randr_get_providers_sizeof (const void *_buffer)
3804 {
3805 char *xcb_tmp = (char *)_buffer;
3806 const xcb_randr_get_providers_reply_t *_aux = (xcb_randr_get_providers_reply_t *)_buffer;
3807 unsigned int xcb_buffer_len = 0;
3808 unsigned int xcb_block_len = 0;
3809 unsigned int xcb_pad = 0;
3810 unsigned int xcb_align_to = 0;
3811
3812
3813 xcb_block_len += sizeof(xcb_randr_get_providers_reply_t);
3814 xcb_tmp += xcb_block_len;
3815 xcb_buffer_len += xcb_block_len;
3816 xcb_block_len = 0;
3817 /* providers */
3818 xcb_block_len += _aux->num_providers * sizeof(xcb_randr_provider_t);
3819 xcb_tmp += xcb_block_len;
3820 xcb_align_to = ALIGNOF(xcb_randr_provider_t);
3821 /* insert padding */
3822 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
3823 xcb_buffer_len += xcb_block_len + xcb_pad;
3824 if (0 != xcb_pad) {
3825 xcb_tmp += xcb_pad;
3826 xcb_pad = 0;
3827 }
3828 xcb_block_len = 0;
3829
3830 return xcb_buffer_len;
3831 }
3832
3833 xcb_randr_get_providers_cookie_t
xcb_randr_get_providers(xcb_connection_t * c,xcb_window_t window)3834 xcb_randr_get_providers (xcb_connection_t *c,
3835 xcb_window_t window)
3836 {
3837 static const xcb_protocol_request_t xcb_req = {
3838 .count = 2,
3839 .ext = &xcb_randr_id,
3840 .opcode = XCB_RANDR_GET_PROVIDERS,
3841 .isvoid = 0
3842 };
3843
3844 struct iovec xcb_parts[4];
3845 xcb_randr_get_providers_cookie_t xcb_ret;
3846 xcb_randr_get_providers_request_t xcb_out;
3847
3848 xcb_out.window = window;
3849
3850 xcb_parts[2].iov_base = (char *) &xcb_out;
3851 xcb_parts[2].iov_len = sizeof(xcb_out);
3852 xcb_parts[3].iov_base = 0;
3853 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3854
3855 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
3856 return xcb_ret;
3857 }
3858
3859 xcb_randr_get_providers_cookie_t
xcb_randr_get_providers_unchecked(xcb_connection_t * c,xcb_window_t window)3860 xcb_randr_get_providers_unchecked (xcb_connection_t *c,
3861 xcb_window_t window)
3862 {
3863 static const xcb_protocol_request_t xcb_req = {
3864 .count = 2,
3865 .ext = &xcb_randr_id,
3866 .opcode = XCB_RANDR_GET_PROVIDERS,
3867 .isvoid = 0
3868 };
3869
3870 struct iovec xcb_parts[4];
3871 xcb_randr_get_providers_cookie_t xcb_ret;
3872 xcb_randr_get_providers_request_t xcb_out;
3873
3874 xcb_out.window = window;
3875
3876 xcb_parts[2].iov_base = (char *) &xcb_out;
3877 xcb_parts[2].iov_len = sizeof(xcb_out);
3878 xcb_parts[3].iov_base = 0;
3879 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3880
3881 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
3882 return xcb_ret;
3883 }
3884
3885 xcb_randr_provider_t *
xcb_randr_get_providers_providers(const xcb_randr_get_providers_reply_t * R)3886 xcb_randr_get_providers_providers (const xcb_randr_get_providers_reply_t *R)
3887 {
3888 return (xcb_randr_provider_t *) (R + 1);
3889 }
3890
3891 int
xcb_randr_get_providers_providers_length(const xcb_randr_get_providers_reply_t * R)3892 xcb_randr_get_providers_providers_length (const xcb_randr_get_providers_reply_t *R)
3893 {
3894 return R->num_providers;
3895 }
3896
3897 xcb_generic_iterator_t
xcb_randr_get_providers_providers_end(const xcb_randr_get_providers_reply_t * R)3898 xcb_randr_get_providers_providers_end (const xcb_randr_get_providers_reply_t *R)
3899 {
3900 xcb_generic_iterator_t i;
3901 i.data = ((xcb_randr_provider_t *) (R + 1)) + (R->num_providers);
3902 i.rem = 0;
3903 i.index = (char *) i.data - (char *) R;
3904 return i;
3905 }
3906
3907 xcb_randr_get_providers_reply_t *
xcb_randr_get_providers_reply(xcb_connection_t * c,xcb_randr_get_providers_cookie_t cookie,xcb_generic_error_t ** e)3908 xcb_randr_get_providers_reply (xcb_connection_t *c,
3909 xcb_randr_get_providers_cookie_t cookie /**< */,
3910 xcb_generic_error_t **e)
3911 {
3912 return (xcb_randr_get_providers_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
3913 }
3914
3915 int
xcb_randr_get_provider_info_sizeof(const void * _buffer)3916 xcb_randr_get_provider_info_sizeof (const void *_buffer)
3917 {
3918 char *xcb_tmp = (char *)_buffer;
3919 const xcb_randr_get_provider_info_reply_t *_aux = (xcb_randr_get_provider_info_reply_t *)_buffer;
3920 unsigned int xcb_buffer_len = 0;
3921 unsigned int xcb_block_len = 0;
3922 unsigned int xcb_pad = 0;
3923 unsigned int xcb_align_to = 0;
3924
3925
3926 xcb_block_len += sizeof(xcb_randr_get_provider_info_reply_t);
3927 xcb_tmp += xcb_block_len;
3928 xcb_buffer_len += xcb_block_len;
3929 xcb_block_len = 0;
3930 /* crtcs */
3931 xcb_block_len += _aux->num_crtcs * sizeof(uint32_t);
3932 xcb_tmp += xcb_block_len;
3933 xcb_align_to = ALIGNOF(xcb_randr_crtc_t);
3934 /* insert padding */
3935 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
3936 xcb_buffer_len += xcb_block_len + xcb_pad;
3937 if (0 != xcb_pad) {
3938 xcb_tmp += xcb_pad;
3939 xcb_pad = 0;
3940 }
3941 xcb_block_len = 0;
3942 /* outputs */
3943 xcb_block_len += _aux->num_outputs * sizeof(uint32_t);
3944 xcb_tmp += xcb_block_len;
3945 xcb_align_to = ALIGNOF(xcb_randr_output_t);
3946 /* insert padding */
3947 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
3948 xcb_buffer_len += xcb_block_len + xcb_pad;
3949 if (0 != xcb_pad) {
3950 xcb_tmp += xcb_pad;
3951 xcb_pad = 0;
3952 }
3953 xcb_block_len = 0;
3954 /* associated_providers */
3955 xcb_block_len += _aux->num_associated_providers * sizeof(uint32_t);
3956 xcb_tmp += xcb_block_len;
3957 xcb_align_to = ALIGNOF(xcb_randr_provider_t);
3958 /* insert padding */
3959 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
3960 xcb_buffer_len += xcb_block_len + xcb_pad;
3961 if (0 != xcb_pad) {
3962 xcb_tmp += xcb_pad;
3963 xcb_pad = 0;
3964 }
3965 xcb_block_len = 0;
3966 /* associated_capability */
3967 xcb_block_len += _aux->num_associated_providers * sizeof(uint32_t);
3968 xcb_tmp += xcb_block_len;
3969 xcb_align_to = ALIGNOF(uint32_t);
3970 /* insert padding */
3971 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
3972 xcb_buffer_len += xcb_block_len + xcb_pad;
3973 if (0 != xcb_pad) {
3974 xcb_tmp += xcb_pad;
3975 xcb_pad = 0;
3976 }
3977 xcb_block_len = 0;
3978 /* name */
3979 xcb_block_len += _aux->name_len * sizeof(char);
3980 xcb_tmp += xcb_block_len;
3981 xcb_align_to = ALIGNOF(char);
3982 /* insert padding */
3983 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
3984 xcb_buffer_len += xcb_block_len + xcb_pad;
3985 if (0 != xcb_pad) {
3986 xcb_tmp += xcb_pad;
3987 xcb_pad = 0;
3988 }
3989 xcb_block_len = 0;
3990
3991 return xcb_buffer_len;
3992 }
3993
3994 xcb_randr_get_provider_info_cookie_t
xcb_randr_get_provider_info(xcb_connection_t * c,xcb_randr_provider_t provider,xcb_timestamp_t config_timestamp)3995 xcb_randr_get_provider_info (xcb_connection_t *c,
3996 xcb_randr_provider_t provider,
3997 xcb_timestamp_t config_timestamp)
3998 {
3999 static const xcb_protocol_request_t xcb_req = {
4000 .count = 2,
4001 .ext = &xcb_randr_id,
4002 .opcode = XCB_RANDR_GET_PROVIDER_INFO,
4003 .isvoid = 0
4004 };
4005
4006 struct iovec xcb_parts[4];
4007 xcb_randr_get_provider_info_cookie_t xcb_ret;
4008 xcb_randr_get_provider_info_request_t xcb_out;
4009
4010 xcb_out.provider = provider;
4011 xcb_out.config_timestamp = config_timestamp;
4012
4013 xcb_parts[2].iov_base = (char *) &xcb_out;
4014 xcb_parts[2].iov_len = sizeof(xcb_out);
4015 xcb_parts[3].iov_base = 0;
4016 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4017
4018 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
4019 return xcb_ret;
4020 }
4021
4022 xcb_randr_get_provider_info_cookie_t
xcb_randr_get_provider_info_unchecked(xcb_connection_t * c,xcb_randr_provider_t provider,xcb_timestamp_t config_timestamp)4023 xcb_randr_get_provider_info_unchecked (xcb_connection_t *c,
4024 xcb_randr_provider_t provider,
4025 xcb_timestamp_t config_timestamp)
4026 {
4027 static const xcb_protocol_request_t xcb_req = {
4028 .count = 2,
4029 .ext = &xcb_randr_id,
4030 .opcode = XCB_RANDR_GET_PROVIDER_INFO,
4031 .isvoid = 0
4032 };
4033
4034 struct iovec xcb_parts[4];
4035 xcb_randr_get_provider_info_cookie_t xcb_ret;
4036 xcb_randr_get_provider_info_request_t xcb_out;
4037
4038 xcb_out.provider = provider;
4039 xcb_out.config_timestamp = config_timestamp;
4040
4041 xcb_parts[2].iov_base = (char *) &xcb_out;
4042 xcb_parts[2].iov_len = sizeof(xcb_out);
4043 xcb_parts[3].iov_base = 0;
4044 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4045
4046 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
4047 return xcb_ret;
4048 }
4049
4050 xcb_randr_crtc_t *
xcb_randr_get_provider_info_crtcs(const xcb_randr_get_provider_info_reply_t * R)4051 xcb_randr_get_provider_info_crtcs (const xcb_randr_get_provider_info_reply_t *R)
4052 {
4053 return (xcb_randr_crtc_t *) (R + 1);
4054 }
4055
4056 int
xcb_randr_get_provider_info_crtcs_length(const xcb_randr_get_provider_info_reply_t * R)4057 xcb_randr_get_provider_info_crtcs_length (const xcb_randr_get_provider_info_reply_t *R)
4058 {
4059 return R->num_crtcs;
4060 }
4061
4062 xcb_generic_iterator_t
xcb_randr_get_provider_info_crtcs_end(const xcb_randr_get_provider_info_reply_t * R)4063 xcb_randr_get_provider_info_crtcs_end (const xcb_randr_get_provider_info_reply_t *R)
4064 {
4065 xcb_generic_iterator_t i;
4066 i.data = ((xcb_randr_crtc_t *) (R + 1)) + (R->num_crtcs);
4067 i.rem = 0;
4068 i.index = (char *) i.data - (char *) R;
4069 return i;
4070 }
4071
4072 xcb_randr_output_t *
xcb_randr_get_provider_info_outputs(const xcb_randr_get_provider_info_reply_t * R)4073 xcb_randr_get_provider_info_outputs (const xcb_randr_get_provider_info_reply_t *R)
4074 {
4075 xcb_generic_iterator_t prev = xcb_randr_get_provider_info_crtcs_end(R);
4076 return (xcb_randr_output_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_output_t, prev.index) + 0);
4077 }
4078
4079 int
xcb_randr_get_provider_info_outputs_length(const xcb_randr_get_provider_info_reply_t * R)4080 xcb_randr_get_provider_info_outputs_length (const xcb_randr_get_provider_info_reply_t *R)
4081 {
4082 return R->num_outputs;
4083 }
4084
4085 xcb_generic_iterator_t
xcb_randr_get_provider_info_outputs_end(const xcb_randr_get_provider_info_reply_t * R)4086 xcb_randr_get_provider_info_outputs_end (const xcb_randr_get_provider_info_reply_t *R)
4087 {
4088 xcb_generic_iterator_t i;
4089 xcb_generic_iterator_t prev = xcb_randr_get_provider_info_crtcs_end(R);
4090 i.data = ((xcb_randr_output_t *) ((char*) prev.data + XCB_TYPE_PAD(xcb_randr_output_t, prev.index))) + (R->num_outputs);
4091 i.rem = 0;
4092 i.index = (char *) i.data - (char *) R;
4093 return i;
4094 }
4095
4096 xcb_randr_provider_t *
xcb_randr_get_provider_info_associated_providers(const xcb_randr_get_provider_info_reply_t * R)4097 xcb_randr_get_provider_info_associated_providers (const xcb_randr_get_provider_info_reply_t *R)
4098 {
4099 xcb_generic_iterator_t prev = xcb_randr_get_provider_info_outputs_end(R);
4100 return (xcb_randr_provider_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_randr_provider_t, prev.index) + 0);
4101 }
4102
4103 int
xcb_randr_get_provider_info_associated_providers_length(const xcb_randr_get_provider_info_reply_t * R)4104 xcb_randr_get_provider_info_associated_providers_length (const xcb_randr_get_provider_info_reply_t *R)
4105 {
4106 return R->num_associated_providers;
4107 }
4108
4109 xcb_generic_iterator_t
xcb_randr_get_provider_info_associated_providers_end(const xcb_randr_get_provider_info_reply_t * R)4110 xcb_randr_get_provider_info_associated_providers_end (const xcb_randr_get_provider_info_reply_t *R)
4111 {
4112 xcb_generic_iterator_t i;
4113 xcb_generic_iterator_t prev = xcb_randr_get_provider_info_outputs_end(R);
4114 i.data = ((xcb_randr_provider_t *) ((char*) prev.data + XCB_TYPE_PAD(xcb_randr_provider_t, prev.index))) + (R->num_associated_providers);
4115 i.rem = 0;
4116 i.index = (char *) i.data - (char *) R;
4117 return i;
4118 }
4119
4120 uint32_t *
xcb_randr_get_provider_info_associated_capability(const xcb_randr_get_provider_info_reply_t * R)4121 xcb_randr_get_provider_info_associated_capability (const xcb_randr_get_provider_info_reply_t *R)
4122 {
4123 xcb_generic_iterator_t prev = xcb_randr_get_provider_info_associated_providers_end(R);
4124 return (uint32_t *) ((char *) prev.data + XCB_TYPE_PAD(uint32_t, prev.index) + 0);
4125 }
4126
4127 int
xcb_randr_get_provider_info_associated_capability_length(const xcb_randr_get_provider_info_reply_t * R)4128 xcb_randr_get_provider_info_associated_capability_length (const xcb_randr_get_provider_info_reply_t *R)
4129 {
4130 return R->num_associated_providers;
4131 }
4132
4133 xcb_generic_iterator_t
xcb_randr_get_provider_info_associated_capability_end(const xcb_randr_get_provider_info_reply_t * R)4134 xcb_randr_get_provider_info_associated_capability_end (const xcb_randr_get_provider_info_reply_t *R)
4135 {
4136 xcb_generic_iterator_t i;
4137 xcb_generic_iterator_t prev = xcb_randr_get_provider_info_associated_providers_end(R);
4138 i.data = ((uint32_t *) ((char*) prev.data + XCB_TYPE_PAD(uint32_t, prev.index))) + (R->num_associated_providers);
4139 i.rem = 0;
4140 i.index = (char *) i.data - (char *) R;
4141 return i;
4142 }
4143
4144 char *
xcb_randr_get_provider_info_name(const xcb_randr_get_provider_info_reply_t * R)4145 xcb_randr_get_provider_info_name (const xcb_randr_get_provider_info_reply_t *R)
4146 {
4147 xcb_generic_iterator_t prev = xcb_randr_get_provider_info_associated_capability_end(R);
4148 return (char *) ((char *) prev.data + XCB_TYPE_PAD(char, prev.index) + 0);
4149 }
4150
4151 int
xcb_randr_get_provider_info_name_length(const xcb_randr_get_provider_info_reply_t * R)4152 xcb_randr_get_provider_info_name_length (const xcb_randr_get_provider_info_reply_t *R)
4153 {
4154 return R->name_len;
4155 }
4156
4157 xcb_generic_iterator_t
xcb_randr_get_provider_info_name_end(const xcb_randr_get_provider_info_reply_t * R)4158 xcb_randr_get_provider_info_name_end (const xcb_randr_get_provider_info_reply_t *R)
4159 {
4160 xcb_generic_iterator_t i;
4161 xcb_generic_iterator_t prev = xcb_randr_get_provider_info_associated_capability_end(R);
4162 i.data = ((char *) ((char*) prev.data + XCB_TYPE_PAD(char, prev.index))) + (R->name_len);
4163 i.rem = 0;
4164 i.index = (char *) i.data - (char *) R;
4165 return i;
4166 }
4167
4168 xcb_randr_get_provider_info_reply_t *
xcb_randr_get_provider_info_reply(xcb_connection_t * c,xcb_randr_get_provider_info_cookie_t cookie,xcb_generic_error_t ** e)4169 xcb_randr_get_provider_info_reply (xcb_connection_t *c,
4170 xcb_randr_get_provider_info_cookie_t cookie /**< */,
4171 xcb_generic_error_t **e)
4172 {
4173 return (xcb_randr_get_provider_info_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
4174 }
4175
4176 xcb_void_cookie_t
xcb_randr_set_provider_offload_sink_checked(xcb_connection_t * c,xcb_randr_provider_t provider,xcb_randr_provider_t sink_provider,xcb_timestamp_t config_timestamp)4177 xcb_randr_set_provider_offload_sink_checked (xcb_connection_t *c,
4178 xcb_randr_provider_t provider,
4179 xcb_randr_provider_t sink_provider,
4180 xcb_timestamp_t config_timestamp)
4181 {
4182 static const xcb_protocol_request_t xcb_req = {
4183 .count = 2,
4184 .ext = &xcb_randr_id,
4185 .opcode = XCB_RANDR_SET_PROVIDER_OFFLOAD_SINK,
4186 .isvoid = 1
4187 };
4188
4189 struct iovec xcb_parts[4];
4190 xcb_void_cookie_t xcb_ret;
4191 xcb_randr_set_provider_offload_sink_request_t xcb_out;
4192
4193 xcb_out.provider = provider;
4194 xcb_out.sink_provider = sink_provider;
4195 xcb_out.config_timestamp = config_timestamp;
4196
4197 xcb_parts[2].iov_base = (char *) &xcb_out;
4198 xcb_parts[2].iov_len = sizeof(xcb_out);
4199 xcb_parts[3].iov_base = 0;
4200 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4201
4202 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
4203 return xcb_ret;
4204 }
4205
4206 xcb_void_cookie_t
xcb_randr_set_provider_offload_sink(xcb_connection_t * c,xcb_randr_provider_t provider,xcb_randr_provider_t sink_provider,xcb_timestamp_t config_timestamp)4207 xcb_randr_set_provider_offload_sink (xcb_connection_t *c,
4208 xcb_randr_provider_t provider,
4209 xcb_randr_provider_t sink_provider,
4210 xcb_timestamp_t config_timestamp)
4211 {
4212 static const xcb_protocol_request_t xcb_req = {
4213 .count = 2,
4214 .ext = &xcb_randr_id,
4215 .opcode = XCB_RANDR_SET_PROVIDER_OFFLOAD_SINK,
4216 .isvoid = 1
4217 };
4218
4219 struct iovec xcb_parts[4];
4220 xcb_void_cookie_t xcb_ret;
4221 xcb_randr_set_provider_offload_sink_request_t xcb_out;
4222
4223 xcb_out.provider = provider;
4224 xcb_out.sink_provider = sink_provider;
4225 xcb_out.config_timestamp = config_timestamp;
4226
4227 xcb_parts[2].iov_base = (char *) &xcb_out;
4228 xcb_parts[2].iov_len = sizeof(xcb_out);
4229 xcb_parts[3].iov_base = 0;
4230 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4231
4232 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
4233 return xcb_ret;
4234 }
4235
4236 xcb_void_cookie_t
xcb_randr_set_provider_output_source_checked(xcb_connection_t * c,xcb_randr_provider_t provider,xcb_randr_provider_t source_provider,xcb_timestamp_t config_timestamp)4237 xcb_randr_set_provider_output_source_checked (xcb_connection_t *c,
4238 xcb_randr_provider_t provider,
4239 xcb_randr_provider_t source_provider,
4240 xcb_timestamp_t config_timestamp)
4241 {
4242 static const xcb_protocol_request_t xcb_req = {
4243 .count = 2,
4244 .ext = &xcb_randr_id,
4245 .opcode = XCB_RANDR_SET_PROVIDER_OUTPUT_SOURCE,
4246 .isvoid = 1
4247 };
4248
4249 struct iovec xcb_parts[4];
4250 xcb_void_cookie_t xcb_ret;
4251 xcb_randr_set_provider_output_source_request_t xcb_out;
4252
4253 xcb_out.provider = provider;
4254 xcb_out.source_provider = source_provider;
4255 xcb_out.config_timestamp = config_timestamp;
4256
4257 xcb_parts[2].iov_base = (char *) &xcb_out;
4258 xcb_parts[2].iov_len = sizeof(xcb_out);
4259 xcb_parts[3].iov_base = 0;
4260 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4261
4262 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
4263 return xcb_ret;
4264 }
4265
4266 xcb_void_cookie_t
xcb_randr_set_provider_output_source(xcb_connection_t * c,xcb_randr_provider_t provider,xcb_randr_provider_t source_provider,xcb_timestamp_t config_timestamp)4267 xcb_randr_set_provider_output_source (xcb_connection_t *c,
4268 xcb_randr_provider_t provider,
4269 xcb_randr_provider_t source_provider,
4270 xcb_timestamp_t config_timestamp)
4271 {
4272 static const xcb_protocol_request_t xcb_req = {
4273 .count = 2,
4274 .ext = &xcb_randr_id,
4275 .opcode = XCB_RANDR_SET_PROVIDER_OUTPUT_SOURCE,
4276 .isvoid = 1
4277 };
4278
4279 struct iovec xcb_parts[4];
4280 xcb_void_cookie_t xcb_ret;
4281 xcb_randr_set_provider_output_source_request_t xcb_out;
4282
4283 xcb_out.provider = provider;
4284 xcb_out.source_provider = source_provider;
4285 xcb_out.config_timestamp = config_timestamp;
4286
4287 xcb_parts[2].iov_base = (char *) &xcb_out;
4288 xcb_parts[2].iov_len = sizeof(xcb_out);
4289 xcb_parts[3].iov_base = 0;
4290 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4291
4292 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
4293 return xcb_ret;
4294 }
4295
4296 int
xcb_randr_list_provider_properties_sizeof(const void * _buffer)4297 xcb_randr_list_provider_properties_sizeof (const void *_buffer)
4298 {
4299 char *xcb_tmp = (char *)_buffer;
4300 const xcb_randr_list_provider_properties_reply_t *_aux = (xcb_randr_list_provider_properties_reply_t *)_buffer;
4301 unsigned int xcb_buffer_len = 0;
4302 unsigned int xcb_block_len = 0;
4303 unsigned int xcb_pad = 0;
4304 unsigned int xcb_align_to = 0;
4305
4306
4307 xcb_block_len += sizeof(xcb_randr_list_provider_properties_reply_t);
4308 xcb_tmp += xcb_block_len;
4309 xcb_buffer_len += xcb_block_len;
4310 xcb_block_len = 0;
4311 /* atoms */
4312 xcb_block_len += _aux->num_atoms * sizeof(xcb_atom_t);
4313 xcb_tmp += xcb_block_len;
4314 xcb_align_to = ALIGNOF(xcb_atom_t);
4315 /* insert padding */
4316 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
4317 xcb_buffer_len += xcb_block_len + xcb_pad;
4318 if (0 != xcb_pad) {
4319 xcb_tmp += xcb_pad;
4320 xcb_pad = 0;
4321 }
4322 xcb_block_len = 0;
4323
4324 return xcb_buffer_len;
4325 }
4326
4327 xcb_randr_list_provider_properties_cookie_t
xcb_randr_list_provider_properties(xcb_connection_t * c,xcb_randr_provider_t provider)4328 xcb_randr_list_provider_properties (xcb_connection_t *c,
4329 xcb_randr_provider_t provider)
4330 {
4331 static const xcb_protocol_request_t xcb_req = {
4332 .count = 2,
4333 .ext = &xcb_randr_id,
4334 .opcode = XCB_RANDR_LIST_PROVIDER_PROPERTIES,
4335 .isvoid = 0
4336 };
4337
4338 struct iovec xcb_parts[4];
4339 xcb_randr_list_provider_properties_cookie_t xcb_ret;
4340 xcb_randr_list_provider_properties_request_t xcb_out;
4341
4342 xcb_out.provider = provider;
4343
4344 xcb_parts[2].iov_base = (char *) &xcb_out;
4345 xcb_parts[2].iov_len = sizeof(xcb_out);
4346 xcb_parts[3].iov_base = 0;
4347 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4348
4349 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
4350 return xcb_ret;
4351 }
4352
4353 xcb_randr_list_provider_properties_cookie_t
xcb_randr_list_provider_properties_unchecked(xcb_connection_t * c,xcb_randr_provider_t provider)4354 xcb_randr_list_provider_properties_unchecked (xcb_connection_t *c,
4355 xcb_randr_provider_t provider)
4356 {
4357 static const xcb_protocol_request_t xcb_req = {
4358 .count = 2,
4359 .ext = &xcb_randr_id,
4360 .opcode = XCB_RANDR_LIST_PROVIDER_PROPERTIES,
4361 .isvoid = 0
4362 };
4363
4364 struct iovec xcb_parts[4];
4365 xcb_randr_list_provider_properties_cookie_t xcb_ret;
4366 xcb_randr_list_provider_properties_request_t xcb_out;
4367
4368 xcb_out.provider = provider;
4369
4370 xcb_parts[2].iov_base = (char *) &xcb_out;
4371 xcb_parts[2].iov_len = sizeof(xcb_out);
4372 xcb_parts[3].iov_base = 0;
4373 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4374
4375 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
4376 return xcb_ret;
4377 }
4378
4379 xcb_atom_t *
xcb_randr_list_provider_properties_atoms(const xcb_randr_list_provider_properties_reply_t * R)4380 xcb_randr_list_provider_properties_atoms (const xcb_randr_list_provider_properties_reply_t *R)
4381 {
4382 return (xcb_atom_t *) (R + 1);
4383 }
4384
4385 int
xcb_randr_list_provider_properties_atoms_length(const xcb_randr_list_provider_properties_reply_t * R)4386 xcb_randr_list_provider_properties_atoms_length (const xcb_randr_list_provider_properties_reply_t *R)
4387 {
4388 return R->num_atoms;
4389 }
4390
4391 xcb_generic_iterator_t
xcb_randr_list_provider_properties_atoms_end(const xcb_randr_list_provider_properties_reply_t * R)4392 xcb_randr_list_provider_properties_atoms_end (const xcb_randr_list_provider_properties_reply_t *R)
4393 {
4394 xcb_generic_iterator_t i;
4395 i.data = ((xcb_atom_t *) (R + 1)) + (R->num_atoms);
4396 i.rem = 0;
4397 i.index = (char *) i.data - (char *) R;
4398 return i;
4399 }
4400
4401 xcb_randr_list_provider_properties_reply_t *
xcb_randr_list_provider_properties_reply(xcb_connection_t * c,xcb_randr_list_provider_properties_cookie_t cookie,xcb_generic_error_t ** e)4402 xcb_randr_list_provider_properties_reply (xcb_connection_t *c,
4403 xcb_randr_list_provider_properties_cookie_t cookie /**< */,
4404 xcb_generic_error_t **e)
4405 {
4406 return (xcb_randr_list_provider_properties_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
4407 }
4408
4409 int
xcb_randr_query_provider_property_sizeof(const void * _buffer)4410 xcb_randr_query_provider_property_sizeof (const void *_buffer)
4411 {
4412 char *xcb_tmp = (char *)_buffer;
4413 const xcb_randr_query_provider_property_reply_t *_aux = (xcb_randr_query_provider_property_reply_t *)_buffer;
4414 unsigned int xcb_buffer_len = 0;
4415 unsigned int xcb_block_len = 0;
4416 unsigned int xcb_pad = 0;
4417 unsigned int xcb_align_to = 0;
4418
4419
4420 xcb_block_len += sizeof(xcb_randr_query_provider_property_reply_t);
4421 xcb_tmp += xcb_block_len;
4422 xcb_buffer_len += xcb_block_len;
4423 xcb_block_len = 0;
4424 /* valid_values */
4425 xcb_block_len += _aux->length * sizeof(int32_t);
4426 xcb_tmp += xcb_block_len;
4427 xcb_align_to = ALIGNOF(int32_t);
4428 /* insert padding */
4429 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
4430 xcb_buffer_len += xcb_block_len + xcb_pad;
4431 if (0 != xcb_pad) {
4432 xcb_tmp += xcb_pad;
4433 xcb_pad = 0;
4434 }
4435 xcb_block_len = 0;
4436
4437 return xcb_buffer_len;
4438 }
4439
4440 xcb_randr_query_provider_property_cookie_t
xcb_randr_query_provider_property(xcb_connection_t * c,xcb_randr_provider_t provider,xcb_atom_t property)4441 xcb_randr_query_provider_property (xcb_connection_t *c,
4442 xcb_randr_provider_t provider,
4443 xcb_atom_t property)
4444 {
4445 static const xcb_protocol_request_t xcb_req = {
4446 .count = 2,
4447 .ext = &xcb_randr_id,
4448 .opcode = XCB_RANDR_QUERY_PROVIDER_PROPERTY,
4449 .isvoid = 0
4450 };
4451
4452 struct iovec xcb_parts[4];
4453 xcb_randr_query_provider_property_cookie_t xcb_ret;
4454 xcb_randr_query_provider_property_request_t xcb_out;
4455
4456 xcb_out.provider = provider;
4457 xcb_out.property = property;
4458
4459 xcb_parts[2].iov_base = (char *) &xcb_out;
4460 xcb_parts[2].iov_len = sizeof(xcb_out);
4461 xcb_parts[3].iov_base = 0;
4462 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4463
4464 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
4465 return xcb_ret;
4466 }
4467
4468 xcb_randr_query_provider_property_cookie_t
xcb_randr_query_provider_property_unchecked(xcb_connection_t * c,xcb_randr_provider_t provider,xcb_atom_t property)4469 xcb_randr_query_provider_property_unchecked (xcb_connection_t *c,
4470 xcb_randr_provider_t provider,
4471 xcb_atom_t property)
4472 {
4473 static const xcb_protocol_request_t xcb_req = {
4474 .count = 2,
4475 .ext = &xcb_randr_id,
4476 .opcode = XCB_RANDR_QUERY_PROVIDER_PROPERTY,
4477 .isvoid = 0
4478 };
4479
4480 struct iovec xcb_parts[4];
4481 xcb_randr_query_provider_property_cookie_t xcb_ret;
4482 xcb_randr_query_provider_property_request_t xcb_out;
4483
4484 xcb_out.provider = provider;
4485 xcb_out.property = property;
4486
4487 xcb_parts[2].iov_base = (char *) &xcb_out;
4488 xcb_parts[2].iov_len = sizeof(xcb_out);
4489 xcb_parts[3].iov_base = 0;
4490 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4491
4492 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
4493 return xcb_ret;
4494 }
4495
4496 int32_t *
xcb_randr_query_provider_property_valid_values(const xcb_randr_query_provider_property_reply_t * R)4497 xcb_randr_query_provider_property_valid_values (const xcb_randr_query_provider_property_reply_t *R)
4498 {
4499 return (int32_t *) (R + 1);
4500 }
4501
4502 int
xcb_randr_query_provider_property_valid_values_length(const xcb_randr_query_provider_property_reply_t * R)4503 xcb_randr_query_provider_property_valid_values_length (const xcb_randr_query_provider_property_reply_t *R)
4504 {
4505 return R->length;
4506 }
4507
4508 xcb_generic_iterator_t
xcb_randr_query_provider_property_valid_values_end(const xcb_randr_query_provider_property_reply_t * R)4509 xcb_randr_query_provider_property_valid_values_end (const xcb_randr_query_provider_property_reply_t *R)
4510 {
4511 xcb_generic_iterator_t i;
4512 i.data = ((int32_t *) (R + 1)) + (R->length);
4513 i.rem = 0;
4514 i.index = (char *) i.data - (char *) R;
4515 return i;
4516 }
4517
4518 xcb_randr_query_provider_property_reply_t *
xcb_randr_query_provider_property_reply(xcb_connection_t * c,xcb_randr_query_provider_property_cookie_t cookie,xcb_generic_error_t ** e)4519 xcb_randr_query_provider_property_reply (xcb_connection_t *c,
4520 xcb_randr_query_provider_property_cookie_t cookie /**< */,
4521 xcb_generic_error_t **e)
4522 {
4523 return (xcb_randr_query_provider_property_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
4524 }
4525
4526 int
xcb_randr_configure_provider_property_sizeof(const void * _buffer,uint32_t values_len)4527 xcb_randr_configure_provider_property_sizeof (const void *_buffer,
4528 uint32_t values_len)
4529 {
4530 char *xcb_tmp = (char *)_buffer;
4531 unsigned int xcb_buffer_len = 0;
4532 unsigned int xcb_block_len = 0;
4533 unsigned int xcb_pad = 0;
4534 unsigned int xcb_align_to = 0;
4535
4536
4537 xcb_block_len += sizeof(xcb_randr_configure_provider_property_request_t);
4538 xcb_tmp += xcb_block_len;
4539 xcb_buffer_len += xcb_block_len;
4540 xcb_block_len = 0;
4541 /* values */
4542 xcb_block_len += values_len * sizeof(int32_t);
4543 xcb_tmp += xcb_block_len;
4544 xcb_align_to = ALIGNOF(int32_t);
4545 /* insert padding */
4546 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
4547 xcb_buffer_len += xcb_block_len + xcb_pad;
4548 if (0 != xcb_pad) {
4549 xcb_tmp += xcb_pad;
4550 xcb_pad = 0;
4551 }
4552 xcb_block_len = 0;
4553
4554 return xcb_buffer_len;
4555 }
4556
4557 xcb_void_cookie_t
xcb_randr_configure_provider_property_checked(xcb_connection_t * c,xcb_randr_provider_t provider,xcb_atom_t property,uint8_t pending,uint8_t range,uint32_t values_len,const int32_t * values)4558 xcb_randr_configure_provider_property_checked (xcb_connection_t *c,
4559 xcb_randr_provider_t provider,
4560 xcb_atom_t property,
4561 uint8_t pending,
4562 uint8_t range,
4563 uint32_t values_len,
4564 const int32_t *values)
4565 {
4566 static const xcb_protocol_request_t xcb_req = {
4567 .count = 4,
4568 .ext = &xcb_randr_id,
4569 .opcode = XCB_RANDR_CONFIGURE_PROVIDER_PROPERTY,
4570 .isvoid = 1
4571 };
4572
4573 struct iovec xcb_parts[6];
4574 xcb_void_cookie_t xcb_ret;
4575 xcb_randr_configure_provider_property_request_t xcb_out;
4576
4577 xcb_out.provider = provider;
4578 xcb_out.property = property;
4579 xcb_out.pending = pending;
4580 xcb_out.range = range;
4581 memset(xcb_out.pad0, 0, 2);
4582
4583 xcb_parts[2].iov_base = (char *) &xcb_out;
4584 xcb_parts[2].iov_len = sizeof(xcb_out);
4585 xcb_parts[3].iov_base = 0;
4586 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4587 /* int32_t values */
4588 xcb_parts[4].iov_base = (char *) values;
4589 xcb_parts[4].iov_len = values_len * sizeof(int32_t);
4590 xcb_parts[5].iov_base = 0;
4591 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
4592
4593 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
4594 return xcb_ret;
4595 }
4596
4597 xcb_void_cookie_t
xcb_randr_configure_provider_property(xcb_connection_t * c,xcb_randr_provider_t provider,xcb_atom_t property,uint8_t pending,uint8_t range,uint32_t values_len,const int32_t * values)4598 xcb_randr_configure_provider_property (xcb_connection_t *c,
4599 xcb_randr_provider_t provider,
4600 xcb_atom_t property,
4601 uint8_t pending,
4602 uint8_t range,
4603 uint32_t values_len,
4604 const int32_t *values)
4605 {
4606 static const xcb_protocol_request_t xcb_req = {
4607 .count = 4,
4608 .ext = &xcb_randr_id,
4609 .opcode = XCB_RANDR_CONFIGURE_PROVIDER_PROPERTY,
4610 .isvoid = 1
4611 };
4612
4613 struct iovec xcb_parts[6];
4614 xcb_void_cookie_t xcb_ret;
4615 xcb_randr_configure_provider_property_request_t xcb_out;
4616
4617 xcb_out.provider = provider;
4618 xcb_out.property = property;
4619 xcb_out.pending = pending;
4620 xcb_out.range = range;
4621 memset(xcb_out.pad0, 0, 2);
4622
4623 xcb_parts[2].iov_base = (char *) &xcb_out;
4624 xcb_parts[2].iov_len = sizeof(xcb_out);
4625 xcb_parts[3].iov_base = 0;
4626 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4627 /* int32_t values */
4628 xcb_parts[4].iov_base = (char *) values;
4629 xcb_parts[4].iov_len = values_len * sizeof(int32_t);
4630 xcb_parts[5].iov_base = 0;
4631 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
4632
4633 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
4634 return xcb_ret;
4635 }
4636
4637 int32_t *
xcb_randr_configure_provider_property_values(const xcb_randr_configure_provider_property_request_t * R)4638 xcb_randr_configure_provider_property_values (const xcb_randr_configure_provider_property_request_t *R)
4639 {
4640 return (int32_t *) (R + 1);
4641 }
4642
4643 int
xcb_randr_configure_provider_property_values_length(const xcb_randr_configure_provider_property_request_t * R)4644 xcb_randr_configure_provider_property_values_length (const xcb_randr_configure_provider_property_request_t *R)
4645 {
4646 return (((R->length * 4) - sizeof(xcb_randr_configure_provider_property_request_t))/sizeof(int32_t));
4647 }
4648
4649 xcb_generic_iterator_t
xcb_randr_configure_provider_property_values_end(const xcb_randr_configure_provider_property_request_t * R)4650 xcb_randr_configure_provider_property_values_end (const xcb_randr_configure_provider_property_request_t *R)
4651 {
4652 xcb_generic_iterator_t i;
4653 i.data = ((int32_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_randr_configure_provider_property_request_t))/sizeof(int32_t)));
4654 i.rem = 0;
4655 i.index = (char *) i.data - (char *) R;
4656 return i;
4657 }
4658
4659 int
xcb_randr_change_provider_property_sizeof(const void * _buffer)4660 xcb_randr_change_provider_property_sizeof (const void *_buffer)
4661 {
4662 char *xcb_tmp = (char *)_buffer;
4663 const xcb_randr_change_provider_property_request_t *_aux = (xcb_randr_change_provider_property_request_t *)_buffer;
4664 unsigned int xcb_buffer_len = 0;
4665 unsigned int xcb_block_len = 0;
4666 unsigned int xcb_pad = 0;
4667 unsigned int xcb_align_to = 0;
4668
4669
4670 xcb_block_len += sizeof(xcb_randr_change_provider_property_request_t);
4671 xcb_tmp += xcb_block_len;
4672 xcb_buffer_len += xcb_block_len;
4673 xcb_block_len = 0;
4674 /* data */
4675 xcb_block_len += (_aux->num_items * (_aux->format / 8)) * sizeof(char);
4676 xcb_tmp += xcb_block_len;
4677 xcb_align_to = ALIGNOF(char);
4678 /* insert padding */
4679 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
4680 xcb_buffer_len += xcb_block_len + xcb_pad;
4681 if (0 != xcb_pad) {
4682 xcb_tmp += xcb_pad;
4683 xcb_pad = 0;
4684 }
4685 xcb_block_len = 0;
4686
4687 return xcb_buffer_len;
4688 }
4689
4690 xcb_void_cookie_t
xcb_randr_change_provider_property_checked(xcb_connection_t * c,xcb_randr_provider_t provider,xcb_atom_t property,xcb_atom_t type,uint8_t format,uint8_t mode,uint32_t num_items,const void * data)4691 xcb_randr_change_provider_property_checked (xcb_connection_t *c,
4692 xcb_randr_provider_t provider,
4693 xcb_atom_t property,
4694 xcb_atom_t type,
4695 uint8_t format,
4696 uint8_t mode,
4697 uint32_t num_items,
4698 const void *data)
4699 {
4700 static const xcb_protocol_request_t xcb_req = {
4701 .count = 4,
4702 .ext = &xcb_randr_id,
4703 .opcode = XCB_RANDR_CHANGE_PROVIDER_PROPERTY,
4704 .isvoid = 1
4705 };
4706
4707 struct iovec xcb_parts[6];
4708 xcb_void_cookie_t xcb_ret;
4709 xcb_randr_change_provider_property_request_t xcb_out;
4710
4711 xcb_out.provider = provider;
4712 xcb_out.property = property;
4713 xcb_out.type = type;
4714 xcb_out.format = format;
4715 xcb_out.mode = mode;
4716 memset(xcb_out.pad0, 0, 2);
4717 xcb_out.num_items = num_items;
4718
4719 xcb_parts[2].iov_base = (char *) &xcb_out;
4720 xcb_parts[2].iov_len = sizeof(xcb_out);
4721 xcb_parts[3].iov_base = 0;
4722 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4723 /* void data */
4724 xcb_parts[4].iov_base = (char *) data;
4725 xcb_parts[4].iov_len = (num_items * (format / 8)) * sizeof(char);
4726 xcb_parts[5].iov_base = 0;
4727 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
4728
4729 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
4730 return xcb_ret;
4731 }
4732
4733 xcb_void_cookie_t
xcb_randr_change_provider_property(xcb_connection_t * c,xcb_randr_provider_t provider,xcb_atom_t property,xcb_atom_t type,uint8_t format,uint8_t mode,uint32_t num_items,const void * data)4734 xcb_randr_change_provider_property (xcb_connection_t *c,
4735 xcb_randr_provider_t provider,
4736 xcb_atom_t property,
4737 xcb_atom_t type,
4738 uint8_t format,
4739 uint8_t mode,
4740 uint32_t num_items,
4741 const void *data)
4742 {
4743 static const xcb_protocol_request_t xcb_req = {
4744 .count = 4,
4745 .ext = &xcb_randr_id,
4746 .opcode = XCB_RANDR_CHANGE_PROVIDER_PROPERTY,
4747 .isvoid = 1
4748 };
4749
4750 struct iovec xcb_parts[6];
4751 xcb_void_cookie_t xcb_ret;
4752 xcb_randr_change_provider_property_request_t xcb_out;
4753
4754 xcb_out.provider = provider;
4755 xcb_out.property = property;
4756 xcb_out.type = type;
4757 xcb_out.format = format;
4758 xcb_out.mode = mode;
4759 memset(xcb_out.pad0, 0, 2);
4760 xcb_out.num_items = num_items;
4761
4762 xcb_parts[2].iov_base = (char *) &xcb_out;
4763 xcb_parts[2].iov_len = sizeof(xcb_out);
4764 xcb_parts[3].iov_base = 0;
4765 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4766 /* void data */
4767 xcb_parts[4].iov_base = (char *) data;
4768 xcb_parts[4].iov_len = (num_items * (format / 8)) * sizeof(char);
4769 xcb_parts[5].iov_base = 0;
4770 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
4771
4772 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
4773 return xcb_ret;
4774 }
4775
4776 void *
xcb_randr_change_provider_property_data(const xcb_randr_change_provider_property_request_t * R)4777 xcb_randr_change_provider_property_data (const xcb_randr_change_provider_property_request_t *R)
4778 {
4779 return (void *) (R + 1);
4780 }
4781
4782 int
xcb_randr_change_provider_property_data_length(const xcb_randr_change_provider_property_request_t * R)4783 xcb_randr_change_provider_property_data_length (const xcb_randr_change_provider_property_request_t *R)
4784 {
4785 return (R->num_items * (R->format / 8));
4786 }
4787
4788 xcb_generic_iterator_t
xcb_randr_change_provider_property_data_end(const xcb_randr_change_provider_property_request_t * R)4789 xcb_randr_change_provider_property_data_end (const xcb_randr_change_provider_property_request_t *R)
4790 {
4791 xcb_generic_iterator_t i;
4792 i.data = ((char *) (R + 1)) + ((R->num_items * (R->format / 8)));
4793 i.rem = 0;
4794 i.index = (char *) i.data - (char *) R;
4795 return i;
4796 }
4797
4798 xcb_void_cookie_t
xcb_randr_delete_provider_property_checked(xcb_connection_t * c,xcb_randr_provider_t provider,xcb_atom_t property)4799 xcb_randr_delete_provider_property_checked (xcb_connection_t *c,
4800 xcb_randr_provider_t provider,
4801 xcb_atom_t property)
4802 {
4803 static const xcb_protocol_request_t xcb_req = {
4804 .count = 2,
4805 .ext = &xcb_randr_id,
4806 .opcode = XCB_RANDR_DELETE_PROVIDER_PROPERTY,
4807 .isvoid = 1
4808 };
4809
4810 struct iovec xcb_parts[4];
4811 xcb_void_cookie_t xcb_ret;
4812 xcb_randr_delete_provider_property_request_t xcb_out;
4813
4814 xcb_out.provider = provider;
4815 xcb_out.property = property;
4816
4817 xcb_parts[2].iov_base = (char *) &xcb_out;
4818 xcb_parts[2].iov_len = sizeof(xcb_out);
4819 xcb_parts[3].iov_base = 0;
4820 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4821
4822 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
4823 return xcb_ret;
4824 }
4825
4826 xcb_void_cookie_t
xcb_randr_delete_provider_property(xcb_connection_t * c,xcb_randr_provider_t provider,xcb_atom_t property)4827 xcb_randr_delete_provider_property (xcb_connection_t *c,
4828 xcb_randr_provider_t provider,
4829 xcb_atom_t property)
4830 {
4831 static const xcb_protocol_request_t xcb_req = {
4832 .count = 2,
4833 .ext = &xcb_randr_id,
4834 .opcode = XCB_RANDR_DELETE_PROVIDER_PROPERTY,
4835 .isvoid = 1
4836 };
4837
4838 struct iovec xcb_parts[4];
4839 xcb_void_cookie_t xcb_ret;
4840 xcb_randr_delete_provider_property_request_t xcb_out;
4841
4842 xcb_out.provider = provider;
4843 xcb_out.property = property;
4844
4845 xcb_parts[2].iov_base = (char *) &xcb_out;
4846 xcb_parts[2].iov_len = sizeof(xcb_out);
4847 xcb_parts[3].iov_base = 0;
4848 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4849
4850 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
4851 return xcb_ret;
4852 }
4853
4854 int
xcb_randr_get_provider_property_sizeof(const void * _buffer)4855 xcb_randr_get_provider_property_sizeof (const void *_buffer)
4856 {
4857 char *xcb_tmp = (char *)_buffer;
4858 const xcb_randr_get_provider_property_reply_t *_aux = (xcb_randr_get_provider_property_reply_t *)_buffer;
4859 unsigned int xcb_buffer_len = 0;
4860 unsigned int xcb_block_len = 0;
4861 unsigned int xcb_pad = 0;
4862 unsigned int xcb_align_to = 0;
4863
4864
4865 xcb_block_len += sizeof(xcb_randr_get_provider_property_reply_t);
4866 xcb_tmp += xcb_block_len;
4867 xcb_buffer_len += xcb_block_len;
4868 xcb_block_len = 0;
4869 /* data */
4870 xcb_block_len += (_aux->num_items * (_aux->format / 8)) * sizeof(char);
4871 xcb_tmp += xcb_block_len;
4872 xcb_align_to = ALIGNOF(char);
4873 /* insert padding */
4874 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
4875 xcb_buffer_len += xcb_block_len + xcb_pad;
4876 if (0 != xcb_pad) {
4877 xcb_tmp += xcb_pad;
4878 xcb_pad = 0;
4879 }
4880 xcb_block_len = 0;
4881
4882 return xcb_buffer_len;
4883 }
4884
4885 xcb_randr_get_provider_property_cookie_t
xcb_randr_get_provider_property(xcb_connection_t * c,xcb_randr_provider_t provider,xcb_atom_t property,xcb_atom_t type,uint32_t long_offset,uint32_t long_length,uint8_t _delete,uint8_t pending)4886 xcb_randr_get_provider_property (xcb_connection_t *c,
4887 xcb_randr_provider_t provider,
4888 xcb_atom_t property,
4889 xcb_atom_t type,
4890 uint32_t long_offset,
4891 uint32_t long_length,
4892 uint8_t _delete,
4893 uint8_t pending)
4894 {
4895 static const xcb_protocol_request_t xcb_req = {
4896 .count = 2,
4897 .ext = &xcb_randr_id,
4898 .opcode = XCB_RANDR_GET_PROVIDER_PROPERTY,
4899 .isvoid = 0
4900 };
4901
4902 struct iovec xcb_parts[4];
4903 xcb_randr_get_provider_property_cookie_t xcb_ret;
4904 xcb_randr_get_provider_property_request_t xcb_out;
4905
4906 xcb_out.provider = provider;
4907 xcb_out.property = property;
4908 xcb_out.type = type;
4909 xcb_out.long_offset = long_offset;
4910 xcb_out.long_length = long_length;
4911 xcb_out._delete = _delete;
4912 xcb_out.pending = pending;
4913 memset(xcb_out.pad0, 0, 2);
4914
4915 xcb_parts[2].iov_base = (char *) &xcb_out;
4916 xcb_parts[2].iov_len = sizeof(xcb_out);
4917 xcb_parts[3].iov_base = 0;
4918 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4919
4920 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
4921 return xcb_ret;
4922 }
4923
4924 xcb_randr_get_provider_property_cookie_t
xcb_randr_get_provider_property_unchecked(xcb_connection_t * c,xcb_randr_provider_t provider,xcb_atom_t property,xcb_atom_t type,uint32_t long_offset,uint32_t long_length,uint8_t _delete,uint8_t pending)4925 xcb_randr_get_provider_property_unchecked (xcb_connection_t *c,
4926 xcb_randr_provider_t provider,
4927 xcb_atom_t property,
4928 xcb_atom_t type,
4929 uint32_t long_offset,
4930 uint32_t long_length,
4931 uint8_t _delete,
4932 uint8_t pending)
4933 {
4934 static const xcb_protocol_request_t xcb_req = {
4935 .count = 2,
4936 .ext = &xcb_randr_id,
4937 .opcode = XCB_RANDR_GET_PROVIDER_PROPERTY,
4938 .isvoid = 0
4939 };
4940
4941 struct iovec xcb_parts[4];
4942 xcb_randr_get_provider_property_cookie_t xcb_ret;
4943 xcb_randr_get_provider_property_request_t xcb_out;
4944
4945 xcb_out.provider = provider;
4946 xcb_out.property = property;
4947 xcb_out.type = type;
4948 xcb_out.long_offset = long_offset;
4949 xcb_out.long_length = long_length;
4950 xcb_out._delete = _delete;
4951 xcb_out.pending = pending;
4952 memset(xcb_out.pad0, 0, 2);
4953
4954 xcb_parts[2].iov_base = (char *) &xcb_out;
4955 xcb_parts[2].iov_len = sizeof(xcb_out);
4956 xcb_parts[3].iov_base = 0;
4957 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4958
4959 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
4960 return xcb_ret;
4961 }
4962
4963 void *
xcb_randr_get_provider_property_data(const xcb_randr_get_provider_property_reply_t * R)4964 xcb_randr_get_provider_property_data (const xcb_randr_get_provider_property_reply_t *R)
4965 {
4966 return (void *) (R + 1);
4967 }
4968
4969 int
xcb_randr_get_provider_property_data_length(const xcb_randr_get_provider_property_reply_t * R)4970 xcb_randr_get_provider_property_data_length (const xcb_randr_get_provider_property_reply_t *R)
4971 {
4972 return (R->num_items * (R->format / 8));
4973 }
4974
4975 xcb_generic_iterator_t
xcb_randr_get_provider_property_data_end(const xcb_randr_get_provider_property_reply_t * R)4976 xcb_randr_get_provider_property_data_end (const xcb_randr_get_provider_property_reply_t *R)
4977 {
4978 xcb_generic_iterator_t i;
4979 i.data = ((char *) (R + 1)) + ((R->num_items * (R->format / 8)));
4980 i.rem = 0;
4981 i.index = (char *) i.data - (char *) R;
4982 return i;
4983 }
4984
4985 xcb_randr_get_provider_property_reply_t *
xcb_randr_get_provider_property_reply(xcb_connection_t * c,xcb_randr_get_provider_property_cookie_t cookie,xcb_generic_error_t ** e)4986 xcb_randr_get_provider_property_reply (xcb_connection_t *c,
4987 xcb_randr_get_provider_property_cookie_t cookie /**< */,
4988 xcb_generic_error_t **e)
4989 {
4990 return (xcb_randr_get_provider_property_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
4991 }
4992
4993 void
xcb_randr_crtc_change_next(xcb_randr_crtc_change_iterator_t * i)4994 xcb_randr_crtc_change_next (xcb_randr_crtc_change_iterator_t *i)
4995 {
4996 --i->rem;
4997 ++i->data;
4998 i->index += sizeof(xcb_randr_crtc_change_t);
4999 }
5000
5001 xcb_generic_iterator_t
xcb_randr_crtc_change_end(xcb_randr_crtc_change_iterator_t i)5002 xcb_randr_crtc_change_end (xcb_randr_crtc_change_iterator_t i)
5003 {
5004 xcb_generic_iterator_t ret;
5005 ret.data = i.data + i.rem;
5006 ret.index = i.index + ((char *) ret.data - (char *) i.data);
5007 ret.rem = 0;
5008 return ret;
5009 }
5010
5011 void
xcb_randr_output_change_next(xcb_randr_output_change_iterator_t * i)5012 xcb_randr_output_change_next (xcb_randr_output_change_iterator_t *i)
5013 {
5014 --i->rem;
5015 ++i->data;
5016 i->index += sizeof(xcb_randr_output_change_t);
5017 }
5018
5019 xcb_generic_iterator_t
xcb_randr_output_change_end(xcb_randr_output_change_iterator_t i)5020 xcb_randr_output_change_end (xcb_randr_output_change_iterator_t i)
5021 {
5022 xcb_generic_iterator_t ret;
5023 ret.data = i.data + i.rem;
5024 ret.index = i.index + ((char *) ret.data - (char *) i.data);
5025 ret.rem = 0;
5026 return ret;
5027 }
5028
5029 void
xcb_randr_output_property_next(xcb_randr_output_property_iterator_t * i)5030 xcb_randr_output_property_next (xcb_randr_output_property_iterator_t *i)
5031 {
5032 --i->rem;
5033 ++i->data;
5034 i->index += sizeof(xcb_randr_output_property_t);
5035 }
5036
5037 xcb_generic_iterator_t
xcb_randr_output_property_end(xcb_randr_output_property_iterator_t i)5038 xcb_randr_output_property_end (xcb_randr_output_property_iterator_t i)
5039 {
5040 xcb_generic_iterator_t ret;
5041 ret.data = i.data + i.rem;
5042 ret.index = i.index + ((char *) ret.data - (char *) i.data);
5043 ret.rem = 0;
5044 return ret;
5045 }
5046
5047 void
xcb_randr_provider_change_next(xcb_randr_provider_change_iterator_t * i)5048 xcb_randr_provider_change_next (xcb_randr_provider_change_iterator_t *i)
5049 {
5050 --i->rem;
5051 ++i->data;
5052 i->index += sizeof(xcb_randr_provider_change_t);
5053 }
5054
5055 xcb_generic_iterator_t
xcb_randr_provider_change_end(xcb_randr_provider_change_iterator_t i)5056 xcb_randr_provider_change_end (xcb_randr_provider_change_iterator_t i)
5057 {
5058 xcb_generic_iterator_t ret;
5059 ret.data = i.data + i.rem;
5060 ret.index = i.index + ((char *) ret.data - (char *) i.data);
5061 ret.rem = 0;
5062 return ret;
5063 }
5064
5065 void
xcb_randr_provider_property_next(xcb_randr_provider_property_iterator_t * i)5066 xcb_randr_provider_property_next (xcb_randr_provider_property_iterator_t *i)
5067 {
5068 --i->rem;
5069 ++i->data;
5070 i->index += sizeof(xcb_randr_provider_property_t);
5071 }
5072
5073 xcb_generic_iterator_t
xcb_randr_provider_property_end(xcb_randr_provider_property_iterator_t i)5074 xcb_randr_provider_property_end (xcb_randr_provider_property_iterator_t i)
5075 {
5076 xcb_generic_iterator_t ret;
5077 ret.data = i.data + i.rem;
5078 ret.index = i.index + ((char *) ret.data - (char *) i.data);
5079 ret.rem = 0;
5080 return ret;
5081 }
5082
5083 void
xcb_randr_resource_change_next(xcb_randr_resource_change_iterator_t * i)5084 xcb_randr_resource_change_next (xcb_randr_resource_change_iterator_t *i)
5085 {
5086 --i->rem;
5087 ++i->data;
5088 i->index += sizeof(xcb_randr_resource_change_t);
5089 }
5090
5091 xcb_generic_iterator_t
xcb_randr_resource_change_end(xcb_randr_resource_change_iterator_t i)5092 xcb_randr_resource_change_end (xcb_randr_resource_change_iterator_t i)
5093 {
5094 xcb_generic_iterator_t ret;
5095 ret.data = i.data + i.rem;
5096 ret.index = i.index + ((char *) ret.data - (char *) i.data);
5097 ret.rem = 0;
5098 return ret;
5099 }
5100
5101 int
xcb_randr_monitor_info_sizeof(const void * _buffer)5102 xcb_randr_monitor_info_sizeof (const void *_buffer)
5103 {
5104 char *xcb_tmp = (char *)_buffer;
5105 const xcb_randr_monitor_info_t *_aux = (xcb_randr_monitor_info_t *)_buffer;
5106 unsigned int xcb_buffer_len = 0;
5107 unsigned int xcb_block_len = 0;
5108 unsigned int xcb_pad = 0;
5109 unsigned int xcb_align_to = 0;
5110
5111
5112 xcb_block_len += sizeof(xcb_randr_monitor_info_t);
5113 xcb_tmp += xcb_block_len;
5114 xcb_buffer_len += xcb_block_len;
5115 xcb_block_len = 0;
5116 /* outputs */
5117 xcb_block_len += _aux->nOutput * sizeof(xcb_randr_output_t);
5118 xcb_tmp += xcb_block_len;
5119 xcb_align_to = ALIGNOF(xcb_randr_output_t);
5120 /* insert padding */
5121 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
5122 xcb_buffer_len += xcb_block_len + xcb_pad;
5123 if (0 != xcb_pad) {
5124 xcb_tmp += xcb_pad;
5125 xcb_pad = 0;
5126 }
5127 xcb_block_len = 0;
5128
5129 return xcb_buffer_len;
5130 }
5131
5132 xcb_randr_output_t *
xcb_randr_monitor_info_outputs(const xcb_randr_monitor_info_t * R)5133 xcb_randr_monitor_info_outputs (const xcb_randr_monitor_info_t *R)
5134 {
5135 return (xcb_randr_output_t *) (R + 1);
5136 }
5137
5138 int
xcb_randr_monitor_info_outputs_length(const xcb_randr_monitor_info_t * R)5139 xcb_randr_monitor_info_outputs_length (const xcb_randr_monitor_info_t *R)
5140 {
5141 return R->nOutput;
5142 }
5143
5144 xcb_generic_iterator_t
xcb_randr_monitor_info_outputs_end(const xcb_randr_monitor_info_t * R)5145 xcb_randr_monitor_info_outputs_end (const xcb_randr_monitor_info_t *R)
5146 {
5147 xcb_generic_iterator_t i;
5148 i.data = ((xcb_randr_output_t *) (R + 1)) + (R->nOutput);
5149 i.rem = 0;
5150 i.index = (char *) i.data - (char *) R;
5151 return i;
5152 }
5153
5154 void
xcb_randr_monitor_info_next(xcb_randr_monitor_info_iterator_t * i)5155 xcb_randr_monitor_info_next (xcb_randr_monitor_info_iterator_t *i)
5156 {
5157 xcb_randr_monitor_info_t *R = i->data;
5158 xcb_generic_iterator_t child;
5159 child.data = (xcb_randr_monitor_info_t *)(((char *)R) + xcb_randr_monitor_info_sizeof(R));
5160 i->index = (char *) child.data - (char *) i->data;
5161 --i->rem;
5162 i->data = (xcb_randr_monitor_info_t *) child.data;
5163 }
5164
5165 xcb_generic_iterator_t
xcb_randr_monitor_info_end(xcb_randr_monitor_info_iterator_t i)5166 xcb_randr_monitor_info_end (xcb_randr_monitor_info_iterator_t i)
5167 {
5168 xcb_generic_iterator_t ret;
5169 while(i.rem > 0)
5170 xcb_randr_monitor_info_next(&i);
5171 ret.data = i.data;
5172 ret.rem = i.rem;
5173 ret.index = i.index;
5174 return ret;
5175 }
5176
5177 int
xcb_randr_get_monitors_sizeof(const void * _buffer)5178 xcb_randr_get_monitors_sizeof (const void *_buffer)
5179 {
5180 char *xcb_tmp = (char *)_buffer;
5181 const xcb_randr_get_monitors_reply_t *_aux = (xcb_randr_get_monitors_reply_t *)_buffer;
5182 unsigned int xcb_buffer_len = 0;
5183 unsigned int xcb_block_len = 0;
5184 unsigned int xcb_pad = 0;
5185 unsigned int xcb_align_to = 0;
5186
5187 unsigned int i;
5188 unsigned int xcb_tmp_len;
5189
5190 xcb_block_len += sizeof(xcb_randr_get_monitors_reply_t);
5191 xcb_tmp += xcb_block_len;
5192 xcb_buffer_len += xcb_block_len;
5193 xcb_block_len = 0;
5194 /* monitors */
5195 for(i=0; i<_aux->nMonitors; i++) {
5196 xcb_tmp_len = xcb_randr_monitor_info_sizeof(xcb_tmp);
5197 xcb_block_len += xcb_tmp_len;
5198 xcb_tmp += xcb_tmp_len;
5199 }
5200 xcb_align_to = ALIGNOF(xcb_randr_monitor_info_t);
5201 /* insert padding */
5202 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
5203 xcb_buffer_len += xcb_block_len + xcb_pad;
5204 if (0 != xcb_pad) {
5205 xcb_tmp += xcb_pad;
5206 xcb_pad = 0;
5207 }
5208 xcb_block_len = 0;
5209
5210 return xcb_buffer_len;
5211 }
5212
5213 xcb_randr_get_monitors_cookie_t
xcb_randr_get_monitors(xcb_connection_t * c,xcb_window_t window,uint8_t get_active)5214 xcb_randr_get_monitors (xcb_connection_t *c,
5215 xcb_window_t window,
5216 uint8_t get_active)
5217 {
5218 static const xcb_protocol_request_t xcb_req = {
5219 .count = 2,
5220 .ext = &xcb_randr_id,
5221 .opcode = XCB_RANDR_GET_MONITORS,
5222 .isvoid = 0
5223 };
5224
5225 struct iovec xcb_parts[4];
5226 xcb_randr_get_monitors_cookie_t xcb_ret;
5227 xcb_randr_get_monitors_request_t xcb_out;
5228
5229 xcb_out.window = window;
5230 xcb_out.get_active = get_active;
5231
5232 xcb_parts[2].iov_base = (char *) &xcb_out;
5233 xcb_parts[2].iov_len = sizeof(xcb_out);
5234 xcb_parts[3].iov_base = 0;
5235 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5236
5237 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
5238 return xcb_ret;
5239 }
5240
5241 xcb_randr_get_monitors_cookie_t
xcb_randr_get_monitors_unchecked(xcb_connection_t * c,xcb_window_t window,uint8_t get_active)5242 xcb_randr_get_monitors_unchecked (xcb_connection_t *c,
5243 xcb_window_t window,
5244 uint8_t get_active)
5245 {
5246 static const xcb_protocol_request_t xcb_req = {
5247 .count = 2,
5248 .ext = &xcb_randr_id,
5249 .opcode = XCB_RANDR_GET_MONITORS,
5250 .isvoid = 0
5251 };
5252
5253 struct iovec xcb_parts[4];
5254 xcb_randr_get_monitors_cookie_t xcb_ret;
5255 xcb_randr_get_monitors_request_t xcb_out;
5256
5257 xcb_out.window = window;
5258 xcb_out.get_active = get_active;
5259
5260 xcb_parts[2].iov_base = (char *) &xcb_out;
5261 xcb_parts[2].iov_len = sizeof(xcb_out);
5262 xcb_parts[3].iov_base = 0;
5263 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5264
5265 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
5266 return xcb_ret;
5267 }
5268
5269 int
xcb_randr_get_monitors_monitors_length(const xcb_randr_get_monitors_reply_t * R)5270 xcb_randr_get_monitors_monitors_length (const xcb_randr_get_monitors_reply_t *R)
5271 {
5272 return R->nMonitors;
5273 }
5274
5275 xcb_randr_monitor_info_iterator_t
xcb_randr_get_monitors_monitors_iterator(const xcb_randr_get_monitors_reply_t * R)5276 xcb_randr_get_monitors_monitors_iterator (const xcb_randr_get_monitors_reply_t *R)
5277 {
5278 xcb_randr_monitor_info_iterator_t i;
5279 i.data = (xcb_randr_monitor_info_t *) (R + 1);
5280 i.rem = R->nMonitors;
5281 i.index = (char *) i.data - (char *) R;
5282 return i;
5283 }
5284
5285 xcb_randr_get_monitors_reply_t *
xcb_randr_get_monitors_reply(xcb_connection_t * c,xcb_randr_get_monitors_cookie_t cookie,xcb_generic_error_t ** e)5286 xcb_randr_get_monitors_reply (xcb_connection_t *c,
5287 xcb_randr_get_monitors_cookie_t cookie /**< */,
5288 xcb_generic_error_t **e)
5289 {
5290 return (xcb_randr_get_monitors_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
5291 }
5292
5293 int
xcb_randr_set_monitor_sizeof(const void * _buffer)5294 xcb_randr_set_monitor_sizeof (const void *_buffer)
5295 {
5296 char *xcb_tmp = (char *)_buffer;
5297 unsigned int xcb_buffer_len = 0;
5298 unsigned int xcb_block_len = 0;
5299 unsigned int xcb_pad = 0;
5300 unsigned int xcb_align_to = 0;
5301
5302
5303 xcb_block_len += sizeof(xcb_randr_set_monitor_request_t);
5304 xcb_tmp += xcb_block_len;
5305 xcb_buffer_len += xcb_block_len;
5306 xcb_block_len = 0;
5307 /* monitorinfo */
5308 xcb_block_len += xcb_randr_monitor_info_sizeof(xcb_tmp);
5309 xcb_tmp += xcb_block_len;
5310 xcb_align_to = ALIGNOF(xcb_randr_monitor_info_t);
5311 /* insert padding */
5312 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
5313 xcb_buffer_len += xcb_block_len + xcb_pad;
5314 if (0 != xcb_pad) {
5315 xcb_tmp += xcb_pad;
5316 xcb_pad = 0;
5317 }
5318 xcb_block_len = 0;
5319
5320 return xcb_buffer_len;
5321 }
5322
5323 xcb_void_cookie_t
xcb_randr_set_monitor_checked(xcb_connection_t * c,xcb_window_t window,xcb_randr_monitor_info_t * monitorinfo)5324 xcb_randr_set_monitor_checked (xcb_connection_t *c,
5325 xcb_window_t window,
5326 xcb_randr_monitor_info_t *monitorinfo)
5327 {
5328 static const xcb_protocol_request_t xcb_req = {
5329 .count = 3,
5330 .ext = &xcb_randr_id,
5331 .opcode = XCB_RANDR_SET_MONITOR,
5332 .isvoid = 1
5333 };
5334
5335 struct iovec xcb_parts[5];
5336 xcb_void_cookie_t xcb_ret;
5337 xcb_randr_set_monitor_request_t xcb_out;
5338
5339 xcb_out.window = window;
5340
5341 xcb_parts[2].iov_base = (char *) &xcb_out;
5342 xcb_parts[2].iov_len = sizeof(xcb_out);
5343 xcb_parts[3].iov_base = 0;
5344 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5345 /* xcb_randr_monitor_info_t monitorinfo */
5346 xcb_parts[4].iov_base = (char *) monitorinfo;
5347 xcb_parts[4].iov_len =
5348 xcb_randr_monitor_info_sizeof (monitorinfo);
5349
5350 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
5351 return xcb_ret;
5352 }
5353
5354 xcb_void_cookie_t
xcb_randr_set_monitor(xcb_connection_t * c,xcb_window_t window,xcb_randr_monitor_info_t * monitorinfo)5355 xcb_randr_set_monitor (xcb_connection_t *c,
5356 xcb_window_t window,
5357 xcb_randr_monitor_info_t *monitorinfo)
5358 {
5359 static const xcb_protocol_request_t xcb_req = {
5360 .count = 3,
5361 .ext = &xcb_randr_id,
5362 .opcode = XCB_RANDR_SET_MONITOR,
5363 .isvoid = 1
5364 };
5365
5366 struct iovec xcb_parts[5];
5367 xcb_void_cookie_t xcb_ret;
5368 xcb_randr_set_monitor_request_t xcb_out;
5369
5370 xcb_out.window = window;
5371
5372 xcb_parts[2].iov_base = (char *) &xcb_out;
5373 xcb_parts[2].iov_len = sizeof(xcb_out);
5374 xcb_parts[3].iov_base = 0;
5375 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5376 /* xcb_randr_monitor_info_t monitorinfo */
5377 xcb_parts[4].iov_base = (char *) monitorinfo;
5378 xcb_parts[4].iov_len =
5379 xcb_randr_monitor_info_sizeof (monitorinfo);
5380
5381 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
5382 return xcb_ret;
5383 }
5384
5385 xcb_randr_monitor_info_t *
xcb_randr_set_monitor_monitorinfo(const xcb_randr_set_monitor_request_t * R)5386 xcb_randr_set_monitor_monitorinfo (const xcb_randr_set_monitor_request_t *R)
5387 {
5388 return (xcb_randr_monitor_info_t *) (R + 1);
5389 }
5390
5391 xcb_void_cookie_t
xcb_randr_delete_monitor_checked(xcb_connection_t * c,xcb_window_t window,xcb_atom_t name)5392 xcb_randr_delete_monitor_checked (xcb_connection_t *c,
5393 xcb_window_t window,
5394 xcb_atom_t name)
5395 {
5396 static const xcb_protocol_request_t xcb_req = {
5397 .count = 2,
5398 .ext = &xcb_randr_id,
5399 .opcode = XCB_RANDR_DELETE_MONITOR,
5400 .isvoid = 1
5401 };
5402
5403 struct iovec xcb_parts[4];
5404 xcb_void_cookie_t xcb_ret;
5405 xcb_randr_delete_monitor_request_t xcb_out;
5406
5407 xcb_out.window = window;
5408 xcb_out.name = name;
5409
5410 xcb_parts[2].iov_base = (char *) &xcb_out;
5411 xcb_parts[2].iov_len = sizeof(xcb_out);
5412 xcb_parts[3].iov_base = 0;
5413 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5414
5415 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
5416 return xcb_ret;
5417 }
5418
5419 xcb_void_cookie_t
xcb_randr_delete_monitor(xcb_connection_t * c,xcb_window_t window,xcb_atom_t name)5420 xcb_randr_delete_monitor (xcb_connection_t *c,
5421 xcb_window_t window,
5422 xcb_atom_t name)
5423 {
5424 static const xcb_protocol_request_t xcb_req = {
5425 .count = 2,
5426 .ext = &xcb_randr_id,
5427 .opcode = XCB_RANDR_DELETE_MONITOR,
5428 .isvoid = 1
5429 };
5430
5431 struct iovec xcb_parts[4];
5432 xcb_void_cookie_t xcb_ret;
5433 xcb_randr_delete_monitor_request_t xcb_out;
5434
5435 xcb_out.window = window;
5436 xcb_out.name = name;
5437
5438 xcb_parts[2].iov_base = (char *) &xcb_out;
5439 xcb_parts[2].iov_len = sizeof(xcb_out);
5440 xcb_parts[3].iov_base = 0;
5441 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5442
5443 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
5444 return xcb_ret;
5445 }
5446
5447 int
xcb_randr_create_lease_sizeof(const void * _buffer)5448 xcb_randr_create_lease_sizeof (const void *_buffer)
5449 {
5450 char *xcb_tmp = (char *)_buffer;
5451 const xcb_randr_create_lease_request_t *_aux = (xcb_randr_create_lease_request_t *)_buffer;
5452 unsigned int xcb_buffer_len = 0;
5453 unsigned int xcb_block_len = 0;
5454 unsigned int xcb_pad = 0;
5455 unsigned int xcb_align_to = 0;
5456
5457
5458 xcb_block_len += sizeof(xcb_randr_create_lease_request_t);
5459 xcb_tmp += xcb_block_len;
5460 xcb_buffer_len += xcb_block_len;
5461 xcb_block_len = 0;
5462 /* crtcs */
5463 xcb_block_len += _aux->num_crtcs * sizeof(xcb_randr_output_t);
5464 xcb_tmp += xcb_block_len;
5465 xcb_align_to = ALIGNOF(xcb_randr_crtc_t);
5466 /* insert padding */
5467 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
5468 xcb_buffer_len += xcb_block_len + xcb_pad;
5469 if (0 != xcb_pad) {
5470 xcb_tmp += xcb_pad;
5471 xcb_pad = 0;
5472 }
5473 xcb_block_len = 0;
5474 /* outputs */
5475 xcb_block_len += _aux->num_outputs * sizeof(xcb_randr_output_t);
5476 xcb_tmp += xcb_block_len;
5477 xcb_align_to = ALIGNOF(xcb_randr_output_t);
5478 /* insert padding */
5479 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
5480 xcb_buffer_len += xcb_block_len + xcb_pad;
5481 if (0 != xcb_pad) {
5482 xcb_tmp += xcb_pad;
5483 xcb_pad = 0;
5484 }
5485 xcb_block_len = 0;
5486
5487 return xcb_buffer_len;
5488 }
5489
5490 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)5491 xcb_randr_create_lease (xcb_connection_t *c,
5492 xcb_window_t window,
5493 xcb_randr_lease_t lid,
5494 uint16_t num_crtcs,
5495 uint16_t num_outputs,
5496 const xcb_randr_crtc_t *crtcs,
5497 const xcb_randr_output_t *outputs)
5498 {
5499 static const xcb_protocol_request_t xcb_req = {
5500 .count = 6,
5501 .ext = &xcb_randr_id,
5502 .opcode = XCB_RANDR_CREATE_LEASE,
5503 .isvoid = 0
5504 };
5505
5506 struct iovec xcb_parts[8];
5507 xcb_randr_create_lease_cookie_t xcb_ret;
5508 xcb_randr_create_lease_request_t xcb_out;
5509
5510 xcb_out.window = window;
5511 xcb_out.lid = lid;
5512 xcb_out.num_crtcs = num_crtcs;
5513 xcb_out.num_outputs = num_outputs;
5514
5515 xcb_parts[2].iov_base = (char *) &xcb_out;
5516 xcb_parts[2].iov_len = sizeof(xcb_out);
5517 xcb_parts[3].iov_base = 0;
5518 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5519 /* xcb_randr_crtc_t crtcs */
5520 xcb_parts[4].iov_base = (char *) crtcs;
5521 xcb_parts[4].iov_len = num_crtcs * sizeof(uint32_t);
5522 xcb_parts[5].iov_base = 0;
5523 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
5524 /* xcb_randr_output_t outputs */
5525 xcb_parts[6].iov_base = (char *) outputs;
5526 xcb_parts[6].iov_len = num_outputs * sizeof(uint32_t);
5527 xcb_parts[7].iov_base = 0;
5528 xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3;
5529
5530 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED|XCB_REQUEST_REPLY_FDS, xcb_parts + 2, &xcb_req);
5531 return xcb_ret;
5532 }
5533
5534 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)5535 xcb_randr_create_lease_unchecked (xcb_connection_t *c,
5536 xcb_window_t window,
5537 xcb_randr_lease_t lid,
5538 uint16_t num_crtcs,
5539 uint16_t num_outputs,
5540 const xcb_randr_crtc_t *crtcs,
5541 const xcb_randr_output_t *outputs)
5542 {
5543 static const xcb_protocol_request_t xcb_req = {
5544 .count = 6,
5545 .ext = &xcb_randr_id,
5546 .opcode = XCB_RANDR_CREATE_LEASE,
5547 .isvoid = 0
5548 };
5549
5550 struct iovec xcb_parts[8];
5551 xcb_randr_create_lease_cookie_t xcb_ret;
5552 xcb_randr_create_lease_request_t xcb_out;
5553
5554 xcb_out.window = window;
5555 xcb_out.lid = lid;
5556 xcb_out.num_crtcs = num_crtcs;
5557 xcb_out.num_outputs = num_outputs;
5558
5559 xcb_parts[2].iov_base = (char *) &xcb_out;
5560 xcb_parts[2].iov_len = sizeof(xcb_out);
5561 xcb_parts[3].iov_base = 0;
5562 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5563 /* xcb_randr_crtc_t crtcs */
5564 xcb_parts[4].iov_base = (char *) crtcs;
5565 xcb_parts[4].iov_len = num_crtcs * sizeof(uint32_t);
5566 xcb_parts[5].iov_base = 0;
5567 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
5568 /* xcb_randr_output_t outputs */
5569 xcb_parts[6].iov_base = (char *) outputs;
5570 xcb_parts[6].iov_len = num_outputs * sizeof(uint32_t);
5571 xcb_parts[7].iov_base = 0;
5572 xcb_parts[7].iov_len = -xcb_parts[6].iov_len & 3;
5573
5574 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_REPLY_FDS, xcb_parts + 2, &xcb_req);
5575 return xcb_ret;
5576 }
5577
5578 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)5579 xcb_randr_create_lease_reply (xcb_connection_t *c,
5580 xcb_randr_create_lease_cookie_t cookie /**< */,
5581 xcb_generic_error_t **e)
5582 {
5583 return (xcb_randr_create_lease_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
5584 }
5585
5586 int *
xcb_randr_create_lease_reply_fds(xcb_connection_t * c,xcb_randr_create_lease_reply_t * reply)5587 xcb_randr_create_lease_reply_fds (xcb_connection_t *c /**< */,
5588 xcb_randr_create_lease_reply_t *reply)
5589 {
5590 return xcb_get_reply_fds(c, reply, sizeof(xcb_randr_create_lease_reply_t) + 4 * reply->length);
5591 }
5592
5593 xcb_void_cookie_t
xcb_randr_free_lease_checked(xcb_connection_t * c,xcb_randr_lease_t lid,uint8_t terminate)5594 xcb_randr_free_lease_checked (xcb_connection_t *c,
5595 xcb_randr_lease_t lid,
5596 uint8_t terminate)
5597 {
5598 static const xcb_protocol_request_t xcb_req = {
5599 .count = 2,
5600 .ext = &xcb_randr_id,
5601 .opcode = XCB_RANDR_FREE_LEASE,
5602 .isvoid = 1
5603 };
5604
5605 struct iovec xcb_parts[4];
5606 xcb_void_cookie_t xcb_ret;
5607 xcb_randr_free_lease_request_t xcb_out;
5608
5609 xcb_out.lid = lid;
5610 xcb_out.terminate = terminate;
5611
5612 xcb_parts[2].iov_base = (char *) &xcb_out;
5613 xcb_parts[2].iov_len = sizeof(xcb_out);
5614 xcb_parts[3].iov_base = 0;
5615 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5616
5617 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
5618 return xcb_ret;
5619 }
5620
5621 xcb_void_cookie_t
xcb_randr_free_lease(xcb_connection_t * c,xcb_randr_lease_t lid,uint8_t terminate)5622 xcb_randr_free_lease (xcb_connection_t *c,
5623 xcb_randr_lease_t lid,
5624 uint8_t terminate)
5625 {
5626 static const xcb_protocol_request_t xcb_req = {
5627 .count = 2,
5628 .ext = &xcb_randr_id,
5629 .opcode = XCB_RANDR_FREE_LEASE,
5630 .isvoid = 1
5631 };
5632
5633 struct iovec xcb_parts[4];
5634 xcb_void_cookie_t xcb_ret;
5635 xcb_randr_free_lease_request_t xcb_out;
5636
5637 xcb_out.lid = lid;
5638 xcb_out.terminate = terminate;
5639
5640 xcb_parts[2].iov_base = (char *) &xcb_out;
5641 xcb_parts[2].iov_len = sizeof(xcb_out);
5642 xcb_parts[3].iov_base = 0;
5643 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5644
5645 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
5646 return xcb_ret;
5647 }
5648
5649 void
xcb_randr_lease_notify_next(xcb_randr_lease_notify_iterator_t * i)5650 xcb_randr_lease_notify_next (xcb_randr_lease_notify_iterator_t *i)
5651 {
5652 --i->rem;
5653 ++i->data;
5654 i->index += sizeof(xcb_randr_lease_notify_t);
5655 }
5656
5657 xcb_generic_iterator_t
xcb_randr_lease_notify_end(xcb_randr_lease_notify_iterator_t i)5658 xcb_randr_lease_notify_end (xcb_randr_lease_notify_iterator_t i)
5659 {
5660 xcb_generic_iterator_t ret;
5661 ret.data = i.data + i.rem;
5662 ret.index = i.index + ((char *) ret.data - (char *) i.data);
5663 ret.rem = 0;
5664 return ret;
5665 }
5666
5667 void
xcb_randr_notify_data_next(xcb_randr_notify_data_iterator_t * i)5668 xcb_randr_notify_data_next (xcb_randr_notify_data_iterator_t *i)
5669 {
5670 --i->rem;
5671 ++i->data;
5672 i->index += sizeof(xcb_randr_notify_data_t);
5673 }
5674
5675 xcb_generic_iterator_t
xcb_randr_notify_data_end(xcb_randr_notify_data_iterator_t i)5676 xcb_randr_notify_data_end (xcb_randr_notify_data_iterator_t i)
5677 {
5678 xcb_generic_iterator_t ret;
5679 ret.data = i.data + i.rem;
5680 ret.index = i.index + ((char *) ret.data - (char *) i.data);
5681 ret.rem = 0;
5682 return ret;
5683 }
5684
5685