1 /*
2 * This file generated automatically from xproto.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 "xproto.h"
15
16 #define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member)
17
18 void
xcb_char2b_next(xcb_char2b_iterator_t * i)19 xcb_char2b_next (xcb_char2b_iterator_t *i /**< */)
20 {
21 --i->rem;
22 ++i->data;
23 i->index += sizeof(xcb_char2b_t);
24 }
25
26 xcb_generic_iterator_t
xcb_char2b_end(xcb_char2b_iterator_t i)27 xcb_char2b_end (xcb_char2b_iterator_t i /**< */)
28 {
29 xcb_generic_iterator_t ret;
30 ret.data = i.data + i.rem;
31 ret.index = i.index + ((char *) ret.data - (char *) i.data);
32 ret.rem = 0;
33 return ret;
34 }
35
36 void
xcb_window_next(xcb_window_iterator_t * i)37 xcb_window_next (xcb_window_iterator_t *i /**< */)
38 {
39 --i->rem;
40 ++i->data;
41 i->index += sizeof(xcb_window_t);
42 }
43
44 xcb_generic_iterator_t
xcb_window_end(xcb_window_iterator_t i)45 xcb_window_end (xcb_window_iterator_t i /**< */)
46 {
47 xcb_generic_iterator_t ret;
48 ret.data = i.data + i.rem;
49 ret.index = i.index + ((char *) ret.data - (char *) i.data);
50 ret.rem = 0;
51 return ret;
52 }
53
54 void
xcb_pixmap_next(xcb_pixmap_iterator_t * i)55 xcb_pixmap_next (xcb_pixmap_iterator_t *i /**< */)
56 {
57 --i->rem;
58 ++i->data;
59 i->index += sizeof(xcb_pixmap_t);
60 }
61
62 xcb_generic_iterator_t
xcb_pixmap_end(xcb_pixmap_iterator_t i)63 xcb_pixmap_end (xcb_pixmap_iterator_t i /**< */)
64 {
65 xcb_generic_iterator_t ret;
66 ret.data = i.data + i.rem;
67 ret.index = i.index + ((char *) ret.data - (char *) i.data);
68 ret.rem = 0;
69 return ret;
70 }
71
72 void
xcb_cursor_next(xcb_cursor_iterator_t * i)73 xcb_cursor_next (xcb_cursor_iterator_t *i /**< */)
74 {
75 --i->rem;
76 ++i->data;
77 i->index += sizeof(xcb_cursor_t);
78 }
79
80 xcb_generic_iterator_t
xcb_cursor_end(xcb_cursor_iterator_t i)81 xcb_cursor_end (xcb_cursor_iterator_t i /**< */)
82 {
83 xcb_generic_iterator_t ret;
84 ret.data = i.data + i.rem;
85 ret.index = i.index + ((char *) ret.data - (char *) i.data);
86 ret.rem = 0;
87 return ret;
88 }
89
90 void
xcb_font_next(xcb_font_iterator_t * i)91 xcb_font_next (xcb_font_iterator_t *i /**< */)
92 {
93 --i->rem;
94 ++i->data;
95 i->index += sizeof(xcb_font_t);
96 }
97
98 xcb_generic_iterator_t
xcb_font_end(xcb_font_iterator_t i)99 xcb_font_end (xcb_font_iterator_t i /**< */)
100 {
101 xcb_generic_iterator_t ret;
102 ret.data = i.data + i.rem;
103 ret.index = i.index + ((char *) ret.data - (char *) i.data);
104 ret.rem = 0;
105 return ret;
106 }
107
108 void
xcb_gcontext_next(xcb_gcontext_iterator_t * i)109 xcb_gcontext_next (xcb_gcontext_iterator_t *i /**< */)
110 {
111 --i->rem;
112 ++i->data;
113 i->index += sizeof(xcb_gcontext_t);
114 }
115
116 xcb_generic_iterator_t
xcb_gcontext_end(xcb_gcontext_iterator_t i)117 xcb_gcontext_end (xcb_gcontext_iterator_t i /**< */)
118 {
119 xcb_generic_iterator_t ret;
120 ret.data = i.data + i.rem;
121 ret.index = i.index + ((char *) ret.data - (char *) i.data);
122 ret.rem = 0;
123 return ret;
124 }
125
126 void
xcb_colormap_next(xcb_colormap_iterator_t * i)127 xcb_colormap_next (xcb_colormap_iterator_t *i /**< */)
128 {
129 --i->rem;
130 ++i->data;
131 i->index += sizeof(xcb_colormap_t);
132 }
133
134 xcb_generic_iterator_t
xcb_colormap_end(xcb_colormap_iterator_t i)135 xcb_colormap_end (xcb_colormap_iterator_t i /**< */)
136 {
137 xcb_generic_iterator_t ret;
138 ret.data = i.data + i.rem;
139 ret.index = i.index + ((char *) ret.data - (char *) i.data);
140 ret.rem = 0;
141 return ret;
142 }
143
144 void
xcb_atom_next(xcb_atom_iterator_t * i)145 xcb_atom_next (xcb_atom_iterator_t *i /**< */)
146 {
147 --i->rem;
148 ++i->data;
149 i->index += sizeof(xcb_atom_t);
150 }
151
152 xcb_generic_iterator_t
xcb_atom_end(xcb_atom_iterator_t i)153 xcb_atom_end (xcb_atom_iterator_t i /**< */)
154 {
155 xcb_generic_iterator_t ret;
156 ret.data = i.data + i.rem;
157 ret.index = i.index + ((char *) ret.data - (char *) i.data);
158 ret.rem = 0;
159 return ret;
160 }
161
162 void
xcb_drawable_next(xcb_drawable_iterator_t * i)163 xcb_drawable_next (xcb_drawable_iterator_t *i /**< */)
164 {
165 --i->rem;
166 ++i->data;
167 i->index += sizeof(xcb_drawable_t);
168 }
169
170 xcb_generic_iterator_t
xcb_drawable_end(xcb_drawable_iterator_t i)171 xcb_drawable_end (xcb_drawable_iterator_t i /**< */)
172 {
173 xcb_generic_iterator_t ret;
174 ret.data = i.data + i.rem;
175 ret.index = i.index + ((char *) ret.data - (char *) i.data);
176 ret.rem = 0;
177 return ret;
178 }
179
180 void
xcb_fontable_next(xcb_fontable_iterator_t * i)181 xcb_fontable_next (xcb_fontable_iterator_t *i /**< */)
182 {
183 --i->rem;
184 ++i->data;
185 i->index += sizeof(xcb_fontable_t);
186 }
187
188 xcb_generic_iterator_t
xcb_fontable_end(xcb_fontable_iterator_t i)189 xcb_fontable_end (xcb_fontable_iterator_t i /**< */)
190 {
191 xcb_generic_iterator_t ret;
192 ret.data = i.data + i.rem;
193 ret.index = i.index + ((char *) ret.data - (char *) i.data);
194 ret.rem = 0;
195 return ret;
196 }
197
198 void
xcb_visualid_next(xcb_visualid_iterator_t * i)199 xcb_visualid_next (xcb_visualid_iterator_t *i /**< */)
200 {
201 --i->rem;
202 ++i->data;
203 i->index += sizeof(xcb_visualid_t);
204 }
205
206 xcb_generic_iterator_t
xcb_visualid_end(xcb_visualid_iterator_t i)207 xcb_visualid_end (xcb_visualid_iterator_t i /**< */)
208 {
209 xcb_generic_iterator_t ret;
210 ret.data = i.data + i.rem;
211 ret.index = i.index + ((char *) ret.data - (char *) i.data);
212 ret.rem = 0;
213 return ret;
214 }
215
216 void
xcb_timestamp_next(xcb_timestamp_iterator_t * i)217 xcb_timestamp_next (xcb_timestamp_iterator_t *i /**< */)
218 {
219 --i->rem;
220 ++i->data;
221 i->index += sizeof(xcb_timestamp_t);
222 }
223
224 xcb_generic_iterator_t
xcb_timestamp_end(xcb_timestamp_iterator_t i)225 xcb_timestamp_end (xcb_timestamp_iterator_t i /**< */)
226 {
227 xcb_generic_iterator_t ret;
228 ret.data = i.data + i.rem;
229 ret.index = i.index + ((char *) ret.data - (char *) i.data);
230 ret.rem = 0;
231 return ret;
232 }
233
234 void
xcb_keysym_next(xcb_keysym_iterator_t * i)235 xcb_keysym_next (xcb_keysym_iterator_t *i /**< */)
236 {
237 --i->rem;
238 ++i->data;
239 i->index += sizeof(xcb_keysym_t);
240 }
241
242 xcb_generic_iterator_t
xcb_keysym_end(xcb_keysym_iterator_t i)243 xcb_keysym_end (xcb_keysym_iterator_t i /**< */)
244 {
245 xcb_generic_iterator_t ret;
246 ret.data = i.data + i.rem;
247 ret.index = i.index + ((char *) ret.data - (char *) i.data);
248 ret.rem = 0;
249 return ret;
250 }
251
252 void
xcb_keycode_next(xcb_keycode_iterator_t * i)253 xcb_keycode_next (xcb_keycode_iterator_t *i /**< */)
254 {
255 --i->rem;
256 ++i->data;
257 i->index += sizeof(xcb_keycode_t);
258 }
259
260 xcb_generic_iterator_t
xcb_keycode_end(xcb_keycode_iterator_t i)261 xcb_keycode_end (xcb_keycode_iterator_t i /**< */)
262 {
263 xcb_generic_iterator_t ret;
264 ret.data = i.data + i.rem;
265 ret.index = i.index + ((char *) ret.data - (char *) i.data);
266 ret.rem = 0;
267 return ret;
268 }
269
270 void
xcb_button_next(xcb_button_iterator_t * i)271 xcb_button_next (xcb_button_iterator_t *i /**< */)
272 {
273 --i->rem;
274 ++i->data;
275 i->index += sizeof(xcb_button_t);
276 }
277
278 xcb_generic_iterator_t
xcb_button_end(xcb_button_iterator_t i)279 xcb_button_end (xcb_button_iterator_t i /**< */)
280 {
281 xcb_generic_iterator_t ret;
282 ret.data = i.data + i.rem;
283 ret.index = i.index + ((char *) ret.data - (char *) i.data);
284 ret.rem = 0;
285 return ret;
286 }
287
288 void
xcb_point_next(xcb_point_iterator_t * i)289 xcb_point_next (xcb_point_iterator_t *i /**< */)
290 {
291 --i->rem;
292 ++i->data;
293 i->index += sizeof(xcb_point_t);
294 }
295
296 xcb_generic_iterator_t
xcb_point_end(xcb_point_iterator_t i)297 xcb_point_end (xcb_point_iterator_t i /**< */)
298 {
299 xcb_generic_iterator_t ret;
300 ret.data = i.data + i.rem;
301 ret.index = i.index + ((char *) ret.data - (char *) i.data);
302 ret.rem = 0;
303 return ret;
304 }
305
306 void
xcb_rectangle_next(xcb_rectangle_iterator_t * i)307 xcb_rectangle_next (xcb_rectangle_iterator_t *i /**< */)
308 {
309 --i->rem;
310 ++i->data;
311 i->index += sizeof(xcb_rectangle_t);
312 }
313
314 xcb_generic_iterator_t
xcb_rectangle_end(xcb_rectangle_iterator_t i)315 xcb_rectangle_end (xcb_rectangle_iterator_t i /**< */)
316 {
317 xcb_generic_iterator_t ret;
318 ret.data = i.data + i.rem;
319 ret.index = i.index + ((char *) ret.data - (char *) i.data);
320 ret.rem = 0;
321 return ret;
322 }
323
324 void
xcb_arc_next(xcb_arc_iterator_t * i)325 xcb_arc_next (xcb_arc_iterator_t *i /**< */)
326 {
327 --i->rem;
328 ++i->data;
329 i->index += sizeof(xcb_arc_t);
330 }
331
332 xcb_generic_iterator_t
xcb_arc_end(xcb_arc_iterator_t i)333 xcb_arc_end (xcb_arc_iterator_t i /**< */)
334 {
335 xcb_generic_iterator_t ret;
336 ret.data = i.data + i.rem;
337 ret.index = i.index + ((char *) ret.data - (char *) i.data);
338 ret.rem = 0;
339 return ret;
340 }
341
342 void
xcb_format_next(xcb_format_iterator_t * i)343 xcb_format_next (xcb_format_iterator_t *i /**< */)
344 {
345 --i->rem;
346 ++i->data;
347 i->index += sizeof(xcb_format_t);
348 }
349
350 xcb_generic_iterator_t
xcb_format_end(xcb_format_iterator_t i)351 xcb_format_end (xcb_format_iterator_t i /**< */)
352 {
353 xcb_generic_iterator_t ret;
354 ret.data = i.data + i.rem;
355 ret.index = i.index + ((char *) ret.data - (char *) i.data);
356 ret.rem = 0;
357 return ret;
358 }
359
360 void
xcb_visualtype_next(xcb_visualtype_iterator_t * i)361 xcb_visualtype_next (xcb_visualtype_iterator_t *i /**< */)
362 {
363 --i->rem;
364 ++i->data;
365 i->index += sizeof(xcb_visualtype_t);
366 }
367
368 xcb_generic_iterator_t
xcb_visualtype_end(xcb_visualtype_iterator_t i)369 xcb_visualtype_end (xcb_visualtype_iterator_t i /**< */)
370 {
371 xcb_generic_iterator_t ret;
372 ret.data = i.data + i.rem;
373 ret.index = i.index + ((char *) ret.data - (char *) i.data);
374 ret.rem = 0;
375 return ret;
376 }
377
378 int
xcb_depth_sizeof(const void * _buffer)379 xcb_depth_sizeof (const void *_buffer /**< */)
380 {
381 char *xcb_tmp = (char *)_buffer;
382 const xcb_depth_t *_aux = (xcb_depth_t *)_buffer;
383 unsigned int xcb_buffer_len = 0;
384 unsigned int xcb_block_len = 0;
385 unsigned int xcb_pad = 0;
386 unsigned int xcb_align_to = 0;
387
388
389 xcb_block_len += sizeof(xcb_depth_t);
390 xcb_tmp += xcb_block_len;
391 xcb_buffer_len += xcb_block_len;
392 xcb_block_len = 0;
393 /* visuals */
394 xcb_block_len += _aux->visuals_len * sizeof(xcb_visualtype_t);
395 xcb_tmp += xcb_block_len;
396 xcb_align_to = ALIGNOF(xcb_visualtype_t);
397 /* insert padding */
398 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
399 xcb_buffer_len += xcb_block_len + xcb_pad;
400 if (0 != xcb_pad) {
401 xcb_tmp += xcb_pad;
402 xcb_pad = 0;
403 }
404 xcb_block_len = 0;
405
406 return xcb_buffer_len;
407 }
408
409 xcb_visualtype_t *
xcb_depth_visuals(const xcb_depth_t * R)410 xcb_depth_visuals (const xcb_depth_t *R /**< */)
411 {
412 return (xcb_visualtype_t *) (R + 1);
413 }
414
415 int
xcb_depth_visuals_length(const xcb_depth_t * R)416 xcb_depth_visuals_length (const xcb_depth_t *R /**< */)
417 {
418 return R->visuals_len;
419 }
420
421 xcb_visualtype_iterator_t
xcb_depth_visuals_iterator(const xcb_depth_t * R)422 xcb_depth_visuals_iterator (const xcb_depth_t *R /**< */)
423 {
424 xcb_visualtype_iterator_t i;
425 i.data = (xcb_visualtype_t *) (R + 1);
426 i.rem = R->visuals_len;
427 i.index = (char *) i.data - (char *) R;
428 return i;
429 }
430
431 void
xcb_depth_next(xcb_depth_iterator_t * i)432 xcb_depth_next (xcb_depth_iterator_t *i /**< */)
433 {
434 xcb_depth_t *R = i->data;
435 xcb_generic_iterator_t child;
436 child.data = (xcb_depth_t *)(((char *)R) + xcb_depth_sizeof(R));
437 i->index = (char *) child.data - (char *) i->data;
438 --i->rem;
439 i->data = (xcb_depth_t *) child.data;
440 }
441
442 xcb_generic_iterator_t
xcb_depth_end(xcb_depth_iterator_t i)443 xcb_depth_end (xcb_depth_iterator_t i /**< */)
444 {
445 xcb_generic_iterator_t ret;
446 while(i.rem > 0)
447 xcb_depth_next(&i);
448 ret.data = i.data;
449 ret.rem = i.rem;
450 ret.index = i.index;
451 return ret;
452 }
453
454 int
xcb_screen_sizeof(const void * _buffer)455 xcb_screen_sizeof (const void *_buffer /**< */)
456 {
457 char *xcb_tmp = (char *)_buffer;
458 const xcb_screen_t *_aux = (xcb_screen_t *)_buffer;
459 unsigned int xcb_buffer_len = 0;
460 unsigned int xcb_block_len = 0;
461 unsigned int xcb_pad = 0;
462 unsigned int xcb_align_to = 0;
463
464 unsigned int i;
465 unsigned int xcb_tmp_len;
466
467 xcb_block_len += sizeof(xcb_screen_t);
468 xcb_tmp += xcb_block_len;
469 xcb_buffer_len += xcb_block_len;
470 xcb_block_len = 0;
471 /* allowed_depths */
472 for(i=0; i<_aux->allowed_depths_len; i++) {
473 xcb_tmp_len = xcb_depth_sizeof(xcb_tmp);
474 xcb_block_len += xcb_tmp_len;
475 xcb_tmp += xcb_tmp_len;
476 }
477 xcb_align_to = ALIGNOF(xcb_depth_t);
478 /* insert padding */
479 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
480 xcb_buffer_len += xcb_block_len + xcb_pad;
481 if (0 != xcb_pad) {
482 xcb_tmp += xcb_pad;
483 xcb_pad = 0;
484 }
485 xcb_block_len = 0;
486
487 return xcb_buffer_len;
488 }
489
490 int
xcb_screen_allowed_depths_length(const xcb_screen_t * R)491 xcb_screen_allowed_depths_length (const xcb_screen_t *R /**< */)
492 {
493 return R->allowed_depths_len;
494 }
495
496 xcb_depth_iterator_t
xcb_screen_allowed_depths_iterator(const xcb_screen_t * R)497 xcb_screen_allowed_depths_iterator (const xcb_screen_t *R /**< */)
498 {
499 xcb_depth_iterator_t i;
500 i.data = (xcb_depth_t *) (R + 1);
501 i.rem = R->allowed_depths_len;
502 i.index = (char *) i.data - (char *) R;
503 return i;
504 }
505
506 void
xcb_screen_next(xcb_screen_iterator_t * i)507 xcb_screen_next (xcb_screen_iterator_t *i /**< */)
508 {
509 xcb_screen_t *R = i->data;
510 xcb_generic_iterator_t child;
511 child.data = (xcb_screen_t *)(((char *)R) + xcb_screen_sizeof(R));
512 i->index = (char *) child.data - (char *) i->data;
513 --i->rem;
514 i->data = (xcb_screen_t *) child.data;
515 }
516
517 xcb_generic_iterator_t
xcb_screen_end(xcb_screen_iterator_t i)518 xcb_screen_end (xcb_screen_iterator_t i /**< */)
519 {
520 xcb_generic_iterator_t ret;
521 while(i.rem > 0)
522 xcb_screen_next(&i);
523 ret.data = i.data;
524 ret.rem = i.rem;
525 ret.index = i.index;
526 return ret;
527 }
528
529 int
xcb_setup_request_sizeof(const void * _buffer)530 xcb_setup_request_sizeof (const void *_buffer /**< */)
531 {
532 char *xcb_tmp = (char *)_buffer;
533 const xcb_setup_request_t *_aux = (xcb_setup_request_t *)_buffer;
534 unsigned int xcb_buffer_len = 0;
535 unsigned int xcb_block_len = 0;
536 unsigned int xcb_pad = 0;
537 unsigned int xcb_align_to = 0;
538
539
540 xcb_block_len += sizeof(xcb_setup_request_t);
541 xcb_tmp += xcb_block_len;
542 xcb_buffer_len += xcb_block_len;
543 xcb_block_len = 0;
544 /* authorization_protocol_name */
545 xcb_block_len += _aux->authorization_protocol_name_len * sizeof(char);
546 xcb_tmp += xcb_block_len;
547 xcb_align_to = ALIGNOF(char);
548 /* insert padding */
549 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
550 xcb_buffer_len += xcb_block_len + xcb_pad;
551 if (0 != xcb_pad) {
552 xcb_tmp += xcb_pad;
553 xcb_pad = 0;
554 }
555 xcb_block_len = 0;
556 /* authorization_protocol_data */
557 xcb_block_len += _aux->authorization_protocol_data_len * sizeof(char);
558 xcb_tmp += xcb_block_len;
559 xcb_align_to = ALIGNOF(char);
560 /* insert padding */
561 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
562 xcb_buffer_len += xcb_block_len + xcb_pad;
563 if (0 != xcb_pad) {
564 xcb_tmp += xcb_pad;
565 xcb_pad = 0;
566 }
567 xcb_block_len = 0;
568
569 return xcb_buffer_len;
570 }
571
572 char *
xcb_setup_request_authorization_protocol_name(const xcb_setup_request_t * R)573 xcb_setup_request_authorization_protocol_name (const xcb_setup_request_t *R /**< */)
574 {
575 return (char *) (R + 1);
576 }
577
578 int
xcb_setup_request_authorization_protocol_name_length(const xcb_setup_request_t * R)579 xcb_setup_request_authorization_protocol_name_length (const xcb_setup_request_t *R /**< */)
580 {
581 return R->authorization_protocol_name_len;
582 }
583
584 xcb_generic_iterator_t
xcb_setup_request_authorization_protocol_name_end(const xcb_setup_request_t * R)585 xcb_setup_request_authorization_protocol_name_end (const xcb_setup_request_t *R /**< */)
586 {
587 xcb_generic_iterator_t i;
588 i.data = ((char *) (R + 1)) + (R->authorization_protocol_name_len);
589 i.rem = 0;
590 i.index = (char *) i.data - (char *) R;
591 return i;
592 }
593
594 char *
xcb_setup_request_authorization_protocol_data(const xcb_setup_request_t * R)595 xcb_setup_request_authorization_protocol_data (const xcb_setup_request_t *R /**< */)
596 {
597 xcb_generic_iterator_t prev = xcb_setup_request_authorization_protocol_name_end(R);
598 return (char *) ((char *) prev.data + XCB_TYPE_PAD(char, prev.index) + 0);
599 }
600
601 int
xcb_setup_request_authorization_protocol_data_length(const xcb_setup_request_t * R)602 xcb_setup_request_authorization_protocol_data_length (const xcb_setup_request_t *R /**< */)
603 {
604 return R->authorization_protocol_data_len;
605 }
606
607 xcb_generic_iterator_t
xcb_setup_request_authorization_protocol_data_end(const xcb_setup_request_t * R)608 xcb_setup_request_authorization_protocol_data_end (const xcb_setup_request_t *R /**< */)
609 {
610 xcb_generic_iterator_t i;
611 xcb_generic_iterator_t child = xcb_setup_request_authorization_protocol_name_end(R);
612 i.data = ((char *) child.data) + (R->authorization_protocol_data_len);
613 i.rem = 0;
614 i.index = (char *) i.data - (char *) R;
615 return i;
616 }
617
618 void
xcb_setup_request_next(xcb_setup_request_iterator_t * i)619 xcb_setup_request_next (xcb_setup_request_iterator_t *i /**< */)
620 {
621 xcb_setup_request_t *R = i->data;
622 xcb_generic_iterator_t child;
623 child.data = (xcb_setup_request_t *)(((char *)R) + xcb_setup_request_sizeof(R));
624 i->index = (char *) child.data - (char *) i->data;
625 --i->rem;
626 i->data = (xcb_setup_request_t *) child.data;
627 }
628
629 xcb_generic_iterator_t
xcb_setup_request_end(xcb_setup_request_iterator_t i)630 xcb_setup_request_end (xcb_setup_request_iterator_t i /**< */)
631 {
632 xcb_generic_iterator_t ret;
633 while(i.rem > 0)
634 xcb_setup_request_next(&i);
635 ret.data = i.data;
636 ret.rem = i.rem;
637 ret.index = i.index;
638 return ret;
639 }
640
641 int
xcb_setup_failed_sizeof(const void * _buffer)642 xcb_setup_failed_sizeof (const void *_buffer /**< */)
643 {
644 char *xcb_tmp = (char *)_buffer;
645 const xcb_setup_failed_t *_aux = (xcb_setup_failed_t *)_buffer;
646 unsigned int xcb_buffer_len = 0;
647 unsigned int xcb_block_len = 0;
648 unsigned int xcb_pad = 0;
649 unsigned int xcb_align_to = 0;
650
651
652 xcb_block_len += sizeof(xcb_setup_failed_t);
653 xcb_tmp += xcb_block_len;
654 xcb_buffer_len += xcb_block_len;
655 xcb_block_len = 0;
656 /* reason */
657 xcb_block_len += _aux->reason_len * sizeof(char);
658 xcb_tmp += xcb_block_len;
659 xcb_align_to = ALIGNOF(char);
660 /* insert padding */
661 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
662 xcb_buffer_len += xcb_block_len + xcb_pad;
663 if (0 != xcb_pad) {
664 xcb_tmp += xcb_pad;
665 xcb_pad = 0;
666 }
667 xcb_block_len = 0;
668
669 return xcb_buffer_len;
670 }
671
672 char *
xcb_setup_failed_reason(const xcb_setup_failed_t * R)673 xcb_setup_failed_reason (const xcb_setup_failed_t *R /**< */)
674 {
675 return (char *) (R + 1);
676 }
677
678 int
xcb_setup_failed_reason_length(const xcb_setup_failed_t * R)679 xcb_setup_failed_reason_length (const xcb_setup_failed_t *R /**< */)
680 {
681 return R->reason_len;
682 }
683
684 xcb_generic_iterator_t
xcb_setup_failed_reason_end(const xcb_setup_failed_t * R)685 xcb_setup_failed_reason_end (const xcb_setup_failed_t *R /**< */)
686 {
687 xcb_generic_iterator_t i;
688 i.data = ((char *) (R + 1)) + (R->reason_len);
689 i.rem = 0;
690 i.index = (char *) i.data - (char *) R;
691 return i;
692 }
693
694 void
xcb_setup_failed_next(xcb_setup_failed_iterator_t * i)695 xcb_setup_failed_next (xcb_setup_failed_iterator_t *i /**< */)
696 {
697 xcb_setup_failed_t *R = i->data;
698 xcb_generic_iterator_t child;
699 child.data = (xcb_setup_failed_t *)(((char *)R) + xcb_setup_failed_sizeof(R));
700 i->index = (char *) child.data - (char *) i->data;
701 --i->rem;
702 i->data = (xcb_setup_failed_t *) child.data;
703 }
704
705 xcb_generic_iterator_t
xcb_setup_failed_end(xcb_setup_failed_iterator_t i)706 xcb_setup_failed_end (xcb_setup_failed_iterator_t i /**< */)
707 {
708 xcb_generic_iterator_t ret;
709 while(i.rem > 0)
710 xcb_setup_failed_next(&i);
711 ret.data = i.data;
712 ret.rem = i.rem;
713 ret.index = i.index;
714 return ret;
715 }
716
717 int
xcb_setup_authenticate_sizeof(const void * _buffer)718 xcb_setup_authenticate_sizeof (const void *_buffer /**< */)
719 {
720 char *xcb_tmp = (char *)_buffer;
721 const xcb_setup_authenticate_t *_aux = (xcb_setup_authenticate_t *)_buffer;
722 unsigned int xcb_buffer_len = 0;
723 unsigned int xcb_block_len = 0;
724 unsigned int xcb_pad = 0;
725 unsigned int xcb_align_to = 0;
726
727
728 xcb_block_len += sizeof(xcb_setup_authenticate_t);
729 xcb_tmp += xcb_block_len;
730 xcb_buffer_len += xcb_block_len;
731 xcb_block_len = 0;
732 /* reason */
733 xcb_block_len += (_aux->length * 4) * sizeof(char);
734 xcb_tmp += xcb_block_len;
735 xcb_align_to = ALIGNOF(char);
736 /* insert padding */
737 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
738 xcb_buffer_len += xcb_block_len + xcb_pad;
739 if (0 != xcb_pad) {
740 xcb_tmp += xcb_pad;
741 xcb_pad = 0;
742 }
743 xcb_block_len = 0;
744
745 return xcb_buffer_len;
746 }
747
748 char *
xcb_setup_authenticate_reason(const xcb_setup_authenticate_t * R)749 xcb_setup_authenticate_reason (const xcb_setup_authenticate_t *R /**< */)
750 {
751 return (char *) (R + 1);
752 }
753
754 int
xcb_setup_authenticate_reason_length(const xcb_setup_authenticate_t * R)755 xcb_setup_authenticate_reason_length (const xcb_setup_authenticate_t *R /**< */)
756 {
757 return (R->length * 4);
758 }
759
760 xcb_generic_iterator_t
xcb_setup_authenticate_reason_end(const xcb_setup_authenticate_t * R)761 xcb_setup_authenticate_reason_end (const xcb_setup_authenticate_t *R /**< */)
762 {
763 xcb_generic_iterator_t i;
764 i.data = ((char *) (R + 1)) + ((R->length * 4));
765 i.rem = 0;
766 i.index = (char *) i.data - (char *) R;
767 return i;
768 }
769
770 void
xcb_setup_authenticate_next(xcb_setup_authenticate_iterator_t * i)771 xcb_setup_authenticate_next (xcb_setup_authenticate_iterator_t *i /**< */)
772 {
773 xcb_setup_authenticate_t *R = i->data;
774 xcb_generic_iterator_t child;
775 child.data = (xcb_setup_authenticate_t *)(((char *)R) + xcb_setup_authenticate_sizeof(R));
776 i->index = (char *) child.data - (char *) i->data;
777 --i->rem;
778 i->data = (xcb_setup_authenticate_t *) child.data;
779 }
780
781 xcb_generic_iterator_t
xcb_setup_authenticate_end(xcb_setup_authenticate_iterator_t i)782 xcb_setup_authenticate_end (xcb_setup_authenticate_iterator_t i /**< */)
783 {
784 xcb_generic_iterator_t ret;
785 while(i.rem > 0)
786 xcb_setup_authenticate_next(&i);
787 ret.data = i.data;
788 ret.rem = i.rem;
789 ret.index = i.index;
790 return ret;
791 }
792
793 int
xcb_setup_sizeof(const void * _buffer)794 xcb_setup_sizeof (const void *_buffer /**< */)
795 {
796 char *xcb_tmp = (char *)_buffer;
797 const xcb_setup_t *_aux = (xcb_setup_t *)_buffer;
798 unsigned int xcb_buffer_len = 0;
799 unsigned int xcb_block_len = 0;
800 unsigned int xcb_pad = 0;
801 unsigned int xcb_align_to = 0;
802
803 unsigned int i;
804 unsigned int xcb_tmp_len;
805
806 xcb_block_len += sizeof(xcb_setup_t);
807 xcb_tmp += xcb_block_len;
808 xcb_buffer_len += xcb_block_len;
809 xcb_block_len = 0;
810 /* vendor */
811 xcb_block_len += _aux->vendor_len * sizeof(char);
812 xcb_tmp += xcb_block_len;
813 xcb_align_to = ALIGNOF(char);
814 /* insert padding */
815 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
816 xcb_buffer_len += xcb_block_len + xcb_pad;
817 if (0 != xcb_pad) {
818 xcb_tmp += xcb_pad;
819 xcb_pad = 0;
820 }
821 xcb_block_len = 0;
822 /* pixmap_formats */
823 xcb_block_len += _aux->pixmap_formats_len * sizeof(xcb_format_t);
824 xcb_tmp += xcb_block_len;
825 xcb_align_to = ALIGNOF(xcb_format_t);
826 /* insert padding */
827 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
828 xcb_buffer_len += xcb_block_len + xcb_pad;
829 if (0 != xcb_pad) {
830 xcb_tmp += xcb_pad;
831 xcb_pad = 0;
832 }
833 xcb_block_len = 0;
834 /* roots */
835 for(i=0; i<_aux->roots_len; i++) {
836 xcb_tmp_len = xcb_screen_sizeof(xcb_tmp);
837 xcb_block_len += xcb_tmp_len;
838 xcb_tmp += xcb_tmp_len;
839 }
840 xcb_align_to = ALIGNOF(xcb_screen_t);
841 /* insert padding */
842 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
843 xcb_buffer_len += xcb_block_len + xcb_pad;
844 if (0 != xcb_pad) {
845 xcb_tmp += xcb_pad;
846 xcb_pad = 0;
847 }
848 xcb_block_len = 0;
849
850 return xcb_buffer_len;
851 }
852
853 char *
xcb_setup_vendor(const xcb_setup_t * R)854 xcb_setup_vendor (const xcb_setup_t *R /**< */)
855 {
856 return (char *) (R + 1);
857 }
858
859 int
xcb_setup_vendor_length(const xcb_setup_t * R)860 xcb_setup_vendor_length (const xcb_setup_t *R /**< */)
861 {
862 return R->vendor_len;
863 }
864
865 xcb_generic_iterator_t
xcb_setup_vendor_end(const xcb_setup_t * R)866 xcb_setup_vendor_end (const xcb_setup_t *R /**< */)
867 {
868 xcb_generic_iterator_t i;
869 i.data = ((char *) (R + 1)) + (R->vendor_len);
870 i.rem = 0;
871 i.index = (char *) i.data - (char *) R;
872 return i;
873 }
874
875 xcb_format_t *
xcb_setup_pixmap_formats(const xcb_setup_t * R)876 xcb_setup_pixmap_formats (const xcb_setup_t *R /**< */)
877 {
878 xcb_generic_iterator_t prev = xcb_setup_vendor_end(R);
879 return (xcb_format_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_format_t, prev.index) + 0);
880 }
881
882 int
xcb_setup_pixmap_formats_length(const xcb_setup_t * R)883 xcb_setup_pixmap_formats_length (const xcb_setup_t *R /**< */)
884 {
885 return R->pixmap_formats_len;
886 }
887
888 xcb_format_iterator_t
xcb_setup_pixmap_formats_iterator(const xcb_setup_t * R)889 xcb_setup_pixmap_formats_iterator (const xcb_setup_t *R /**< */)
890 {
891 xcb_format_iterator_t i;
892 xcb_generic_iterator_t prev = xcb_setup_vendor_end(R);
893 i.data = (xcb_format_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_format_t, prev.index));
894 i.rem = R->pixmap_formats_len;
895 i.index = (char *) i.data - (char *) R;
896 return i;
897 }
898
899 int
xcb_setup_roots_length(const xcb_setup_t * R)900 xcb_setup_roots_length (const xcb_setup_t *R /**< */)
901 {
902 return R->roots_len;
903 }
904
905 xcb_screen_iterator_t
xcb_setup_roots_iterator(const xcb_setup_t * R)906 xcb_setup_roots_iterator (const xcb_setup_t *R /**< */)
907 {
908 xcb_screen_iterator_t i;
909 xcb_generic_iterator_t prev = xcb_format_end(xcb_setup_pixmap_formats_iterator(R));
910 i.data = (xcb_screen_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_screen_t, prev.index));
911 i.rem = R->roots_len;
912 i.index = (char *) i.data - (char *) R;
913 return i;
914 }
915
916 void
xcb_setup_next(xcb_setup_iterator_t * i)917 xcb_setup_next (xcb_setup_iterator_t *i /**< */)
918 {
919 xcb_setup_t *R = i->data;
920 xcb_generic_iterator_t child;
921 child.data = (xcb_setup_t *)(((char *)R) + xcb_setup_sizeof(R));
922 i->index = (char *) child.data - (char *) i->data;
923 --i->rem;
924 i->data = (xcb_setup_t *) child.data;
925 }
926
927 xcb_generic_iterator_t
xcb_setup_end(xcb_setup_iterator_t i)928 xcb_setup_end (xcb_setup_iterator_t i /**< */)
929 {
930 xcb_generic_iterator_t ret;
931 while(i.rem > 0)
932 xcb_setup_next(&i);
933 ret.data = i.data;
934 ret.rem = i.rem;
935 ret.index = i.index;
936 return ret;
937 }
938
939 void
xcb_client_message_data_next(xcb_client_message_data_iterator_t * i)940 xcb_client_message_data_next (xcb_client_message_data_iterator_t *i /**< */)
941 {
942 --i->rem;
943 ++i->data;
944 i->index += sizeof(xcb_client_message_data_t);
945 }
946
947 xcb_generic_iterator_t
xcb_client_message_data_end(xcb_client_message_data_iterator_t i)948 xcb_client_message_data_end (xcb_client_message_data_iterator_t i /**< */)
949 {
950 xcb_generic_iterator_t ret;
951 ret.data = i.data + i.rem;
952 ret.index = i.index + ((char *) ret.data - (char *) i.data);
953 ret.rem = 0;
954 return ret;
955 }
956
957 int
xcb_create_window_sizeof(const void * _buffer)958 xcb_create_window_sizeof (const void *_buffer /**< */)
959 {
960 char *xcb_tmp = (char *)_buffer;
961 const xcb_create_window_request_t *_aux = (xcb_create_window_request_t *)_buffer;
962 unsigned int xcb_buffer_len = 0;
963 unsigned int xcb_block_len = 0;
964 unsigned int xcb_pad = 0;
965 unsigned int xcb_align_to = 0;
966
967
968 xcb_block_len += sizeof(xcb_create_window_request_t);
969 xcb_tmp += xcb_block_len;
970 xcb_buffer_len += xcb_block_len;
971 xcb_block_len = 0;
972 /* value_list */
973 xcb_block_len += xcb_popcount(_aux->value_mask) * sizeof(uint32_t);
974 xcb_tmp += xcb_block_len;
975 xcb_align_to = ALIGNOF(uint32_t);
976 /* insert padding */
977 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
978 xcb_buffer_len += xcb_block_len + xcb_pad;
979 if (0 != xcb_pad) {
980 xcb_tmp += xcb_pad;
981 xcb_pad = 0;
982 }
983 xcb_block_len = 0;
984
985 return xcb_buffer_len;
986 }
987
988 xcb_void_cookie_t
xcb_create_window_checked(xcb_connection_t * c,uint8_t depth,xcb_window_t wid,xcb_window_t parent,int16_t x,int16_t y,uint16_t width,uint16_t height,uint16_t border_width,uint16_t _class,xcb_visualid_t visual,uint32_t value_mask,const uint32_t * value_list)989 xcb_create_window_checked (xcb_connection_t *c /**< */,
990 uint8_t depth /**< */,
991 xcb_window_t wid /**< */,
992 xcb_window_t parent /**< */,
993 int16_t x /**< */,
994 int16_t y /**< */,
995 uint16_t width /**< */,
996 uint16_t height /**< */,
997 uint16_t border_width /**< */,
998 uint16_t _class /**< */,
999 xcb_visualid_t visual /**< */,
1000 uint32_t value_mask /**< */,
1001 const uint32_t *value_list /**< */)
1002 {
1003 static const xcb_protocol_request_t xcb_req = {
1004 /* count */ 4,
1005 /* ext */ 0,
1006 /* opcode */ XCB_CREATE_WINDOW,
1007 /* isvoid */ 1
1008 };
1009
1010 struct iovec xcb_parts[6];
1011 xcb_void_cookie_t xcb_ret;
1012 xcb_create_window_request_t xcb_out;
1013
1014 xcb_out.depth = depth;
1015 xcb_out.wid = wid;
1016 xcb_out.parent = parent;
1017 xcb_out.x = x;
1018 xcb_out.y = y;
1019 xcb_out.width = width;
1020 xcb_out.height = height;
1021 xcb_out.border_width = border_width;
1022 xcb_out._class = _class;
1023 xcb_out.visual = visual;
1024 xcb_out.value_mask = value_mask;
1025
1026 xcb_parts[2].iov_base = (char *) &xcb_out;
1027 xcb_parts[2].iov_len = sizeof(xcb_out);
1028 xcb_parts[3].iov_base = 0;
1029 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1030 /* uint32_t value_list */
1031 xcb_parts[4].iov_base = (char *) value_list;
1032 xcb_parts[4].iov_len = xcb_popcount(value_mask) * sizeof(uint32_t);
1033 xcb_parts[5].iov_base = 0;
1034 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
1035
1036 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1037 return xcb_ret;
1038 }
1039
1040 xcb_void_cookie_t
xcb_create_window(xcb_connection_t * c,uint8_t depth,xcb_window_t wid,xcb_window_t parent,int16_t x,int16_t y,uint16_t width,uint16_t height,uint16_t border_width,uint16_t _class,xcb_visualid_t visual,uint32_t value_mask,const uint32_t * value_list)1041 xcb_create_window (xcb_connection_t *c /**< */,
1042 uint8_t depth /**< */,
1043 xcb_window_t wid /**< */,
1044 xcb_window_t parent /**< */,
1045 int16_t x /**< */,
1046 int16_t y /**< */,
1047 uint16_t width /**< */,
1048 uint16_t height /**< */,
1049 uint16_t border_width /**< */,
1050 uint16_t _class /**< */,
1051 xcb_visualid_t visual /**< */,
1052 uint32_t value_mask /**< */,
1053 const uint32_t *value_list /**< */)
1054 {
1055 static const xcb_protocol_request_t xcb_req = {
1056 /* count */ 4,
1057 /* ext */ 0,
1058 /* opcode */ XCB_CREATE_WINDOW,
1059 /* isvoid */ 1
1060 };
1061
1062 struct iovec xcb_parts[6];
1063 xcb_void_cookie_t xcb_ret;
1064 xcb_create_window_request_t xcb_out;
1065
1066 xcb_out.depth = depth;
1067 xcb_out.wid = wid;
1068 xcb_out.parent = parent;
1069 xcb_out.x = x;
1070 xcb_out.y = y;
1071 xcb_out.width = width;
1072 xcb_out.height = height;
1073 xcb_out.border_width = border_width;
1074 xcb_out._class = _class;
1075 xcb_out.visual = visual;
1076 xcb_out.value_mask = value_mask;
1077
1078 xcb_parts[2].iov_base = (char *) &xcb_out;
1079 xcb_parts[2].iov_len = sizeof(xcb_out);
1080 xcb_parts[3].iov_base = 0;
1081 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1082 /* uint32_t value_list */
1083 xcb_parts[4].iov_base = (char *) value_list;
1084 xcb_parts[4].iov_len = xcb_popcount(value_mask) * sizeof(uint32_t);
1085 xcb_parts[5].iov_base = 0;
1086 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
1087
1088 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1089 return xcb_ret;
1090 }
1091
1092 int
xcb_change_window_attributes_sizeof(const void * _buffer)1093 xcb_change_window_attributes_sizeof (const void *_buffer /**< */)
1094 {
1095 char *xcb_tmp = (char *)_buffer;
1096 const xcb_change_window_attributes_request_t *_aux = (xcb_change_window_attributes_request_t *)_buffer;
1097 unsigned int xcb_buffer_len = 0;
1098 unsigned int xcb_block_len = 0;
1099 unsigned int xcb_pad = 0;
1100 unsigned int xcb_align_to = 0;
1101
1102
1103 xcb_block_len += sizeof(xcb_change_window_attributes_request_t);
1104 xcb_tmp += xcb_block_len;
1105 xcb_buffer_len += xcb_block_len;
1106 xcb_block_len = 0;
1107 /* value_list */
1108 xcb_block_len += xcb_popcount(_aux->value_mask) * sizeof(uint32_t);
1109 xcb_tmp += xcb_block_len;
1110 xcb_align_to = ALIGNOF(uint32_t);
1111 /* insert padding */
1112 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
1113 xcb_buffer_len += xcb_block_len + xcb_pad;
1114 if (0 != xcb_pad) {
1115 xcb_tmp += xcb_pad;
1116 xcb_pad = 0;
1117 }
1118 xcb_block_len = 0;
1119
1120 return xcb_buffer_len;
1121 }
1122
1123 xcb_void_cookie_t
xcb_change_window_attributes_checked(xcb_connection_t * c,xcb_window_t window,uint32_t value_mask,const uint32_t * value_list)1124 xcb_change_window_attributes_checked (xcb_connection_t *c /**< */,
1125 xcb_window_t window /**< */,
1126 uint32_t value_mask /**< */,
1127 const uint32_t *value_list /**< */)
1128 {
1129 static const xcb_protocol_request_t xcb_req = {
1130 /* count */ 4,
1131 /* ext */ 0,
1132 /* opcode */ XCB_CHANGE_WINDOW_ATTRIBUTES,
1133 /* isvoid */ 1
1134 };
1135
1136 struct iovec xcb_parts[6];
1137 xcb_void_cookie_t xcb_ret;
1138 xcb_change_window_attributes_request_t xcb_out;
1139
1140 xcb_out.pad0 = 0;
1141 xcb_out.window = window;
1142 xcb_out.value_mask = value_mask;
1143
1144 xcb_parts[2].iov_base = (char *) &xcb_out;
1145 xcb_parts[2].iov_len = sizeof(xcb_out);
1146 xcb_parts[3].iov_base = 0;
1147 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1148 /* uint32_t value_list */
1149 xcb_parts[4].iov_base = (char *) value_list;
1150 xcb_parts[4].iov_len = xcb_popcount(value_mask) * sizeof(uint32_t);
1151 xcb_parts[5].iov_base = 0;
1152 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
1153
1154 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1155 return xcb_ret;
1156 }
1157
1158 xcb_void_cookie_t
xcb_change_window_attributes(xcb_connection_t * c,xcb_window_t window,uint32_t value_mask,const uint32_t * value_list)1159 xcb_change_window_attributes (xcb_connection_t *c /**< */,
1160 xcb_window_t window /**< */,
1161 uint32_t value_mask /**< */,
1162 const uint32_t *value_list /**< */)
1163 {
1164 static const xcb_protocol_request_t xcb_req = {
1165 /* count */ 4,
1166 /* ext */ 0,
1167 /* opcode */ XCB_CHANGE_WINDOW_ATTRIBUTES,
1168 /* isvoid */ 1
1169 };
1170
1171 struct iovec xcb_parts[6];
1172 xcb_void_cookie_t xcb_ret;
1173 xcb_change_window_attributes_request_t xcb_out;
1174
1175 xcb_out.pad0 = 0;
1176 xcb_out.window = window;
1177 xcb_out.value_mask = value_mask;
1178
1179 xcb_parts[2].iov_base = (char *) &xcb_out;
1180 xcb_parts[2].iov_len = sizeof(xcb_out);
1181 xcb_parts[3].iov_base = 0;
1182 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1183 /* uint32_t value_list */
1184 xcb_parts[4].iov_base = (char *) value_list;
1185 xcb_parts[4].iov_len = xcb_popcount(value_mask) * sizeof(uint32_t);
1186 xcb_parts[5].iov_base = 0;
1187 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
1188
1189 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1190 return xcb_ret;
1191 }
1192
1193 xcb_get_window_attributes_cookie_t
xcb_get_window_attributes(xcb_connection_t * c,xcb_window_t window)1194 xcb_get_window_attributes (xcb_connection_t *c /**< */,
1195 xcb_window_t window /**< */)
1196 {
1197 static const xcb_protocol_request_t xcb_req = {
1198 /* count */ 2,
1199 /* ext */ 0,
1200 /* opcode */ XCB_GET_WINDOW_ATTRIBUTES,
1201 /* isvoid */ 0
1202 };
1203
1204 struct iovec xcb_parts[4];
1205 xcb_get_window_attributes_cookie_t xcb_ret;
1206 xcb_get_window_attributes_request_t xcb_out;
1207
1208 xcb_out.pad0 = 0;
1209 xcb_out.window = window;
1210
1211 xcb_parts[2].iov_base = (char *) &xcb_out;
1212 xcb_parts[2].iov_len = sizeof(xcb_out);
1213 xcb_parts[3].iov_base = 0;
1214 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1215
1216 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1217 return xcb_ret;
1218 }
1219
1220 xcb_get_window_attributes_cookie_t
xcb_get_window_attributes_unchecked(xcb_connection_t * c,xcb_window_t window)1221 xcb_get_window_attributes_unchecked (xcb_connection_t *c /**< */,
1222 xcb_window_t window /**< */)
1223 {
1224 static const xcb_protocol_request_t xcb_req = {
1225 /* count */ 2,
1226 /* ext */ 0,
1227 /* opcode */ XCB_GET_WINDOW_ATTRIBUTES,
1228 /* isvoid */ 0
1229 };
1230
1231 struct iovec xcb_parts[4];
1232 xcb_get_window_attributes_cookie_t xcb_ret;
1233 xcb_get_window_attributes_request_t xcb_out;
1234
1235 xcb_out.pad0 = 0;
1236 xcb_out.window = window;
1237
1238 xcb_parts[2].iov_base = (char *) &xcb_out;
1239 xcb_parts[2].iov_len = sizeof(xcb_out);
1240 xcb_parts[3].iov_base = 0;
1241 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1242
1243 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1244 return xcb_ret;
1245 }
1246
1247 xcb_get_window_attributes_reply_t *
xcb_get_window_attributes_reply(xcb_connection_t * c,xcb_get_window_attributes_cookie_t cookie,xcb_generic_error_t ** e)1248 xcb_get_window_attributes_reply (xcb_connection_t *c /**< */,
1249 xcb_get_window_attributes_cookie_t cookie /**< */,
1250 xcb_generic_error_t **e /**< */)
1251 {
1252 return (xcb_get_window_attributes_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
1253 }
1254
1255 xcb_void_cookie_t
xcb_destroy_window_checked(xcb_connection_t * c,xcb_window_t window)1256 xcb_destroy_window_checked (xcb_connection_t *c /**< */,
1257 xcb_window_t window /**< */)
1258 {
1259 static const xcb_protocol_request_t xcb_req = {
1260 /* count */ 2,
1261 /* ext */ 0,
1262 /* opcode */ XCB_DESTROY_WINDOW,
1263 /* isvoid */ 1
1264 };
1265
1266 struct iovec xcb_parts[4];
1267 xcb_void_cookie_t xcb_ret;
1268 xcb_destroy_window_request_t xcb_out;
1269
1270 xcb_out.pad0 = 0;
1271 xcb_out.window = window;
1272
1273 xcb_parts[2].iov_base = (char *) &xcb_out;
1274 xcb_parts[2].iov_len = sizeof(xcb_out);
1275 xcb_parts[3].iov_base = 0;
1276 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1277
1278 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1279 return xcb_ret;
1280 }
1281
1282 xcb_void_cookie_t
xcb_destroy_window(xcb_connection_t * c,xcb_window_t window)1283 xcb_destroy_window (xcb_connection_t *c /**< */,
1284 xcb_window_t window /**< */)
1285 {
1286 static const xcb_protocol_request_t xcb_req = {
1287 /* count */ 2,
1288 /* ext */ 0,
1289 /* opcode */ XCB_DESTROY_WINDOW,
1290 /* isvoid */ 1
1291 };
1292
1293 struct iovec xcb_parts[4];
1294 xcb_void_cookie_t xcb_ret;
1295 xcb_destroy_window_request_t xcb_out;
1296
1297 xcb_out.pad0 = 0;
1298 xcb_out.window = window;
1299
1300 xcb_parts[2].iov_base = (char *) &xcb_out;
1301 xcb_parts[2].iov_len = sizeof(xcb_out);
1302 xcb_parts[3].iov_base = 0;
1303 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1304
1305 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1306 return xcb_ret;
1307 }
1308
1309 xcb_void_cookie_t
xcb_destroy_subwindows_checked(xcb_connection_t * c,xcb_window_t window)1310 xcb_destroy_subwindows_checked (xcb_connection_t *c /**< */,
1311 xcb_window_t window /**< */)
1312 {
1313 static const xcb_protocol_request_t xcb_req = {
1314 /* count */ 2,
1315 /* ext */ 0,
1316 /* opcode */ XCB_DESTROY_SUBWINDOWS,
1317 /* isvoid */ 1
1318 };
1319
1320 struct iovec xcb_parts[4];
1321 xcb_void_cookie_t xcb_ret;
1322 xcb_destroy_subwindows_request_t xcb_out;
1323
1324 xcb_out.pad0 = 0;
1325 xcb_out.window = window;
1326
1327 xcb_parts[2].iov_base = (char *) &xcb_out;
1328 xcb_parts[2].iov_len = sizeof(xcb_out);
1329 xcb_parts[3].iov_base = 0;
1330 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1331
1332 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1333 return xcb_ret;
1334 }
1335
1336 xcb_void_cookie_t
xcb_destroy_subwindows(xcb_connection_t * c,xcb_window_t window)1337 xcb_destroy_subwindows (xcb_connection_t *c /**< */,
1338 xcb_window_t window /**< */)
1339 {
1340 static const xcb_protocol_request_t xcb_req = {
1341 /* count */ 2,
1342 /* ext */ 0,
1343 /* opcode */ XCB_DESTROY_SUBWINDOWS,
1344 /* isvoid */ 1
1345 };
1346
1347 struct iovec xcb_parts[4];
1348 xcb_void_cookie_t xcb_ret;
1349 xcb_destroy_subwindows_request_t xcb_out;
1350
1351 xcb_out.pad0 = 0;
1352 xcb_out.window = window;
1353
1354 xcb_parts[2].iov_base = (char *) &xcb_out;
1355 xcb_parts[2].iov_len = sizeof(xcb_out);
1356 xcb_parts[3].iov_base = 0;
1357 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1358
1359 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1360 return xcb_ret;
1361 }
1362
1363 xcb_void_cookie_t
xcb_change_save_set_checked(xcb_connection_t * c,uint8_t mode,xcb_window_t window)1364 xcb_change_save_set_checked (xcb_connection_t *c /**< */,
1365 uint8_t mode /**< */,
1366 xcb_window_t window /**< */)
1367 {
1368 static const xcb_protocol_request_t xcb_req = {
1369 /* count */ 2,
1370 /* ext */ 0,
1371 /* opcode */ XCB_CHANGE_SAVE_SET,
1372 /* isvoid */ 1
1373 };
1374
1375 struct iovec xcb_parts[4];
1376 xcb_void_cookie_t xcb_ret;
1377 xcb_change_save_set_request_t xcb_out;
1378
1379 xcb_out.mode = mode;
1380 xcb_out.window = window;
1381
1382 xcb_parts[2].iov_base = (char *) &xcb_out;
1383 xcb_parts[2].iov_len = sizeof(xcb_out);
1384 xcb_parts[3].iov_base = 0;
1385 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1386
1387 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1388 return xcb_ret;
1389 }
1390
1391 xcb_void_cookie_t
xcb_change_save_set(xcb_connection_t * c,uint8_t mode,xcb_window_t window)1392 xcb_change_save_set (xcb_connection_t *c /**< */,
1393 uint8_t mode /**< */,
1394 xcb_window_t window /**< */)
1395 {
1396 static const xcb_protocol_request_t xcb_req = {
1397 /* count */ 2,
1398 /* ext */ 0,
1399 /* opcode */ XCB_CHANGE_SAVE_SET,
1400 /* isvoid */ 1
1401 };
1402
1403 struct iovec xcb_parts[4];
1404 xcb_void_cookie_t xcb_ret;
1405 xcb_change_save_set_request_t xcb_out;
1406
1407 xcb_out.mode = mode;
1408 xcb_out.window = window;
1409
1410 xcb_parts[2].iov_base = (char *) &xcb_out;
1411 xcb_parts[2].iov_len = sizeof(xcb_out);
1412 xcb_parts[3].iov_base = 0;
1413 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1414
1415 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1416 return xcb_ret;
1417 }
1418
1419 xcb_void_cookie_t
xcb_reparent_window_checked(xcb_connection_t * c,xcb_window_t window,xcb_window_t parent,int16_t x,int16_t y)1420 xcb_reparent_window_checked (xcb_connection_t *c /**< */,
1421 xcb_window_t window /**< */,
1422 xcb_window_t parent /**< */,
1423 int16_t x /**< */,
1424 int16_t y /**< */)
1425 {
1426 static const xcb_protocol_request_t xcb_req = {
1427 /* count */ 2,
1428 /* ext */ 0,
1429 /* opcode */ XCB_REPARENT_WINDOW,
1430 /* isvoid */ 1
1431 };
1432
1433 struct iovec xcb_parts[4];
1434 xcb_void_cookie_t xcb_ret;
1435 xcb_reparent_window_request_t xcb_out;
1436
1437 xcb_out.pad0 = 0;
1438 xcb_out.window = window;
1439 xcb_out.parent = parent;
1440 xcb_out.x = x;
1441 xcb_out.y = y;
1442
1443 xcb_parts[2].iov_base = (char *) &xcb_out;
1444 xcb_parts[2].iov_len = sizeof(xcb_out);
1445 xcb_parts[3].iov_base = 0;
1446 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1447
1448 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1449 return xcb_ret;
1450 }
1451
1452 xcb_void_cookie_t
xcb_reparent_window(xcb_connection_t * c,xcb_window_t window,xcb_window_t parent,int16_t x,int16_t y)1453 xcb_reparent_window (xcb_connection_t *c /**< */,
1454 xcb_window_t window /**< */,
1455 xcb_window_t parent /**< */,
1456 int16_t x /**< */,
1457 int16_t y /**< */)
1458 {
1459 static const xcb_protocol_request_t xcb_req = {
1460 /* count */ 2,
1461 /* ext */ 0,
1462 /* opcode */ XCB_REPARENT_WINDOW,
1463 /* isvoid */ 1
1464 };
1465
1466 struct iovec xcb_parts[4];
1467 xcb_void_cookie_t xcb_ret;
1468 xcb_reparent_window_request_t xcb_out;
1469
1470 xcb_out.pad0 = 0;
1471 xcb_out.window = window;
1472 xcb_out.parent = parent;
1473 xcb_out.x = x;
1474 xcb_out.y = y;
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
1481 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1482 return xcb_ret;
1483 }
1484
1485 xcb_void_cookie_t
xcb_map_window_checked(xcb_connection_t * c,xcb_window_t window)1486 xcb_map_window_checked (xcb_connection_t *c /**< */,
1487 xcb_window_t window /**< */)
1488 {
1489 static const xcb_protocol_request_t xcb_req = {
1490 /* count */ 2,
1491 /* ext */ 0,
1492 /* opcode */ XCB_MAP_WINDOW,
1493 /* isvoid */ 1
1494 };
1495
1496 struct iovec xcb_parts[4];
1497 xcb_void_cookie_t xcb_ret;
1498 xcb_map_window_request_t xcb_out;
1499
1500 xcb_out.pad0 = 0;
1501 xcb_out.window = window;
1502
1503 xcb_parts[2].iov_base = (char *) &xcb_out;
1504 xcb_parts[2].iov_len = sizeof(xcb_out);
1505 xcb_parts[3].iov_base = 0;
1506 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1507
1508 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1509 return xcb_ret;
1510 }
1511
1512 xcb_void_cookie_t
xcb_map_window(xcb_connection_t * c,xcb_window_t window)1513 xcb_map_window (xcb_connection_t *c /**< */,
1514 xcb_window_t window /**< */)
1515 {
1516 static const xcb_protocol_request_t xcb_req = {
1517 /* count */ 2,
1518 /* ext */ 0,
1519 /* opcode */ XCB_MAP_WINDOW,
1520 /* isvoid */ 1
1521 };
1522
1523 struct iovec xcb_parts[4];
1524 xcb_void_cookie_t xcb_ret;
1525 xcb_map_window_request_t xcb_out;
1526
1527 xcb_out.pad0 = 0;
1528 xcb_out.window = window;
1529
1530 xcb_parts[2].iov_base = (char *) &xcb_out;
1531 xcb_parts[2].iov_len = sizeof(xcb_out);
1532 xcb_parts[3].iov_base = 0;
1533 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1534
1535 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1536 return xcb_ret;
1537 }
1538
1539 xcb_void_cookie_t
xcb_map_subwindows_checked(xcb_connection_t * c,xcb_window_t window)1540 xcb_map_subwindows_checked (xcb_connection_t *c /**< */,
1541 xcb_window_t window /**< */)
1542 {
1543 static const xcb_protocol_request_t xcb_req = {
1544 /* count */ 2,
1545 /* ext */ 0,
1546 /* opcode */ XCB_MAP_SUBWINDOWS,
1547 /* isvoid */ 1
1548 };
1549
1550 struct iovec xcb_parts[4];
1551 xcb_void_cookie_t xcb_ret;
1552 xcb_map_subwindows_request_t xcb_out;
1553
1554 xcb_out.pad0 = 0;
1555 xcb_out.window = window;
1556
1557 xcb_parts[2].iov_base = (char *) &xcb_out;
1558 xcb_parts[2].iov_len = sizeof(xcb_out);
1559 xcb_parts[3].iov_base = 0;
1560 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1561
1562 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1563 return xcb_ret;
1564 }
1565
1566 xcb_void_cookie_t
xcb_map_subwindows(xcb_connection_t * c,xcb_window_t window)1567 xcb_map_subwindows (xcb_connection_t *c /**< */,
1568 xcb_window_t window /**< */)
1569 {
1570 static const xcb_protocol_request_t xcb_req = {
1571 /* count */ 2,
1572 /* ext */ 0,
1573 /* opcode */ XCB_MAP_SUBWINDOWS,
1574 /* isvoid */ 1
1575 };
1576
1577 struct iovec xcb_parts[4];
1578 xcb_void_cookie_t xcb_ret;
1579 xcb_map_subwindows_request_t xcb_out;
1580
1581 xcb_out.pad0 = 0;
1582 xcb_out.window = window;
1583
1584 xcb_parts[2].iov_base = (char *) &xcb_out;
1585 xcb_parts[2].iov_len = sizeof(xcb_out);
1586 xcb_parts[3].iov_base = 0;
1587 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1588
1589 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1590 return xcb_ret;
1591 }
1592
1593 xcb_void_cookie_t
xcb_unmap_window_checked(xcb_connection_t * c,xcb_window_t window)1594 xcb_unmap_window_checked (xcb_connection_t *c /**< */,
1595 xcb_window_t window /**< */)
1596 {
1597 static const xcb_protocol_request_t xcb_req = {
1598 /* count */ 2,
1599 /* ext */ 0,
1600 /* opcode */ XCB_UNMAP_WINDOW,
1601 /* isvoid */ 1
1602 };
1603
1604 struct iovec xcb_parts[4];
1605 xcb_void_cookie_t xcb_ret;
1606 xcb_unmap_window_request_t xcb_out;
1607
1608 xcb_out.pad0 = 0;
1609 xcb_out.window = window;
1610
1611 xcb_parts[2].iov_base = (char *) &xcb_out;
1612 xcb_parts[2].iov_len = sizeof(xcb_out);
1613 xcb_parts[3].iov_base = 0;
1614 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1615
1616 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1617 return xcb_ret;
1618 }
1619
1620 xcb_void_cookie_t
xcb_unmap_window(xcb_connection_t * c,xcb_window_t window)1621 xcb_unmap_window (xcb_connection_t *c /**< */,
1622 xcb_window_t window /**< */)
1623 {
1624 static const xcb_protocol_request_t xcb_req = {
1625 /* count */ 2,
1626 /* ext */ 0,
1627 /* opcode */ XCB_UNMAP_WINDOW,
1628 /* isvoid */ 1
1629 };
1630
1631 struct iovec xcb_parts[4];
1632 xcb_void_cookie_t xcb_ret;
1633 xcb_unmap_window_request_t xcb_out;
1634
1635 xcb_out.pad0 = 0;
1636 xcb_out.window = window;
1637
1638 xcb_parts[2].iov_base = (char *) &xcb_out;
1639 xcb_parts[2].iov_len = sizeof(xcb_out);
1640 xcb_parts[3].iov_base = 0;
1641 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1642
1643 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1644 return xcb_ret;
1645 }
1646
1647 xcb_void_cookie_t
xcb_unmap_subwindows_checked(xcb_connection_t * c,xcb_window_t window)1648 xcb_unmap_subwindows_checked (xcb_connection_t *c /**< */,
1649 xcb_window_t window /**< */)
1650 {
1651 static const xcb_protocol_request_t xcb_req = {
1652 /* count */ 2,
1653 /* ext */ 0,
1654 /* opcode */ XCB_UNMAP_SUBWINDOWS,
1655 /* isvoid */ 1
1656 };
1657
1658 struct iovec xcb_parts[4];
1659 xcb_void_cookie_t xcb_ret;
1660 xcb_unmap_subwindows_request_t xcb_out;
1661
1662 xcb_out.pad0 = 0;
1663 xcb_out.window = window;
1664
1665 xcb_parts[2].iov_base = (char *) &xcb_out;
1666 xcb_parts[2].iov_len = sizeof(xcb_out);
1667 xcb_parts[3].iov_base = 0;
1668 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1669
1670 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1671 return xcb_ret;
1672 }
1673
1674 xcb_void_cookie_t
xcb_unmap_subwindows(xcb_connection_t * c,xcb_window_t window)1675 xcb_unmap_subwindows (xcb_connection_t *c /**< */,
1676 xcb_window_t window /**< */)
1677 {
1678 static const xcb_protocol_request_t xcb_req = {
1679 /* count */ 2,
1680 /* ext */ 0,
1681 /* opcode */ XCB_UNMAP_SUBWINDOWS,
1682 /* isvoid */ 1
1683 };
1684
1685 struct iovec xcb_parts[4];
1686 xcb_void_cookie_t xcb_ret;
1687 xcb_unmap_subwindows_request_t xcb_out;
1688
1689 xcb_out.pad0 = 0;
1690 xcb_out.window = window;
1691
1692 xcb_parts[2].iov_base = (char *) &xcb_out;
1693 xcb_parts[2].iov_len = sizeof(xcb_out);
1694 xcb_parts[3].iov_base = 0;
1695 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1696
1697 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1698 return xcb_ret;
1699 }
1700
1701 int
xcb_configure_window_sizeof(const void * _buffer)1702 xcb_configure_window_sizeof (const void *_buffer /**< */)
1703 {
1704 char *xcb_tmp = (char *)_buffer;
1705 const xcb_configure_window_request_t *_aux = (xcb_configure_window_request_t *)_buffer;
1706 unsigned int xcb_buffer_len = 0;
1707 unsigned int xcb_block_len = 0;
1708 unsigned int xcb_pad = 0;
1709 unsigned int xcb_align_to = 0;
1710
1711
1712 xcb_block_len += sizeof(xcb_configure_window_request_t);
1713 xcb_tmp += xcb_block_len;
1714 xcb_buffer_len += xcb_block_len;
1715 xcb_block_len = 0;
1716 /* value_list */
1717 xcb_block_len += xcb_popcount(_aux->value_mask) * sizeof(uint32_t);
1718 xcb_tmp += xcb_block_len;
1719 xcb_align_to = ALIGNOF(uint32_t);
1720 /* insert padding */
1721 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
1722 xcb_buffer_len += xcb_block_len + xcb_pad;
1723 if (0 != xcb_pad) {
1724 xcb_tmp += xcb_pad;
1725 xcb_pad = 0;
1726 }
1727 xcb_block_len = 0;
1728
1729 return xcb_buffer_len;
1730 }
1731
1732 xcb_void_cookie_t
xcb_configure_window_checked(xcb_connection_t * c,xcb_window_t window,uint16_t value_mask,const uint32_t * value_list)1733 xcb_configure_window_checked (xcb_connection_t *c /**< */,
1734 xcb_window_t window /**< */,
1735 uint16_t value_mask /**< */,
1736 const uint32_t *value_list /**< */)
1737 {
1738 static const xcb_protocol_request_t xcb_req = {
1739 /* count */ 4,
1740 /* ext */ 0,
1741 /* opcode */ XCB_CONFIGURE_WINDOW,
1742 /* isvoid */ 1
1743 };
1744
1745 struct iovec xcb_parts[6];
1746 xcb_void_cookie_t xcb_ret;
1747 xcb_configure_window_request_t xcb_out;
1748
1749 xcb_out.pad0 = 0;
1750 xcb_out.window = window;
1751 xcb_out.value_mask = value_mask;
1752 memset(xcb_out.pad1, 0, 2);
1753
1754 xcb_parts[2].iov_base = (char *) &xcb_out;
1755 xcb_parts[2].iov_len = sizeof(xcb_out);
1756 xcb_parts[3].iov_base = 0;
1757 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1758 /* uint32_t value_list */
1759 xcb_parts[4].iov_base = (char *) value_list;
1760 xcb_parts[4].iov_len = xcb_popcount(value_mask) * sizeof(uint32_t);
1761 xcb_parts[5].iov_base = 0;
1762 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
1763
1764 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1765 return xcb_ret;
1766 }
1767
1768 xcb_void_cookie_t
xcb_configure_window(xcb_connection_t * c,xcb_window_t window,uint16_t value_mask,const uint32_t * value_list)1769 xcb_configure_window (xcb_connection_t *c /**< */,
1770 xcb_window_t window /**< */,
1771 uint16_t value_mask /**< */,
1772 const uint32_t *value_list /**< */)
1773 {
1774 static const xcb_protocol_request_t xcb_req = {
1775 /* count */ 4,
1776 /* ext */ 0,
1777 /* opcode */ XCB_CONFIGURE_WINDOW,
1778 /* isvoid */ 1
1779 };
1780
1781 struct iovec xcb_parts[6];
1782 xcb_void_cookie_t xcb_ret;
1783 xcb_configure_window_request_t xcb_out;
1784
1785 xcb_out.pad0 = 0;
1786 xcb_out.window = window;
1787 xcb_out.value_mask = value_mask;
1788 memset(xcb_out.pad1, 0, 2);
1789
1790 xcb_parts[2].iov_base = (char *) &xcb_out;
1791 xcb_parts[2].iov_len = sizeof(xcb_out);
1792 xcb_parts[3].iov_base = 0;
1793 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1794 /* uint32_t value_list */
1795 xcb_parts[4].iov_base = (char *) value_list;
1796 xcb_parts[4].iov_len = xcb_popcount(value_mask) * sizeof(uint32_t);
1797 xcb_parts[5].iov_base = 0;
1798 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
1799
1800 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1801 return xcb_ret;
1802 }
1803
1804 xcb_void_cookie_t
xcb_circulate_window_checked(xcb_connection_t * c,uint8_t direction,xcb_window_t window)1805 xcb_circulate_window_checked (xcb_connection_t *c /**< */,
1806 uint8_t direction /**< */,
1807 xcb_window_t window /**< */)
1808 {
1809 static const xcb_protocol_request_t xcb_req = {
1810 /* count */ 2,
1811 /* ext */ 0,
1812 /* opcode */ XCB_CIRCULATE_WINDOW,
1813 /* isvoid */ 1
1814 };
1815
1816 struct iovec xcb_parts[4];
1817 xcb_void_cookie_t xcb_ret;
1818 xcb_circulate_window_request_t xcb_out;
1819
1820 xcb_out.direction = direction;
1821 xcb_out.window = window;
1822
1823 xcb_parts[2].iov_base = (char *) &xcb_out;
1824 xcb_parts[2].iov_len = sizeof(xcb_out);
1825 xcb_parts[3].iov_base = 0;
1826 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1827
1828 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1829 return xcb_ret;
1830 }
1831
1832 xcb_void_cookie_t
xcb_circulate_window(xcb_connection_t * c,uint8_t direction,xcb_window_t window)1833 xcb_circulate_window (xcb_connection_t *c /**< */,
1834 uint8_t direction /**< */,
1835 xcb_window_t window /**< */)
1836 {
1837 static const xcb_protocol_request_t xcb_req = {
1838 /* count */ 2,
1839 /* ext */ 0,
1840 /* opcode */ XCB_CIRCULATE_WINDOW,
1841 /* isvoid */ 1
1842 };
1843
1844 struct iovec xcb_parts[4];
1845 xcb_void_cookie_t xcb_ret;
1846 xcb_circulate_window_request_t xcb_out;
1847
1848 xcb_out.direction = direction;
1849 xcb_out.window = window;
1850
1851 xcb_parts[2].iov_base = (char *) &xcb_out;
1852 xcb_parts[2].iov_len = sizeof(xcb_out);
1853 xcb_parts[3].iov_base = 0;
1854 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1855
1856 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1857 return xcb_ret;
1858 }
1859
1860 xcb_get_geometry_cookie_t
xcb_get_geometry(xcb_connection_t * c,xcb_drawable_t drawable)1861 xcb_get_geometry (xcb_connection_t *c /**< */,
1862 xcb_drawable_t drawable /**< */)
1863 {
1864 static const xcb_protocol_request_t xcb_req = {
1865 /* count */ 2,
1866 /* ext */ 0,
1867 /* opcode */ XCB_GET_GEOMETRY,
1868 /* isvoid */ 0
1869 };
1870
1871 struct iovec xcb_parts[4];
1872 xcb_get_geometry_cookie_t xcb_ret;
1873 xcb_get_geometry_request_t xcb_out;
1874
1875 xcb_out.pad0 = 0;
1876 xcb_out.drawable = drawable;
1877
1878 xcb_parts[2].iov_base = (char *) &xcb_out;
1879 xcb_parts[2].iov_len = sizeof(xcb_out);
1880 xcb_parts[3].iov_base = 0;
1881 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1882
1883 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1884 return xcb_ret;
1885 }
1886
1887 xcb_get_geometry_cookie_t
xcb_get_geometry_unchecked(xcb_connection_t * c,xcb_drawable_t drawable)1888 xcb_get_geometry_unchecked (xcb_connection_t *c /**< */,
1889 xcb_drawable_t drawable /**< */)
1890 {
1891 static const xcb_protocol_request_t xcb_req = {
1892 /* count */ 2,
1893 /* ext */ 0,
1894 /* opcode */ XCB_GET_GEOMETRY,
1895 /* isvoid */ 0
1896 };
1897
1898 struct iovec xcb_parts[4];
1899 xcb_get_geometry_cookie_t xcb_ret;
1900 xcb_get_geometry_request_t xcb_out;
1901
1902 xcb_out.pad0 = 0;
1903 xcb_out.drawable = drawable;
1904
1905 xcb_parts[2].iov_base = (char *) &xcb_out;
1906 xcb_parts[2].iov_len = sizeof(xcb_out);
1907 xcb_parts[3].iov_base = 0;
1908 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1909
1910 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1911 return xcb_ret;
1912 }
1913
1914 xcb_get_geometry_reply_t *
xcb_get_geometry_reply(xcb_connection_t * c,xcb_get_geometry_cookie_t cookie,xcb_generic_error_t ** e)1915 xcb_get_geometry_reply (xcb_connection_t *c /**< */,
1916 xcb_get_geometry_cookie_t cookie /**< */,
1917 xcb_generic_error_t **e /**< */)
1918 {
1919 return (xcb_get_geometry_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
1920 }
1921
1922 int
xcb_query_tree_sizeof(const void * _buffer)1923 xcb_query_tree_sizeof (const void *_buffer /**< */)
1924 {
1925 char *xcb_tmp = (char *)_buffer;
1926 const xcb_query_tree_reply_t *_aux = (xcb_query_tree_reply_t *)_buffer;
1927 unsigned int xcb_buffer_len = 0;
1928 unsigned int xcb_block_len = 0;
1929 unsigned int xcb_pad = 0;
1930 unsigned int xcb_align_to = 0;
1931
1932
1933 xcb_block_len += sizeof(xcb_query_tree_reply_t);
1934 xcb_tmp += xcb_block_len;
1935 xcb_buffer_len += xcb_block_len;
1936 xcb_block_len = 0;
1937 /* children */
1938 xcb_block_len += _aux->children_len * sizeof(xcb_window_t);
1939 xcb_tmp += xcb_block_len;
1940 xcb_align_to = ALIGNOF(xcb_window_t);
1941 /* insert padding */
1942 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
1943 xcb_buffer_len += xcb_block_len + xcb_pad;
1944 if (0 != xcb_pad) {
1945 xcb_tmp += xcb_pad;
1946 xcb_pad = 0;
1947 }
1948 xcb_block_len = 0;
1949
1950 return xcb_buffer_len;
1951 }
1952
1953 xcb_query_tree_cookie_t
xcb_query_tree(xcb_connection_t * c,xcb_window_t window)1954 xcb_query_tree (xcb_connection_t *c /**< */,
1955 xcb_window_t window /**< */)
1956 {
1957 static const xcb_protocol_request_t xcb_req = {
1958 /* count */ 2,
1959 /* ext */ 0,
1960 /* opcode */ XCB_QUERY_TREE,
1961 /* isvoid */ 0
1962 };
1963
1964 struct iovec xcb_parts[4];
1965 xcb_query_tree_cookie_t xcb_ret;
1966 xcb_query_tree_request_t xcb_out;
1967
1968 xcb_out.pad0 = 0;
1969 xcb_out.window = window;
1970
1971 xcb_parts[2].iov_base = (char *) &xcb_out;
1972 xcb_parts[2].iov_len = sizeof(xcb_out);
1973 xcb_parts[3].iov_base = 0;
1974 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1975
1976 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1977 return xcb_ret;
1978 }
1979
1980 xcb_query_tree_cookie_t
xcb_query_tree_unchecked(xcb_connection_t * c,xcb_window_t window)1981 xcb_query_tree_unchecked (xcb_connection_t *c /**< */,
1982 xcb_window_t window /**< */)
1983 {
1984 static const xcb_protocol_request_t xcb_req = {
1985 /* count */ 2,
1986 /* ext */ 0,
1987 /* opcode */ XCB_QUERY_TREE,
1988 /* isvoid */ 0
1989 };
1990
1991 struct iovec xcb_parts[4];
1992 xcb_query_tree_cookie_t xcb_ret;
1993 xcb_query_tree_request_t xcb_out;
1994
1995 xcb_out.pad0 = 0;
1996 xcb_out.window = window;
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_window_t *
xcb_query_tree_children(const xcb_query_tree_reply_t * R)2008 xcb_query_tree_children (const xcb_query_tree_reply_t *R /**< */)
2009 {
2010 return (xcb_window_t *) (R + 1);
2011 }
2012
2013 int
xcb_query_tree_children_length(const xcb_query_tree_reply_t * R)2014 xcb_query_tree_children_length (const xcb_query_tree_reply_t *R /**< */)
2015 {
2016 return R->children_len;
2017 }
2018
2019 xcb_generic_iterator_t
xcb_query_tree_children_end(const xcb_query_tree_reply_t * R)2020 xcb_query_tree_children_end (const xcb_query_tree_reply_t *R /**< */)
2021 {
2022 xcb_generic_iterator_t i;
2023 i.data = ((xcb_window_t *) (R + 1)) + (R->children_len);
2024 i.rem = 0;
2025 i.index = (char *) i.data - (char *) R;
2026 return i;
2027 }
2028
2029 xcb_query_tree_reply_t *
xcb_query_tree_reply(xcb_connection_t * c,xcb_query_tree_cookie_t cookie,xcb_generic_error_t ** e)2030 xcb_query_tree_reply (xcb_connection_t *c /**< */,
2031 xcb_query_tree_cookie_t cookie /**< */,
2032 xcb_generic_error_t **e /**< */)
2033 {
2034 return (xcb_query_tree_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
2035 }
2036
2037 int
xcb_intern_atom_sizeof(const void * _buffer)2038 xcb_intern_atom_sizeof (const void *_buffer /**< */)
2039 {
2040 char *xcb_tmp = (char *)_buffer;
2041 const xcb_intern_atom_request_t *_aux = (xcb_intern_atom_request_t *)_buffer;
2042 unsigned int xcb_buffer_len = 0;
2043 unsigned int xcb_block_len = 0;
2044 unsigned int xcb_pad = 0;
2045 unsigned int xcb_align_to = 0;
2046
2047
2048 xcb_block_len += sizeof(xcb_intern_atom_request_t);
2049 xcb_tmp += xcb_block_len;
2050 xcb_buffer_len += xcb_block_len;
2051 xcb_block_len = 0;
2052 /* name */
2053 xcb_block_len += _aux->name_len * sizeof(char);
2054 xcb_tmp += xcb_block_len;
2055 xcb_align_to = ALIGNOF(char);
2056 /* insert padding */
2057 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
2058 xcb_buffer_len += xcb_block_len + xcb_pad;
2059 if (0 != xcb_pad) {
2060 xcb_tmp += xcb_pad;
2061 xcb_pad = 0;
2062 }
2063 xcb_block_len = 0;
2064
2065 return xcb_buffer_len;
2066 }
2067
2068 xcb_intern_atom_cookie_t
xcb_intern_atom(xcb_connection_t * c,uint8_t only_if_exists,uint16_t name_len,const char * name)2069 xcb_intern_atom (xcb_connection_t *c /**< */,
2070 uint8_t only_if_exists /**< */,
2071 uint16_t name_len /**< */,
2072 const char *name /**< */)
2073 {
2074 static const xcb_protocol_request_t xcb_req = {
2075 /* count */ 4,
2076 /* ext */ 0,
2077 /* opcode */ XCB_INTERN_ATOM,
2078 /* isvoid */ 0
2079 };
2080
2081 struct iovec xcb_parts[6];
2082 xcb_intern_atom_cookie_t xcb_ret;
2083 xcb_intern_atom_request_t xcb_out;
2084
2085 xcb_out.only_if_exists = only_if_exists;
2086 xcb_out.name_len = name_len;
2087 memset(xcb_out.pad0, 0, 2);
2088
2089 xcb_parts[2].iov_base = (char *) &xcb_out;
2090 xcb_parts[2].iov_len = sizeof(xcb_out);
2091 xcb_parts[3].iov_base = 0;
2092 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2093 /* char name */
2094 xcb_parts[4].iov_base = (char *) name;
2095 xcb_parts[4].iov_len = name_len * sizeof(char);
2096 xcb_parts[5].iov_base = 0;
2097 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
2098
2099 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2100 return xcb_ret;
2101 }
2102
2103 xcb_intern_atom_cookie_t
xcb_intern_atom_unchecked(xcb_connection_t * c,uint8_t only_if_exists,uint16_t name_len,const char * name)2104 xcb_intern_atom_unchecked (xcb_connection_t *c /**< */,
2105 uint8_t only_if_exists /**< */,
2106 uint16_t name_len /**< */,
2107 const char *name /**< */)
2108 {
2109 static const xcb_protocol_request_t xcb_req = {
2110 /* count */ 4,
2111 /* ext */ 0,
2112 /* opcode */ XCB_INTERN_ATOM,
2113 /* isvoid */ 0
2114 };
2115
2116 struct iovec xcb_parts[6];
2117 xcb_intern_atom_cookie_t xcb_ret;
2118 xcb_intern_atom_request_t xcb_out;
2119
2120 xcb_out.only_if_exists = only_if_exists;
2121 xcb_out.name_len = name_len;
2122 memset(xcb_out.pad0, 0, 2);
2123
2124 xcb_parts[2].iov_base = (char *) &xcb_out;
2125 xcb_parts[2].iov_len = sizeof(xcb_out);
2126 xcb_parts[3].iov_base = 0;
2127 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2128 /* char name */
2129 xcb_parts[4].iov_base = (char *) name;
2130 xcb_parts[4].iov_len = name_len * sizeof(char);
2131 xcb_parts[5].iov_base = 0;
2132 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
2133
2134 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2135 return xcb_ret;
2136 }
2137
2138 xcb_intern_atom_reply_t *
xcb_intern_atom_reply(xcb_connection_t * c,xcb_intern_atom_cookie_t cookie,xcb_generic_error_t ** e)2139 xcb_intern_atom_reply (xcb_connection_t *c /**< */,
2140 xcb_intern_atom_cookie_t cookie /**< */,
2141 xcb_generic_error_t **e /**< */)
2142 {
2143 return (xcb_intern_atom_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
2144 }
2145
2146 int
xcb_get_atom_name_sizeof(const void * _buffer)2147 xcb_get_atom_name_sizeof (const void *_buffer /**< */)
2148 {
2149 char *xcb_tmp = (char *)_buffer;
2150 const xcb_get_atom_name_reply_t *_aux = (xcb_get_atom_name_reply_t *)_buffer;
2151 unsigned int xcb_buffer_len = 0;
2152 unsigned int xcb_block_len = 0;
2153 unsigned int xcb_pad = 0;
2154 unsigned int xcb_align_to = 0;
2155
2156
2157 xcb_block_len += sizeof(xcb_get_atom_name_reply_t);
2158 xcb_tmp += xcb_block_len;
2159 xcb_buffer_len += xcb_block_len;
2160 xcb_block_len = 0;
2161 /* name */
2162 xcb_block_len += _aux->name_len * sizeof(char);
2163 xcb_tmp += xcb_block_len;
2164 xcb_align_to = ALIGNOF(char);
2165 /* insert padding */
2166 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
2167 xcb_buffer_len += xcb_block_len + xcb_pad;
2168 if (0 != xcb_pad) {
2169 xcb_tmp += xcb_pad;
2170 xcb_pad = 0;
2171 }
2172 xcb_block_len = 0;
2173
2174 return xcb_buffer_len;
2175 }
2176
2177 xcb_get_atom_name_cookie_t
xcb_get_atom_name(xcb_connection_t * c,xcb_atom_t atom)2178 xcb_get_atom_name (xcb_connection_t *c /**< */,
2179 xcb_atom_t atom /**< */)
2180 {
2181 static const xcb_protocol_request_t xcb_req = {
2182 /* count */ 2,
2183 /* ext */ 0,
2184 /* opcode */ XCB_GET_ATOM_NAME,
2185 /* isvoid */ 0
2186 };
2187
2188 struct iovec xcb_parts[4];
2189 xcb_get_atom_name_cookie_t xcb_ret;
2190 xcb_get_atom_name_request_t xcb_out;
2191
2192 xcb_out.pad0 = 0;
2193 xcb_out.atom = atom;
2194
2195 xcb_parts[2].iov_base = (char *) &xcb_out;
2196 xcb_parts[2].iov_len = sizeof(xcb_out);
2197 xcb_parts[3].iov_base = 0;
2198 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2199
2200 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2201 return xcb_ret;
2202 }
2203
2204 xcb_get_atom_name_cookie_t
xcb_get_atom_name_unchecked(xcb_connection_t * c,xcb_atom_t atom)2205 xcb_get_atom_name_unchecked (xcb_connection_t *c /**< */,
2206 xcb_atom_t atom /**< */)
2207 {
2208 static const xcb_protocol_request_t xcb_req = {
2209 /* count */ 2,
2210 /* ext */ 0,
2211 /* opcode */ XCB_GET_ATOM_NAME,
2212 /* isvoid */ 0
2213 };
2214
2215 struct iovec xcb_parts[4];
2216 xcb_get_atom_name_cookie_t xcb_ret;
2217 xcb_get_atom_name_request_t xcb_out;
2218
2219 xcb_out.pad0 = 0;
2220 xcb_out.atom = atom;
2221
2222 xcb_parts[2].iov_base = (char *) &xcb_out;
2223 xcb_parts[2].iov_len = sizeof(xcb_out);
2224 xcb_parts[3].iov_base = 0;
2225 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2226
2227 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2228 return xcb_ret;
2229 }
2230
2231 char *
xcb_get_atom_name_name(const xcb_get_atom_name_reply_t * R)2232 xcb_get_atom_name_name (const xcb_get_atom_name_reply_t *R /**< */)
2233 {
2234 return (char *) (R + 1);
2235 }
2236
2237 int
xcb_get_atom_name_name_length(const xcb_get_atom_name_reply_t * R)2238 xcb_get_atom_name_name_length (const xcb_get_atom_name_reply_t *R /**< */)
2239 {
2240 return R->name_len;
2241 }
2242
2243 xcb_generic_iterator_t
xcb_get_atom_name_name_end(const xcb_get_atom_name_reply_t * R)2244 xcb_get_atom_name_name_end (const xcb_get_atom_name_reply_t *R /**< */)
2245 {
2246 xcb_generic_iterator_t i;
2247 i.data = ((char *) (R + 1)) + (R->name_len);
2248 i.rem = 0;
2249 i.index = (char *) i.data - (char *) R;
2250 return i;
2251 }
2252
2253 xcb_get_atom_name_reply_t *
xcb_get_atom_name_reply(xcb_connection_t * c,xcb_get_atom_name_cookie_t cookie,xcb_generic_error_t ** e)2254 xcb_get_atom_name_reply (xcb_connection_t *c /**< */,
2255 xcb_get_atom_name_cookie_t cookie /**< */,
2256 xcb_generic_error_t **e /**< */)
2257 {
2258 return (xcb_get_atom_name_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
2259 }
2260
2261 int
xcb_change_property_sizeof(const void * _buffer)2262 xcb_change_property_sizeof (const void *_buffer /**< */)
2263 {
2264 char *xcb_tmp = (char *)_buffer;
2265 const xcb_change_property_request_t *_aux = (xcb_change_property_request_t *)_buffer;
2266 unsigned int xcb_buffer_len = 0;
2267 unsigned int xcb_block_len = 0;
2268 unsigned int xcb_pad = 0;
2269 unsigned int xcb_align_to = 0;
2270
2271
2272 xcb_block_len += sizeof(xcb_change_property_request_t);
2273 xcb_tmp += xcb_block_len;
2274 xcb_buffer_len += xcb_block_len;
2275 xcb_block_len = 0;
2276 /* data */
2277 xcb_block_len += ((_aux->data_len * _aux->format) / 8) * sizeof(char);
2278 xcb_tmp += xcb_block_len;
2279 xcb_align_to = ALIGNOF(char);
2280 /* insert padding */
2281 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
2282 xcb_buffer_len += xcb_block_len + xcb_pad;
2283 if (0 != xcb_pad) {
2284 xcb_tmp += xcb_pad;
2285 xcb_pad = 0;
2286 }
2287 xcb_block_len = 0;
2288
2289 return xcb_buffer_len;
2290 }
2291
2292 xcb_void_cookie_t
xcb_change_property_checked(xcb_connection_t * c,uint8_t mode,xcb_window_t window,xcb_atom_t property,xcb_atom_t type,uint8_t format,uint32_t data_len,const void * data)2293 xcb_change_property_checked (xcb_connection_t *c /**< */,
2294 uint8_t mode /**< */,
2295 xcb_window_t window /**< */,
2296 xcb_atom_t property /**< */,
2297 xcb_atom_t type /**< */,
2298 uint8_t format /**< */,
2299 uint32_t data_len /**< */,
2300 const void *data /**< */)
2301 {
2302 static const xcb_protocol_request_t xcb_req = {
2303 /* count */ 4,
2304 /* ext */ 0,
2305 /* opcode */ XCB_CHANGE_PROPERTY,
2306 /* isvoid */ 1
2307 };
2308
2309 struct iovec xcb_parts[6];
2310 xcb_void_cookie_t xcb_ret;
2311 xcb_change_property_request_t xcb_out;
2312
2313 xcb_out.mode = mode;
2314 xcb_out.window = window;
2315 xcb_out.property = property;
2316 xcb_out.type = type;
2317 xcb_out.format = format;
2318 memset(xcb_out.pad0, 0, 3);
2319 xcb_out.data_len = data_len;
2320
2321 xcb_parts[2].iov_base = (char *) &xcb_out;
2322 xcb_parts[2].iov_len = sizeof(xcb_out);
2323 xcb_parts[3].iov_base = 0;
2324 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2325 /* void data */
2326 xcb_parts[4].iov_base = (char *) data;
2327 xcb_parts[4].iov_len = ((data_len * format) / 8) * sizeof(char);
2328 xcb_parts[5].iov_base = 0;
2329 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
2330
2331 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2332 return xcb_ret;
2333 }
2334
2335 xcb_void_cookie_t
xcb_change_property(xcb_connection_t * c,uint8_t mode,xcb_window_t window,xcb_atom_t property,xcb_atom_t type,uint8_t format,uint32_t data_len,const void * data)2336 xcb_change_property (xcb_connection_t *c /**< */,
2337 uint8_t mode /**< */,
2338 xcb_window_t window /**< */,
2339 xcb_atom_t property /**< */,
2340 xcb_atom_t type /**< */,
2341 uint8_t format /**< */,
2342 uint32_t data_len /**< */,
2343 const void *data /**< */)
2344 {
2345 static const xcb_protocol_request_t xcb_req = {
2346 /* count */ 4,
2347 /* ext */ 0,
2348 /* opcode */ XCB_CHANGE_PROPERTY,
2349 /* isvoid */ 1
2350 };
2351
2352 struct iovec xcb_parts[6];
2353 xcb_void_cookie_t xcb_ret;
2354 xcb_change_property_request_t xcb_out;
2355
2356 xcb_out.mode = mode;
2357 xcb_out.window = window;
2358 xcb_out.property = property;
2359 xcb_out.type = type;
2360 xcb_out.format = format;
2361 memset(xcb_out.pad0, 0, 3);
2362 xcb_out.data_len = data_len;
2363
2364 xcb_parts[2].iov_base = (char *) &xcb_out;
2365 xcb_parts[2].iov_len = sizeof(xcb_out);
2366 xcb_parts[3].iov_base = 0;
2367 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2368 /* void data */
2369 xcb_parts[4].iov_base = (char *) data;
2370 xcb_parts[4].iov_len = ((data_len * format) / 8) * sizeof(char);
2371 xcb_parts[5].iov_base = 0;
2372 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
2373
2374 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2375 return xcb_ret;
2376 }
2377
2378 xcb_void_cookie_t
xcb_delete_property_checked(xcb_connection_t * c,xcb_window_t window,xcb_atom_t property)2379 xcb_delete_property_checked (xcb_connection_t *c /**< */,
2380 xcb_window_t window /**< */,
2381 xcb_atom_t property /**< */)
2382 {
2383 static const xcb_protocol_request_t xcb_req = {
2384 /* count */ 2,
2385 /* ext */ 0,
2386 /* opcode */ XCB_DELETE_PROPERTY,
2387 /* isvoid */ 1
2388 };
2389
2390 struct iovec xcb_parts[4];
2391 xcb_void_cookie_t xcb_ret;
2392 xcb_delete_property_request_t xcb_out;
2393
2394 xcb_out.pad0 = 0;
2395 xcb_out.window = window;
2396 xcb_out.property = property;
2397
2398 xcb_parts[2].iov_base = (char *) &xcb_out;
2399 xcb_parts[2].iov_len = sizeof(xcb_out);
2400 xcb_parts[3].iov_base = 0;
2401 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2402
2403 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2404 return xcb_ret;
2405 }
2406
2407 xcb_void_cookie_t
xcb_delete_property(xcb_connection_t * c,xcb_window_t window,xcb_atom_t property)2408 xcb_delete_property (xcb_connection_t *c /**< */,
2409 xcb_window_t window /**< */,
2410 xcb_atom_t property /**< */)
2411 {
2412 static const xcb_protocol_request_t xcb_req = {
2413 /* count */ 2,
2414 /* ext */ 0,
2415 /* opcode */ XCB_DELETE_PROPERTY,
2416 /* isvoid */ 1
2417 };
2418
2419 struct iovec xcb_parts[4];
2420 xcb_void_cookie_t xcb_ret;
2421 xcb_delete_property_request_t xcb_out;
2422
2423 xcb_out.pad0 = 0;
2424 xcb_out.window = window;
2425 xcb_out.property = property;
2426
2427 xcb_parts[2].iov_base = (char *) &xcb_out;
2428 xcb_parts[2].iov_len = sizeof(xcb_out);
2429 xcb_parts[3].iov_base = 0;
2430 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2431
2432 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2433 return xcb_ret;
2434 }
2435
2436 int
xcb_get_property_sizeof(const void * _buffer)2437 xcb_get_property_sizeof (const void *_buffer /**< */)
2438 {
2439 char *xcb_tmp = (char *)_buffer;
2440 const xcb_get_property_reply_t *_aux = (xcb_get_property_reply_t *)_buffer;
2441 unsigned int xcb_buffer_len = 0;
2442 unsigned int xcb_block_len = 0;
2443 unsigned int xcb_pad = 0;
2444 unsigned int xcb_align_to = 0;
2445
2446
2447 xcb_block_len += sizeof(xcb_get_property_reply_t);
2448 xcb_tmp += xcb_block_len;
2449 xcb_buffer_len += xcb_block_len;
2450 xcb_block_len = 0;
2451 /* value */
2452 xcb_block_len += (_aux->value_len * (_aux->format / 8)) * sizeof(char);
2453 xcb_tmp += xcb_block_len;
2454 xcb_align_to = ALIGNOF(char);
2455 /* insert padding */
2456 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
2457 xcb_buffer_len += xcb_block_len + xcb_pad;
2458 if (0 != xcb_pad) {
2459 xcb_tmp += xcb_pad;
2460 xcb_pad = 0;
2461 }
2462 xcb_block_len = 0;
2463
2464 return xcb_buffer_len;
2465 }
2466
2467 xcb_get_property_cookie_t
xcb_get_property(xcb_connection_t * c,uint8_t _delete,xcb_window_t window,xcb_atom_t property,xcb_atom_t type,uint32_t long_offset,uint32_t long_length)2468 xcb_get_property (xcb_connection_t *c /**< */,
2469 uint8_t _delete /**< */,
2470 xcb_window_t window /**< */,
2471 xcb_atom_t property /**< */,
2472 xcb_atom_t type /**< */,
2473 uint32_t long_offset /**< */,
2474 uint32_t long_length /**< */)
2475 {
2476 static const xcb_protocol_request_t xcb_req = {
2477 /* count */ 2,
2478 /* ext */ 0,
2479 /* opcode */ XCB_GET_PROPERTY,
2480 /* isvoid */ 0
2481 };
2482
2483 struct iovec xcb_parts[4];
2484 xcb_get_property_cookie_t xcb_ret;
2485 xcb_get_property_request_t xcb_out;
2486
2487 xcb_out._delete = _delete;
2488 xcb_out.window = window;
2489 xcb_out.property = property;
2490 xcb_out.type = type;
2491 xcb_out.long_offset = long_offset;
2492 xcb_out.long_length = long_length;
2493
2494 xcb_parts[2].iov_base = (char *) &xcb_out;
2495 xcb_parts[2].iov_len = sizeof(xcb_out);
2496 xcb_parts[3].iov_base = 0;
2497 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2498
2499 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2500 return xcb_ret;
2501 }
2502
2503 xcb_get_property_cookie_t
xcb_get_property_unchecked(xcb_connection_t * c,uint8_t _delete,xcb_window_t window,xcb_atom_t property,xcb_atom_t type,uint32_t long_offset,uint32_t long_length)2504 xcb_get_property_unchecked (xcb_connection_t *c /**< */,
2505 uint8_t _delete /**< */,
2506 xcb_window_t window /**< */,
2507 xcb_atom_t property /**< */,
2508 xcb_atom_t type /**< */,
2509 uint32_t long_offset /**< */,
2510 uint32_t long_length /**< */)
2511 {
2512 static const xcb_protocol_request_t xcb_req = {
2513 /* count */ 2,
2514 /* ext */ 0,
2515 /* opcode */ XCB_GET_PROPERTY,
2516 /* isvoid */ 0
2517 };
2518
2519 struct iovec xcb_parts[4];
2520 xcb_get_property_cookie_t xcb_ret;
2521 xcb_get_property_request_t xcb_out;
2522
2523 xcb_out._delete = _delete;
2524 xcb_out.window = window;
2525 xcb_out.property = property;
2526 xcb_out.type = type;
2527 xcb_out.long_offset = long_offset;
2528 xcb_out.long_length = long_length;
2529
2530 xcb_parts[2].iov_base = (char *) &xcb_out;
2531 xcb_parts[2].iov_len = sizeof(xcb_out);
2532 xcb_parts[3].iov_base = 0;
2533 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2534
2535 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2536 return xcb_ret;
2537 }
2538
2539 void *
xcb_get_property_value(const xcb_get_property_reply_t * R)2540 xcb_get_property_value (const xcb_get_property_reply_t *R /**< */)
2541 {
2542 return (void *) (R + 1);
2543 }
2544
2545 int
xcb_get_property_value_length(const xcb_get_property_reply_t * R)2546 xcb_get_property_value_length (const xcb_get_property_reply_t *R /**< */)
2547 {
2548 return (R->value_len * (R->format / 8));
2549 }
2550
2551 xcb_generic_iterator_t
xcb_get_property_value_end(const xcb_get_property_reply_t * R)2552 xcb_get_property_value_end (const xcb_get_property_reply_t *R /**< */)
2553 {
2554 xcb_generic_iterator_t i;
2555 i.data = ((char *) (R + 1)) + ((R->value_len * (R->format / 8)));
2556 i.rem = 0;
2557 i.index = (char *) i.data - (char *) R;
2558 return i;
2559 }
2560
2561 xcb_get_property_reply_t *
xcb_get_property_reply(xcb_connection_t * c,xcb_get_property_cookie_t cookie,xcb_generic_error_t ** e)2562 xcb_get_property_reply (xcb_connection_t *c /**< */,
2563 xcb_get_property_cookie_t cookie /**< */,
2564 xcb_generic_error_t **e /**< */)
2565 {
2566 return (xcb_get_property_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
2567 }
2568
2569 int
xcb_list_properties_sizeof(const void * _buffer)2570 xcb_list_properties_sizeof (const void *_buffer /**< */)
2571 {
2572 char *xcb_tmp = (char *)_buffer;
2573 const xcb_list_properties_reply_t *_aux = (xcb_list_properties_reply_t *)_buffer;
2574 unsigned int xcb_buffer_len = 0;
2575 unsigned int xcb_block_len = 0;
2576 unsigned int xcb_pad = 0;
2577 unsigned int xcb_align_to = 0;
2578
2579
2580 xcb_block_len += sizeof(xcb_list_properties_reply_t);
2581 xcb_tmp += xcb_block_len;
2582 xcb_buffer_len += xcb_block_len;
2583 xcb_block_len = 0;
2584 /* atoms */
2585 xcb_block_len += _aux->atoms_len * sizeof(xcb_atom_t);
2586 xcb_tmp += xcb_block_len;
2587 xcb_align_to = ALIGNOF(xcb_atom_t);
2588 /* insert padding */
2589 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
2590 xcb_buffer_len += xcb_block_len + xcb_pad;
2591 if (0 != xcb_pad) {
2592 xcb_tmp += xcb_pad;
2593 xcb_pad = 0;
2594 }
2595 xcb_block_len = 0;
2596
2597 return xcb_buffer_len;
2598 }
2599
2600 xcb_list_properties_cookie_t
xcb_list_properties(xcb_connection_t * c,xcb_window_t window)2601 xcb_list_properties (xcb_connection_t *c /**< */,
2602 xcb_window_t window /**< */)
2603 {
2604 static const xcb_protocol_request_t xcb_req = {
2605 /* count */ 2,
2606 /* ext */ 0,
2607 /* opcode */ XCB_LIST_PROPERTIES,
2608 /* isvoid */ 0
2609 };
2610
2611 struct iovec xcb_parts[4];
2612 xcb_list_properties_cookie_t xcb_ret;
2613 xcb_list_properties_request_t xcb_out;
2614
2615 xcb_out.pad0 = 0;
2616 xcb_out.window = window;
2617
2618 xcb_parts[2].iov_base = (char *) &xcb_out;
2619 xcb_parts[2].iov_len = sizeof(xcb_out);
2620 xcb_parts[3].iov_base = 0;
2621 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2622
2623 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2624 return xcb_ret;
2625 }
2626
2627 xcb_list_properties_cookie_t
xcb_list_properties_unchecked(xcb_connection_t * c,xcb_window_t window)2628 xcb_list_properties_unchecked (xcb_connection_t *c /**< */,
2629 xcb_window_t window /**< */)
2630 {
2631 static const xcb_protocol_request_t xcb_req = {
2632 /* count */ 2,
2633 /* ext */ 0,
2634 /* opcode */ XCB_LIST_PROPERTIES,
2635 /* isvoid */ 0
2636 };
2637
2638 struct iovec xcb_parts[4];
2639 xcb_list_properties_cookie_t xcb_ret;
2640 xcb_list_properties_request_t xcb_out;
2641
2642 xcb_out.pad0 = 0;
2643 xcb_out.window = window;
2644
2645 xcb_parts[2].iov_base = (char *) &xcb_out;
2646 xcb_parts[2].iov_len = sizeof(xcb_out);
2647 xcb_parts[3].iov_base = 0;
2648 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2649
2650 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2651 return xcb_ret;
2652 }
2653
2654 xcb_atom_t *
xcb_list_properties_atoms(const xcb_list_properties_reply_t * R)2655 xcb_list_properties_atoms (const xcb_list_properties_reply_t *R /**< */)
2656 {
2657 return (xcb_atom_t *) (R + 1);
2658 }
2659
2660 int
xcb_list_properties_atoms_length(const xcb_list_properties_reply_t * R)2661 xcb_list_properties_atoms_length (const xcb_list_properties_reply_t *R /**< */)
2662 {
2663 return R->atoms_len;
2664 }
2665
2666 xcb_generic_iterator_t
xcb_list_properties_atoms_end(const xcb_list_properties_reply_t * R)2667 xcb_list_properties_atoms_end (const xcb_list_properties_reply_t *R /**< */)
2668 {
2669 xcb_generic_iterator_t i;
2670 i.data = ((xcb_atom_t *) (R + 1)) + (R->atoms_len);
2671 i.rem = 0;
2672 i.index = (char *) i.data - (char *) R;
2673 return i;
2674 }
2675
2676 xcb_list_properties_reply_t *
xcb_list_properties_reply(xcb_connection_t * c,xcb_list_properties_cookie_t cookie,xcb_generic_error_t ** e)2677 xcb_list_properties_reply (xcb_connection_t *c /**< */,
2678 xcb_list_properties_cookie_t cookie /**< */,
2679 xcb_generic_error_t **e /**< */)
2680 {
2681 return (xcb_list_properties_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
2682 }
2683
2684 xcb_void_cookie_t
xcb_set_selection_owner_checked(xcb_connection_t * c,xcb_window_t owner,xcb_atom_t selection,xcb_timestamp_t time)2685 xcb_set_selection_owner_checked (xcb_connection_t *c /**< */,
2686 xcb_window_t owner /**< */,
2687 xcb_atom_t selection /**< */,
2688 xcb_timestamp_t time /**< */)
2689 {
2690 static const xcb_protocol_request_t xcb_req = {
2691 /* count */ 2,
2692 /* ext */ 0,
2693 /* opcode */ XCB_SET_SELECTION_OWNER,
2694 /* isvoid */ 1
2695 };
2696
2697 struct iovec xcb_parts[4];
2698 xcb_void_cookie_t xcb_ret;
2699 xcb_set_selection_owner_request_t xcb_out;
2700
2701 xcb_out.pad0 = 0;
2702 xcb_out.owner = owner;
2703 xcb_out.selection = selection;
2704 xcb_out.time = time;
2705
2706 xcb_parts[2].iov_base = (char *) &xcb_out;
2707 xcb_parts[2].iov_len = sizeof(xcb_out);
2708 xcb_parts[3].iov_base = 0;
2709 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2710
2711 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2712 return xcb_ret;
2713 }
2714
2715 xcb_void_cookie_t
xcb_set_selection_owner(xcb_connection_t * c,xcb_window_t owner,xcb_atom_t selection,xcb_timestamp_t time)2716 xcb_set_selection_owner (xcb_connection_t *c /**< */,
2717 xcb_window_t owner /**< */,
2718 xcb_atom_t selection /**< */,
2719 xcb_timestamp_t time /**< */)
2720 {
2721 static const xcb_protocol_request_t xcb_req = {
2722 /* count */ 2,
2723 /* ext */ 0,
2724 /* opcode */ XCB_SET_SELECTION_OWNER,
2725 /* isvoid */ 1
2726 };
2727
2728 struct iovec xcb_parts[4];
2729 xcb_void_cookie_t xcb_ret;
2730 xcb_set_selection_owner_request_t xcb_out;
2731
2732 xcb_out.pad0 = 0;
2733 xcb_out.owner = owner;
2734 xcb_out.selection = selection;
2735 xcb_out.time = time;
2736
2737 xcb_parts[2].iov_base = (char *) &xcb_out;
2738 xcb_parts[2].iov_len = sizeof(xcb_out);
2739 xcb_parts[3].iov_base = 0;
2740 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2741
2742 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2743 return xcb_ret;
2744 }
2745
2746 xcb_get_selection_owner_cookie_t
xcb_get_selection_owner(xcb_connection_t * c,xcb_atom_t selection)2747 xcb_get_selection_owner (xcb_connection_t *c /**< */,
2748 xcb_atom_t selection /**< */)
2749 {
2750 static const xcb_protocol_request_t xcb_req = {
2751 /* count */ 2,
2752 /* ext */ 0,
2753 /* opcode */ XCB_GET_SELECTION_OWNER,
2754 /* isvoid */ 0
2755 };
2756
2757 struct iovec xcb_parts[4];
2758 xcb_get_selection_owner_cookie_t xcb_ret;
2759 xcb_get_selection_owner_request_t xcb_out;
2760
2761 xcb_out.pad0 = 0;
2762 xcb_out.selection = selection;
2763
2764 xcb_parts[2].iov_base = (char *) &xcb_out;
2765 xcb_parts[2].iov_len = sizeof(xcb_out);
2766 xcb_parts[3].iov_base = 0;
2767 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2768
2769 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2770 return xcb_ret;
2771 }
2772
2773 xcb_get_selection_owner_cookie_t
xcb_get_selection_owner_unchecked(xcb_connection_t * c,xcb_atom_t selection)2774 xcb_get_selection_owner_unchecked (xcb_connection_t *c /**< */,
2775 xcb_atom_t selection /**< */)
2776 {
2777 static const xcb_protocol_request_t xcb_req = {
2778 /* count */ 2,
2779 /* ext */ 0,
2780 /* opcode */ XCB_GET_SELECTION_OWNER,
2781 /* isvoid */ 0
2782 };
2783
2784 struct iovec xcb_parts[4];
2785 xcb_get_selection_owner_cookie_t xcb_ret;
2786 xcb_get_selection_owner_request_t xcb_out;
2787
2788 xcb_out.pad0 = 0;
2789 xcb_out.selection = selection;
2790
2791 xcb_parts[2].iov_base = (char *) &xcb_out;
2792 xcb_parts[2].iov_len = sizeof(xcb_out);
2793 xcb_parts[3].iov_base = 0;
2794 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2795
2796 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2797 return xcb_ret;
2798 }
2799
2800 xcb_get_selection_owner_reply_t *
xcb_get_selection_owner_reply(xcb_connection_t * c,xcb_get_selection_owner_cookie_t cookie,xcb_generic_error_t ** e)2801 xcb_get_selection_owner_reply (xcb_connection_t *c /**< */,
2802 xcb_get_selection_owner_cookie_t cookie /**< */,
2803 xcb_generic_error_t **e /**< */)
2804 {
2805 return (xcb_get_selection_owner_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
2806 }
2807
2808 xcb_void_cookie_t
xcb_convert_selection_checked(xcb_connection_t * c,xcb_window_t requestor,xcb_atom_t selection,xcb_atom_t target,xcb_atom_t property,xcb_timestamp_t time)2809 xcb_convert_selection_checked (xcb_connection_t *c /**< */,
2810 xcb_window_t requestor /**< */,
2811 xcb_atom_t selection /**< */,
2812 xcb_atom_t target /**< */,
2813 xcb_atom_t property /**< */,
2814 xcb_timestamp_t time /**< */)
2815 {
2816 static const xcb_protocol_request_t xcb_req = {
2817 /* count */ 2,
2818 /* ext */ 0,
2819 /* opcode */ XCB_CONVERT_SELECTION,
2820 /* isvoid */ 1
2821 };
2822
2823 struct iovec xcb_parts[4];
2824 xcb_void_cookie_t xcb_ret;
2825 xcb_convert_selection_request_t xcb_out;
2826
2827 xcb_out.pad0 = 0;
2828 xcb_out.requestor = requestor;
2829 xcb_out.selection = selection;
2830 xcb_out.target = target;
2831 xcb_out.property = property;
2832 xcb_out.time = time;
2833
2834 xcb_parts[2].iov_base = (char *) &xcb_out;
2835 xcb_parts[2].iov_len = sizeof(xcb_out);
2836 xcb_parts[3].iov_base = 0;
2837 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2838
2839 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2840 return xcb_ret;
2841 }
2842
2843 xcb_void_cookie_t
xcb_convert_selection(xcb_connection_t * c,xcb_window_t requestor,xcb_atom_t selection,xcb_atom_t target,xcb_atom_t property,xcb_timestamp_t time)2844 xcb_convert_selection (xcb_connection_t *c /**< */,
2845 xcb_window_t requestor /**< */,
2846 xcb_atom_t selection /**< */,
2847 xcb_atom_t target /**< */,
2848 xcb_atom_t property /**< */,
2849 xcb_timestamp_t time /**< */)
2850 {
2851 static const xcb_protocol_request_t xcb_req = {
2852 /* count */ 2,
2853 /* ext */ 0,
2854 /* opcode */ XCB_CONVERT_SELECTION,
2855 /* isvoid */ 1
2856 };
2857
2858 struct iovec xcb_parts[4];
2859 xcb_void_cookie_t xcb_ret;
2860 xcb_convert_selection_request_t xcb_out;
2861
2862 xcb_out.pad0 = 0;
2863 xcb_out.requestor = requestor;
2864 xcb_out.selection = selection;
2865 xcb_out.target = target;
2866 xcb_out.property = property;
2867 xcb_out.time = time;
2868
2869 xcb_parts[2].iov_base = (char *) &xcb_out;
2870 xcb_parts[2].iov_len = sizeof(xcb_out);
2871 xcb_parts[3].iov_base = 0;
2872 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2873
2874 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2875 return xcb_ret;
2876 }
2877
2878 xcb_void_cookie_t
xcb_send_event_checked(xcb_connection_t * c,uint8_t propagate,xcb_window_t destination,uint32_t event_mask,const char * event)2879 xcb_send_event_checked (xcb_connection_t *c /**< */,
2880 uint8_t propagate /**< */,
2881 xcb_window_t destination /**< */,
2882 uint32_t event_mask /**< */,
2883 const char *event /**< */)
2884 {
2885 static const xcb_protocol_request_t xcb_req = {
2886 /* count */ 2,
2887 /* ext */ 0,
2888 /* opcode */ XCB_SEND_EVENT,
2889 /* isvoid */ 1
2890 };
2891
2892 struct iovec xcb_parts[4];
2893 xcb_void_cookie_t xcb_ret;
2894 xcb_send_event_request_t xcb_out;
2895
2896 xcb_out.propagate = propagate;
2897 xcb_out.destination = destination;
2898 xcb_out.event_mask = event_mask;
2899 memcpy(xcb_out.event, event, 32);
2900
2901 xcb_parts[2].iov_base = (char *) &xcb_out;
2902 xcb_parts[2].iov_len = sizeof(xcb_out);
2903 xcb_parts[3].iov_base = 0;
2904 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2905
2906 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2907 return xcb_ret;
2908 }
2909
2910 xcb_void_cookie_t
xcb_send_event(xcb_connection_t * c,uint8_t propagate,xcb_window_t destination,uint32_t event_mask,const char * event)2911 xcb_send_event (xcb_connection_t *c /**< */,
2912 uint8_t propagate /**< */,
2913 xcb_window_t destination /**< */,
2914 uint32_t event_mask /**< */,
2915 const char *event /**< */)
2916 {
2917 static const xcb_protocol_request_t xcb_req = {
2918 /* count */ 2,
2919 /* ext */ 0,
2920 /* opcode */ XCB_SEND_EVENT,
2921 /* isvoid */ 1
2922 };
2923
2924 struct iovec xcb_parts[4];
2925 xcb_void_cookie_t xcb_ret;
2926 xcb_send_event_request_t xcb_out;
2927
2928 xcb_out.propagate = propagate;
2929 xcb_out.destination = destination;
2930 xcb_out.event_mask = event_mask;
2931 memcpy(xcb_out.event, event, 32);
2932
2933 xcb_parts[2].iov_base = (char *) &xcb_out;
2934 xcb_parts[2].iov_len = sizeof(xcb_out);
2935 xcb_parts[3].iov_base = 0;
2936 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2937
2938 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2939 return xcb_ret;
2940 }
2941
2942 xcb_grab_pointer_cookie_t
xcb_grab_pointer(xcb_connection_t * c,uint8_t owner_events,xcb_window_t grab_window,uint16_t event_mask,uint8_t pointer_mode,uint8_t keyboard_mode,xcb_window_t confine_to,xcb_cursor_t cursor,xcb_timestamp_t time)2943 xcb_grab_pointer (xcb_connection_t *c /**< */,
2944 uint8_t owner_events /**< */,
2945 xcb_window_t grab_window /**< */,
2946 uint16_t event_mask /**< */,
2947 uint8_t pointer_mode /**< */,
2948 uint8_t keyboard_mode /**< */,
2949 xcb_window_t confine_to /**< */,
2950 xcb_cursor_t cursor /**< */,
2951 xcb_timestamp_t time /**< */)
2952 {
2953 static const xcb_protocol_request_t xcb_req = {
2954 /* count */ 2,
2955 /* ext */ 0,
2956 /* opcode */ XCB_GRAB_POINTER,
2957 /* isvoid */ 0
2958 };
2959
2960 struct iovec xcb_parts[4];
2961 xcb_grab_pointer_cookie_t xcb_ret;
2962 xcb_grab_pointer_request_t xcb_out;
2963
2964 xcb_out.owner_events = owner_events;
2965 xcb_out.grab_window = grab_window;
2966 xcb_out.event_mask = event_mask;
2967 xcb_out.pointer_mode = pointer_mode;
2968 xcb_out.keyboard_mode = keyboard_mode;
2969 xcb_out.confine_to = confine_to;
2970 xcb_out.cursor = cursor;
2971 xcb_out.time = time;
2972
2973 xcb_parts[2].iov_base = (char *) &xcb_out;
2974 xcb_parts[2].iov_len = sizeof(xcb_out);
2975 xcb_parts[3].iov_base = 0;
2976 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2977
2978 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
2979 return xcb_ret;
2980 }
2981
2982 xcb_grab_pointer_cookie_t
xcb_grab_pointer_unchecked(xcb_connection_t * c,uint8_t owner_events,xcb_window_t grab_window,uint16_t event_mask,uint8_t pointer_mode,uint8_t keyboard_mode,xcb_window_t confine_to,xcb_cursor_t cursor,xcb_timestamp_t time)2983 xcb_grab_pointer_unchecked (xcb_connection_t *c /**< */,
2984 uint8_t owner_events /**< */,
2985 xcb_window_t grab_window /**< */,
2986 uint16_t event_mask /**< */,
2987 uint8_t pointer_mode /**< */,
2988 uint8_t keyboard_mode /**< */,
2989 xcb_window_t confine_to /**< */,
2990 xcb_cursor_t cursor /**< */,
2991 xcb_timestamp_t time /**< */)
2992 {
2993 static const xcb_protocol_request_t xcb_req = {
2994 /* count */ 2,
2995 /* ext */ 0,
2996 /* opcode */ XCB_GRAB_POINTER,
2997 /* isvoid */ 0
2998 };
2999
3000 struct iovec xcb_parts[4];
3001 xcb_grab_pointer_cookie_t xcb_ret;
3002 xcb_grab_pointer_request_t xcb_out;
3003
3004 xcb_out.owner_events = owner_events;
3005 xcb_out.grab_window = grab_window;
3006 xcb_out.event_mask = event_mask;
3007 xcb_out.pointer_mode = pointer_mode;
3008 xcb_out.keyboard_mode = keyboard_mode;
3009 xcb_out.confine_to = confine_to;
3010 xcb_out.cursor = cursor;
3011 xcb_out.time = time;
3012
3013 xcb_parts[2].iov_base = (char *) &xcb_out;
3014 xcb_parts[2].iov_len = sizeof(xcb_out);
3015 xcb_parts[3].iov_base = 0;
3016 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3017
3018 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
3019 return xcb_ret;
3020 }
3021
3022 xcb_grab_pointer_reply_t *
xcb_grab_pointer_reply(xcb_connection_t * c,xcb_grab_pointer_cookie_t cookie,xcb_generic_error_t ** e)3023 xcb_grab_pointer_reply (xcb_connection_t *c /**< */,
3024 xcb_grab_pointer_cookie_t cookie /**< */,
3025 xcb_generic_error_t **e /**< */)
3026 {
3027 return (xcb_grab_pointer_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
3028 }
3029
3030 xcb_void_cookie_t
xcb_ungrab_pointer_checked(xcb_connection_t * c,xcb_timestamp_t time)3031 xcb_ungrab_pointer_checked (xcb_connection_t *c /**< */,
3032 xcb_timestamp_t time /**< */)
3033 {
3034 static const xcb_protocol_request_t xcb_req = {
3035 /* count */ 2,
3036 /* ext */ 0,
3037 /* opcode */ XCB_UNGRAB_POINTER,
3038 /* isvoid */ 1
3039 };
3040
3041 struct iovec xcb_parts[4];
3042 xcb_void_cookie_t xcb_ret;
3043 xcb_ungrab_pointer_request_t xcb_out;
3044
3045 xcb_out.pad0 = 0;
3046 xcb_out.time = time;
3047
3048 xcb_parts[2].iov_base = (char *) &xcb_out;
3049 xcb_parts[2].iov_len = sizeof(xcb_out);
3050 xcb_parts[3].iov_base = 0;
3051 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3052
3053 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
3054 return xcb_ret;
3055 }
3056
3057 xcb_void_cookie_t
xcb_ungrab_pointer(xcb_connection_t * c,xcb_timestamp_t time)3058 xcb_ungrab_pointer (xcb_connection_t *c /**< */,
3059 xcb_timestamp_t time /**< */)
3060 {
3061 static const xcb_protocol_request_t xcb_req = {
3062 /* count */ 2,
3063 /* ext */ 0,
3064 /* opcode */ XCB_UNGRAB_POINTER,
3065 /* isvoid */ 1
3066 };
3067
3068 struct iovec xcb_parts[4];
3069 xcb_void_cookie_t xcb_ret;
3070 xcb_ungrab_pointer_request_t xcb_out;
3071
3072 xcb_out.pad0 = 0;
3073 xcb_out.time = time;
3074
3075 xcb_parts[2].iov_base = (char *) &xcb_out;
3076 xcb_parts[2].iov_len = sizeof(xcb_out);
3077 xcb_parts[3].iov_base = 0;
3078 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3079
3080 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
3081 return xcb_ret;
3082 }
3083
3084 xcb_void_cookie_t
xcb_grab_button_checked(xcb_connection_t * c,uint8_t owner_events,xcb_window_t grab_window,uint16_t event_mask,uint8_t pointer_mode,uint8_t keyboard_mode,xcb_window_t confine_to,xcb_cursor_t cursor,uint8_t button,uint16_t modifiers)3085 xcb_grab_button_checked (xcb_connection_t *c /**< */,
3086 uint8_t owner_events /**< */,
3087 xcb_window_t grab_window /**< */,
3088 uint16_t event_mask /**< */,
3089 uint8_t pointer_mode /**< */,
3090 uint8_t keyboard_mode /**< */,
3091 xcb_window_t confine_to /**< */,
3092 xcb_cursor_t cursor /**< */,
3093 uint8_t button /**< */,
3094 uint16_t modifiers /**< */)
3095 {
3096 static const xcb_protocol_request_t xcb_req = {
3097 /* count */ 2,
3098 /* ext */ 0,
3099 /* opcode */ XCB_GRAB_BUTTON,
3100 /* isvoid */ 1
3101 };
3102
3103 struct iovec xcb_parts[4];
3104 xcb_void_cookie_t xcb_ret;
3105 xcb_grab_button_request_t xcb_out;
3106
3107 xcb_out.owner_events = owner_events;
3108 xcb_out.grab_window = grab_window;
3109 xcb_out.event_mask = event_mask;
3110 xcb_out.pointer_mode = pointer_mode;
3111 xcb_out.keyboard_mode = keyboard_mode;
3112 xcb_out.confine_to = confine_to;
3113 xcb_out.cursor = cursor;
3114 xcb_out.button = button;
3115 xcb_out.pad0 = 0;
3116 xcb_out.modifiers = modifiers;
3117
3118 xcb_parts[2].iov_base = (char *) &xcb_out;
3119 xcb_parts[2].iov_len = sizeof(xcb_out);
3120 xcb_parts[3].iov_base = 0;
3121 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3122
3123 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
3124 return xcb_ret;
3125 }
3126
3127 xcb_void_cookie_t
xcb_grab_button(xcb_connection_t * c,uint8_t owner_events,xcb_window_t grab_window,uint16_t event_mask,uint8_t pointer_mode,uint8_t keyboard_mode,xcb_window_t confine_to,xcb_cursor_t cursor,uint8_t button,uint16_t modifiers)3128 xcb_grab_button (xcb_connection_t *c /**< */,
3129 uint8_t owner_events /**< */,
3130 xcb_window_t grab_window /**< */,
3131 uint16_t event_mask /**< */,
3132 uint8_t pointer_mode /**< */,
3133 uint8_t keyboard_mode /**< */,
3134 xcb_window_t confine_to /**< */,
3135 xcb_cursor_t cursor /**< */,
3136 uint8_t button /**< */,
3137 uint16_t modifiers /**< */)
3138 {
3139 static const xcb_protocol_request_t xcb_req = {
3140 /* count */ 2,
3141 /* ext */ 0,
3142 /* opcode */ XCB_GRAB_BUTTON,
3143 /* isvoid */ 1
3144 };
3145
3146 struct iovec xcb_parts[4];
3147 xcb_void_cookie_t xcb_ret;
3148 xcb_grab_button_request_t xcb_out;
3149
3150 xcb_out.owner_events = owner_events;
3151 xcb_out.grab_window = grab_window;
3152 xcb_out.event_mask = event_mask;
3153 xcb_out.pointer_mode = pointer_mode;
3154 xcb_out.keyboard_mode = keyboard_mode;
3155 xcb_out.confine_to = confine_to;
3156 xcb_out.cursor = cursor;
3157 xcb_out.button = button;
3158 xcb_out.pad0 = 0;
3159 xcb_out.modifiers = modifiers;
3160
3161 xcb_parts[2].iov_base = (char *) &xcb_out;
3162 xcb_parts[2].iov_len = sizeof(xcb_out);
3163 xcb_parts[3].iov_base = 0;
3164 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3165
3166 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
3167 return xcb_ret;
3168 }
3169
3170 xcb_void_cookie_t
xcb_ungrab_button_checked(xcb_connection_t * c,uint8_t button,xcb_window_t grab_window,uint16_t modifiers)3171 xcb_ungrab_button_checked (xcb_connection_t *c /**< */,
3172 uint8_t button /**< */,
3173 xcb_window_t grab_window /**< */,
3174 uint16_t modifiers /**< */)
3175 {
3176 static const xcb_protocol_request_t xcb_req = {
3177 /* count */ 2,
3178 /* ext */ 0,
3179 /* opcode */ XCB_UNGRAB_BUTTON,
3180 /* isvoid */ 1
3181 };
3182
3183 struct iovec xcb_parts[4];
3184 xcb_void_cookie_t xcb_ret;
3185 xcb_ungrab_button_request_t xcb_out;
3186
3187 xcb_out.button = button;
3188 xcb_out.grab_window = grab_window;
3189 xcb_out.modifiers = modifiers;
3190 memset(xcb_out.pad0, 0, 2);
3191
3192 xcb_parts[2].iov_base = (char *) &xcb_out;
3193 xcb_parts[2].iov_len = sizeof(xcb_out);
3194 xcb_parts[3].iov_base = 0;
3195 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3196
3197 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
3198 return xcb_ret;
3199 }
3200
3201 xcb_void_cookie_t
xcb_ungrab_button(xcb_connection_t * c,uint8_t button,xcb_window_t grab_window,uint16_t modifiers)3202 xcb_ungrab_button (xcb_connection_t *c /**< */,
3203 uint8_t button /**< */,
3204 xcb_window_t grab_window /**< */,
3205 uint16_t modifiers /**< */)
3206 {
3207 static const xcb_protocol_request_t xcb_req = {
3208 /* count */ 2,
3209 /* ext */ 0,
3210 /* opcode */ XCB_UNGRAB_BUTTON,
3211 /* isvoid */ 1
3212 };
3213
3214 struct iovec xcb_parts[4];
3215 xcb_void_cookie_t xcb_ret;
3216 xcb_ungrab_button_request_t xcb_out;
3217
3218 xcb_out.button = button;
3219 xcb_out.grab_window = grab_window;
3220 xcb_out.modifiers = modifiers;
3221 memset(xcb_out.pad0, 0, 2);
3222
3223 xcb_parts[2].iov_base = (char *) &xcb_out;
3224 xcb_parts[2].iov_len = sizeof(xcb_out);
3225 xcb_parts[3].iov_base = 0;
3226 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3227
3228 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
3229 return xcb_ret;
3230 }
3231
3232 xcb_void_cookie_t
xcb_change_active_pointer_grab_checked(xcb_connection_t * c,xcb_cursor_t cursor,xcb_timestamp_t time,uint16_t event_mask)3233 xcb_change_active_pointer_grab_checked (xcb_connection_t *c /**< */,
3234 xcb_cursor_t cursor /**< */,
3235 xcb_timestamp_t time /**< */,
3236 uint16_t event_mask /**< */)
3237 {
3238 static const xcb_protocol_request_t xcb_req = {
3239 /* count */ 2,
3240 /* ext */ 0,
3241 /* opcode */ XCB_CHANGE_ACTIVE_POINTER_GRAB,
3242 /* isvoid */ 1
3243 };
3244
3245 struct iovec xcb_parts[4];
3246 xcb_void_cookie_t xcb_ret;
3247 xcb_change_active_pointer_grab_request_t xcb_out;
3248
3249 xcb_out.pad0 = 0;
3250 xcb_out.cursor = cursor;
3251 xcb_out.time = time;
3252 xcb_out.event_mask = event_mask;
3253 memset(xcb_out.pad1, 0, 2);
3254
3255 xcb_parts[2].iov_base = (char *) &xcb_out;
3256 xcb_parts[2].iov_len = sizeof(xcb_out);
3257 xcb_parts[3].iov_base = 0;
3258 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3259
3260 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
3261 return xcb_ret;
3262 }
3263
3264 xcb_void_cookie_t
xcb_change_active_pointer_grab(xcb_connection_t * c,xcb_cursor_t cursor,xcb_timestamp_t time,uint16_t event_mask)3265 xcb_change_active_pointer_grab (xcb_connection_t *c /**< */,
3266 xcb_cursor_t cursor /**< */,
3267 xcb_timestamp_t time /**< */,
3268 uint16_t event_mask /**< */)
3269 {
3270 static const xcb_protocol_request_t xcb_req = {
3271 /* count */ 2,
3272 /* ext */ 0,
3273 /* opcode */ XCB_CHANGE_ACTIVE_POINTER_GRAB,
3274 /* isvoid */ 1
3275 };
3276
3277 struct iovec xcb_parts[4];
3278 xcb_void_cookie_t xcb_ret;
3279 xcb_change_active_pointer_grab_request_t xcb_out;
3280
3281 xcb_out.pad0 = 0;
3282 xcb_out.cursor = cursor;
3283 xcb_out.time = time;
3284 xcb_out.event_mask = event_mask;
3285 memset(xcb_out.pad1, 0, 2);
3286
3287 xcb_parts[2].iov_base = (char *) &xcb_out;
3288 xcb_parts[2].iov_len = sizeof(xcb_out);
3289 xcb_parts[3].iov_base = 0;
3290 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3291
3292 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
3293 return xcb_ret;
3294 }
3295
3296 xcb_grab_keyboard_cookie_t
xcb_grab_keyboard(xcb_connection_t * c,uint8_t owner_events,xcb_window_t grab_window,xcb_timestamp_t time,uint8_t pointer_mode,uint8_t keyboard_mode)3297 xcb_grab_keyboard (xcb_connection_t *c /**< */,
3298 uint8_t owner_events /**< */,
3299 xcb_window_t grab_window /**< */,
3300 xcb_timestamp_t time /**< */,
3301 uint8_t pointer_mode /**< */,
3302 uint8_t keyboard_mode /**< */)
3303 {
3304 static const xcb_protocol_request_t xcb_req = {
3305 /* count */ 2,
3306 /* ext */ 0,
3307 /* opcode */ XCB_GRAB_KEYBOARD,
3308 /* isvoid */ 0
3309 };
3310
3311 struct iovec xcb_parts[4];
3312 xcb_grab_keyboard_cookie_t xcb_ret;
3313 xcb_grab_keyboard_request_t xcb_out;
3314
3315 xcb_out.owner_events = owner_events;
3316 xcb_out.grab_window = grab_window;
3317 xcb_out.time = time;
3318 xcb_out.pointer_mode = pointer_mode;
3319 xcb_out.keyboard_mode = keyboard_mode;
3320 memset(xcb_out.pad0, 0, 2);
3321
3322 xcb_parts[2].iov_base = (char *) &xcb_out;
3323 xcb_parts[2].iov_len = sizeof(xcb_out);
3324 xcb_parts[3].iov_base = 0;
3325 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3326
3327 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
3328 return xcb_ret;
3329 }
3330
3331 xcb_grab_keyboard_cookie_t
xcb_grab_keyboard_unchecked(xcb_connection_t * c,uint8_t owner_events,xcb_window_t grab_window,xcb_timestamp_t time,uint8_t pointer_mode,uint8_t keyboard_mode)3332 xcb_grab_keyboard_unchecked (xcb_connection_t *c /**< */,
3333 uint8_t owner_events /**< */,
3334 xcb_window_t grab_window /**< */,
3335 xcb_timestamp_t time /**< */,
3336 uint8_t pointer_mode /**< */,
3337 uint8_t keyboard_mode /**< */)
3338 {
3339 static const xcb_protocol_request_t xcb_req = {
3340 /* count */ 2,
3341 /* ext */ 0,
3342 /* opcode */ XCB_GRAB_KEYBOARD,
3343 /* isvoid */ 0
3344 };
3345
3346 struct iovec xcb_parts[4];
3347 xcb_grab_keyboard_cookie_t xcb_ret;
3348 xcb_grab_keyboard_request_t xcb_out;
3349
3350 xcb_out.owner_events = owner_events;
3351 xcb_out.grab_window = grab_window;
3352 xcb_out.time = time;
3353 xcb_out.pointer_mode = pointer_mode;
3354 xcb_out.keyboard_mode = keyboard_mode;
3355 memset(xcb_out.pad0, 0, 2);
3356
3357 xcb_parts[2].iov_base = (char *) &xcb_out;
3358 xcb_parts[2].iov_len = sizeof(xcb_out);
3359 xcb_parts[3].iov_base = 0;
3360 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3361
3362 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
3363 return xcb_ret;
3364 }
3365
3366 xcb_grab_keyboard_reply_t *
xcb_grab_keyboard_reply(xcb_connection_t * c,xcb_grab_keyboard_cookie_t cookie,xcb_generic_error_t ** e)3367 xcb_grab_keyboard_reply (xcb_connection_t *c /**< */,
3368 xcb_grab_keyboard_cookie_t cookie /**< */,
3369 xcb_generic_error_t **e /**< */)
3370 {
3371 return (xcb_grab_keyboard_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
3372 }
3373
3374 xcb_void_cookie_t
xcb_ungrab_keyboard_checked(xcb_connection_t * c,xcb_timestamp_t time)3375 xcb_ungrab_keyboard_checked (xcb_connection_t *c /**< */,
3376 xcb_timestamp_t time /**< */)
3377 {
3378 static const xcb_protocol_request_t xcb_req = {
3379 /* count */ 2,
3380 /* ext */ 0,
3381 /* opcode */ XCB_UNGRAB_KEYBOARD,
3382 /* isvoid */ 1
3383 };
3384
3385 struct iovec xcb_parts[4];
3386 xcb_void_cookie_t xcb_ret;
3387 xcb_ungrab_keyboard_request_t xcb_out;
3388
3389 xcb_out.pad0 = 0;
3390 xcb_out.time = time;
3391
3392 xcb_parts[2].iov_base = (char *) &xcb_out;
3393 xcb_parts[2].iov_len = sizeof(xcb_out);
3394 xcb_parts[3].iov_base = 0;
3395 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3396
3397 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
3398 return xcb_ret;
3399 }
3400
3401 xcb_void_cookie_t
xcb_ungrab_keyboard(xcb_connection_t * c,xcb_timestamp_t time)3402 xcb_ungrab_keyboard (xcb_connection_t *c /**< */,
3403 xcb_timestamp_t time /**< */)
3404 {
3405 static const xcb_protocol_request_t xcb_req = {
3406 /* count */ 2,
3407 /* ext */ 0,
3408 /* opcode */ XCB_UNGRAB_KEYBOARD,
3409 /* isvoid */ 1
3410 };
3411
3412 struct iovec xcb_parts[4];
3413 xcb_void_cookie_t xcb_ret;
3414 xcb_ungrab_keyboard_request_t xcb_out;
3415
3416 xcb_out.pad0 = 0;
3417 xcb_out.time = time;
3418
3419 xcb_parts[2].iov_base = (char *) &xcb_out;
3420 xcb_parts[2].iov_len = sizeof(xcb_out);
3421 xcb_parts[3].iov_base = 0;
3422 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3423
3424 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
3425 return xcb_ret;
3426 }
3427
3428 xcb_void_cookie_t
xcb_grab_key_checked(xcb_connection_t * c,uint8_t owner_events,xcb_window_t grab_window,uint16_t modifiers,xcb_keycode_t key,uint8_t pointer_mode,uint8_t keyboard_mode)3429 xcb_grab_key_checked (xcb_connection_t *c /**< */,
3430 uint8_t owner_events /**< */,
3431 xcb_window_t grab_window /**< */,
3432 uint16_t modifiers /**< */,
3433 xcb_keycode_t key /**< */,
3434 uint8_t pointer_mode /**< */,
3435 uint8_t keyboard_mode /**< */)
3436 {
3437 static const xcb_protocol_request_t xcb_req = {
3438 /* count */ 2,
3439 /* ext */ 0,
3440 /* opcode */ XCB_GRAB_KEY,
3441 /* isvoid */ 1
3442 };
3443
3444 struct iovec xcb_parts[4];
3445 xcb_void_cookie_t xcb_ret;
3446 xcb_grab_key_request_t xcb_out;
3447
3448 xcb_out.owner_events = owner_events;
3449 xcb_out.grab_window = grab_window;
3450 xcb_out.modifiers = modifiers;
3451 xcb_out.key = key;
3452 xcb_out.pointer_mode = pointer_mode;
3453 xcb_out.keyboard_mode = keyboard_mode;
3454 memset(xcb_out.pad0, 0, 3);
3455
3456 xcb_parts[2].iov_base = (char *) &xcb_out;
3457 xcb_parts[2].iov_len = sizeof(xcb_out);
3458 xcb_parts[3].iov_base = 0;
3459 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3460
3461 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
3462 return xcb_ret;
3463 }
3464
3465 xcb_void_cookie_t
xcb_grab_key(xcb_connection_t * c,uint8_t owner_events,xcb_window_t grab_window,uint16_t modifiers,xcb_keycode_t key,uint8_t pointer_mode,uint8_t keyboard_mode)3466 xcb_grab_key (xcb_connection_t *c /**< */,
3467 uint8_t owner_events /**< */,
3468 xcb_window_t grab_window /**< */,
3469 uint16_t modifiers /**< */,
3470 xcb_keycode_t key /**< */,
3471 uint8_t pointer_mode /**< */,
3472 uint8_t keyboard_mode /**< */)
3473 {
3474 static const xcb_protocol_request_t xcb_req = {
3475 /* count */ 2,
3476 /* ext */ 0,
3477 /* opcode */ XCB_GRAB_KEY,
3478 /* isvoid */ 1
3479 };
3480
3481 struct iovec xcb_parts[4];
3482 xcb_void_cookie_t xcb_ret;
3483 xcb_grab_key_request_t xcb_out;
3484
3485 xcb_out.owner_events = owner_events;
3486 xcb_out.grab_window = grab_window;
3487 xcb_out.modifiers = modifiers;
3488 xcb_out.key = key;
3489 xcb_out.pointer_mode = pointer_mode;
3490 xcb_out.keyboard_mode = keyboard_mode;
3491 memset(xcb_out.pad0, 0, 3);
3492
3493 xcb_parts[2].iov_base = (char *) &xcb_out;
3494 xcb_parts[2].iov_len = sizeof(xcb_out);
3495 xcb_parts[3].iov_base = 0;
3496 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3497
3498 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
3499 return xcb_ret;
3500 }
3501
3502 xcb_void_cookie_t
xcb_ungrab_key_checked(xcb_connection_t * c,xcb_keycode_t key,xcb_window_t grab_window,uint16_t modifiers)3503 xcb_ungrab_key_checked (xcb_connection_t *c /**< */,
3504 xcb_keycode_t key /**< */,
3505 xcb_window_t grab_window /**< */,
3506 uint16_t modifiers /**< */)
3507 {
3508 static const xcb_protocol_request_t xcb_req = {
3509 /* count */ 2,
3510 /* ext */ 0,
3511 /* opcode */ XCB_UNGRAB_KEY,
3512 /* isvoid */ 1
3513 };
3514
3515 struct iovec xcb_parts[4];
3516 xcb_void_cookie_t xcb_ret;
3517 xcb_ungrab_key_request_t xcb_out;
3518
3519 xcb_out.key = key;
3520 xcb_out.grab_window = grab_window;
3521 xcb_out.modifiers = modifiers;
3522 memset(xcb_out.pad0, 0, 2);
3523
3524 xcb_parts[2].iov_base = (char *) &xcb_out;
3525 xcb_parts[2].iov_len = sizeof(xcb_out);
3526 xcb_parts[3].iov_base = 0;
3527 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3528
3529 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
3530 return xcb_ret;
3531 }
3532
3533 xcb_void_cookie_t
xcb_ungrab_key(xcb_connection_t * c,xcb_keycode_t key,xcb_window_t grab_window,uint16_t modifiers)3534 xcb_ungrab_key (xcb_connection_t *c /**< */,
3535 xcb_keycode_t key /**< */,
3536 xcb_window_t grab_window /**< */,
3537 uint16_t modifiers /**< */)
3538 {
3539 static const xcb_protocol_request_t xcb_req = {
3540 /* count */ 2,
3541 /* ext */ 0,
3542 /* opcode */ XCB_UNGRAB_KEY,
3543 /* isvoid */ 1
3544 };
3545
3546 struct iovec xcb_parts[4];
3547 xcb_void_cookie_t xcb_ret;
3548 xcb_ungrab_key_request_t xcb_out;
3549
3550 xcb_out.key = key;
3551 xcb_out.grab_window = grab_window;
3552 xcb_out.modifiers = modifiers;
3553 memset(xcb_out.pad0, 0, 2);
3554
3555 xcb_parts[2].iov_base = (char *) &xcb_out;
3556 xcb_parts[2].iov_len = sizeof(xcb_out);
3557 xcb_parts[3].iov_base = 0;
3558 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3559
3560 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
3561 return xcb_ret;
3562 }
3563
3564 xcb_void_cookie_t
xcb_allow_events_checked(xcb_connection_t * c,uint8_t mode,xcb_timestamp_t time)3565 xcb_allow_events_checked (xcb_connection_t *c /**< */,
3566 uint8_t mode /**< */,
3567 xcb_timestamp_t time /**< */)
3568 {
3569 static const xcb_protocol_request_t xcb_req = {
3570 /* count */ 2,
3571 /* ext */ 0,
3572 /* opcode */ XCB_ALLOW_EVENTS,
3573 /* isvoid */ 1
3574 };
3575
3576 struct iovec xcb_parts[4];
3577 xcb_void_cookie_t xcb_ret;
3578 xcb_allow_events_request_t xcb_out;
3579
3580 xcb_out.mode = mode;
3581 xcb_out.time = time;
3582
3583 xcb_parts[2].iov_base = (char *) &xcb_out;
3584 xcb_parts[2].iov_len = sizeof(xcb_out);
3585 xcb_parts[3].iov_base = 0;
3586 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3587
3588 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
3589 return xcb_ret;
3590 }
3591
3592 xcb_void_cookie_t
xcb_allow_events(xcb_connection_t * c,uint8_t mode,xcb_timestamp_t time)3593 xcb_allow_events (xcb_connection_t *c /**< */,
3594 uint8_t mode /**< */,
3595 xcb_timestamp_t time /**< */)
3596 {
3597 static const xcb_protocol_request_t xcb_req = {
3598 /* count */ 2,
3599 /* ext */ 0,
3600 /* opcode */ XCB_ALLOW_EVENTS,
3601 /* isvoid */ 1
3602 };
3603
3604 struct iovec xcb_parts[4];
3605 xcb_void_cookie_t xcb_ret;
3606 xcb_allow_events_request_t xcb_out;
3607
3608 xcb_out.mode = mode;
3609 xcb_out.time = time;
3610
3611 xcb_parts[2].iov_base = (char *) &xcb_out;
3612 xcb_parts[2].iov_len = sizeof(xcb_out);
3613 xcb_parts[3].iov_base = 0;
3614 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3615
3616 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
3617 return xcb_ret;
3618 }
3619
3620 xcb_void_cookie_t
xcb_grab_server_checked(xcb_connection_t * c)3621 xcb_grab_server_checked (xcb_connection_t *c /**< */)
3622 {
3623 static const xcb_protocol_request_t xcb_req = {
3624 /* count */ 2,
3625 /* ext */ 0,
3626 /* opcode */ XCB_GRAB_SERVER,
3627 /* isvoid */ 1
3628 };
3629
3630 struct iovec xcb_parts[4];
3631 xcb_void_cookie_t xcb_ret;
3632 xcb_grab_server_request_t xcb_out;
3633
3634 xcb_out.pad0 = 0;
3635
3636 xcb_parts[2].iov_base = (char *) &xcb_out;
3637 xcb_parts[2].iov_len = sizeof(xcb_out);
3638 xcb_parts[3].iov_base = 0;
3639 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3640
3641 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
3642 return xcb_ret;
3643 }
3644
3645 xcb_void_cookie_t
xcb_grab_server(xcb_connection_t * c)3646 xcb_grab_server (xcb_connection_t *c /**< */)
3647 {
3648 static const xcb_protocol_request_t xcb_req = {
3649 /* count */ 2,
3650 /* ext */ 0,
3651 /* opcode */ XCB_GRAB_SERVER,
3652 /* isvoid */ 1
3653 };
3654
3655 struct iovec xcb_parts[4];
3656 xcb_void_cookie_t xcb_ret;
3657 xcb_grab_server_request_t xcb_out;
3658
3659 xcb_out.pad0 = 0;
3660
3661 xcb_parts[2].iov_base = (char *) &xcb_out;
3662 xcb_parts[2].iov_len = sizeof(xcb_out);
3663 xcb_parts[3].iov_base = 0;
3664 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3665
3666 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
3667 return xcb_ret;
3668 }
3669
3670 xcb_void_cookie_t
xcb_ungrab_server_checked(xcb_connection_t * c)3671 xcb_ungrab_server_checked (xcb_connection_t *c /**< */)
3672 {
3673 static const xcb_protocol_request_t xcb_req = {
3674 /* count */ 2,
3675 /* ext */ 0,
3676 /* opcode */ XCB_UNGRAB_SERVER,
3677 /* isvoid */ 1
3678 };
3679
3680 struct iovec xcb_parts[4];
3681 xcb_void_cookie_t xcb_ret;
3682 xcb_ungrab_server_request_t xcb_out;
3683
3684 xcb_out.pad0 = 0;
3685
3686 xcb_parts[2].iov_base = (char *) &xcb_out;
3687 xcb_parts[2].iov_len = sizeof(xcb_out);
3688 xcb_parts[3].iov_base = 0;
3689 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3690
3691 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
3692 return xcb_ret;
3693 }
3694
3695 xcb_void_cookie_t
xcb_ungrab_server(xcb_connection_t * c)3696 xcb_ungrab_server (xcb_connection_t *c /**< */)
3697 {
3698 static const xcb_protocol_request_t xcb_req = {
3699 /* count */ 2,
3700 /* ext */ 0,
3701 /* opcode */ XCB_UNGRAB_SERVER,
3702 /* isvoid */ 1
3703 };
3704
3705 struct iovec xcb_parts[4];
3706 xcb_void_cookie_t xcb_ret;
3707 xcb_ungrab_server_request_t xcb_out;
3708
3709 xcb_out.pad0 = 0;
3710
3711 xcb_parts[2].iov_base = (char *) &xcb_out;
3712 xcb_parts[2].iov_len = sizeof(xcb_out);
3713 xcb_parts[3].iov_base = 0;
3714 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3715
3716 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
3717 return xcb_ret;
3718 }
3719
3720 xcb_query_pointer_cookie_t
xcb_query_pointer(xcb_connection_t * c,xcb_window_t window)3721 xcb_query_pointer (xcb_connection_t *c /**< */,
3722 xcb_window_t window /**< */)
3723 {
3724 static const xcb_protocol_request_t xcb_req = {
3725 /* count */ 2,
3726 /* ext */ 0,
3727 /* opcode */ XCB_QUERY_POINTER,
3728 /* isvoid */ 0
3729 };
3730
3731 struct iovec xcb_parts[4];
3732 xcb_query_pointer_cookie_t xcb_ret;
3733 xcb_query_pointer_request_t xcb_out;
3734
3735 xcb_out.pad0 = 0;
3736 xcb_out.window = window;
3737
3738 xcb_parts[2].iov_base = (char *) &xcb_out;
3739 xcb_parts[2].iov_len = sizeof(xcb_out);
3740 xcb_parts[3].iov_base = 0;
3741 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3742
3743 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
3744 return xcb_ret;
3745 }
3746
3747 xcb_query_pointer_cookie_t
xcb_query_pointer_unchecked(xcb_connection_t * c,xcb_window_t window)3748 xcb_query_pointer_unchecked (xcb_connection_t *c /**< */,
3749 xcb_window_t window /**< */)
3750 {
3751 static const xcb_protocol_request_t xcb_req = {
3752 /* count */ 2,
3753 /* ext */ 0,
3754 /* opcode */ XCB_QUERY_POINTER,
3755 /* isvoid */ 0
3756 };
3757
3758 struct iovec xcb_parts[4];
3759 xcb_query_pointer_cookie_t xcb_ret;
3760 xcb_query_pointer_request_t xcb_out;
3761
3762 xcb_out.pad0 = 0;
3763 xcb_out.window = window;
3764
3765 xcb_parts[2].iov_base = (char *) &xcb_out;
3766 xcb_parts[2].iov_len = sizeof(xcb_out);
3767 xcb_parts[3].iov_base = 0;
3768 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3769
3770 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
3771 return xcb_ret;
3772 }
3773
3774 xcb_query_pointer_reply_t *
xcb_query_pointer_reply(xcb_connection_t * c,xcb_query_pointer_cookie_t cookie,xcb_generic_error_t ** e)3775 xcb_query_pointer_reply (xcb_connection_t *c /**< */,
3776 xcb_query_pointer_cookie_t cookie /**< */,
3777 xcb_generic_error_t **e /**< */)
3778 {
3779 return (xcb_query_pointer_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
3780 }
3781
3782 void
xcb_timecoord_next(xcb_timecoord_iterator_t * i)3783 xcb_timecoord_next (xcb_timecoord_iterator_t *i /**< */)
3784 {
3785 --i->rem;
3786 ++i->data;
3787 i->index += sizeof(xcb_timecoord_t);
3788 }
3789
3790 xcb_generic_iterator_t
xcb_timecoord_end(xcb_timecoord_iterator_t i)3791 xcb_timecoord_end (xcb_timecoord_iterator_t i /**< */)
3792 {
3793 xcb_generic_iterator_t ret;
3794 ret.data = i.data + i.rem;
3795 ret.index = i.index + ((char *) ret.data - (char *) i.data);
3796 ret.rem = 0;
3797 return ret;
3798 }
3799
3800 int
xcb_get_motion_events_sizeof(const void * _buffer)3801 xcb_get_motion_events_sizeof (const void *_buffer /**< */)
3802 {
3803 char *xcb_tmp = (char *)_buffer;
3804 const xcb_get_motion_events_reply_t *_aux = (xcb_get_motion_events_reply_t *)_buffer;
3805 unsigned int xcb_buffer_len = 0;
3806 unsigned int xcb_block_len = 0;
3807 unsigned int xcb_pad = 0;
3808 unsigned int xcb_align_to = 0;
3809
3810
3811 xcb_block_len += sizeof(xcb_get_motion_events_reply_t);
3812 xcb_tmp += xcb_block_len;
3813 xcb_buffer_len += xcb_block_len;
3814 xcb_block_len = 0;
3815 /* events */
3816 xcb_block_len += _aux->events_len * sizeof(xcb_timecoord_t);
3817 xcb_tmp += xcb_block_len;
3818 xcb_align_to = ALIGNOF(xcb_timecoord_t);
3819 /* insert padding */
3820 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
3821 xcb_buffer_len += xcb_block_len + xcb_pad;
3822 if (0 != xcb_pad) {
3823 xcb_tmp += xcb_pad;
3824 xcb_pad = 0;
3825 }
3826 xcb_block_len = 0;
3827
3828 return xcb_buffer_len;
3829 }
3830
3831 xcb_get_motion_events_cookie_t
xcb_get_motion_events(xcb_connection_t * c,xcb_window_t window,xcb_timestamp_t start,xcb_timestamp_t stop)3832 xcb_get_motion_events (xcb_connection_t *c /**< */,
3833 xcb_window_t window /**< */,
3834 xcb_timestamp_t start /**< */,
3835 xcb_timestamp_t stop /**< */)
3836 {
3837 static const xcb_protocol_request_t xcb_req = {
3838 /* count */ 2,
3839 /* ext */ 0,
3840 /* opcode */ XCB_GET_MOTION_EVENTS,
3841 /* isvoid */ 0
3842 };
3843
3844 struct iovec xcb_parts[4];
3845 xcb_get_motion_events_cookie_t xcb_ret;
3846 xcb_get_motion_events_request_t xcb_out;
3847
3848 xcb_out.pad0 = 0;
3849 xcb_out.window = window;
3850 xcb_out.start = start;
3851 xcb_out.stop = stop;
3852
3853 xcb_parts[2].iov_base = (char *) &xcb_out;
3854 xcb_parts[2].iov_len = sizeof(xcb_out);
3855 xcb_parts[3].iov_base = 0;
3856 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3857
3858 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
3859 return xcb_ret;
3860 }
3861
3862 xcb_get_motion_events_cookie_t
xcb_get_motion_events_unchecked(xcb_connection_t * c,xcb_window_t window,xcb_timestamp_t start,xcb_timestamp_t stop)3863 xcb_get_motion_events_unchecked (xcb_connection_t *c /**< */,
3864 xcb_window_t window /**< */,
3865 xcb_timestamp_t start /**< */,
3866 xcb_timestamp_t stop /**< */)
3867 {
3868 static const xcb_protocol_request_t xcb_req = {
3869 /* count */ 2,
3870 /* ext */ 0,
3871 /* opcode */ XCB_GET_MOTION_EVENTS,
3872 /* isvoid */ 0
3873 };
3874
3875 struct iovec xcb_parts[4];
3876 xcb_get_motion_events_cookie_t xcb_ret;
3877 xcb_get_motion_events_request_t xcb_out;
3878
3879 xcb_out.pad0 = 0;
3880 xcb_out.window = window;
3881 xcb_out.start = start;
3882 xcb_out.stop = stop;
3883
3884 xcb_parts[2].iov_base = (char *) &xcb_out;
3885 xcb_parts[2].iov_len = sizeof(xcb_out);
3886 xcb_parts[3].iov_base = 0;
3887 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3888
3889 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
3890 return xcb_ret;
3891 }
3892
3893 xcb_timecoord_t *
xcb_get_motion_events_events(const xcb_get_motion_events_reply_t * R)3894 xcb_get_motion_events_events (const xcb_get_motion_events_reply_t *R /**< */)
3895 {
3896 return (xcb_timecoord_t *) (R + 1);
3897 }
3898
3899 int
xcb_get_motion_events_events_length(const xcb_get_motion_events_reply_t * R)3900 xcb_get_motion_events_events_length (const xcb_get_motion_events_reply_t *R /**< */)
3901 {
3902 return R->events_len;
3903 }
3904
3905 xcb_timecoord_iterator_t
xcb_get_motion_events_events_iterator(const xcb_get_motion_events_reply_t * R)3906 xcb_get_motion_events_events_iterator (const xcb_get_motion_events_reply_t *R /**< */)
3907 {
3908 xcb_timecoord_iterator_t i;
3909 i.data = (xcb_timecoord_t *) (R + 1);
3910 i.rem = R->events_len;
3911 i.index = (char *) i.data - (char *) R;
3912 return i;
3913 }
3914
3915 xcb_get_motion_events_reply_t *
xcb_get_motion_events_reply(xcb_connection_t * c,xcb_get_motion_events_cookie_t cookie,xcb_generic_error_t ** e)3916 xcb_get_motion_events_reply (xcb_connection_t *c /**< */,
3917 xcb_get_motion_events_cookie_t cookie /**< */,
3918 xcb_generic_error_t **e /**< */)
3919 {
3920 return (xcb_get_motion_events_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
3921 }
3922
3923 xcb_translate_coordinates_cookie_t
xcb_translate_coordinates(xcb_connection_t * c,xcb_window_t src_window,xcb_window_t dst_window,int16_t src_x,int16_t src_y)3924 xcb_translate_coordinates (xcb_connection_t *c /**< */,
3925 xcb_window_t src_window /**< */,
3926 xcb_window_t dst_window /**< */,
3927 int16_t src_x /**< */,
3928 int16_t src_y /**< */)
3929 {
3930 static const xcb_protocol_request_t xcb_req = {
3931 /* count */ 2,
3932 /* ext */ 0,
3933 /* opcode */ XCB_TRANSLATE_COORDINATES,
3934 /* isvoid */ 0
3935 };
3936
3937 struct iovec xcb_parts[4];
3938 xcb_translate_coordinates_cookie_t xcb_ret;
3939 xcb_translate_coordinates_request_t xcb_out;
3940
3941 xcb_out.pad0 = 0;
3942 xcb_out.src_window = src_window;
3943 xcb_out.dst_window = dst_window;
3944 xcb_out.src_x = src_x;
3945 xcb_out.src_y = src_y;
3946
3947 xcb_parts[2].iov_base = (char *) &xcb_out;
3948 xcb_parts[2].iov_len = sizeof(xcb_out);
3949 xcb_parts[3].iov_base = 0;
3950 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3951
3952 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
3953 return xcb_ret;
3954 }
3955
3956 xcb_translate_coordinates_cookie_t
xcb_translate_coordinates_unchecked(xcb_connection_t * c,xcb_window_t src_window,xcb_window_t dst_window,int16_t src_x,int16_t src_y)3957 xcb_translate_coordinates_unchecked (xcb_connection_t *c /**< */,
3958 xcb_window_t src_window /**< */,
3959 xcb_window_t dst_window /**< */,
3960 int16_t src_x /**< */,
3961 int16_t src_y /**< */)
3962 {
3963 static const xcb_protocol_request_t xcb_req = {
3964 /* count */ 2,
3965 /* ext */ 0,
3966 /* opcode */ XCB_TRANSLATE_COORDINATES,
3967 /* isvoid */ 0
3968 };
3969
3970 struct iovec xcb_parts[4];
3971 xcb_translate_coordinates_cookie_t xcb_ret;
3972 xcb_translate_coordinates_request_t xcb_out;
3973
3974 xcb_out.pad0 = 0;
3975 xcb_out.src_window = src_window;
3976 xcb_out.dst_window = dst_window;
3977 xcb_out.src_x = src_x;
3978 xcb_out.src_y = src_y;
3979
3980 xcb_parts[2].iov_base = (char *) &xcb_out;
3981 xcb_parts[2].iov_len = sizeof(xcb_out);
3982 xcb_parts[3].iov_base = 0;
3983 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3984
3985 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
3986 return xcb_ret;
3987 }
3988
3989 xcb_translate_coordinates_reply_t *
xcb_translate_coordinates_reply(xcb_connection_t * c,xcb_translate_coordinates_cookie_t cookie,xcb_generic_error_t ** e)3990 xcb_translate_coordinates_reply (xcb_connection_t *c /**< */,
3991 xcb_translate_coordinates_cookie_t cookie /**< */,
3992 xcb_generic_error_t **e /**< */)
3993 {
3994 return (xcb_translate_coordinates_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
3995 }
3996
3997 xcb_void_cookie_t
xcb_warp_pointer_checked(xcb_connection_t * c,xcb_window_t src_window,xcb_window_t dst_window,int16_t src_x,int16_t src_y,uint16_t src_width,uint16_t src_height,int16_t dst_x,int16_t dst_y)3998 xcb_warp_pointer_checked (xcb_connection_t *c /**< */,
3999 xcb_window_t src_window /**< */,
4000 xcb_window_t dst_window /**< */,
4001 int16_t src_x /**< */,
4002 int16_t src_y /**< */,
4003 uint16_t src_width /**< */,
4004 uint16_t src_height /**< */,
4005 int16_t dst_x /**< */,
4006 int16_t dst_y /**< */)
4007 {
4008 static const xcb_protocol_request_t xcb_req = {
4009 /* count */ 2,
4010 /* ext */ 0,
4011 /* opcode */ XCB_WARP_POINTER,
4012 /* isvoid */ 1
4013 };
4014
4015 struct iovec xcb_parts[4];
4016 xcb_void_cookie_t xcb_ret;
4017 xcb_warp_pointer_request_t xcb_out;
4018
4019 xcb_out.pad0 = 0;
4020 xcb_out.src_window = src_window;
4021 xcb_out.dst_window = dst_window;
4022 xcb_out.src_x = src_x;
4023 xcb_out.src_y = src_y;
4024 xcb_out.src_width = src_width;
4025 xcb_out.src_height = src_height;
4026 xcb_out.dst_x = dst_x;
4027 xcb_out.dst_y = dst_y;
4028
4029 xcb_parts[2].iov_base = (char *) &xcb_out;
4030 xcb_parts[2].iov_len = sizeof(xcb_out);
4031 xcb_parts[3].iov_base = 0;
4032 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4033
4034 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
4035 return xcb_ret;
4036 }
4037
4038 xcb_void_cookie_t
xcb_warp_pointer(xcb_connection_t * c,xcb_window_t src_window,xcb_window_t dst_window,int16_t src_x,int16_t src_y,uint16_t src_width,uint16_t src_height,int16_t dst_x,int16_t dst_y)4039 xcb_warp_pointer (xcb_connection_t *c /**< */,
4040 xcb_window_t src_window /**< */,
4041 xcb_window_t dst_window /**< */,
4042 int16_t src_x /**< */,
4043 int16_t src_y /**< */,
4044 uint16_t src_width /**< */,
4045 uint16_t src_height /**< */,
4046 int16_t dst_x /**< */,
4047 int16_t dst_y /**< */)
4048 {
4049 static const xcb_protocol_request_t xcb_req = {
4050 /* count */ 2,
4051 /* ext */ 0,
4052 /* opcode */ XCB_WARP_POINTER,
4053 /* isvoid */ 1
4054 };
4055
4056 struct iovec xcb_parts[4];
4057 xcb_void_cookie_t xcb_ret;
4058 xcb_warp_pointer_request_t xcb_out;
4059
4060 xcb_out.pad0 = 0;
4061 xcb_out.src_window = src_window;
4062 xcb_out.dst_window = dst_window;
4063 xcb_out.src_x = src_x;
4064 xcb_out.src_y = src_y;
4065 xcb_out.src_width = src_width;
4066 xcb_out.src_height = src_height;
4067 xcb_out.dst_x = dst_x;
4068 xcb_out.dst_y = dst_y;
4069
4070 xcb_parts[2].iov_base = (char *) &xcb_out;
4071 xcb_parts[2].iov_len = sizeof(xcb_out);
4072 xcb_parts[3].iov_base = 0;
4073 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4074
4075 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
4076 return xcb_ret;
4077 }
4078
4079 xcb_void_cookie_t
xcb_set_input_focus_checked(xcb_connection_t * c,uint8_t revert_to,xcb_window_t focus,xcb_timestamp_t time)4080 xcb_set_input_focus_checked (xcb_connection_t *c /**< */,
4081 uint8_t revert_to /**< */,
4082 xcb_window_t focus /**< */,
4083 xcb_timestamp_t time /**< */)
4084 {
4085 static const xcb_protocol_request_t xcb_req = {
4086 /* count */ 2,
4087 /* ext */ 0,
4088 /* opcode */ XCB_SET_INPUT_FOCUS,
4089 /* isvoid */ 1
4090 };
4091
4092 struct iovec xcb_parts[4];
4093 xcb_void_cookie_t xcb_ret;
4094 xcb_set_input_focus_request_t xcb_out;
4095
4096 xcb_out.revert_to = revert_to;
4097 xcb_out.focus = focus;
4098 xcb_out.time = time;
4099
4100 xcb_parts[2].iov_base = (char *) &xcb_out;
4101 xcb_parts[2].iov_len = sizeof(xcb_out);
4102 xcb_parts[3].iov_base = 0;
4103 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4104
4105 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
4106 return xcb_ret;
4107 }
4108
4109 xcb_void_cookie_t
xcb_set_input_focus(xcb_connection_t * c,uint8_t revert_to,xcb_window_t focus,xcb_timestamp_t time)4110 xcb_set_input_focus (xcb_connection_t *c /**< */,
4111 uint8_t revert_to /**< */,
4112 xcb_window_t focus /**< */,
4113 xcb_timestamp_t time /**< */)
4114 {
4115 static const xcb_protocol_request_t xcb_req = {
4116 /* count */ 2,
4117 /* ext */ 0,
4118 /* opcode */ XCB_SET_INPUT_FOCUS,
4119 /* isvoid */ 1
4120 };
4121
4122 struct iovec xcb_parts[4];
4123 xcb_void_cookie_t xcb_ret;
4124 xcb_set_input_focus_request_t xcb_out;
4125
4126 xcb_out.revert_to = revert_to;
4127 xcb_out.focus = focus;
4128 xcb_out.time = time;
4129
4130 xcb_parts[2].iov_base = (char *) &xcb_out;
4131 xcb_parts[2].iov_len = sizeof(xcb_out);
4132 xcb_parts[3].iov_base = 0;
4133 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4134
4135 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
4136 return xcb_ret;
4137 }
4138
4139 xcb_get_input_focus_cookie_t
xcb_get_input_focus(xcb_connection_t * c)4140 xcb_get_input_focus (xcb_connection_t *c /**< */)
4141 {
4142 static const xcb_protocol_request_t xcb_req = {
4143 /* count */ 2,
4144 /* ext */ 0,
4145 /* opcode */ XCB_GET_INPUT_FOCUS,
4146 /* isvoid */ 0
4147 };
4148
4149 struct iovec xcb_parts[4];
4150 xcb_get_input_focus_cookie_t xcb_ret;
4151 xcb_get_input_focus_request_t xcb_out;
4152
4153 xcb_out.pad0 = 0;
4154
4155 xcb_parts[2].iov_base = (char *) &xcb_out;
4156 xcb_parts[2].iov_len = sizeof(xcb_out);
4157 xcb_parts[3].iov_base = 0;
4158 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4159
4160 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
4161 return xcb_ret;
4162 }
4163
4164 xcb_get_input_focus_cookie_t
xcb_get_input_focus_unchecked(xcb_connection_t * c)4165 xcb_get_input_focus_unchecked (xcb_connection_t *c /**< */)
4166 {
4167 static const xcb_protocol_request_t xcb_req = {
4168 /* count */ 2,
4169 /* ext */ 0,
4170 /* opcode */ XCB_GET_INPUT_FOCUS,
4171 /* isvoid */ 0
4172 };
4173
4174 struct iovec xcb_parts[4];
4175 xcb_get_input_focus_cookie_t xcb_ret;
4176 xcb_get_input_focus_request_t xcb_out;
4177
4178 xcb_out.pad0 = 0;
4179
4180 xcb_parts[2].iov_base = (char *) &xcb_out;
4181 xcb_parts[2].iov_len = sizeof(xcb_out);
4182 xcb_parts[3].iov_base = 0;
4183 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4184
4185 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
4186 return xcb_ret;
4187 }
4188
4189 xcb_get_input_focus_reply_t *
xcb_get_input_focus_reply(xcb_connection_t * c,xcb_get_input_focus_cookie_t cookie,xcb_generic_error_t ** e)4190 xcb_get_input_focus_reply (xcb_connection_t *c /**< */,
4191 xcb_get_input_focus_cookie_t cookie /**< */,
4192 xcb_generic_error_t **e /**< */)
4193 {
4194 return (xcb_get_input_focus_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
4195 }
4196
4197 xcb_query_keymap_cookie_t
xcb_query_keymap(xcb_connection_t * c)4198 xcb_query_keymap (xcb_connection_t *c /**< */)
4199 {
4200 static const xcb_protocol_request_t xcb_req = {
4201 /* count */ 2,
4202 /* ext */ 0,
4203 /* opcode */ XCB_QUERY_KEYMAP,
4204 /* isvoid */ 0
4205 };
4206
4207 struct iovec xcb_parts[4];
4208 xcb_query_keymap_cookie_t xcb_ret;
4209 xcb_query_keymap_request_t xcb_out;
4210
4211 xcb_out.pad0 = 0;
4212
4213 xcb_parts[2].iov_base = (char *) &xcb_out;
4214 xcb_parts[2].iov_len = sizeof(xcb_out);
4215 xcb_parts[3].iov_base = 0;
4216 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4217
4218 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
4219 return xcb_ret;
4220 }
4221
4222 xcb_query_keymap_cookie_t
xcb_query_keymap_unchecked(xcb_connection_t * c)4223 xcb_query_keymap_unchecked (xcb_connection_t *c /**< */)
4224 {
4225 static const xcb_protocol_request_t xcb_req = {
4226 /* count */ 2,
4227 /* ext */ 0,
4228 /* opcode */ XCB_QUERY_KEYMAP,
4229 /* isvoid */ 0
4230 };
4231
4232 struct iovec xcb_parts[4];
4233 xcb_query_keymap_cookie_t xcb_ret;
4234 xcb_query_keymap_request_t xcb_out;
4235
4236 xcb_out.pad0 = 0;
4237
4238 xcb_parts[2].iov_base = (char *) &xcb_out;
4239 xcb_parts[2].iov_len = sizeof(xcb_out);
4240 xcb_parts[3].iov_base = 0;
4241 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4242
4243 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
4244 return xcb_ret;
4245 }
4246
4247 xcb_query_keymap_reply_t *
xcb_query_keymap_reply(xcb_connection_t * c,xcb_query_keymap_cookie_t cookie,xcb_generic_error_t ** e)4248 xcb_query_keymap_reply (xcb_connection_t *c /**< */,
4249 xcb_query_keymap_cookie_t cookie /**< */,
4250 xcb_generic_error_t **e /**< */)
4251 {
4252 return (xcb_query_keymap_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
4253 }
4254
4255 int
xcb_open_font_sizeof(const void * _buffer)4256 xcb_open_font_sizeof (const void *_buffer /**< */)
4257 {
4258 char *xcb_tmp = (char *)_buffer;
4259 const xcb_open_font_request_t *_aux = (xcb_open_font_request_t *)_buffer;
4260 unsigned int xcb_buffer_len = 0;
4261 unsigned int xcb_block_len = 0;
4262 unsigned int xcb_pad = 0;
4263 unsigned int xcb_align_to = 0;
4264
4265
4266 xcb_block_len += sizeof(xcb_open_font_request_t);
4267 xcb_tmp += xcb_block_len;
4268 xcb_buffer_len += xcb_block_len;
4269 xcb_block_len = 0;
4270 /* name */
4271 xcb_block_len += _aux->name_len * sizeof(char);
4272 xcb_tmp += xcb_block_len;
4273 xcb_align_to = ALIGNOF(char);
4274 /* insert padding */
4275 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
4276 xcb_buffer_len += xcb_block_len + xcb_pad;
4277 if (0 != xcb_pad) {
4278 xcb_tmp += xcb_pad;
4279 xcb_pad = 0;
4280 }
4281 xcb_block_len = 0;
4282
4283 return xcb_buffer_len;
4284 }
4285
4286 xcb_void_cookie_t
xcb_open_font_checked(xcb_connection_t * c,xcb_font_t fid,uint16_t name_len,const char * name)4287 xcb_open_font_checked (xcb_connection_t *c /**< */,
4288 xcb_font_t fid /**< */,
4289 uint16_t name_len /**< */,
4290 const char *name /**< */)
4291 {
4292 static const xcb_protocol_request_t xcb_req = {
4293 /* count */ 4,
4294 /* ext */ 0,
4295 /* opcode */ XCB_OPEN_FONT,
4296 /* isvoid */ 1
4297 };
4298
4299 struct iovec xcb_parts[6];
4300 xcb_void_cookie_t xcb_ret;
4301 xcb_open_font_request_t xcb_out;
4302
4303 xcb_out.pad0 = 0;
4304 xcb_out.fid = fid;
4305 xcb_out.name_len = name_len;
4306 memset(xcb_out.pad1, 0, 2);
4307
4308 xcb_parts[2].iov_base = (char *) &xcb_out;
4309 xcb_parts[2].iov_len = sizeof(xcb_out);
4310 xcb_parts[3].iov_base = 0;
4311 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4312 /* char name */
4313 xcb_parts[4].iov_base = (char *) name;
4314 xcb_parts[4].iov_len = name_len * sizeof(char);
4315 xcb_parts[5].iov_base = 0;
4316 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
4317
4318 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
4319 return xcb_ret;
4320 }
4321
4322 xcb_void_cookie_t
xcb_open_font(xcb_connection_t * c,xcb_font_t fid,uint16_t name_len,const char * name)4323 xcb_open_font (xcb_connection_t *c /**< */,
4324 xcb_font_t fid /**< */,
4325 uint16_t name_len /**< */,
4326 const char *name /**< */)
4327 {
4328 static const xcb_protocol_request_t xcb_req = {
4329 /* count */ 4,
4330 /* ext */ 0,
4331 /* opcode */ XCB_OPEN_FONT,
4332 /* isvoid */ 1
4333 };
4334
4335 struct iovec xcb_parts[6];
4336 xcb_void_cookie_t xcb_ret;
4337 xcb_open_font_request_t xcb_out;
4338
4339 xcb_out.pad0 = 0;
4340 xcb_out.fid = fid;
4341 xcb_out.name_len = name_len;
4342 memset(xcb_out.pad1, 0, 2);
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 /* char name */
4349 xcb_parts[4].iov_base = (char *) name;
4350 xcb_parts[4].iov_len = name_len * sizeof(char);
4351 xcb_parts[5].iov_base = 0;
4352 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
4353
4354 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
4355 return xcb_ret;
4356 }
4357
4358 xcb_void_cookie_t
xcb_close_font_checked(xcb_connection_t * c,xcb_font_t font)4359 xcb_close_font_checked (xcb_connection_t *c /**< */,
4360 xcb_font_t font /**< */)
4361 {
4362 static const xcb_protocol_request_t xcb_req = {
4363 /* count */ 2,
4364 /* ext */ 0,
4365 /* opcode */ XCB_CLOSE_FONT,
4366 /* isvoid */ 1
4367 };
4368
4369 struct iovec xcb_parts[4];
4370 xcb_void_cookie_t xcb_ret;
4371 xcb_close_font_request_t xcb_out;
4372
4373 xcb_out.pad0 = 0;
4374 xcb_out.font = font;
4375
4376 xcb_parts[2].iov_base = (char *) &xcb_out;
4377 xcb_parts[2].iov_len = sizeof(xcb_out);
4378 xcb_parts[3].iov_base = 0;
4379 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4380
4381 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
4382 return xcb_ret;
4383 }
4384
4385 xcb_void_cookie_t
xcb_close_font(xcb_connection_t * c,xcb_font_t font)4386 xcb_close_font (xcb_connection_t *c /**< */,
4387 xcb_font_t font /**< */)
4388 {
4389 static const xcb_protocol_request_t xcb_req = {
4390 /* count */ 2,
4391 /* ext */ 0,
4392 /* opcode */ XCB_CLOSE_FONT,
4393 /* isvoid */ 1
4394 };
4395
4396 struct iovec xcb_parts[4];
4397 xcb_void_cookie_t xcb_ret;
4398 xcb_close_font_request_t xcb_out;
4399
4400 xcb_out.pad0 = 0;
4401 xcb_out.font = font;
4402
4403 xcb_parts[2].iov_base = (char *) &xcb_out;
4404 xcb_parts[2].iov_len = sizeof(xcb_out);
4405 xcb_parts[3].iov_base = 0;
4406 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4407
4408 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
4409 return xcb_ret;
4410 }
4411
4412 void
xcb_fontprop_next(xcb_fontprop_iterator_t * i)4413 xcb_fontprop_next (xcb_fontprop_iterator_t *i /**< */)
4414 {
4415 --i->rem;
4416 ++i->data;
4417 i->index += sizeof(xcb_fontprop_t);
4418 }
4419
4420 xcb_generic_iterator_t
xcb_fontprop_end(xcb_fontprop_iterator_t i)4421 xcb_fontprop_end (xcb_fontprop_iterator_t i /**< */)
4422 {
4423 xcb_generic_iterator_t ret;
4424 ret.data = i.data + i.rem;
4425 ret.index = i.index + ((char *) ret.data - (char *) i.data);
4426 ret.rem = 0;
4427 return ret;
4428 }
4429
4430 void
xcb_charinfo_next(xcb_charinfo_iterator_t * i)4431 xcb_charinfo_next (xcb_charinfo_iterator_t *i /**< */)
4432 {
4433 --i->rem;
4434 ++i->data;
4435 i->index += sizeof(xcb_charinfo_t);
4436 }
4437
4438 xcb_generic_iterator_t
xcb_charinfo_end(xcb_charinfo_iterator_t i)4439 xcb_charinfo_end (xcb_charinfo_iterator_t i /**< */)
4440 {
4441 xcb_generic_iterator_t ret;
4442 ret.data = i.data + i.rem;
4443 ret.index = i.index + ((char *) ret.data - (char *) i.data);
4444 ret.rem = 0;
4445 return ret;
4446 }
4447
4448 int
xcb_query_font_sizeof(const void * _buffer)4449 xcb_query_font_sizeof (const void *_buffer /**< */)
4450 {
4451 char *xcb_tmp = (char *)_buffer;
4452 const xcb_query_font_reply_t *_aux = (xcb_query_font_reply_t *)_buffer;
4453 unsigned int xcb_buffer_len = 0;
4454 unsigned int xcb_block_len = 0;
4455 unsigned int xcb_pad = 0;
4456 unsigned int xcb_align_to = 0;
4457
4458
4459 xcb_block_len += sizeof(xcb_query_font_reply_t);
4460 xcb_tmp += xcb_block_len;
4461 xcb_buffer_len += xcb_block_len;
4462 xcb_block_len = 0;
4463 /* properties */
4464 xcb_block_len += _aux->properties_len * sizeof(xcb_fontprop_t);
4465 xcb_tmp += xcb_block_len;
4466 xcb_align_to = ALIGNOF(xcb_fontprop_t);
4467 /* insert padding */
4468 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
4469 xcb_buffer_len += xcb_block_len + xcb_pad;
4470 if (0 != xcb_pad) {
4471 xcb_tmp += xcb_pad;
4472 xcb_pad = 0;
4473 }
4474 xcb_block_len = 0;
4475 /* char_infos */
4476 xcb_block_len += _aux->char_infos_len * sizeof(xcb_charinfo_t);
4477 xcb_tmp += xcb_block_len;
4478 xcb_align_to = ALIGNOF(xcb_charinfo_t);
4479 /* insert padding */
4480 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
4481 xcb_buffer_len += xcb_block_len + xcb_pad;
4482 if (0 != xcb_pad) {
4483 xcb_tmp += xcb_pad;
4484 xcb_pad = 0;
4485 }
4486 xcb_block_len = 0;
4487
4488 return xcb_buffer_len;
4489 }
4490
4491 xcb_query_font_cookie_t
xcb_query_font(xcb_connection_t * c,xcb_fontable_t font)4492 xcb_query_font (xcb_connection_t *c /**< */,
4493 xcb_fontable_t font /**< */)
4494 {
4495 static const xcb_protocol_request_t xcb_req = {
4496 /* count */ 2,
4497 /* ext */ 0,
4498 /* opcode */ XCB_QUERY_FONT,
4499 /* isvoid */ 0
4500 };
4501
4502 struct iovec xcb_parts[4];
4503 xcb_query_font_cookie_t xcb_ret;
4504 xcb_query_font_request_t xcb_out;
4505
4506 xcb_out.pad0 = 0;
4507 xcb_out.font = font;
4508
4509 xcb_parts[2].iov_base = (char *) &xcb_out;
4510 xcb_parts[2].iov_len = sizeof(xcb_out);
4511 xcb_parts[3].iov_base = 0;
4512 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4513
4514 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
4515 return xcb_ret;
4516 }
4517
4518 xcb_query_font_cookie_t
xcb_query_font_unchecked(xcb_connection_t * c,xcb_fontable_t font)4519 xcb_query_font_unchecked (xcb_connection_t *c /**< */,
4520 xcb_fontable_t font /**< */)
4521 {
4522 static const xcb_protocol_request_t xcb_req = {
4523 /* count */ 2,
4524 /* ext */ 0,
4525 /* opcode */ XCB_QUERY_FONT,
4526 /* isvoid */ 0
4527 };
4528
4529 struct iovec xcb_parts[4];
4530 xcb_query_font_cookie_t xcb_ret;
4531 xcb_query_font_request_t xcb_out;
4532
4533 xcb_out.pad0 = 0;
4534 xcb_out.font = font;
4535
4536 xcb_parts[2].iov_base = (char *) &xcb_out;
4537 xcb_parts[2].iov_len = sizeof(xcb_out);
4538 xcb_parts[3].iov_base = 0;
4539 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4540
4541 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
4542 return xcb_ret;
4543 }
4544
4545 xcb_fontprop_t *
xcb_query_font_properties(const xcb_query_font_reply_t * R)4546 xcb_query_font_properties (const xcb_query_font_reply_t *R /**< */)
4547 {
4548 return (xcb_fontprop_t *) (R + 1);
4549 }
4550
4551 int
xcb_query_font_properties_length(const xcb_query_font_reply_t * R)4552 xcb_query_font_properties_length (const xcb_query_font_reply_t *R /**< */)
4553 {
4554 return R->properties_len;
4555 }
4556
4557 xcb_fontprop_iterator_t
xcb_query_font_properties_iterator(const xcb_query_font_reply_t * R)4558 xcb_query_font_properties_iterator (const xcb_query_font_reply_t *R /**< */)
4559 {
4560 xcb_fontprop_iterator_t i;
4561 i.data = (xcb_fontprop_t *) (R + 1);
4562 i.rem = R->properties_len;
4563 i.index = (char *) i.data - (char *) R;
4564 return i;
4565 }
4566
4567 xcb_charinfo_t *
xcb_query_font_char_infos(const xcb_query_font_reply_t * R)4568 xcb_query_font_char_infos (const xcb_query_font_reply_t *R /**< */)
4569 {
4570 xcb_generic_iterator_t prev = xcb_fontprop_end(xcb_query_font_properties_iterator(R));
4571 return (xcb_charinfo_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_charinfo_t, prev.index) + 0);
4572 }
4573
4574 int
xcb_query_font_char_infos_length(const xcb_query_font_reply_t * R)4575 xcb_query_font_char_infos_length (const xcb_query_font_reply_t *R /**< */)
4576 {
4577 return R->char_infos_len;
4578 }
4579
4580 xcb_charinfo_iterator_t
xcb_query_font_char_infos_iterator(const xcb_query_font_reply_t * R)4581 xcb_query_font_char_infos_iterator (const xcb_query_font_reply_t *R /**< */)
4582 {
4583 xcb_charinfo_iterator_t i;
4584 xcb_generic_iterator_t prev = xcb_fontprop_end(xcb_query_font_properties_iterator(R));
4585 i.data = (xcb_charinfo_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_charinfo_t, prev.index));
4586 i.rem = R->char_infos_len;
4587 i.index = (char *) i.data - (char *) R;
4588 return i;
4589 }
4590
4591 xcb_query_font_reply_t *
xcb_query_font_reply(xcb_connection_t * c,xcb_query_font_cookie_t cookie,xcb_generic_error_t ** e)4592 xcb_query_font_reply (xcb_connection_t *c /**< */,
4593 xcb_query_font_cookie_t cookie /**< */,
4594 xcb_generic_error_t **e /**< */)
4595 {
4596 return (xcb_query_font_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
4597 }
4598
4599 int
xcb_query_text_extents_sizeof(const void * _buffer,uint32_t string_len)4600 xcb_query_text_extents_sizeof (const void *_buffer /**< */,
4601 uint32_t string_len /**< */)
4602 {
4603 char *xcb_tmp = (char *)_buffer;
4604 unsigned int xcb_buffer_len = 0;
4605 unsigned int xcb_block_len = 0;
4606 unsigned int xcb_pad = 0;
4607 unsigned int xcb_align_to = 0;
4608
4609
4610 xcb_block_len += sizeof(xcb_query_text_extents_request_t);
4611 xcb_tmp += xcb_block_len;
4612 xcb_buffer_len += xcb_block_len;
4613 xcb_block_len = 0;
4614 /* string */
4615 xcb_block_len += string_len * sizeof(xcb_char2b_t);
4616 xcb_tmp += xcb_block_len;
4617 xcb_align_to = ALIGNOF(xcb_char2b_t);
4618 /* insert padding */
4619 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
4620 xcb_buffer_len += xcb_block_len + xcb_pad;
4621 if (0 != xcb_pad) {
4622 xcb_tmp += xcb_pad;
4623 xcb_pad = 0;
4624 }
4625 xcb_block_len = 0;
4626
4627 return xcb_buffer_len;
4628 }
4629
4630 xcb_query_text_extents_cookie_t
xcb_query_text_extents(xcb_connection_t * c,xcb_fontable_t font,uint32_t string_len,const xcb_char2b_t * string)4631 xcb_query_text_extents (xcb_connection_t *c /**< */,
4632 xcb_fontable_t font /**< */,
4633 uint32_t string_len /**< */,
4634 const xcb_char2b_t *string /**< */)
4635 {
4636 static const xcb_protocol_request_t xcb_req = {
4637 /* count */ 4,
4638 /* ext */ 0,
4639 /* opcode */ XCB_QUERY_TEXT_EXTENTS,
4640 /* isvoid */ 0
4641 };
4642
4643 struct iovec xcb_parts[6];
4644 xcb_query_text_extents_cookie_t xcb_ret;
4645 xcb_query_text_extents_request_t xcb_out;
4646
4647 xcb_out.odd_length = (string_len & 1);
4648 xcb_out.font = font;
4649
4650 xcb_parts[2].iov_base = (char *) &xcb_out;
4651 xcb_parts[2].iov_len = sizeof(xcb_out);
4652 xcb_parts[3].iov_base = 0;
4653 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4654 /* xcb_char2b_t string */
4655 xcb_parts[4].iov_base = (char *) string;
4656 xcb_parts[4].iov_len = string_len * sizeof(xcb_char2b_t);
4657 xcb_parts[5].iov_base = 0;
4658 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
4659
4660 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
4661 return xcb_ret;
4662 }
4663
4664 xcb_query_text_extents_cookie_t
xcb_query_text_extents_unchecked(xcb_connection_t * c,xcb_fontable_t font,uint32_t string_len,const xcb_char2b_t * string)4665 xcb_query_text_extents_unchecked (xcb_connection_t *c /**< */,
4666 xcb_fontable_t font /**< */,
4667 uint32_t string_len /**< */,
4668 const xcb_char2b_t *string /**< */)
4669 {
4670 static const xcb_protocol_request_t xcb_req = {
4671 /* count */ 4,
4672 /* ext */ 0,
4673 /* opcode */ XCB_QUERY_TEXT_EXTENTS,
4674 /* isvoid */ 0
4675 };
4676
4677 struct iovec xcb_parts[6];
4678 xcb_query_text_extents_cookie_t xcb_ret;
4679 xcb_query_text_extents_request_t xcb_out;
4680
4681 xcb_out.odd_length = (string_len & 1);
4682 xcb_out.font = font;
4683
4684 xcb_parts[2].iov_base = (char *) &xcb_out;
4685 xcb_parts[2].iov_len = sizeof(xcb_out);
4686 xcb_parts[3].iov_base = 0;
4687 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4688 /* xcb_char2b_t string */
4689 xcb_parts[4].iov_base = (char *) string;
4690 xcb_parts[4].iov_len = string_len * sizeof(xcb_char2b_t);
4691 xcb_parts[5].iov_base = 0;
4692 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
4693
4694 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
4695 return xcb_ret;
4696 }
4697
4698 xcb_query_text_extents_reply_t *
xcb_query_text_extents_reply(xcb_connection_t * c,xcb_query_text_extents_cookie_t cookie,xcb_generic_error_t ** e)4699 xcb_query_text_extents_reply (xcb_connection_t *c /**< */,
4700 xcb_query_text_extents_cookie_t cookie /**< */,
4701 xcb_generic_error_t **e /**< */)
4702 {
4703 return (xcb_query_text_extents_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
4704 }
4705
4706 int
xcb_str_sizeof(const void * _buffer)4707 xcb_str_sizeof (const void *_buffer /**< */)
4708 {
4709 char *xcb_tmp = (char *)_buffer;
4710 const xcb_str_t *_aux = (xcb_str_t *)_buffer;
4711 unsigned int xcb_buffer_len = 0;
4712 unsigned int xcb_block_len = 0;
4713 unsigned int xcb_pad = 0;
4714 unsigned int xcb_align_to = 0;
4715
4716
4717 xcb_block_len += sizeof(xcb_str_t);
4718 xcb_tmp += xcb_block_len;
4719 xcb_buffer_len += xcb_block_len;
4720 xcb_block_len = 0;
4721 /* name */
4722 xcb_block_len += _aux->name_len * sizeof(char);
4723 xcb_tmp += xcb_block_len;
4724 xcb_align_to = ALIGNOF(char);
4725 /* insert padding */
4726 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
4727 xcb_buffer_len += xcb_block_len + xcb_pad;
4728 if (0 != xcb_pad) {
4729 xcb_tmp += xcb_pad;
4730 xcb_pad = 0;
4731 }
4732 xcb_block_len = 0;
4733
4734 return xcb_buffer_len;
4735 }
4736
4737 char *
xcb_str_name(const xcb_str_t * R)4738 xcb_str_name (const xcb_str_t *R /**< */)
4739 {
4740 return (char *) (R + 1);
4741 }
4742
4743 int
xcb_str_name_length(const xcb_str_t * R)4744 xcb_str_name_length (const xcb_str_t *R /**< */)
4745 {
4746 return R->name_len;
4747 }
4748
4749 xcb_generic_iterator_t
xcb_str_name_end(const xcb_str_t * R)4750 xcb_str_name_end (const xcb_str_t *R /**< */)
4751 {
4752 xcb_generic_iterator_t i;
4753 i.data = ((char *) (R + 1)) + (R->name_len);
4754 i.rem = 0;
4755 i.index = (char *) i.data - (char *) R;
4756 return i;
4757 }
4758
4759 void
xcb_str_next(xcb_str_iterator_t * i)4760 xcb_str_next (xcb_str_iterator_t *i /**< */)
4761 {
4762 xcb_str_t *R = i->data;
4763 xcb_generic_iterator_t child;
4764 child.data = (xcb_str_t *)(((char *)R) + xcb_str_sizeof(R));
4765 i->index = (char *) child.data - (char *) i->data;
4766 --i->rem;
4767 i->data = (xcb_str_t *) child.data;
4768 }
4769
4770 xcb_generic_iterator_t
xcb_str_end(xcb_str_iterator_t i)4771 xcb_str_end (xcb_str_iterator_t i /**< */)
4772 {
4773 xcb_generic_iterator_t ret;
4774 while(i.rem > 0)
4775 xcb_str_next(&i);
4776 ret.data = i.data;
4777 ret.rem = i.rem;
4778 ret.index = i.index;
4779 return ret;
4780 }
4781
4782 int
xcb_list_fonts_sizeof(const void * _buffer)4783 xcb_list_fonts_sizeof (const void *_buffer /**< */)
4784 {
4785 char *xcb_tmp = (char *)_buffer;
4786 const xcb_list_fonts_request_t *_aux = (xcb_list_fonts_request_t *)_buffer;
4787 unsigned int xcb_buffer_len = 0;
4788 unsigned int xcb_block_len = 0;
4789 unsigned int xcb_pad = 0;
4790 unsigned int xcb_align_to = 0;
4791
4792
4793 xcb_block_len += sizeof(xcb_list_fonts_request_t);
4794 xcb_tmp += xcb_block_len;
4795 xcb_buffer_len += xcb_block_len;
4796 xcb_block_len = 0;
4797 /* pattern */
4798 xcb_block_len += _aux->pattern_len * sizeof(char);
4799 xcb_tmp += xcb_block_len;
4800 xcb_align_to = ALIGNOF(char);
4801 /* insert padding */
4802 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
4803 xcb_buffer_len += xcb_block_len + xcb_pad;
4804 if (0 != xcb_pad) {
4805 xcb_tmp += xcb_pad;
4806 xcb_pad = 0;
4807 }
4808 xcb_block_len = 0;
4809
4810 return xcb_buffer_len;
4811 }
4812
4813 xcb_list_fonts_cookie_t
xcb_list_fonts(xcb_connection_t * c,uint16_t max_names,uint16_t pattern_len,const char * pattern)4814 xcb_list_fonts (xcb_connection_t *c /**< */,
4815 uint16_t max_names /**< */,
4816 uint16_t pattern_len /**< */,
4817 const char *pattern /**< */)
4818 {
4819 static const xcb_protocol_request_t xcb_req = {
4820 /* count */ 4,
4821 /* ext */ 0,
4822 /* opcode */ XCB_LIST_FONTS,
4823 /* isvoid */ 0
4824 };
4825
4826 struct iovec xcb_parts[6];
4827 xcb_list_fonts_cookie_t xcb_ret;
4828 xcb_list_fonts_request_t xcb_out;
4829
4830 xcb_out.pad0 = 0;
4831 xcb_out.max_names = max_names;
4832 xcb_out.pattern_len = pattern_len;
4833
4834 xcb_parts[2].iov_base = (char *) &xcb_out;
4835 xcb_parts[2].iov_len = sizeof(xcb_out);
4836 xcb_parts[3].iov_base = 0;
4837 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4838 /* char pattern */
4839 xcb_parts[4].iov_base = (char *) pattern;
4840 xcb_parts[4].iov_len = pattern_len * sizeof(char);
4841 xcb_parts[5].iov_base = 0;
4842 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
4843
4844 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
4845 return xcb_ret;
4846 }
4847
4848 xcb_list_fonts_cookie_t
xcb_list_fonts_unchecked(xcb_connection_t * c,uint16_t max_names,uint16_t pattern_len,const char * pattern)4849 xcb_list_fonts_unchecked (xcb_connection_t *c /**< */,
4850 uint16_t max_names /**< */,
4851 uint16_t pattern_len /**< */,
4852 const char *pattern /**< */)
4853 {
4854 static const xcb_protocol_request_t xcb_req = {
4855 /* count */ 4,
4856 /* ext */ 0,
4857 /* opcode */ XCB_LIST_FONTS,
4858 /* isvoid */ 0
4859 };
4860
4861 struct iovec xcb_parts[6];
4862 xcb_list_fonts_cookie_t xcb_ret;
4863 xcb_list_fonts_request_t xcb_out;
4864
4865 xcb_out.pad0 = 0;
4866 xcb_out.max_names = max_names;
4867 xcb_out.pattern_len = pattern_len;
4868
4869 xcb_parts[2].iov_base = (char *) &xcb_out;
4870 xcb_parts[2].iov_len = sizeof(xcb_out);
4871 xcb_parts[3].iov_base = 0;
4872 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4873 /* char pattern */
4874 xcb_parts[4].iov_base = (char *) pattern;
4875 xcb_parts[4].iov_len = pattern_len * sizeof(char);
4876 xcb_parts[5].iov_base = 0;
4877 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
4878
4879 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
4880 return xcb_ret;
4881 }
4882
4883 int
xcb_list_fonts_names_length(const xcb_list_fonts_reply_t * R)4884 xcb_list_fonts_names_length (const xcb_list_fonts_reply_t *R /**< */)
4885 {
4886 return R->names_len;
4887 }
4888
4889 xcb_str_iterator_t
xcb_list_fonts_names_iterator(const xcb_list_fonts_reply_t * R)4890 xcb_list_fonts_names_iterator (const xcb_list_fonts_reply_t *R /**< */)
4891 {
4892 xcb_str_iterator_t i;
4893 i.data = (xcb_str_t *) (R + 1);
4894 i.rem = R->names_len;
4895 i.index = (char *) i.data - (char *) R;
4896 return i;
4897 }
4898
4899 xcb_list_fonts_reply_t *
xcb_list_fonts_reply(xcb_connection_t * c,xcb_list_fonts_cookie_t cookie,xcb_generic_error_t ** e)4900 xcb_list_fonts_reply (xcb_connection_t *c /**< */,
4901 xcb_list_fonts_cookie_t cookie /**< */,
4902 xcb_generic_error_t **e /**< */)
4903 {
4904 return (xcb_list_fonts_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
4905 }
4906
4907 int
xcb_list_fonts_with_info_sizeof(const void * _buffer)4908 xcb_list_fonts_with_info_sizeof (const void *_buffer /**< */)
4909 {
4910 char *xcb_tmp = (char *)_buffer;
4911 const xcb_list_fonts_with_info_request_t *_aux = (xcb_list_fonts_with_info_request_t *)_buffer;
4912 unsigned int xcb_buffer_len = 0;
4913 unsigned int xcb_block_len = 0;
4914 unsigned int xcb_pad = 0;
4915 unsigned int xcb_align_to = 0;
4916
4917
4918 xcb_block_len += sizeof(xcb_list_fonts_with_info_request_t);
4919 xcb_tmp += xcb_block_len;
4920 xcb_buffer_len += xcb_block_len;
4921 xcb_block_len = 0;
4922 /* pattern */
4923 xcb_block_len += _aux->pattern_len * sizeof(char);
4924 xcb_tmp += xcb_block_len;
4925 xcb_align_to = ALIGNOF(char);
4926 /* insert padding */
4927 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
4928 xcb_buffer_len += xcb_block_len + xcb_pad;
4929 if (0 != xcb_pad) {
4930 xcb_tmp += xcb_pad;
4931 xcb_pad = 0;
4932 }
4933 xcb_block_len = 0;
4934
4935 return xcb_buffer_len;
4936 }
4937
4938 xcb_list_fonts_with_info_cookie_t
xcb_list_fonts_with_info(xcb_connection_t * c,uint16_t max_names,uint16_t pattern_len,const char * pattern)4939 xcb_list_fonts_with_info (xcb_connection_t *c /**< */,
4940 uint16_t max_names /**< */,
4941 uint16_t pattern_len /**< */,
4942 const char *pattern /**< */)
4943 {
4944 static const xcb_protocol_request_t xcb_req = {
4945 /* count */ 4,
4946 /* ext */ 0,
4947 /* opcode */ XCB_LIST_FONTS_WITH_INFO,
4948 /* isvoid */ 0
4949 };
4950
4951 struct iovec xcb_parts[6];
4952 xcb_list_fonts_with_info_cookie_t xcb_ret;
4953 xcb_list_fonts_with_info_request_t xcb_out;
4954
4955 xcb_out.pad0 = 0;
4956 xcb_out.max_names = max_names;
4957 xcb_out.pattern_len = pattern_len;
4958
4959 xcb_parts[2].iov_base = (char *) &xcb_out;
4960 xcb_parts[2].iov_len = sizeof(xcb_out);
4961 xcb_parts[3].iov_base = 0;
4962 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4963 /* char pattern */
4964 xcb_parts[4].iov_base = (char *) pattern;
4965 xcb_parts[4].iov_len = pattern_len * sizeof(char);
4966 xcb_parts[5].iov_base = 0;
4967 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
4968
4969 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
4970 return xcb_ret;
4971 }
4972
4973 xcb_list_fonts_with_info_cookie_t
xcb_list_fonts_with_info_unchecked(xcb_connection_t * c,uint16_t max_names,uint16_t pattern_len,const char * pattern)4974 xcb_list_fonts_with_info_unchecked (xcb_connection_t *c /**< */,
4975 uint16_t max_names /**< */,
4976 uint16_t pattern_len /**< */,
4977 const char *pattern /**< */)
4978 {
4979 static const xcb_protocol_request_t xcb_req = {
4980 /* count */ 4,
4981 /* ext */ 0,
4982 /* opcode */ XCB_LIST_FONTS_WITH_INFO,
4983 /* isvoid */ 0
4984 };
4985
4986 struct iovec xcb_parts[6];
4987 xcb_list_fonts_with_info_cookie_t xcb_ret;
4988 xcb_list_fonts_with_info_request_t xcb_out;
4989
4990 xcb_out.pad0 = 0;
4991 xcb_out.max_names = max_names;
4992 xcb_out.pattern_len = pattern_len;
4993
4994 xcb_parts[2].iov_base = (char *) &xcb_out;
4995 xcb_parts[2].iov_len = sizeof(xcb_out);
4996 xcb_parts[3].iov_base = 0;
4997 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4998 /* char pattern */
4999 xcb_parts[4].iov_base = (char *) pattern;
5000 xcb_parts[4].iov_len = pattern_len * sizeof(char);
5001 xcb_parts[5].iov_base = 0;
5002 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
5003
5004 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
5005 return xcb_ret;
5006 }
5007
5008 xcb_fontprop_t *
xcb_list_fonts_with_info_properties(const xcb_list_fonts_with_info_reply_t * R)5009 xcb_list_fonts_with_info_properties (const xcb_list_fonts_with_info_reply_t *R /**< */)
5010 {
5011 return (xcb_fontprop_t *) (R + 1);
5012 }
5013
5014 int
xcb_list_fonts_with_info_properties_length(const xcb_list_fonts_with_info_reply_t * R)5015 xcb_list_fonts_with_info_properties_length (const xcb_list_fonts_with_info_reply_t *R /**< */)
5016 {
5017 return R->properties_len;
5018 }
5019
5020 xcb_fontprop_iterator_t
xcb_list_fonts_with_info_properties_iterator(const xcb_list_fonts_with_info_reply_t * R)5021 xcb_list_fonts_with_info_properties_iterator (const xcb_list_fonts_with_info_reply_t *R /**< */)
5022 {
5023 xcb_fontprop_iterator_t i;
5024 i.data = (xcb_fontprop_t *) (R + 1);
5025 i.rem = R->properties_len;
5026 i.index = (char *) i.data - (char *) R;
5027 return i;
5028 }
5029
5030 char *
xcb_list_fonts_with_info_name(const xcb_list_fonts_with_info_reply_t * R)5031 xcb_list_fonts_with_info_name (const xcb_list_fonts_with_info_reply_t *R /**< */)
5032 {
5033 xcb_generic_iterator_t prev = xcb_fontprop_end(xcb_list_fonts_with_info_properties_iterator(R));
5034 return (char *) ((char *) prev.data + XCB_TYPE_PAD(char, prev.index) + 0);
5035 }
5036
5037 int
xcb_list_fonts_with_info_name_length(const xcb_list_fonts_with_info_reply_t * R)5038 xcb_list_fonts_with_info_name_length (const xcb_list_fonts_with_info_reply_t *R /**< */)
5039 {
5040 return R->name_len;
5041 }
5042
5043 xcb_generic_iterator_t
xcb_list_fonts_with_info_name_end(const xcb_list_fonts_with_info_reply_t * R)5044 xcb_list_fonts_with_info_name_end (const xcb_list_fonts_with_info_reply_t *R /**< */)
5045 {
5046 xcb_generic_iterator_t i;
5047 xcb_generic_iterator_t child = xcb_fontprop_end(xcb_list_fonts_with_info_properties_iterator(R));
5048 i.data = ((char *) child.data) + (R->name_len);
5049 i.rem = 0;
5050 i.index = (char *) i.data - (char *) R;
5051 return i;
5052 }
5053
5054 xcb_list_fonts_with_info_reply_t *
xcb_list_fonts_with_info_reply(xcb_connection_t * c,xcb_list_fonts_with_info_cookie_t cookie,xcb_generic_error_t ** e)5055 xcb_list_fonts_with_info_reply (xcb_connection_t *c /**< */,
5056 xcb_list_fonts_with_info_cookie_t cookie /**< */,
5057 xcb_generic_error_t **e /**< */)
5058 {
5059 return (xcb_list_fonts_with_info_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
5060 }
5061
5062 int
xcb_set_font_path_sizeof(const void * _buffer)5063 xcb_set_font_path_sizeof (const void *_buffer /**< */)
5064 {
5065 char *xcb_tmp = (char *)_buffer;
5066 const xcb_set_font_path_request_t *_aux = (xcb_set_font_path_request_t *)_buffer;
5067 unsigned int xcb_buffer_len = 0;
5068 unsigned int xcb_block_len = 0;
5069 unsigned int xcb_pad = 0;
5070 unsigned int xcb_align_to = 0;
5071
5072 unsigned int i;
5073 unsigned int xcb_tmp_len;
5074
5075 xcb_block_len += sizeof(xcb_set_font_path_request_t);
5076 xcb_tmp += xcb_block_len;
5077 xcb_buffer_len += xcb_block_len;
5078 xcb_block_len = 0;
5079 /* font */
5080 for(i=0; i<_aux->font_qty; i++) {
5081 xcb_tmp_len = xcb_str_sizeof(xcb_tmp);
5082 xcb_block_len += xcb_tmp_len;
5083 xcb_tmp += xcb_tmp_len;
5084 }
5085 xcb_align_to = ALIGNOF(xcb_str_t);
5086 /* insert padding */
5087 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
5088 xcb_buffer_len += xcb_block_len + xcb_pad;
5089 if (0 != xcb_pad) {
5090 xcb_tmp += xcb_pad;
5091 xcb_pad = 0;
5092 }
5093 xcb_block_len = 0;
5094
5095 return xcb_buffer_len;
5096 }
5097
5098 xcb_void_cookie_t
xcb_set_font_path_checked(xcb_connection_t * c,uint16_t font_qty,const xcb_str_t * font)5099 xcb_set_font_path_checked (xcb_connection_t *c /**< */,
5100 uint16_t font_qty /**< */,
5101 const xcb_str_t *font /**< */)
5102 {
5103 static const xcb_protocol_request_t xcb_req = {
5104 /* count */ 4,
5105 /* ext */ 0,
5106 /* opcode */ XCB_SET_FONT_PATH,
5107 /* isvoid */ 1
5108 };
5109
5110 struct iovec xcb_parts[6];
5111 xcb_void_cookie_t xcb_ret;
5112 xcb_set_font_path_request_t xcb_out;
5113 unsigned int i;
5114 unsigned int xcb_tmp_len;
5115 char *xcb_tmp;
5116
5117 xcb_out.pad0 = 0;
5118 xcb_out.font_qty = font_qty;
5119 memset(xcb_out.pad1, 0, 2);
5120
5121 xcb_parts[2].iov_base = (char *) &xcb_out;
5122 xcb_parts[2].iov_len = sizeof(xcb_out);
5123 xcb_parts[3].iov_base = 0;
5124 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5125 /* xcb_str_t font */
5126 xcb_parts[4].iov_base = (char *) font;
5127 xcb_parts[4].iov_len = 0;
5128 xcb_tmp = (char *)font;
5129 for(i=0; i<font_qty; i++) {
5130 xcb_tmp_len = xcb_str_sizeof(xcb_tmp);
5131 xcb_parts[4].iov_len += xcb_tmp_len;
5132 xcb_tmp += xcb_tmp_len;
5133 }
5134 xcb_parts[5].iov_base = 0;
5135 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
5136
5137 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
5138 return xcb_ret;
5139 }
5140
5141 xcb_void_cookie_t
xcb_set_font_path(xcb_connection_t * c,uint16_t font_qty,const xcb_str_t * font)5142 xcb_set_font_path (xcb_connection_t *c /**< */,
5143 uint16_t font_qty /**< */,
5144 const xcb_str_t *font /**< */)
5145 {
5146 static const xcb_protocol_request_t xcb_req = {
5147 /* count */ 4,
5148 /* ext */ 0,
5149 /* opcode */ XCB_SET_FONT_PATH,
5150 /* isvoid */ 1
5151 };
5152
5153 struct iovec xcb_parts[6];
5154 xcb_void_cookie_t xcb_ret;
5155 xcb_set_font_path_request_t xcb_out;
5156 unsigned int i;
5157 unsigned int xcb_tmp_len;
5158 char *xcb_tmp;
5159
5160 xcb_out.pad0 = 0;
5161 xcb_out.font_qty = font_qty;
5162 memset(xcb_out.pad1, 0, 2);
5163
5164 xcb_parts[2].iov_base = (char *) &xcb_out;
5165 xcb_parts[2].iov_len = sizeof(xcb_out);
5166 xcb_parts[3].iov_base = 0;
5167 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5168 /* xcb_str_t font */
5169 xcb_parts[4].iov_base = (char *) font;
5170 xcb_parts[4].iov_len = 0;
5171 xcb_tmp = (char *)font;
5172 for(i=0; i<font_qty; i++) {
5173 xcb_tmp_len = xcb_str_sizeof(xcb_tmp);
5174 xcb_parts[4].iov_len += xcb_tmp_len;
5175 xcb_tmp += xcb_tmp_len;
5176 }
5177 xcb_parts[5].iov_base = 0;
5178 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
5179
5180 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
5181 return xcb_ret;
5182 }
5183
5184 int
xcb_get_font_path_sizeof(const void * _buffer)5185 xcb_get_font_path_sizeof (const void *_buffer /**< */)
5186 {
5187 char *xcb_tmp = (char *)_buffer;
5188 const xcb_get_font_path_reply_t *_aux = (xcb_get_font_path_reply_t *)_buffer;
5189 unsigned int xcb_buffer_len = 0;
5190 unsigned int xcb_block_len = 0;
5191 unsigned int xcb_pad = 0;
5192 unsigned int xcb_align_to = 0;
5193
5194 unsigned int i;
5195 unsigned int xcb_tmp_len;
5196
5197 xcb_block_len += sizeof(xcb_get_font_path_reply_t);
5198 xcb_tmp += xcb_block_len;
5199 xcb_buffer_len += xcb_block_len;
5200 xcb_block_len = 0;
5201 /* path */
5202 for(i=0; i<_aux->path_len; i++) {
5203 xcb_tmp_len = xcb_str_sizeof(xcb_tmp);
5204 xcb_block_len += xcb_tmp_len;
5205 xcb_tmp += xcb_tmp_len;
5206 }
5207 xcb_align_to = ALIGNOF(xcb_str_t);
5208 /* insert padding */
5209 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
5210 xcb_buffer_len += xcb_block_len + xcb_pad;
5211 if (0 != xcb_pad) {
5212 xcb_tmp += xcb_pad;
5213 xcb_pad = 0;
5214 }
5215 xcb_block_len = 0;
5216
5217 return xcb_buffer_len;
5218 }
5219
5220 xcb_get_font_path_cookie_t
xcb_get_font_path(xcb_connection_t * c)5221 xcb_get_font_path (xcb_connection_t *c /**< */)
5222 {
5223 static const xcb_protocol_request_t xcb_req = {
5224 /* count */ 2,
5225 /* ext */ 0,
5226 /* opcode */ XCB_GET_FONT_PATH,
5227 /* isvoid */ 0
5228 };
5229
5230 struct iovec xcb_parts[4];
5231 xcb_get_font_path_cookie_t xcb_ret;
5232 xcb_get_font_path_request_t xcb_out;
5233
5234 xcb_out.pad0 = 0;
5235
5236 xcb_parts[2].iov_base = (char *) &xcb_out;
5237 xcb_parts[2].iov_len = sizeof(xcb_out);
5238 xcb_parts[3].iov_base = 0;
5239 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5240
5241 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
5242 return xcb_ret;
5243 }
5244
5245 xcb_get_font_path_cookie_t
xcb_get_font_path_unchecked(xcb_connection_t * c)5246 xcb_get_font_path_unchecked (xcb_connection_t *c /**< */)
5247 {
5248 static const xcb_protocol_request_t xcb_req = {
5249 /* count */ 2,
5250 /* ext */ 0,
5251 /* opcode */ XCB_GET_FONT_PATH,
5252 /* isvoid */ 0
5253 };
5254
5255 struct iovec xcb_parts[4];
5256 xcb_get_font_path_cookie_t xcb_ret;
5257 xcb_get_font_path_request_t xcb_out;
5258
5259 xcb_out.pad0 = 0;
5260
5261 xcb_parts[2].iov_base = (char *) &xcb_out;
5262 xcb_parts[2].iov_len = sizeof(xcb_out);
5263 xcb_parts[3].iov_base = 0;
5264 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5265
5266 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
5267 return xcb_ret;
5268 }
5269
5270 int
xcb_get_font_path_path_length(const xcb_get_font_path_reply_t * R)5271 xcb_get_font_path_path_length (const xcb_get_font_path_reply_t *R /**< */)
5272 {
5273 return R->path_len;
5274 }
5275
5276 xcb_str_iterator_t
xcb_get_font_path_path_iterator(const xcb_get_font_path_reply_t * R)5277 xcb_get_font_path_path_iterator (const xcb_get_font_path_reply_t *R /**< */)
5278 {
5279 xcb_str_iterator_t i;
5280 i.data = (xcb_str_t *) (R + 1);
5281 i.rem = R->path_len;
5282 i.index = (char *) i.data - (char *) R;
5283 return i;
5284 }
5285
5286 xcb_get_font_path_reply_t *
xcb_get_font_path_reply(xcb_connection_t * c,xcb_get_font_path_cookie_t cookie,xcb_generic_error_t ** e)5287 xcb_get_font_path_reply (xcb_connection_t *c /**< */,
5288 xcb_get_font_path_cookie_t cookie /**< */,
5289 xcb_generic_error_t **e /**< */)
5290 {
5291 return (xcb_get_font_path_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
5292 }
5293
5294 xcb_void_cookie_t
xcb_create_pixmap_checked(xcb_connection_t * c,uint8_t depth,xcb_pixmap_t pid,xcb_drawable_t drawable,uint16_t width,uint16_t height)5295 xcb_create_pixmap_checked (xcb_connection_t *c /**< */,
5296 uint8_t depth /**< */,
5297 xcb_pixmap_t pid /**< */,
5298 xcb_drawable_t drawable /**< */,
5299 uint16_t width /**< */,
5300 uint16_t height /**< */)
5301 {
5302 static const xcb_protocol_request_t xcb_req = {
5303 /* count */ 2,
5304 /* ext */ 0,
5305 /* opcode */ XCB_CREATE_PIXMAP,
5306 /* isvoid */ 1
5307 };
5308
5309 struct iovec xcb_parts[4];
5310 xcb_void_cookie_t xcb_ret;
5311 xcb_create_pixmap_request_t xcb_out;
5312
5313 xcb_out.depth = depth;
5314 xcb_out.pid = pid;
5315 xcb_out.drawable = drawable;
5316 xcb_out.width = width;
5317 xcb_out.height = height;
5318
5319 xcb_parts[2].iov_base = (char *) &xcb_out;
5320 xcb_parts[2].iov_len = sizeof(xcb_out);
5321 xcb_parts[3].iov_base = 0;
5322 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5323
5324 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
5325 return xcb_ret;
5326 }
5327
5328 xcb_void_cookie_t
xcb_create_pixmap(xcb_connection_t * c,uint8_t depth,xcb_pixmap_t pid,xcb_drawable_t drawable,uint16_t width,uint16_t height)5329 xcb_create_pixmap (xcb_connection_t *c /**< */,
5330 uint8_t depth /**< */,
5331 xcb_pixmap_t pid /**< */,
5332 xcb_drawable_t drawable /**< */,
5333 uint16_t width /**< */,
5334 uint16_t height /**< */)
5335 {
5336 static const xcb_protocol_request_t xcb_req = {
5337 /* count */ 2,
5338 /* ext */ 0,
5339 /* opcode */ XCB_CREATE_PIXMAP,
5340 /* isvoid */ 1
5341 };
5342
5343 struct iovec xcb_parts[4];
5344 xcb_void_cookie_t xcb_ret;
5345 xcb_create_pixmap_request_t xcb_out;
5346
5347 xcb_out.depth = depth;
5348 xcb_out.pid = pid;
5349 xcb_out.drawable = drawable;
5350 xcb_out.width = width;
5351 xcb_out.height = height;
5352
5353 xcb_parts[2].iov_base = (char *) &xcb_out;
5354 xcb_parts[2].iov_len = sizeof(xcb_out);
5355 xcb_parts[3].iov_base = 0;
5356 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5357
5358 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
5359 return xcb_ret;
5360 }
5361
5362 xcb_void_cookie_t
xcb_free_pixmap_checked(xcb_connection_t * c,xcb_pixmap_t pixmap)5363 xcb_free_pixmap_checked (xcb_connection_t *c /**< */,
5364 xcb_pixmap_t pixmap /**< */)
5365 {
5366 static const xcb_protocol_request_t xcb_req = {
5367 /* count */ 2,
5368 /* ext */ 0,
5369 /* opcode */ XCB_FREE_PIXMAP,
5370 /* isvoid */ 1
5371 };
5372
5373 struct iovec xcb_parts[4];
5374 xcb_void_cookie_t xcb_ret;
5375 xcb_free_pixmap_request_t xcb_out;
5376
5377 xcb_out.pad0 = 0;
5378 xcb_out.pixmap = pixmap;
5379
5380 xcb_parts[2].iov_base = (char *) &xcb_out;
5381 xcb_parts[2].iov_len = sizeof(xcb_out);
5382 xcb_parts[3].iov_base = 0;
5383 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5384
5385 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
5386 return xcb_ret;
5387 }
5388
5389 xcb_void_cookie_t
xcb_free_pixmap(xcb_connection_t * c,xcb_pixmap_t pixmap)5390 xcb_free_pixmap (xcb_connection_t *c /**< */,
5391 xcb_pixmap_t pixmap /**< */)
5392 {
5393 static const xcb_protocol_request_t xcb_req = {
5394 /* count */ 2,
5395 /* ext */ 0,
5396 /* opcode */ XCB_FREE_PIXMAP,
5397 /* isvoid */ 1
5398 };
5399
5400 struct iovec xcb_parts[4];
5401 xcb_void_cookie_t xcb_ret;
5402 xcb_free_pixmap_request_t xcb_out;
5403
5404 xcb_out.pad0 = 0;
5405 xcb_out.pixmap = pixmap;
5406
5407 xcb_parts[2].iov_base = (char *) &xcb_out;
5408 xcb_parts[2].iov_len = sizeof(xcb_out);
5409 xcb_parts[3].iov_base = 0;
5410 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5411
5412 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
5413 return xcb_ret;
5414 }
5415
5416 int
xcb_create_gc_sizeof(const void * _buffer)5417 xcb_create_gc_sizeof (const void *_buffer /**< */)
5418 {
5419 char *xcb_tmp = (char *)_buffer;
5420 const xcb_create_gc_request_t *_aux = (xcb_create_gc_request_t *)_buffer;
5421 unsigned int xcb_buffer_len = 0;
5422 unsigned int xcb_block_len = 0;
5423 unsigned int xcb_pad = 0;
5424 unsigned int xcb_align_to = 0;
5425
5426
5427 xcb_block_len += sizeof(xcb_create_gc_request_t);
5428 xcb_tmp += xcb_block_len;
5429 xcb_buffer_len += xcb_block_len;
5430 xcb_block_len = 0;
5431 /* value_list */
5432 xcb_block_len += xcb_popcount(_aux->value_mask) * sizeof(uint32_t);
5433 xcb_tmp += xcb_block_len;
5434 xcb_align_to = ALIGNOF(uint32_t);
5435 /* insert padding */
5436 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
5437 xcb_buffer_len += xcb_block_len + xcb_pad;
5438 if (0 != xcb_pad) {
5439 xcb_tmp += xcb_pad;
5440 xcb_pad = 0;
5441 }
5442 xcb_block_len = 0;
5443
5444 return xcb_buffer_len;
5445 }
5446
5447 xcb_void_cookie_t
xcb_create_gc_checked(xcb_connection_t * c,xcb_gcontext_t cid,xcb_drawable_t drawable,uint32_t value_mask,const uint32_t * value_list)5448 xcb_create_gc_checked (xcb_connection_t *c /**< */,
5449 xcb_gcontext_t cid /**< */,
5450 xcb_drawable_t drawable /**< */,
5451 uint32_t value_mask /**< */,
5452 const uint32_t *value_list /**< */)
5453 {
5454 static const xcb_protocol_request_t xcb_req = {
5455 /* count */ 4,
5456 /* ext */ 0,
5457 /* opcode */ XCB_CREATE_GC,
5458 /* isvoid */ 1
5459 };
5460
5461 struct iovec xcb_parts[6];
5462 xcb_void_cookie_t xcb_ret;
5463 xcb_create_gc_request_t xcb_out;
5464
5465 xcb_out.pad0 = 0;
5466 xcb_out.cid = cid;
5467 xcb_out.drawable = drawable;
5468 xcb_out.value_mask = value_mask;
5469
5470 xcb_parts[2].iov_base = (char *) &xcb_out;
5471 xcb_parts[2].iov_len = sizeof(xcb_out);
5472 xcb_parts[3].iov_base = 0;
5473 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5474 /* uint32_t value_list */
5475 xcb_parts[4].iov_base = (char *) value_list;
5476 xcb_parts[4].iov_len = xcb_popcount(value_mask) * sizeof(uint32_t);
5477 xcb_parts[5].iov_base = 0;
5478 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
5479
5480 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
5481 return xcb_ret;
5482 }
5483
5484 xcb_void_cookie_t
xcb_create_gc(xcb_connection_t * c,xcb_gcontext_t cid,xcb_drawable_t drawable,uint32_t value_mask,const uint32_t * value_list)5485 xcb_create_gc (xcb_connection_t *c /**< */,
5486 xcb_gcontext_t cid /**< */,
5487 xcb_drawable_t drawable /**< */,
5488 uint32_t value_mask /**< */,
5489 const uint32_t *value_list /**< */)
5490 {
5491 static const xcb_protocol_request_t xcb_req = {
5492 /* count */ 4,
5493 /* ext */ 0,
5494 /* opcode */ XCB_CREATE_GC,
5495 /* isvoid */ 1
5496 };
5497
5498 struct iovec xcb_parts[6];
5499 xcb_void_cookie_t xcb_ret;
5500 xcb_create_gc_request_t xcb_out;
5501
5502 xcb_out.pad0 = 0;
5503 xcb_out.cid = cid;
5504 xcb_out.drawable = drawable;
5505 xcb_out.value_mask = value_mask;
5506
5507 xcb_parts[2].iov_base = (char *) &xcb_out;
5508 xcb_parts[2].iov_len = sizeof(xcb_out);
5509 xcb_parts[3].iov_base = 0;
5510 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5511 /* uint32_t value_list */
5512 xcb_parts[4].iov_base = (char *) value_list;
5513 xcb_parts[4].iov_len = xcb_popcount(value_mask) * sizeof(uint32_t);
5514 xcb_parts[5].iov_base = 0;
5515 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
5516
5517 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
5518 return xcb_ret;
5519 }
5520
5521 int
xcb_change_gc_sizeof(const void * _buffer)5522 xcb_change_gc_sizeof (const void *_buffer /**< */)
5523 {
5524 char *xcb_tmp = (char *)_buffer;
5525 const xcb_change_gc_request_t *_aux = (xcb_change_gc_request_t *)_buffer;
5526 unsigned int xcb_buffer_len = 0;
5527 unsigned int xcb_block_len = 0;
5528 unsigned int xcb_pad = 0;
5529 unsigned int xcb_align_to = 0;
5530
5531
5532 xcb_block_len += sizeof(xcb_change_gc_request_t);
5533 xcb_tmp += xcb_block_len;
5534 xcb_buffer_len += xcb_block_len;
5535 xcb_block_len = 0;
5536 /* value_list */
5537 xcb_block_len += xcb_popcount(_aux->value_mask) * sizeof(uint32_t);
5538 xcb_tmp += xcb_block_len;
5539 xcb_align_to = ALIGNOF(uint32_t);
5540 /* insert padding */
5541 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
5542 xcb_buffer_len += xcb_block_len + xcb_pad;
5543 if (0 != xcb_pad) {
5544 xcb_tmp += xcb_pad;
5545 xcb_pad = 0;
5546 }
5547 xcb_block_len = 0;
5548
5549 return xcb_buffer_len;
5550 }
5551
5552 xcb_void_cookie_t
xcb_change_gc_checked(xcb_connection_t * c,xcb_gcontext_t gc,uint32_t value_mask,const uint32_t * value_list)5553 xcb_change_gc_checked (xcb_connection_t *c /**< */,
5554 xcb_gcontext_t gc /**< */,
5555 uint32_t value_mask /**< */,
5556 const uint32_t *value_list /**< */)
5557 {
5558 static const xcb_protocol_request_t xcb_req = {
5559 /* count */ 4,
5560 /* ext */ 0,
5561 /* opcode */ XCB_CHANGE_GC,
5562 /* isvoid */ 1
5563 };
5564
5565 struct iovec xcb_parts[6];
5566 xcb_void_cookie_t xcb_ret;
5567 xcb_change_gc_request_t xcb_out;
5568
5569 xcb_out.pad0 = 0;
5570 xcb_out.gc = gc;
5571 xcb_out.value_mask = value_mask;
5572
5573 xcb_parts[2].iov_base = (char *) &xcb_out;
5574 xcb_parts[2].iov_len = sizeof(xcb_out);
5575 xcb_parts[3].iov_base = 0;
5576 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5577 /* uint32_t value_list */
5578 xcb_parts[4].iov_base = (char *) value_list;
5579 xcb_parts[4].iov_len = xcb_popcount(value_mask) * sizeof(uint32_t);
5580 xcb_parts[5].iov_base = 0;
5581 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
5582
5583 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
5584 return xcb_ret;
5585 }
5586
5587 xcb_void_cookie_t
xcb_change_gc(xcb_connection_t * c,xcb_gcontext_t gc,uint32_t value_mask,const uint32_t * value_list)5588 xcb_change_gc (xcb_connection_t *c /**< */,
5589 xcb_gcontext_t gc /**< */,
5590 uint32_t value_mask /**< */,
5591 const uint32_t *value_list /**< */)
5592 {
5593 static const xcb_protocol_request_t xcb_req = {
5594 /* count */ 4,
5595 /* ext */ 0,
5596 /* opcode */ XCB_CHANGE_GC,
5597 /* isvoid */ 1
5598 };
5599
5600 struct iovec xcb_parts[6];
5601 xcb_void_cookie_t xcb_ret;
5602 xcb_change_gc_request_t xcb_out;
5603
5604 xcb_out.pad0 = 0;
5605 xcb_out.gc = gc;
5606 xcb_out.value_mask = value_mask;
5607
5608 xcb_parts[2].iov_base = (char *) &xcb_out;
5609 xcb_parts[2].iov_len = sizeof(xcb_out);
5610 xcb_parts[3].iov_base = 0;
5611 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5612 /* uint32_t value_list */
5613 xcb_parts[4].iov_base = (char *) value_list;
5614 xcb_parts[4].iov_len = xcb_popcount(value_mask) * sizeof(uint32_t);
5615 xcb_parts[5].iov_base = 0;
5616 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
5617
5618 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
5619 return xcb_ret;
5620 }
5621
5622 xcb_void_cookie_t
xcb_copy_gc_checked(xcb_connection_t * c,xcb_gcontext_t src_gc,xcb_gcontext_t dst_gc,uint32_t value_mask)5623 xcb_copy_gc_checked (xcb_connection_t *c /**< */,
5624 xcb_gcontext_t src_gc /**< */,
5625 xcb_gcontext_t dst_gc /**< */,
5626 uint32_t value_mask /**< */)
5627 {
5628 static const xcb_protocol_request_t xcb_req = {
5629 /* count */ 2,
5630 /* ext */ 0,
5631 /* opcode */ XCB_COPY_GC,
5632 /* isvoid */ 1
5633 };
5634
5635 struct iovec xcb_parts[4];
5636 xcb_void_cookie_t xcb_ret;
5637 xcb_copy_gc_request_t xcb_out;
5638
5639 xcb_out.pad0 = 0;
5640 xcb_out.src_gc = src_gc;
5641 xcb_out.dst_gc = dst_gc;
5642 xcb_out.value_mask = value_mask;
5643
5644 xcb_parts[2].iov_base = (char *) &xcb_out;
5645 xcb_parts[2].iov_len = sizeof(xcb_out);
5646 xcb_parts[3].iov_base = 0;
5647 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5648
5649 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
5650 return xcb_ret;
5651 }
5652
5653 xcb_void_cookie_t
xcb_copy_gc(xcb_connection_t * c,xcb_gcontext_t src_gc,xcb_gcontext_t dst_gc,uint32_t value_mask)5654 xcb_copy_gc (xcb_connection_t *c /**< */,
5655 xcb_gcontext_t src_gc /**< */,
5656 xcb_gcontext_t dst_gc /**< */,
5657 uint32_t value_mask /**< */)
5658 {
5659 static const xcb_protocol_request_t xcb_req = {
5660 /* count */ 2,
5661 /* ext */ 0,
5662 /* opcode */ XCB_COPY_GC,
5663 /* isvoid */ 1
5664 };
5665
5666 struct iovec xcb_parts[4];
5667 xcb_void_cookie_t xcb_ret;
5668 xcb_copy_gc_request_t xcb_out;
5669
5670 xcb_out.pad0 = 0;
5671 xcb_out.src_gc = src_gc;
5672 xcb_out.dst_gc = dst_gc;
5673 xcb_out.value_mask = value_mask;
5674
5675 xcb_parts[2].iov_base = (char *) &xcb_out;
5676 xcb_parts[2].iov_len = sizeof(xcb_out);
5677 xcb_parts[3].iov_base = 0;
5678 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5679
5680 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
5681 return xcb_ret;
5682 }
5683
5684 int
xcb_set_dashes_sizeof(const void * _buffer)5685 xcb_set_dashes_sizeof (const void *_buffer /**< */)
5686 {
5687 char *xcb_tmp = (char *)_buffer;
5688 const xcb_set_dashes_request_t *_aux = (xcb_set_dashes_request_t *)_buffer;
5689 unsigned int xcb_buffer_len = 0;
5690 unsigned int xcb_block_len = 0;
5691 unsigned int xcb_pad = 0;
5692 unsigned int xcb_align_to = 0;
5693
5694
5695 xcb_block_len += sizeof(xcb_set_dashes_request_t);
5696 xcb_tmp += xcb_block_len;
5697 xcb_buffer_len += xcb_block_len;
5698 xcb_block_len = 0;
5699 /* dashes */
5700 xcb_block_len += _aux->dashes_len * sizeof(uint8_t);
5701 xcb_tmp += xcb_block_len;
5702 xcb_align_to = ALIGNOF(uint8_t);
5703 /* insert padding */
5704 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
5705 xcb_buffer_len += xcb_block_len + xcb_pad;
5706 if (0 != xcb_pad) {
5707 xcb_tmp += xcb_pad;
5708 xcb_pad = 0;
5709 }
5710 xcb_block_len = 0;
5711
5712 return xcb_buffer_len;
5713 }
5714
5715 xcb_void_cookie_t
xcb_set_dashes_checked(xcb_connection_t * c,xcb_gcontext_t gc,uint16_t dash_offset,uint16_t dashes_len,const uint8_t * dashes)5716 xcb_set_dashes_checked (xcb_connection_t *c /**< */,
5717 xcb_gcontext_t gc /**< */,
5718 uint16_t dash_offset /**< */,
5719 uint16_t dashes_len /**< */,
5720 const uint8_t *dashes /**< */)
5721 {
5722 static const xcb_protocol_request_t xcb_req = {
5723 /* count */ 4,
5724 /* ext */ 0,
5725 /* opcode */ XCB_SET_DASHES,
5726 /* isvoid */ 1
5727 };
5728
5729 struct iovec xcb_parts[6];
5730 xcb_void_cookie_t xcb_ret;
5731 xcb_set_dashes_request_t xcb_out;
5732
5733 xcb_out.pad0 = 0;
5734 xcb_out.gc = gc;
5735 xcb_out.dash_offset = dash_offset;
5736 xcb_out.dashes_len = dashes_len;
5737
5738 xcb_parts[2].iov_base = (char *) &xcb_out;
5739 xcb_parts[2].iov_len = sizeof(xcb_out);
5740 xcb_parts[3].iov_base = 0;
5741 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5742 /* uint8_t dashes */
5743 xcb_parts[4].iov_base = (char *) dashes;
5744 xcb_parts[4].iov_len = dashes_len * sizeof(uint8_t);
5745 xcb_parts[5].iov_base = 0;
5746 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
5747
5748 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
5749 return xcb_ret;
5750 }
5751
5752 xcb_void_cookie_t
xcb_set_dashes(xcb_connection_t * c,xcb_gcontext_t gc,uint16_t dash_offset,uint16_t dashes_len,const uint8_t * dashes)5753 xcb_set_dashes (xcb_connection_t *c /**< */,
5754 xcb_gcontext_t gc /**< */,
5755 uint16_t dash_offset /**< */,
5756 uint16_t dashes_len /**< */,
5757 const uint8_t *dashes /**< */)
5758 {
5759 static const xcb_protocol_request_t xcb_req = {
5760 /* count */ 4,
5761 /* ext */ 0,
5762 /* opcode */ XCB_SET_DASHES,
5763 /* isvoid */ 1
5764 };
5765
5766 struct iovec xcb_parts[6];
5767 xcb_void_cookie_t xcb_ret;
5768 xcb_set_dashes_request_t xcb_out;
5769
5770 xcb_out.pad0 = 0;
5771 xcb_out.gc = gc;
5772 xcb_out.dash_offset = dash_offset;
5773 xcb_out.dashes_len = dashes_len;
5774
5775 xcb_parts[2].iov_base = (char *) &xcb_out;
5776 xcb_parts[2].iov_len = sizeof(xcb_out);
5777 xcb_parts[3].iov_base = 0;
5778 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5779 /* uint8_t dashes */
5780 xcb_parts[4].iov_base = (char *) dashes;
5781 xcb_parts[4].iov_len = dashes_len * sizeof(uint8_t);
5782 xcb_parts[5].iov_base = 0;
5783 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
5784
5785 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
5786 return xcb_ret;
5787 }
5788
5789 int
xcb_set_clip_rectangles_sizeof(const void * _buffer,uint32_t rectangles_len)5790 xcb_set_clip_rectangles_sizeof (const void *_buffer /**< */,
5791 uint32_t rectangles_len /**< */)
5792 {
5793 char *xcb_tmp = (char *)_buffer;
5794 unsigned int xcb_buffer_len = 0;
5795 unsigned int xcb_block_len = 0;
5796 unsigned int xcb_pad = 0;
5797 unsigned int xcb_align_to = 0;
5798
5799
5800 xcb_block_len += sizeof(xcb_set_clip_rectangles_request_t);
5801 xcb_tmp += xcb_block_len;
5802 xcb_buffer_len += xcb_block_len;
5803 xcb_block_len = 0;
5804 /* rectangles */
5805 xcb_block_len += rectangles_len * sizeof(xcb_rectangle_t);
5806 xcb_tmp += xcb_block_len;
5807 xcb_align_to = ALIGNOF(xcb_rectangle_t);
5808 /* insert padding */
5809 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
5810 xcb_buffer_len += xcb_block_len + xcb_pad;
5811 if (0 != xcb_pad) {
5812 xcb_tmp += xcb_pad;
5813 xcb_pad = 0;
5814 }
5815 xcb_block_len = 0;
5816
5817 return xcb_buffer_len;
5818 }
5819
5820 xcb_void_cookie_t
xcb_set_clip_rectangles_checked(xcb_connection_t * c,uint8_t ordering,xcb_gcontext_t gc,int16_t clip_x_origin,int16_t clip_y_origin,uint32_t rectangles_len,const xcb_rectangle_t * rectangles)5821 xcb_set_clip_rectangles_checked (xcb_connection_t *c /**< */,
5822 uint8_t ordering /**< */,
5823 xcb_gcontext_t gc /**< */,
5824 int16_t clip_x_origin /**< */,
5825 int16_t clip_y_origin /**< */,
5826 uint32_t rectangles_len /**< */,
5827 const xcb_rectangle_t *rectangles /**< */)
5828 {
5829 static const xcb_protocol_request_t xcb_req = {
5830 /* count */ 4,
5831 /* ext */ 0,
5832 /* opcode */ XCB_SET_CLIP_RECTANGLES,
5833 /* isvoid */ 1
5834 };
5835
5836 struct iovec xcb_parts[6];
5837 xcb_void_cookie_t xcb_ret;
5838 xcb_set_clip_rectangles_request_t xcb_out;
5839
5840 xcb_out.ordering = ordering;
5841 xcb_out.gc = gc;
5842 xcb_out.clip_x_origin = clip_x_origin;
5843 xcb_out.clip_y_origin = clip_y_origin;
5844
5845 xcb_parts[2].iov_base = (char *) &xcb_out;
5846 xcb_parts[2].iov_len = sizeof(xcb_out);
5847 xcb_parts[3].iov_base = 0;
5848 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5849 /* xcb_rectangle_t rectangles */
5850 xcb_parts[4].iov_base = (char *) rectangles;
5851 xcb_parts[4].iov_len = rectangles_len * sizeof(xcb_rectangle_t);
5852 xcb_parts[5].iov_base = 0;
5853 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
5854
5855 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
5856 return xcb_ret;
5857 }
5858
5859 xcb_void_cookie_t
xcb_set_clip_rectangles(xcb_connection_t * c,uint8_t ordering,xcb_gcontext_t gc,int16_t clip_x_origin,int16_t clip_y_origin,uint32_t rectangles_len,const xcb_rectangle_t * rectangles)5860 xcb_set_clip_rectangles (xcb_connection_t *c /**< */,
5861 uint8_t ordering /**< */,
5862 xcb_gcontext_t gc /**< */,
5863 int16_t clip_x_origin /**< */,
5864 int16_t clip_y_origin /**< */,
5865 uint32_t rectangles_len /**< */,
5866 const xcb_rectangle_t *rectangles /**< */)
5867 {
5868 static const xcb_protocol_request_t xcb_req = {
5869 /* count */ 4,
5870 /* ext */ 0,
5871 /* opcode */ XCB_SET_CLIP_RECTANGLES,
5872 /* isvoid */ 1
5873 };
5874
5875 struct iovec xcb_parts[6];
5876 xcb_void_cookie_t xcb_ret;
5877 xcb_set_clip_rectangles_request_t xcb_out;
5878
5879 xcb_out.ordering = ordering;
5880 xcb_out.gc = gc;
5881 xcb_out.clip_x_origin = clip_x_origin;
5882 xcb_out.clip_y_origin = clip_y_origin;
5883
5884 xcb_parts[2].iov_base = (char *) &xcb_out;
5885 xcb_parts[2].iov_len = sizeof(xcb_out);
5886 xcb_parts[3].iov_base = 0;
5887 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5888 /* xcb_rectangle_t rectangles */
5889 xcb_parts[4].iov_base = (char *) rectangles;
5890 xcb_parts[4].iov_len = rectangles_len * sizeof(xcb_rectangle_t);
5891 xcb_parts[5].iov_base = 0;
5892 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
5893
5894 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
5895 return xcb_ret;
5896 }
5897
5898 xcb_void_cookie_t
xcb_free_gc_checked(xcb_connection_t * c,xcb_gcontext_t gc)5899 xcb_free_gc_checked (xcb_connection_t *c /**< */,
5900 xcb_gcontext_t gc /**< */)
5901 {
5902 static const xcb_protocol_request_t xcb_req = {
5903 /* count */ 2,
5904 /* ext */ 0,
5905 /* opcode */ XCB_FREE_GC,
5906 /* isvoid */ 1
5907 };
5908
5909 struct iovec xcb_parts[4];
5910 xcb_void_cookie_t xcb_ret;
5911 xcb_free_gc_request_t xcb_out;
5912
5913 xcb_out.pad0 = 0;
5914 xcb_out.gc = gc;
5915
5916 xcb_parts[2].iov_base = (char *) &xcb_out;
5917 xcb_parts[2].iov_len = sizeof(xcb_out);
5918 xcb_parts[3].iov_base = 0;
5919 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5920
5921 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
5922 return xcb_ret;
5923 }
5924
5925 xcb_void_cookie_t
xcb_free_gc(xcb_connection_t * c,xcb_gcontext_t gc)5926 xcb_free_gc (xcb_connection_t *c /**< */,
5927 xcb_gcontext_t gc /**< */)
5928 {
5929 static const xcb_protocol_request_t xcb_req = {
5930 /* count */ 2,
5931 /* ext */ 0,
5932 /* opcode */ XCB_FREE_GC,
5933 /* isvoid */ 1
5934 };
5935
5936 struct iovec xcb_parts[4];
5937 xcb_void_cookie_t xcb_ret;
5938 xcb_free_gc_request_t xcb_out;
5939
5940 xcb_out.pad0 = 0;
5941 xcb_out.gc = gc;
5942
5943 xcb_parts[2].iov_base = (char *) &xcb_out;
5944 xcb_parts[2].iov_len = sizeof(xcb_out);
5945 xcb_parts[3].iov_base = 0;
5946 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5947
5948 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
5949 return xcb_ret;
5950 }
5951
5952 xcb_void_cookie_t
xcb_clear_area_checked(xcb_connection_t * c,uint8_t exposures,xcb_window_t window,int16_t x,int16_t y,uint16_t width,uint16_t height)5953 xcb_clear_area_checked (xcb_connection_t *c /**< */,
5954 uint8_t exposures /**< */,
5955 xcb_window_t window /**< */,
5956 int16_t x /**< */,
5957 int16_t y /**< */,
5958 uint16_t width /**< */,
5959 uint16_t height /**< */)
5960 {
5961 static const xcb_protocol_request_t xcb_req = {
5962 /* count */ 2,
5963 /* ext */ 0,
5964 /* opcode */ XCB_CLEAR_AREA,
5965 /* isvoid */ 1
5966 };
5967
5968 struct iovec xcb_parts[4];
5969 xcb_void_cookie_t xcb_ret;
5970 xcb_clear_area_request_t xcb_out;
5971
5972 xcb_out.exposures = exposures;
5973 xcb_out.window = window;
5974 xcb_out.x = x;
5975 xcb_out.y = y;
5976 xcb_out.width = width;
5977 xcb_out.height = height;
5978
5979 xcb_parts[2].iov_base = (char *) &xcb_out;
5980 xcb_parts[2].iov_len = sizeof(xcb_out);
5981 xcb_parts[3].iov_base = 0;
5982 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
5983
5984 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
5985 return xcb_ret;
5986 }
5987
5988 xcb_void_cookie_t
xcb_clear_area(xcb_connection_t * c,uint8_t exposures,xcb_window_t window,int16_t x,int16_t y,uint16_t width,uint16_t height)5989 xcb_clear_area (xcb_connection_t *c /**< */,
5990 uint8_t exposures /**< */,
5991 xcb_window_t window /**< */,
5992 int16_t x /**< */,
5993 int16_t y /**< */,
5994 uint16_t width /**< */,
5995 uint16_t height /**< */)
5996 {
5997 static const xcb_protocol_request_t xcb_req = {
5998 /* count */ 2,
5999 /* ext */ 0,
6000 /* opcode */ XCB_CLEAR_AREA,
6001 /* isvoid */ 1
6002 };
6003
6004 struct iovec xcb_parts[4];
6005 xcb_void_cookie_t xcb_ret;
6006 xcb_clear_area_request_t xcb_out;
6007
6008 xcb_out.exposures = exposures;
6009 xcb_out.window = window;
6010 xcb_out.x = x;
6011 xcb_out.y = y;
6012 xcb_out.width = width;
6013 xcb_out.height = height;
6014
6015 xcb_parts[2].iov_base = (char *) &xcb_out;
6016 xcb_parts[2].iov_len = sizeof(xcb_out);
6017 xcb_parts[3].iov_base = 0;
6018 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
6019
6020 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
6021 return xcb_ret;
6022 }
6023
6024 xcb_void_cookie_t
xcb_copy_area_checked(xcb_connection_t * c,xcb_drawable_t src_drawable,xcb_drawable_t dst_drawable,xcb_gcontext_t gc,int16_t src_x,int16_t src_y,int16_t dst_x,int16_t dst_y,uint16_t width,uint16_t height)6025 xcb_copy_area_checked (xcb_connection_t *c /**< */,
6026 xcb_drawable_t src_drawable /**< */,
6027 xcb_drawable_t dst_drawable /**< */,
6028 xcb_gcontext_t gc /**< */,
6029 int16_t src_x /**< */,
6030 int16_t src_y /**< */,
6031 int16_t dst_x /**< */,
6032 int16_t dst_y /**< */,
6033 uint16_t width /**< */,
6034 uint16_t height /**< */)
6035 {
6036 static const xcb_protocol_request_t xcb_req = {
6037 /* count */ 2,
6038 /* ext */ 0,
6039 /* opcode */ XCB_COPY_AREA,
6040 /* isvoid */ 1
6041 };
6042
6043 struct iovec xcb_parts[4];
6044 xcb_void_cookie_t xcb_ret;
6045 xcb_copy_area_request_t xcb_out;
6046
6047 xcb_out.pad0 = 0;
6048 xcb_out.src_drawable = src_drawable;
6049 xcb_out.dst_drawable = dst_drawable;
6050 xcb_out.gc = gc;
6051 xcb_out.src_x = src_x;
6052 xcb_out.src_y = src_y;
6053 xcb_out.dst_x = dst_x;
6054 xcb_out.dst_y = dst_y;
6055 xcb_out.width = width;
6056 xcb_out.height = height;
6057
6058 xcb_parts[2].iov_base = (char *) &xcb_out;
6059 xcb_parts[2].iov_len = sizeof(xcb_out);
6060 xcb_parts[3].iov_base = 0;
6061 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
6062
6063 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
6064 return xcb_ret;
6065 }
6066
6067 xcb_void_cookie_t
xcb_copy_area(xcb_connection_t * c,xcb_drawable_t src_drawable,xcb_drawable_t dst_drawable,xcb_gcontext_t gc,int16_t src_x,int16_t src_y,int16_t dst_x,int16_t dst_y,uint16_t width,uint16_t height)6068 xcb_copy_area (xcb_connection_t *c /**< */,
6069 xcb_drawable_t src_drawable /**< */,
6070 xcb_drawable_t dst_drawable /**< */,
6071 xcb_gcontext_t gc /**< */,
6072 int16_t src_x /**< */,
6073 int16_t src_y /**< */,
6074 int16_t dst_x /**< */,
6075 int16_t dst_y /**< */,
6076 uint16_t width /**< */,
6077 uint16_t height /**< */)
6078 {
6079 static const xcb_protocol_request_t xcb_req = {
6080 /* count */ 2,
6081 /* ext */ 0,
6082 /* opcode */ XCB_COPY_AREA,
6083 /* isvoid */ 1
6084 };
6085
6086 struct iovec xcb_parts[4];
6087 xcb_void_cookie_t xcb_ret;
6088 xcb_copy_area_request_t xcb_out;
6089
6090 xcb_out.pad0 = 0;
6091 xcb_out.src_drawable = src_drawable;
6092 xcb_out.dst_drawable = dst_drawable;
6093 xcb_out.gc = gc;
6094 xcb_out.src_x = src_x;
6095 xcb_out.src_y = src_y;
6096 xcb_out.dst_x = dst_x;
6097 xcb_out.dst_y = dst_y;
6098 xcb_out.width = width;
6099 xcb_out.height = height;
6100
6101 xcb_parts[2].iov_base = (char *) &xcb_out;
6102 xcb_parts[2].iov_len = sizeof(xcb_out);
6103 xcb_parts[3].iov_base = 0;
6104 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
6105
6106 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
6107 return xcb_ret;
6108 }
6109
6110 xcb_void_cookie_t
xcb_copy_plane_checked(xcb_connection_t * c,xcb_drawable_t src_drawable,xcb_drawable_t dst_drawable,xcb_gcontext_t gc,int16_t src_x,int16_t src_y,int16_t dst_x,int16_t dst_y,uint16_t width,uint16_t height,uint32_t bit_plane)6111 xcb_copy_plane_checked (xcb_connection_t *c /**< */,
6112 xcb_drawable_t src_drawable /**< */,
6113 xcb_drawable_t dst_drawable /**< */,
6114 xcb_gcontext_t gc /**< */,
6115 int16_t src_x /**< */,
6116 int16_t src_y /**< */,
6117 int16_t dst_x /**< */,
6118 int16_t dst_y /**< */,
6119 uint16_t width /**< */,
6120 uint16_t height /**< */,
6121 uint32_t bit_plane /**< */)
6122 {
6123 static const xcb_protocol_request_t xcb_req = {
6124 /* count */ 2,
6125 /* ext */ 0,
6126 /* opcode */ XCB_COPY_PLANE,
6127 /* isvoid */ 1
6128 };
6129
6130 struct iovec xcb_parts[4];
6131 xcb_void_cookie_t xcb_ret;
6132 xcb_copy_plane_request_t xcb_out;
6133
6134 xcb_out.pad0 = 0;
6135 xcb_out.src_drawable = src_drawable;
6136 xcb_out.dst_drawable = dst_drawable;
6137 xcb_out.gc = gc;
6138 xcb_out.src_x = src_x;
6139 xcb_out.src_y = src_y;
6140 xcb_out.dst_x = dst_x;
6141 xcb_out.dst_y = dst_y;
6142 xcb_out.width = width;
6143 xcb_out.height = height;
6144 xcb_out.bit_plane = bit_plane;
6145
6146 xcb_parts[2].iov_base = (char *) &xcb_out;
6147 xcb_parts[2].iov_len = sizeof(xcb_out);
6148 xcb_parts[3].iov_base = 0;
6149 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
6150
6151 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
6152 return xcb_ret;
6153 }
6154
6155 xcb_void_cookie_t
xcb_copy_plane(xcb_connection_t * c,xcb_drawable_t src_drawable,xcb_drawable_t dst_drawable,xcb_gcontext_t gc,int16_t src_x,int16_t src_y,int16_t dst_x,int16_t dst_y,uint16_t width,uint16_t height,uint32_t bit_plane)6156 xcb_copy_plane (xcb_connection_t *c /**< */,
6157 xcb_drawable_t src_drawable /**< */,
6158 xcb_drawable_t dst_drawable /**< */,
6159 xcb_gcontext_t gc /**< */,
6160 int16_t src_x /**< */,
6161 int16_t src_y /**< */,
6162 int16_t dst_x /**< */,
6163 int16_t dst_y /**< */,
6164 uint16_t width /**< */,
6165 uint16_t height /**< */,
6166 uint32_t bit_plane /**< */)
6167 {
6168 static const xcb_protocol_request_t xcb_req = {
6169 /* count */ 2,
6170 /* ext */ 0,
6171 /* opcode */ XCB_COPY_PLANE,
6172 /* isvoid */ 1
6173 };
6174
6175 struct iovec xcb_parts[4];
6176 xcb_void_cookie_t xcb_ret;
6177 xcb_copy_plane_request_t xcb_out;
6178
6179 xcb_out.pad0 = 0;
6180 xcb_out.src_drawable = src_drawable;
6181 xcb_out.dst_drawable = dst_drawable;
6182 xcb_out.gc = gc;
6183 xcb_out.src_x = src_x;
6184 xcb_out.src_y = src_y;
6185 xcb_out.dst_x = dst_x;
6186 xcb_out.dst_y = dst_y;
6187 xcb_out.width = width;
6188 xcb_out.height = height;
6189 xcb_out.bit_plane = bit_plane;
6190
6191 xcb_parts[2].iov_base = (char *) &xcb_out;
6192 xcb_parts[2].iov_len = sizeof(xcb_out);
6193 xcb_parts[3].iov_base = 0;
6194 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
6195
6196 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
6197 return xcb_ret;
6198 }
6199
6200 int
xcb_poly_point_sizeof(const void * _buffer,uint32_t points_len)6201 xcb_poly_point_sizeof (const void *_buffer /**< */,
6202 uint32_t points_len /**< */)
6203 {
6204 char *xcb_tmp = (char *)_buffer;
6205 unsigned int xcb_buffer_len = 0;
6206 unsigned int xcb_block_len = 0;
6207 unsigned int xcb_pad = 0;
6208 unsigned int xcb_align_to = 0;
6209
6210
6211 xcb_block_len += sizeof(xcb_poly_point_request_t);
6212 xcb_tmp += xcb_block_len;
6213 xcb_buffer_len += xcb_block_len;
6214 xcb_block_len = 0;
6215 /* points */
6216 xcb_block_len += points_len * sizeof(xcb_point_t);
6217 xcb_tmp += xcb_block_len;
6218 xcb_align_to = ALIGNOF(xcb_point_t);
6219 /* insert padding */
6220 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
6221 xcb_buffer_len += xcb_block_len + xcb_pad;
6222 if (0 != xcb_pad) {
6223 xcb_tmp += xcb_pad;
6224 xcb_pad = 0;
6225 }
6226 xcb_block_len = 0;
6227
6228 return xcb_buffer_len;
6229 }
6230
6231 xcb_void_cookie_t
xcb_poly_point_checked(xcb_connection_t * c,uint8_t coordinate_mode,xcb_drawable_t drawable,xcb_gcontext_t gc,uint32_t points_len,const xcb_point_t * points)6232 xcb_poly_point_checked (xcb_connection_t *c /**< */,
6233 uint8_t coordinate_mode /**< */,
6234 xcb_drawable_t drawable /**< */,
6235 xcb_gcontext_t gc /**< */,
6236 uint32_t points_len /**< */,
6237 const xcb_point_t *points /**< */)
6238 {
6239 static const xcb_protocol_request_t xcb_req = {
6240 /* count */ 4,
6241 /* ext */ 0,
6242 /* opcode */ XCB_POLY_POINT,
6243 /* isvoid */ 1
6244 };
6245
6246 struct iovec xcb_parts[6];
6247 xcb_void_cookie_t xcb_ret;
6248 xcb_poly_point_request_t xcb_out;
6249
6250 xcb_out.coordinate_mode = coordinate_mode;
6251 xcb_out.drawable = drawable;
6252 xcb_out.gc = gc;
6253
6254 xcb_parts[2].iov_base = (char *) &xcb_out;
6255 xcb_parts[2].iov_len = sizeof(xcb_out);
6256 xcb_parts[3].iov_base = 0;
6257 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
6258 /* xcb_point_t points */
6259 xcb_parts[4].iov_base = (char *) points;
6260 xcb_parts[4].iov_len = points_len * sizeof(xcb_point_t);
6261 xcb_parts[5].iov_base = 0;
6262 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
6263
6264 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
6265 return xcb_ret;
6266 }
6267
6268 xcb_void_cookie_t
xcb_poly_point(xcb_connection_t * c,uint8_t coordinate_mode,xcb_drawable_t drawable,xcb_gcontext_t gc,uint32_t points_len,const xcb_point_t * points)6269 xcb_poly_point (xcb_connection_t *c /**< */,
6270 uint8_t coordinate_mode /**< */,
6271 xcb_drawable_t drawable /**< */,
6272 xcb_gcontext_t gc /**< */,
6273 uint32_t points_len /**< */,
6274 const xcb_point_t *points /**< */)
6275 {
6276 static const xcb_protocol_request_t xcb_req = {
6277 /* count */ 4,
6278 /* ext */ 0,
6279 /* opcode */ XCB_POLY_POINT,
6280 /* isvoid */ 1
6281 };
6282
6283 struct iovec xcb_parts[6];
6284 xcb_void_cookie_t xcb_ret;
6285 xcb_poly_point_request_t xcb_out;
6286
6287 xcb_out.coordinate_mode = coordinate_mode;
6288 xcb_out.drawable = drawable;
6289 xcb_out.gc = gc;
6290
6291 xcb_parts[2].iov_base = (char *) &xcb_out;
6292 xcb_parts[2].iov_len = sizeof(xcb_out);
6293 xcb_parts[3].iov_base = 0;
6294 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
6295 /* xcb_point_t points */
6296 xcb_parts[4].iov_base = (char *) points;
6297 xcb_parts[4].iov_len = points_len * sizeof(xcb_point_t);
6298 xcb_parts[5].iov_base = 0;
6299 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
6300
6301 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
6302 return xcb_ret;
6303 }
6304
6305 int
xcb_poly_line_sizeof(const void * _buffer,uint32_t points_len)6306 xcb_poly_line_sizeof (const void *_buffer /**< */,
6307 uint32_t points_len /**< */)
6308 {
6309 char *xcb_tmp = (char *)_buffer;
6310 unsigned int xcb_buffer_len = 0;
6311 unsigned int xcb_block_len = 0;
6312 unsigned int xcb_pad = 0;
6313 unsigned int xcb_align_to = 0;
6314
6315
6316 xcb_block_len += sizeof(xcb_poly_line_request_t);
6317 xcb_tmp += xcb_block_len;
6318 xcb_buffer_len += xcb_block_len;
6319 xcb_block_len = 0;
6320 /* points */
6321 xcb_block_len += points_len * sizeof(xcb_point_t);
6322 xcb_tmp += xcb_block_len;
6323 xcb_align_to = ALIGNOF(xcb_point_t);
6324 /* insert padding */
6325 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
6326 xcb_buffer_len += xcb_block_len + xcb_pad;
6327 if (0 != xcb_pad) {
6328 xcb_tmp += xcb_pad;
6329 xcb_pad = 0;
6330 }
6331 xcb_block_len = 0;
6332
6333 return xcb_buffer_len;
6334 }
6335
6336 xcb_void_cookie_t
xcb_poly_line_checked(xcb_connection_t * c,uint8_t coordinate_mode,xcb_drawable_t drawable,xcb_gcontext_t gc,uint32_t points_len,const xcb_point_t * points)6337 xcb_poly_line_checked (xcb_connection_t *c /**< */,
6338 uint8_t coordinate_mode /**< */,
6339 xcb_drawable_t drawable /**< */,
6340 xcb_gcontext_t gc /**< */,
6341 uint32_t points_len /**< */,
6342 const xcb_point_t *points /**< */)
6343 {
6344 static const xcb_protocol_request_t xcb_req = {
6345 /* count */ 4,
6346 /* ext */ 0,
6347 /* opcode */ XCB_POLY_LINE,
6348 /* isvoid */ 1
6349 };
6350
6351 struct iovec xcb_parts[6];
6352 xcb_void_cookie_t xcb_ret;
6353 xcb_poly_line_request_t xcb_out;
6354
6355 xcb_out.coordinate_mode = coordinate_mode;
6356 xcb_out.drawable = drawable;
6357 xcb_out.gc = gc;
6358
6359 xcb_parts[2].iov_base = (char *) &xcb_out;
6360 xcb_parts[2].iov_len = sizeof(xcb_out);
6361 xcb_parts[3].iov_base = 0;
6362 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
6363 /* xcb_point_t points */
6364 xcb_parts[4].iov_base = (char *) points;
6365 xcb_parts[4].iov_len = points_len * sizeof(xcb_point_t);
6366 xcb_parts[5].iov_base = 0;
6367 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
6368
6369 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
6370 return xcb_ret;
6371 }
6372
6373 xcb_void_cookie_t
xcb_poly_line(xcb_connection_t * c,uint8_t coordinate_mode,xcb_drawable_t drawable,xcb_gcontext_t gc,uint32_t points_len,const xcb_point_t * points)6374 xcb_poly_line (xcb_connection_t *c /**< */,
6375 uint8_t coordinate_mode /**< */,
6376 xcb_drawable_t drawable /**< */,
6377 xcb_gcontext_t gc /**< */,
6378 uint32_t points_len /**< */,
6379 const xcb_point_t *points /**< */)
6380 {
6381 static const xcb_protocol_request_t xcb_req = {
6382 /* count */ 4,
6383 /* ext */ 0,
6384 /* opcode */ XCB_POLY_LINE,
6385 /* isvoid */ 1
6386 };
6387
6388 struct iovec xcb_parts[6];
6389 xcb_void_cookie_t xcb_ret;
6390 xcb_poly_line_request_t xcb_out;
6391
6392 xcb_out.coordinate_mode = coordinate_mode;
6393 xcb_out.drawable = drawable;
6394 xcb_out.gc = gc;
6395
6396 xcb_parts[2].iov_base = (char *) &xcb_out;
6397 xcb_parts[2].iov_len = sizeof(xcb_out);
6398 xcb_parts[3].iov_base = 0;
6399 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
6400 /* xcb_point_t points */
6401 xcb_parts[4].iov_base = (char *) points;
6402 xcb_parts[4].iov_len = points_len * sizeof(xcb_point_t);
6403 xcb_parts[5].iov_base = 0;
6404 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
6405
6406 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
6407 return xcb_ret;
6408 }
6409
6410 void
xcb_segment_next(xcb_segment_iterator_t * i)6411 xcb_segment_next (xcb_segment_iterator_t *i /**< */)
6412 {
6413 --i->rem;
6414 ++i->data;
6415 i->index += sizeof(xcb_segment_t);
6416 }
6417
6418 xcb_generic_iterator_t
xcb_segment_end(xcb_segment_iterator_t i)6419 xcb_segment_end (xcb_segment_iterator_t i /**< */)
6420 {
6421 xcb_generic_iterator_t ret;
6422 ret.data = i.data + i.rem;
6423 ret.index = i.index + ((char *) ret.data - (char *) i.data);
6424 ret.rem = 0;
6425 return ret;
6426 }
6427
6428 int
xcb_poly_segment_sizeof(const void * _buffer,uint32_t segments_len)6429 xcb_poly_segment_sizeof (const void *_buffer /**< */,
6430 uint32_t segments_len /**< */)
6431 {
6432 char *xcb_tmp = (char *)_buffer;
6433 unsigned int xcb_buffer_len = 0;
6434 unsigned int xcb_block_len = 0;
6435 unsigned int xcb_pad = 0;
6436 unsigned int xcb_align_to = 0;
6437
6438
6439 xcb_block_len += sizeof(xcb_poly_segment_request_t);
6440 xcb_tmp += xcb_block_len;
6441 xcb_buffer_len += xcb_block_len;
6442 xcb_block_len = 0;
6443 /* segments */
6444 xcb_block_len += segments_len * sizeof(xcb_segment_t);
6445 xcb_tmp += xcb_block_len;
6446 xcb_align_to = ALIGNOF(xcb_segment_t);
6447 /* insert padding */
6448 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
6449 xcb_buffer_len += xcb_block_len + xcb_pad;
6450 if (0 != xcb_pad) {
6451 xcb_tmp += xcb_pad;
6452 xcb_pad = 0;
6453 }
6454 xcb_block_len = 0;
6455
6456 return xcb_buffer_len;
6457 }
6458
6459 xcb_void_cookie_t
xcb_poly_segment_checked(xcb_connection_t * c,xcb_drawable_t drawable,xcb_gcontext_t gc,uint32_t segments_len,const xcb_segment_t * segments)6460 xcb_poly_segment_checked (xcb_connection_t *c /**< */,
6461 xcb_drawable_t drawable /**< */,
6462 xcb_gcontext_t gc /**< */,
6463 uint32_t segments_len /**< */,
6464 const xcb_segment_t *segments /**< */)
6465 {
6466 static const xcb_protocol_request_t xcb_req = {
6467 /* count */ 4,
6468 /* ext */ 0,
6469 /* opcode */ XCB_POLY_SEGMENT,
6470 /* isvoid */ 1
6471 };
6472
6473 struct iovec xcb_parts[6];
6474 xcb_void_cookie_t xcb_ret;
6475 xcb_poly_segment_request_t xcb_out;
6476
6477 xcb_out.pad0 = 0;
6478 xcb_out.drawable = drawable;
6479 xcb_out.gc = gc;
6480
6481 xcb_parts[2].iov_base = (char *) &xcb_out;
6482 xcb_parts[2].iov_len = sizeof(xcb_out);
6483 xcb_parts[3].iov_base = 0;
6484 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
6485 /* xcb_segment_t segments */
6486 xcb_parts[4].iov_base = (char *) segments;
6487 xcb_parts[4].iov_len = segments_len * sizeof(xcb_segment_t);
6488 xcb_parts[5].iov_base = 0;
6489 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
6490
6491 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
6492 return xcb_ret;
6493 }
6494
6495 xcb_void_cookie_t
xcb_poly_segment(xcb_connection_t * c,xcb_drawable_t drawable,xcb_gcontext_t gc,uint32_t segments_len,const xcb_segment_t * segments)6496 xcb_poly_segment (xcb_connection_t *c /**< */,
6497 xcb_drawable_t drawable /**< */,
6498 xcb_gcontext_t gc /**< */,
6499 uint32_t segments_len /**< */,
6500 const xcb_segment_t *segments /**< */)
6501 {
6502 static const xcb_protocol_request_t xcb_req = {
6503 /* count */ 4,
6504 /* ext */ 0,
6505 /* opcode */ XCB_POLY_SEGMENT,
6506 /* isvoid */ 1
6507 };
6508
6509 struct iovec xcb_parts[6];
6510 xcb_void_cookie_t xcb_ret;
6511 xcb_poly_segment_request_t xcb_out;
6512
6513 xcb_out.pad0 = 0;
6514 xcb_out.drawable = drawable;
6515 xcb_out.gc = gc;
6516
6517 xcb_parts[2].iov_base = (char *) &xcb_out;
6518 xcb_parts[2].iov_len = sizeof(xcb_out);
6519 xcb_parts[3].iov_base = 0;
6520 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
6521 /* xcb_segment_t segments */
6522 xcb_parts[4].iov_base = (char *) segments;
6523 xcb_parts[4].iov_len = segments_len * sizeof(xcb_segment_t);
6524 xcb_parts[5].iov_base = 0;
6525 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
6526
6527 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
6528 return xcb_ret;
6529 }
6530
6531 int
xcb_poly_rectangle_sizeof(const void * _buffer,uint32_t rectangles_len)6532 xcb_poly_rectangle_sizeof (const void *_buffer /**< */,
6533 uint32_t rectangles_len /**< */)
6534 {
6535 char *xcb_tmp = (char *)_buffer;
6536 unsigned int xcb_buffer_len = 0;
6537 unsigned int xcb_block_len = 0;
6538 unsigned int xcb_pad = 0;
6539 unsigned int xcb_align_to = 0;
6540
6541
6542 xcb_block_len += sizeof(xcb_poly_rectangle_request_t);
6543 xcb_tmp += xcb_block_len;
6544 xcb_buffer_len += xcb_block_len;
6545 xcb_block_len = 0;
6546 /* rectangles */
6547 xcb_block_len += rectangles_len * sizeof(xcb_rectangle_t);
6548 xcb_tmp += xcb_block_len;
6549 xcb_align_to = ALIGNOF(xcb_rectangle_t);
6550 /* insert padding */
6551 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
6552 xcb_buffer_len += xcb_block_len + xcb_pad;
6553 if (0 != xcb_pad) {
6554 xcb_tmp += xcb_pad;
6555 xcb_pad = 0;
6556 }
6557 xcb_block_len = 0;
6558
6559 return xcb_buffer_len;
6560 }
6561
6562 xcb_void_cookie_t
xcb_poly_rectangle_checked(xcb_connection_t * c,xcb_drawable_t drawable,xcb_gcontext_t gc,uint32_t rectangles_len,const xcb_rectangle_t * rectangles)6563 xcb_poly_rectangle_checked (xcb_connection_t *c /**< */,
6564 xcb_drawable_t drawable /**< */,
6565 xcb_gcontext_t gc /**< */,
6566 uint32_t rectangles_len /**< */,
6567 const xcb_rectangle_t *rectangles /**< */)
6568 {
6569 static const xcb_protocol_request_t xcb_req = {
6570 /* count */ 4,
6571 /* ext */ 0,
6572 /* opcode */ XCB_POLY_RECTANGLE,
6573 /* isvoid */ 1
6574 };
6575
6576 struct iovec xcb_parts[6];
6577 xcb_void_cookie_t xcb_ret;
6578 xcb_poly_rectangle_request_t xcb_out;
6579
6580 xcb_out.pad0 = 0;
6581 xcb_out.drawable = drawable;
6582 xcb_out.gc = gc;
6583
6584 xcb_parts[2].iov_base = (char *) &xcb_out;
6585 xcb_parts[2].iov_len = sizeof(xcb_out);
6586 xcb_parts[3].iov_base = 0;
6587 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
6588 /* xcb_rectangle_t rectangles */
6589 xcb_parts[4].iov_base = (char *) rectangles;
6590 xcb_parts[4].iov_len = rectangles_len * sizeof(xcb_rectangle_t);
6591 xcb_parts[5].iov_base = 0;
6592 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
6593
6594 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
6595 return xcb_ret;
6596 }
6597
6598 xcb_void_cookie_t
xcb_poly_rectangle(xcb_connection_t * c,xcb_drawable_t drawable,xcb_gcontext_t gc,uint32_t rectangles_len,const xcb_rectangle_t * rectangles)6599 xcb_poly_rectangle (xcb_connection_t *c /**< */,
6600 xcb_drawable_t drawable /**< */,
6601 xcb_gcontext_t gc /**< */,
6602 uint32_t rectangles_len /**< */,
6603 const xcb_rectangle_t *rectangles /**< */)
6604 {
6605 static const xcb_protocol_request_t xcb_req = {
6606 /* count */ 4,
6607 /* ext */ 0,
6608 /* opcode */ XCB_POLY_RECTANGLE,
6609 /* isvoid */ 1
6610 };
6611
6612 struct iovec xcb_parts[6];
6613 xcb_void_cookie_t xcb_ret;
6614 xcb_poly_rectangle_request_t xcb_out;
6615
6616 xcb_out.pad0 = 0;
6617 xcb_out.drawable = drawable;
6618 xcb_out.gc = gc;
6619
6620 xcb_parts[2].iov_base = (char *) &xcb_out;
6621 xcb_parts[2].iov_len = sizeof(xcb_out);
6622 xcb_parts[3].iov_base = 0;
6623 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
6624 /* xcb_rectangle_t rectangles */
6625 xcb_parts[4].iov_base = (char *) rectangles;
6626 xcb_parts[4].iov_len = rectangles_len * sizeof(xcb_rectangle_t);
6627 xcb_parts[5].iov_base = 0;
6628 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
6629
6630 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
6631 return xcb_ret;
6632 }
6633
6634 int
xcb_poly_arc_sizeof(const void * _buffer,uint32_t arcs_len)6635 xcb_poly_arc_sizeof (const void *_buffer /**< */,
6636 uint32_t arcs_len /**< */)
6637 {
6638 char *xcb_tmp = (char *)_buffer;
6639 unsigned int xcb_buffer_len = 0;
6640 unsigned int xcb_block_len = 0;
6641 unsigned int xcb_pad = 0;
6642 unsigned int xcb_align_to = 0;
6643
6644
6645 xcb_block_len += sizeof(xcb_poly_arc_request_t);
6646 xcb_tmp += xcb_block_len;
6647 xcb_buffer_len += xcb_block_len;
6648 xcb_block_len = 0;
6649 /* arcs */
6650 xcb_block_len += arcs_len * sizeof(xcb_arc_t);
6651 xcb_tmp += xcb_block_len;
6652 xcb_align_to = ALIGNOF(xcb_arc_t);
6653 /* insert padding */
6654 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
6655 xcb_buffer_len += xcb_block_len + xcb_pad;
6656 if (0 != xcb_pad) {
6657 xcb_tmp += xcb_pad;
6658 xcb_pad = 0;
6659 }
6660 xcb_block_len = 0;
6661
6662 return xcb_buffer_len;
6663 }
6664
6665 xcb_void_cookie_t
xcb_poly_arc_checked(xcb_connection_t * c,xcb_drawable_t drawable,xcb_gcontext_t gc,uint32_t arcs_len,const xcb_arc_t * arcs)6666 xcb_poly_arc_checked (xcb_connection_t *c /**< */,
6667 xcb_drawable_t drawable /**< */,
6668 xcb_gcontext_t gc /**< */,
6669 uint32_t arcs_len /**< */,
6670 const xcb_arc_t *arcs /**< */)
6671 {
6672 static const xcb_protocol_request_t xcb_req = {
6673 /* count */ 4,
6674 /* ext */ 0,
6675 /* opcode */ XCB_POLY_ARC,
6676 /* isvoid */ 1
6677 };
6678
6679 struct iovec xcb_parts[6];
6680 xcb_void_cookie_t xcb_ret;
6681 xcb_poly_arc_request_t xcb_out;
6682
6683 xcb_out.pad0 = 0;
6684 xcb_out.drawable = drawable;
6685 xcb_out.gc = gc;
6686
6687 xcb_parts[2].iov_base = (char *) &xcb_out;
6688 xcb_parts[2].iov_len = sizeof(xcb_out);
6689 xcb_parts[3].iov_base = 0;
6690 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
6691 /* xcb_arc_t arcs */
6692 xcb_parts[4].iov_base = (char *) arcs;
6693 xcb_parts[4].iov_len = arcs_len * sizeof(xcb_arc_t);
6694 xcb_parts[5].iov_base = 0;
6695 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
6696
6697 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
6698 return xcb_ret;
6699 }
6700
6701 xcb_void_cookie_t
xcb_poly_arc(xcb_connection_t * c,xcb_drawable_t drawable,xcb_gcontext_t gc,uint32_t arcs_len,const xcb_arc_t * arcs)6702 xcb_poly_arc (xcb_connection_t *c /**< */,
6703 xcb_drawable_t drawable /**< */,
6704 xcb_gcontext_t gc /**< */,
6705 uint32_t arcs_len /**< */,
6706 const xcb_arc_t *arcs /**< */)
6707 {
6708 static const xcb_protocol_request_t xcb_req = {
6709 /* count */ 4,
6710 /* ext */ 0,
6711 /* opcode */ XCB_POLY_ARC,
6712 /* isvoid */ 1
6713 };
6714
6715 struct iovec xcb_parts[6];
6716 xcb_void_cookie_t xcb_ret;
6717 xcb_poly_arc_request_t xcb_out;
6718
6719 xcb_out.pad0 = 0;
6720 xcb_out.drawable = drawable;
6721 xcb_out.gc = gc;
6722
6723 xcb_parts[2].iov_base = (char *) &xcb_out;
6724 xcb_parts[2].iov_len = sizeof(xcb_out);
6725 xcb_parts[3].iov_base = 0;
6726 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
6727 /* xcb_arc_t arcs */
6728 xcb_parts[4].iov_base = (char *) arcs;
6729 xcb_parts[4].iov_len = arcs_len * sizeof(xcb_arc_t);
6730 xcb_parts[5].iov_base = 0;
6731 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
6732
6733 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
6734 return xcb_ret;
6735 }
6736
6737 int
xcb_fill_poly_sizeof(const void * _buffer,uint32_t points_len)6738 xcb_fill_poly_sizeof (const void *_buffer /**< */,
6739 uint32_t points_len /**< */)
6740 {
6741 char *xcb_tmp = (char *)_buffer;
6742 unsigned int xcb_buffer_len = 0;
6743 unsigned int xcb_block_len = 0;
6744 unsigned int xcb_pad = 0;
6745 unsigned int xcb_align_to = 0;
6746
6747
6748 xcb_block_len += sizeof(xcb_fill_poly_request_t);
6749 xcb_tmp += xcb_block_len;
6750 xcb_buffer_len += xcb_block_len;
6751 xcb_block_len = 0;
6752 /* points */
6753 xcb_block_len += points_len * sizeof(xcb_point_t);
6754 xcb_tmp += xcb_block_len;
6755 xcb_align_to = ALIGNOF(xcb_point_t);
6756 /* insert padding */
6757 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
6758 xcb_buffer_len += xcb_block_len + xcb_pad;
6759 if (0 != xcb_pad) {
6760 xcb_tmp += xcb_pad;
6761 xcb_pad = 0;
6762 }
6763 xcb_block_len = 0;
6764
6765 return xcb_buffer_len;
6766 }
6767
6768 xcb_void_cookie_t
xcb_fill_poly_checked(xcb_connection_t * c,xcb_drawable_t drawable,xcb_gcontext_t gc,uint8_t shape,uint8_t coordinate_mode,uint32_t points_len,const xcb_point_t * points)6769 xcb_fill_poly_checked (xcb_connection_t *c /**< */,
6770 xcb_drawable_t drawable /**< */,
6771 xcb_gcontext_t gc /**< */,
6772 uint8_t shape /**< */,
6773 uint8_t coordinate_mode /**< */,
6774 uint32_t points_len /**< */,
6775 const xcb_point_t *points /**< */)
6776 {
6777 static const xcb_protocol_request_t xcb_req = {
6778 /* count */ 4,
6779 /* ext */ 0,
6780 /* opcode */ XCB_FILL_POLY,
6781 /* isvoid */ 1
6782 };
6783
6784 struct iovec xcb_parts[6];
6785 xcb_void_cookie_t xcb_ret;
6786 xcb_fill_poly_request_t xcb_out;
6787
6788 xcb_out.pad0 = 0;
6789 xcb_out.drawable = drawable;
6790 xcb_out.gc = gc;
6791 xcb_out.shape = shape;
6792 xcb_out.coordinate_mode = coordinate_mode;
6793 memset(xcb_out.pad1, 0, 2);
6794
6795 xcb_parts[2].iov_base = (char *) &xcb_out;
6796 xcb_parts[2].iov_len = sizeof(xcb_out);
6797 xcb_parts[3].iov_base = 0;
6798 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
6799 /* xcb_point_t points */
6800 xcb_parts[4].iov_base = (char *) points;
6801 xcb_parts[4].iov_len = points_len * sizeof(xcb_point_t);
6802 xcb_parts[5].iov_base = 0;
6803 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
6804
6805 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
6806 return xcb_ret;
6807 }
6808
6809 xcb_void_cookie_t
xcb_fill_poly(xcb_connection_t * c,xcb_drawable_t drawable,xcb_gcontext_t gc,uint8_t shape,uint8_t coordinate_mode,uint32_t points_len,const xcb_point_t * points)6810 xcb_fill_poly (xcb_connection_t *c /**< */,
6811 xcb_drawable_t drawable /**< */,
6812 xcb_gcontext_t gc /**< */,
6813 uint8_t shape /**< */,
6814 uint8_t coordinate_mode /**< */,
6815 uint32_t points_len /**< */,
6816 const xcb_point_t *points /**< */)
6817 {
6818 static const xcb_protocol_request_t xcb_req = {
6819 /* count */ 4,
6820 /* ext */ 0,
6821 /* opcode */ XCB_FILL_POLY,
6822 /* isvoid */ 1
6823 };
6824
6825 struct iovec xcb_parts[6];
6826 xcb_void_cookie_t xcb_ret;
6827 xcb_fill_poly_request_t xcb_out;
6828
6829 xcb_out.pad0 = 0;
6830 xcb_out.drawable = drawable;
6831 xcb_out.gc = gc;
6832 xcb_out.shape = shape;
6833 xcb_out.coordinate_mode = coordinate_mode;
6834 memset(xcb_out.pad1, 0, 2);
6835
6836 xcb_parts[2].iov_base = (char *) &xcb_out;
6837 xcb_parts[2].iov_len = sizeof(xcb_out);
6838 xcb_parts[3].iov_base = 0;
6839 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
6840 /* xcb_point_t points */
6841 xcb_parts[4].iov_base = (char *) points;
6842 xcb_parts[4].iov_len = points_len * sizeof(xcb_point_t);
6843 xcb_parts[5].iov_base = 0;
6844 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
6845
6846 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
6847 return xcb_ret;
6848 }
6849
6850 int
xcb_poly_fill_rectangle_sizeof(const void * _buffer,uint32_t rectangles_len)6851 xcb_poly_fill_rectangle_sizeof (const void *_buffer /**< */,
6852 uint32_t rectangles_len /**< */)
6853 {
6854 char *xcb_tmp = (char *)_buffer;
6855 unsigned int xcb_buffer_len = 0;
6856 unsigned int xcb_block_len = 0;
6857 unsigned int xcb_pad = 0;
6858 unsigned int xcb_align_to = 0;
6859
6860
6861 xcb_block_len += sizeof(xcb_poly_fill_rectangle_request_t);
6862 xcb_tmp += xcb_block_len;
6863 xcb_buffer_len += xcb_block_len;
6864 xcb_block_len = 0;
6865 /* rectangles */
6866 xcb_block_len += rectangles_len * sizeof(xcb_rectangle_t);
6867 xcb_tmp += xcb_block_len;
6868 xcb_align_to = ALIGNOF(xcb_rectangle_t);
6869 /* insert padding */
6870 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
6871 xcb_buffer_len += xcb_block_len + xcb_pad;
6872 if (0 != xcb_pad) {
6873 xcb_tmp += xcb_pad;
6874 xcb_pad = 0;
6875 }
6876 xcb_block_len = 0;
6877
6878 return xcb_buffer_len;
6879 }
6880
6881 xcb_void_cookie_t
xcb_poly_fill_rectangle_checked(xcb_connection_t * c,xcb_drawable_t drawable,xcb_gcontext_t gc,uint32_t rectangles_len,const xcb_rectangle_t * rectangles)6882 xcb_poly_fill_rectangle_checked (xcb_connection_t *c /**< */,
6883 xcb_drawable_t drawable /**< */,
6884 xcb_gcontext_t gc /**< */,
6885 uint32_t rectangles_len /**< */,
6886 const xcb_rectangle_t *rectangles /**< */)
6887 {
6888 static const xcb_protocol_request_t xcb_req = {
6889 /* count */ 4,
6890 /* ext */ 0,
6891 /* opcode */ XCB_POLY_FILL_RECTANGLE,
6892 /* isvoid */ 1
6893 };
6894
6895 struct iovec xcb_parts[6];
6896 xcb_void_cookie_t xcb_ret;
6897 xcb_poly_fill_rectangle_request_t xcb_out;
6898
6899 xcb_out.pad0 = 0;
6900 xcb_out.drawable = drawable;
6901 xcb_out.gc = gc;
6902
6903 xcb_parts[2].iov_base = (char *) &xcb_out;
6904 xcb_parts[2].iov_len = sizeof(xcb_out);
6905 xcb_parts[3].iov_base = 0;
6906 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
6907 /* xcb_rectangle_t rectangles */
6908 xcb_parts[4].iov_base = (char *) rectangles;
6909 xcb_parts[4].iov_len = rectangles_len * sizeof(xcb_rectangle_t);
6910 xcb_parts[5].iov_base = 0;
6911 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
6912
6913 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
6914 return xcb_ret;
6915 }
6916
6917 xcb_void_cookie_t
xcb_poly_fill_rectangle(xcb_connection_t * c,xcb_drawable_t drawable,xcb_gcontext_t gc,uint32_t rectangles_len,const xcb_rectangle_t * rectangles)6918 xcb_poly_fill_rectangle (xcb_connection_t *c /**< */,
6919 xcb_drawable_t drawable /**< */,
6920 xcb_gcontext_t gc /**< */,
6921 uint32_t rectangles_len /**< */,
6922 const xcb_rectangle_t *rectangles /**< */)
6923 {
6924 static const xcb_protocol_request_t xcb_req = {
6925 /* count */ 4,
6926 /* ext */ 0,
6927 /* opcode */ XCB_POLY_FILL_RECTANGLE,
6928 /* isvoid */ 1
6929 };
6930
6931 struct iovec xcb_parts[6];
6932 xcb_void_cookie_t xcb_ret;
6933 xcb_poly_fill_rectangle_request_t xcb_out;
6934
6935 xcb_out.pad0 = 0;
6936 xcb_out.drawable = drawable;
6937 xcb_out.gc = gc;
6938
6939 xcb_parts[2].iov_base = (char *) &xcb_out;
6940 xcb_parts[2].iov_len = sizeof(xcb_out);
6941 xcb_parts[3].iov_base = 0;
6942 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
6943 /* xcb_rectangle_t rectangles */
6944 xcb_parts[4].iov_base = (char *) rectangles;
6945 xcb_parts[4].iov_len = rectangles_len * sizeof(xcb_rectangle_t);
6946 xcb_parts[5].iov_base = 0;
6947 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
6948
6949 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
6950 return xcb_ret;
6951 }
6952
6953 int
xcb_poly_fill_arc_sizeof(const void * _buffer,uint32_t arcs_len)6954 xcb_poly_fill_arc_sizeof (const void *_buffer /**< */,
6955 uint32_t arcs_len /**< */)
6956 {
6957 char *xcb_tmp = (char *)_buffer;
6958 unsigned int xcb_buffer_len = 0;
6959 unsigned int xcb_block_len = 0;
6960 unsigned int xcb_pad = 0;
6961 unsigned int xcb_align_to = 0;
6962
6963
6964 xcb_block_len += sizeof(xcb_poly_fill_arc_request_t);
6965 xcb_tmp += xcb_block_len;
6966 xcb_buffer_len += xcb_block_len;
6967 xcb_block_len = 0;
6968 /* arcs */
6969 xcb_block_len += arcs_len * sizeof(xcb_arc_t);
6970 xcb_tmp += xcb_block_len;
6971 xcb_align_to = ALIGNOF(xcb_arc_t);
6972 /* insert padding */
6973 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
6974 xcb_buffer_len += xcb_block_len + xcb_pad;
6975 if (0 != xcb_pad) {
6976 xcb_tmp += xcb_pad;
6977 xcb_pad = 0;
6978 }
6979 xcb_block_len = 0;
6980
6981 return xcb_buffer_len;
6982 }
6983
6984 xcb_void_cookie_t
xcb_poly_fill_arc_checked(xcb_connection_t * c,xcb_drawable_t drawable,xcb_gcontext_t gc,uint32_t arcs_len,const xcb_arc_t * arcs)6985 xcb_poly_fill_arc_checked (xcb_connection_t *c /**< */,
6986 xcb_drawable_t drawable /**< */,
6987 xcb_gcontext_t gc /**< */,
6988 uint32_t arcs_len /**< */,
6989 const xcb_arc_t *arcs /**< */)
6990 {
6991 static const xcb_protocol_request_t xcb_req = {
6992 /* count */ 4,
6993 /* ext */ 0,
6994 /* opcode */ XCB_POLY_FILL_ARC,
6995 /* isvoid */ 1
6996 };
6997
6998 struct iovec xcb_parts[6];
6999 xcb_void_cookie_t xcb_ret;
7000 xcb_poly_fill_arc_request_t xcb_out;
7001
7002 xcb_out.pad0 = 0;
7003 xcb_out.drawable = drawable;
7004 xcb_out.gc = gc;
7005
7006 xcb_parts[2].iov_base = (char *) &xcb_out;
7007 xcb_parts[2].iov_len = sizeof(xcb_out);
7008 xcb_parts[3].iov_base = 0;
7009 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
7010 /* xcb_arc_t arcs */
7011 xcb_parts[4].iov_base = (char *) arcs;
7012 xcb_parts[4].iov_len = arcs_len * sizeof(xcb_arc_t);
7013 xcb_parts[5].iov_base = 0;
7014 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
7015
7016 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
7017 return xcb_ret;
7018 }
7019
7020 xcb_void_cookie_t
xcb_poly_fill_arc(xcb_connection_t * c,xcb_drawable_t drawable,xcb_gcontext_t gc,uint32_t arcs_len,const xcb_arc_t * arcs)7021 xcb_poly_fill_arc (xcb_connection_t *c /**< */,
7022 xcb_drawable_t drawable /**< */,
7023 xcb_gcontext_t gc /**< */,
7024 uint32_t arcs_len /**< */,
7025 const xcb_arc_t *arcs /**< */)
7026 {
7027 static const xcb_protocol_request_t xcb_req = {
7028 /* count */ 4,
7029 /* ext */ 0,
7030 /* opcode */ XCB_POLY_FILL_ARC,
7031 /* isvoid */ 1
7032 };
7033
7034 struct iovec xcb_parts[6];
7035 xcb_void_cookie_t xcb_ret;
7036 xcb_poly_fill_arc_request_t xcb_out;
7037
7038 xcb_out.pad0 = 0;
7039 xcb_out.drawable = drawable;
7040 xcb_out.gc = gc;
7041
7042 xcb_parts[2].iov_base = (char *) &xcb_out;
7043 xcb_parts[2].iov_len = sizeof(xcb_out);
7044 xcb_parts[3].iov_base = 0;
7045 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
7046 /* xcb_arc_t arcs */
7047 xcb_parts[4].iov_base = (char *) arcs;
7048 xcb_parts[4].iov_len = arcs_len * sizeof(xcb_arc_t);
7049 xcb_parts[5].iov_base = 0;
7050 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
7051
7052 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
7053 return xcb_ret;
7054 }
7055
7056 int
xcb_put_image_sizeof(const void * _buffer,uint32_t data_len)7057 xcb_put_image_sizeof (const void *_buffer /**< */,
7058 uint32_t data_len /**< */)
7059 {
7060 char *xcb_tmp = (char *)_buffer;
7061 unsigned int xcb_buffer_len = 0;
7062 unsigned int xcb_block_len = 0;
7063 unsigned int xcb_pad = 0;
7064 unsigned int xcb_align_to = 0;
7065
7066
7067 xcb_block_len += sizeof(xcb_put_image_request_t);
7068 xcb_tmp += xcb_block_len;
7069 xcb_buffer_len += xcb_block_len;
7070 xcb_block_len = 0;
7071 /* data */
7072 xcb_block_len += data_len * sizeof(uint8_t);
7073 xcb_tmp += xcb_block_len;
7074 xcb_align_to = ALIGNOF(uint8_t);
7075 /* insert padding */
7076 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
7077 xcb_buffer_len += xcb_block_len + xcb_pad;
7078 if (0 != xcb_pad) {
7079 xcb_tmp += xcb_pad;
7080 xcb_pad = 0;
7081 }
7082 xcb_block_len = 0;
7083
7084 return xcb_buffer_len;
7085 }
7086
7087 xcb_void_cookie_t
xcb_put_image_checked(xcb_connection_t * c,uint8_t format,xcb_drawable_t drawable,xcb_gcontext_t gc,uint16_t width,uint16_t height,int16_t dst_x,int16_t dst_y,uint8_t left_pad,uint8_t depth,uint32_t data_len,const uint8_t * data)7088 xcb_put_image_checked (xcb_connection_t *c /**< */,
7089 uint8_t format /**< */,
7090 xcb_drawable_t drawable /**< */,
7091 xcb_gcontext_t gc /**< */,
7092 uint16_t width /**< */,
7093 uint16_t height /**< */,
7094 int16_t dst_x /**< */,
7095 int16_t dst_y /**< */,
7096 uint8_t left_pad /**< */,
7097 uint8_t depth /**< */,
7098 uint32_t data_len /**< */,
7099 const uint8_t *data /**< */)
7100 {
7101 static const xcb_protocol_request_t xcb_req = {
7102 /* count */ 4,
7103 /* ext */ 0,
7104 /* opcode */ XCB_PUT_IMAGE,
7105 /* isvoid */ 1
7106 };
7107
7108 struct iovec xcb_parts[6];
7109 xcb_void_cookie_t xcb_ret;
7110 xcb_put_image_request_t xcb_out;
7111
7112 xcb_out.format = format;
7113 xcb_out.drawable = drawable;
7114 xcb_out.gc = gc;
7115 xcb_out.width = width;
7116 xcb_out.height = height;
7117 xcb_out.dst_x = dst_x;
7118 xcb_out.dst_y = dst_y;
7119 xcb_out.left_pad = left_pad;
7120 xcb_out.depth = depth;
7121 memset(xcb_out.pad0, 0, 2);
7122
7123 xcb_parts[2].iov_base = (char *) &xcb_out;
7124 xcb_parts[2].iov_len = sizeof(xcb_out);
7125 xcb_parts[3].iov_base = 0;
7126 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
7127 /* uint8_t data */
7128 xcb_parts[4].iov_base = (char *) data;
7129 xcb_parts[4].iov_len = data_len * sizeof(uint8_t);
7130 xcb_parts[5].iov_base = 0;
7131 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
7132
7133 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
7134 return xcb_ret;
7135 }
7136
7137 xcb_void_cookie_t
xcb_put_image(xcb_connection_t * c,uint8_t format,xcb_drawable_t drawable,xcb_gcontext_t gc,uint16_t width,uint16_t height,int16_t dst_x,int16_t dst_y,uint8_t left_pad,uint8_t depth,uint32_t data_len,const uint8_t * data)7138 xcb_put_image (xcb_connection_t *c /**< */,
7139 uint8_t format /**< */,
7140 xcb_drawable_t drawable /**< */,
7141 xcb_gcontext_t gc /**< */,
7142 uint16_t width /**< */,
7143 uint16_t height /**< */,
7144 int16_t dst_x /**< */,
7145 int16_t dst_y /**< */,
7146 uint8_t left_pad /**< */,
7147 uint8_t depth /**< */,
7148 uint32_t data_len /**< */,
7149 const uint8_t *data /**< */)
7150 {
7151 static const xcb_protocol_request_t xcb_req = {
7152 /* count */ 4,
7153 /* ext */ 0,
7154 /* opcode */ XCB_PUT_IMAGE,
7155 /* isvoid */ 1
7156 };
7157
7158 struct iovec xcb_parts[6];
7159 xcb_void_cookie_t xcb_ret;
7160 xcb_put_image_request_t xcb_out;
7161
7162 xcb_out.format = format;
7163 xcb_out.drawable = drawable;
7164 xcb_out.gc = gc;
7165 xcb_out.width = width;
7166 xcb_out.height = height;
7167 xcb_out.dst_x = dst_x;
7168 xcb_out.dst_y = dst_y;
7169 xcb_out.left_pad = left_pad;
7170 xcb_out.depth = depth;
7171 memset(xcb_out.pad0, 0, 2);
7172
7173 xcb_parts[2].iov_base = (char *) &xcb_out;
7174 xcb_parts[2].iov_len = sizeof(xcb_out);
7175 xcb_parts[3].iov_base = 0;
7176 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
7177 /* uint8_t data */
7178 xcb_parts[4].iov_base = (char *) data;
7179 xcb_parts[4].iov_len = data_len * sizeof(uint8_t);
7180 xcb_parts[5].iov_base = 0;
7181 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
7182
7183 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
7184 return xcb_ret;
7185 }
7186
7187 int
xcb_get_image_sizeof(const void * _buffer)7188 xcb_get_image_sizeof (const void *_buffer /**< */)
7189 {
7190 char *xcb_tmp = (char *)_buffer;
7191 const xcb_get_image_reply_t *_aux = (xcb_get_image_reply_t *)_buffer;
7192 unsigned int xcb_buffer_len = 0;
7193 unsigned int xcb_block_len = 0;
7194 unsigned int xcb_pad = 0;
7195 unsigned int xcb_align_to = 0;
7196
7197
7198 xcb_block_len += sizeof(xcb_get_image_reply_t);
7199 xcb_tmp += xcb_block_len;
7200 xcb_buffer_len += xcb_block_len;
7201 xcb_block_len = 0;
7202 /* data */
7203 xcb_block_len += (_aux->length * 4) * sizeof(uint8_t);
7204 xcb_tmp += xcb_block_len;
7205 xcb_align_to = ALIGNOF(uint8_t);
7206 /* insert padding */
7207 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
7208 xcb_buffer_len += xcb_block_len + xcb_pad;
7209 if (0 != xcb_pad) {
7210 xcb_tmp += xcb_pad;
7211 xcb_pad = 0;
7212 }
7213 xcb_block_len = 0;
7214
7215 return xcb_buffer_len;
7216 }
7217
7218 xcb_get_image_cookie_t
xcb_get_image(xcb_connection_t * c,uint8_t format,xcb_drawable_t drawable,int16_t x,int16_t y,uint16_t width,uint16_t height,uint32_t plane_mask)7219 xcb_get_image (xcb_connection_t *c /**< */,
7220 uint8_t format /**< */,
7221 xcb_drawable_t drawable /**< */,
7222 int16_t x /**< */,
7223 int16_t y /**< */,
7224 uint16_t width /**< */,
7225 uint16_t height /**< */,
7226 uint32_t plane_mask /**< */)
7227 {
7228 static const xcb_protocol_request_t xcb_req = {
7229 /* count */ 2,
7230 /* ext */ 0,
7231 /* opcode */ XCB_GET_IMAGE,
7232 /* isvoid */ 0
7233 };
7234
7235 struct iovec xcb_parts[4];
7236 xcb_get_image_cookie_t xcb_ret;
7237 xcb_get_image_request_t xcb_out;
7238
7239 xcb_out.format = format;
7240 xcb_out.drawable = drawable;
7241 xcb_out.x = x;
7242 xcb_out.y = y;
7243 xcb_out.width = width;
7244 xcb_out.height = height;
7245 xcb_out.plane_mask = plane_mask;
7246
7247 xcb_parts[2].iov_base = (char *) &xcb_out;
7248 xcb_parts[2].iov_len = sizeof(xcb_out);
7249 xcb_parts[3].iov_base = 0;
7250 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
7251
7252 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
7253 return xcb_ret;
7254 }
7255
7256 xcb_get_image_cookie_t
xcb_get_image_unchecked(xcb_connection_t * c,uint8_t format,xcb_drawable_t drawable,int16_t x,int16_t y,uint16_t width,uint16_t height,uint32_t plane_mask)7257 xcb_get_image_unchecked (xcb_connection_t *c /**< */,
7258 uint8_t format /**< */,
7259 xcb_drawable_t drawable /**< */,
7260 int16_t x /**< */,
7261 int16_t y /**< */,
7262 uint16_t width /**< */,
7263 uint16_t height /**< */,
7264 uint32_t plane_mask /**< */)
7265 {
7266 static const xcb_protocol_request_t xcb_req = {
7267 /* count */ 2,
7268 /* ext */ 0,
7269 /* opcode */ XCB_GET_IMAGE,
7270 /* isvoid */ 0
7271 };
7272
7273 struct iovec xcb_parts[4];
7274 xcb_get_image_cookie_t xcb_ret;
7275 xcb_get_image_request_t xcb_out;
7276
7277 xcb_out.format = format;
7278 xcb_out.drawable = drawable;
7279 xcb_out.x = x;
7280 xcb_out.y = y;
7281 xcb_out.width = width;
7282 xcb_out.height = height;
7283 xcb_out.plane_mask = plane_mask;
7284
7285 xcb_parts[2].iov_base = (char *) &xcb_out;
7286 xcb_parts[2].iov_len = sizeof(xcb_out);
7287 xcb_parts[3].iov_base = 0;
7288 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
7289
7290 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
7291 return xcb_ret;
7292 }
7293
7294 uint8_t *
xcb_get_image_data(const xcb_get_image_reply_t * R)7295 xcb_get_image_data (const xcb_get_image_reply_t *R /**< */)
7296 {
7297 return (uint8_t *) (R + 1);
7298 }
7299
7300 int
xcb_get_image_data_length(const xcb_get_image_reply_t * R)7301 xcb_get_image_data_length (const xcb_get_image_reply_t *R /**< */)
7302 {
7303 return (R->length * 4);
7304 }
7305
7306 xcb_generic_iterator_t
xcb_get_image_data_end(const xcb_get_image_reply_t * R)7307 xcb_get_image_data_end (const xcb_get_image_reply_t *R /**< */)
7308 {
7309 xcb_generic_iterator_t i;
7310 i.data = ((uint8_t *) (R + 1)) + ((R->length * 4));
7311 i.rem = 0;
7312 i.index = (char *) i.data - (char *) R;
7313 return i;
7314 }
7315
7316 xcb_get_image_reply_t *
xcb_get_image_reply(xcb_connection_t * c,xcb_get_image_cookie_t cookie,xcb_generic_error_t ** e)7317 xcb_get_image_reply (xcb_connection_t *c /**< */,
7318 xcb_get_image_cookie_t cookie /**< */,
7319 xcb_generic_error_t **e /**< */)
7320 {
7321 return (xcb_get_image_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
7322 }
7323
7324 int
xcb_poly_text_8_sizeof(const void * _buffer,uint32_t items_len)7325 xcb_poly_text_8_sizeof (const void *_buffer /**< */,
7326 uint32_t items_len /**< */)
7327 {
7328 char *xcb_tmp = (char *)_buffer;
7329 unsigned int xcb_buffer_len = 0;
7330 unsigned int xcb_block_len = 0;
7331 unsigned int xcb_pad = 0;
7332 unsigned int xcb_align_to = 0;
7333
7334
7335 xcb_block_len += sizeof(xcb_poly_text_8_request_t);
7336 xcb_tmp += xcb_block_len;
7337 xcb_buffer_len += xcb_block_len;
7338 xcb_block_len = 0;
7339 /* items */
7340 xcb_block_len += items_len * sizeof(uint8_t);
7341 xcb_tmp += xcb_block_len;
7342 xcb_align_to = ALIGNOF(uint8_t);
7343 /* insert padding */
7344 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
7345 xcb_buffer_len += xcb_block_len + xcb_pad;
7346 if (0 != xcb_pad) {
7347 xcb_tmp += xcb_pad;
7348 xcb_pad = 0;
7349 }
7350 xcb_block_len = 0;
7351
7352 return xcb_buffer_len;
7353 }
7354
7355 xcb_void_cookie_t
xcb_poly_text_8_checked(xcb_connection_t * c,xcb_drawable_t drawable,xcb_gcontext_t gc,int16_t x,int16_t y,uint32_t items_len,const uint8_t * items)7356 xcb_poly_text_8_checked (xcb_connection_t *c /**< */,
7357 xcb_drawable_t drawable /**< */,
7358 xcb_gcontext_t gc /**< */,
7359 int16_t x /**< */,
7360 int16_t y /**< */,
7361 uint32_t items_len /**< */,
7362 const uint8_t *items /**< */)
7363 {
7364 static const xcb_protocol_request_t xcb_req = {
7365 /* count */ 4,
7366 /* ext */ 0,
7367 /* opcode */ XCB_POLY_TEXT_8,
7368 /* isvoid */ 1
7369 };
7370
7371 struct iovec xcb_parts[6];
7372 xcb_void_cookie_t xcb_ret;
7373 xcb_poly_text_8_request_t xcb_out;
7374
7375 xcb_out.pad0 = 0;
7376 xcb_out.drawable = drawable;
7377 xcb_out.gc = gc;
7378 xcb_out.x = x;
7379 xcb_out.y = y;
7380
7381 xcb_parts[2].iov_base = (char *) &xcb_out;
7382 xcb_parts[2].iov_len = sizeof(xcb_out);
7383 xcb_parts[3].iov_base = 0;
7384 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
7385 /* uint8_t items */
7386 xcb_parts[4].iov_base = (char *) items;
7387 xcb_parts[4].iov_len = items_len * sizeof(uint8_t);
7388 xcb_parts[5].iov_base = 0;
7389 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
7390
7391 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
7392 return xcb_ret;
7393 }
7394
7395 xcb_void_cookie_t
xcb_poly_text_8(xcb_connection_t * c,xcb_drawable_t drawable,xcb_gcontext_t gc,int16_t x,int16_t y,uint32_t items_len,const uint8_t * items)7396 xcb_poly_text_8 (xcb_connection_t *c /**< */,
7397 xcb_drawable_t drawable /**< */,
7398 xcb_gcontext_t gc /**< */,
7399 int16_t x /**< */,
7400 int16_t y /**< */,
7401 uint32_t items_len /**< */,
7402 const uint8_t *items /**< */)
7403 {
7404 static const xcb_protocol_request_t xcb_req = {
7405 /* count */ 4,
7406 /* ext */ 0,
7407 /* opcode */ XCB_POLY_TEXT_8,
7408 /* isvoid */ 1
7409 };
7410
7411 struct iovec xcb_parts[6];
7412 xcb_void_cookie_t xcb_ret;
7413 xcb_poly_text_8_request_t xcb_out;
7414
7415 xcb_out.pad0 = 0;
7416 xcb_out.drawable = drawable;
7417 xcb_out.gc = gc;
7418 xcb_out.x = x;
7419 xcb_out.y = y;
7420
7421 xcb_parts[2].iov_base = (char *) &xcb_out;
7422 xcb_parts[2].iov_len = sizeof(xcb_out);
7423 xcb_parts[3].iov_base = 0;
7424 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
7425 /* uint8_t items */
7426 xcb_parts[4].iov_base = (char *) items;
7427 xcb_parts[4].iov_len = items_len * sizeof(uint8_t);
7428 xcb_parts[5].iov_base = 0;
7429 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
7430
7431 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
7432 return xcb_ret;
7433 }
7434
7435 int
xcb_poly_text_16_sizeof(const void * _buffer,uint32_t items_len)7436 xcb_poly_text_16_sizeof (const void *_buffer /**< */,
7437 uint32_t items_len /**< */)
7438 {
7439 char *xcb_tmp = (char *)_buffer;
7440 unsigned int xcb_buffer_len = 0;
7441 unsigned int xcb_block_len = 0;
7442 unsigned int xcb_pad = 0;
7443 unsigned int xcb_align_to = 0;
7444
7445
7446 xcb_block_len += sizeof(xcb_poly_text_16_request_t);
7447 xcb_tmp += xcb_block_len;
7448 xcb_buffer_len += xcb_block_len;
7449 xcb_block_len = 0;
7450 /* items */
7451 xcb_block_len += items_len * sizeof(uint8_t);
7452 xcb_tmp += xcb_block_len;
7453 xcb_align_to = ALIGNOF(uint8_t);
7454 /* insert padding */
7455 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
7456 xcb_buffer_len += xcb_block_len + xcb_pad;
7457 if (0 != xcb_pad) {
7458 xcb_tmp += xcb_pad;
7459 xcb_pad = 0;
7460 }
7461 xcb_block_len = 0;
7462
7463 return xcb_buffer_len;
7464 }
7465
7466 xcb_void_cookie_t
xcb_poly_text_16_checked(xcb_connection_t * c,xcb_drawable_t drawable,xcb_gcontext_t gc,int16_t x,int16_t y,uint32_t items_len,const uint8_t * items)7467 xcb_poly_text_16_checked (xcb_connection_t *c /**< */,
7468 xcb_drawable_t drawable /**< */,
7469 xcb_gcontext_t gc /**< */,
7470 int16_t x /**< */,
7471 int16_t y /**< */,
7472 uint32_t items_len /**< */,
7473 const uint8_t *items /**< */)
7474 {
7475 static const xcb_protocol_request_t xcb_req = {
7476 /* count */ 4,
7477 /* ext */ 0,
7478 /* opcode */ XCB_POLY_TEXT_16,
7479 /* isvoid */ 1
7480 };
7481
7482 struct iovec xcb_parts[6];
7483 xcb_void_cookie_t xcb_ret;
7484 xcb_poly_text_16_request_t xcb_out;
7485
7486 xcb_out.pad0 = 0;
7487 xcb_out.drawable = drawable;
7488 xcb_out.gc = gc;
7489 xcb_out.x = x;
7490 xcb_out.y = y;
7491
7492 xcb_parts[2].iov_base = (char *) &xcb_out;
7493 xcb_parts[2].iov_len = sizeof(xcb_out);
7494 xcb_parts[3].iov_base = 0;
7495 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
7496 /* uint8_t items */
7497 xcb_parts[4].iov_base = (char *) items;
7498 xcb_parts[4].iov_len = items_len * sizeof(uint8_t);
7499 xcb_parts[5].iov_base = 0;
7500 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
7501
7502 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
7503 return xcb_ret;
7504 }
7505
7506 xcb_void_cookie_t
xcb_poly_text_16(xcb_connection_t * c,xcb_drawable_t drawable,xcb_gcontext_t gc,int16_t x,int16_t y,uint32_t items_len,const uint8_t * items)7507 xcb_poly_text_16 (xcb_connection_t *c /**< */,
7508 xcb_drawable_t drawable /**< */,
7509 xcb_gcontext_t gc /**< */,
7510 int16_t x /**< */,
7511 int16_t y /**< */,
7512 uint32_t items_len /**< */,
7513 const uint8_t *items /**< */)
7514 {
7515 static const xcb_protocol_request_t xcb_req = {
7516 /* count */ 4,
7517 /* ext */ 0,
7518 /* opcode */ XCB_POLY_TEXT_16,
7519 /* isvoid */ 1
7520 };
7521
7522 struct iovec xcb_parts[6];
7523 xcb_void_cookie_t xcb_ret;
7524 xcb_poly_text_16_request_t xcb_out;
7525
7526 xcb_out.pad0 = 0;
7527 xcb_out.drawable = drawable;
7528 xcb_out.gc = gc;
7529 xcb_out.x = x;
7530 xcb_out.y = y;
7531
7532 xcb_parts[2].iov_base = (char *) &xcb_out;
7533 xcb_parts[2].iov_len = sizeof(xcb_out);
7534 xcb_parts[3].iov_base = 0;
7535 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
7536 /* uint8_t items */
7537 xcb_parts[4].iov_base = (char *) items;
7538 xcb_parts[4].iov_len = items_len * sizeof(uint8_t);
7539 xcb_parts[5].iov_base = 0;
7540 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
7541
7542 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
7543 return xcb_ret;
7544 }
7545
7546 int
xcb_image_text_8_sizeof(const void * _buffer)7547 xcb_image_text_8_sizeof (const void *_buffer /**< */)
7548 {
7549 char *xcb_tmp = (char *)_buffer;
7550 const xcb_image_text_8_request_t *_aux = (xcb_image_text_8_request_t *)_buffer;
7551 unsigned int xcb_buffer_len = 0;
7552 unsigned int xcb_block_len = 0;
7553 unsigned int xcb_pad = 0;
7554 unsigned int xcb_align_to = 0;
7555
7556
7557 xcb_block_len += sizeof(xcb_image_text_8_request_t);
7558 xcb_tmp += xcb_block_len;
7559 xcb_buffer_len += xcb_block_len;
7560 xcb_block_len = 0;
7561 /* string */
7562 xcb_block_len += _aux->string_len * sizeof(char);
7563 xcb_tmp += xcb_block_len;
7564 xcb_align_to = ALIGNOF(char);
7565 /* insert padding */
7566 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
7567 xcb_buffer_len += xcb_block_len + xcb_pad;
7568 if (0 != xcb_pad) {
7569 xcb_tmp += xcb_pad;
7570 xcb_pad = 0;
7571 }
7572 xcb_block_len = 0;
7573
7574 return xcb_buffer_len;
7575 }
7576
7577 xcb_void_cookie_t
xcb_image_text_8_checked(xcb_connection_t * c,uint8_t string_len,xcb_drawable_t drawable,xcb_gcontext_t gc,int16_t x,int16_t y,const char * string)7578 xcb_image_text_8_checked (xcb_connection_t *c /**< */,
7579 uint8_t string_len /**< */,
7580 xcb_drawable_t drawable /**< */,
7581 xcb_gcontext_t gc /**< */,
7582 int16_t x /**< */,
7583 int16_t y /**< */,
7584 const char *string /**< */)
7585 {
7586 static const xcb_protocol_request_t xcb_req = {
7587 /* count */ 4,
7588 /* ext */ 0,
7589 /* opcode */ XCB_IMAGE_TEXT_8,
7590 /* isvoid */ 1
7591 };
7592
7593 struct iovec xcb_parts[6];
7594 xcb_void_cookie_t xcb_ret;
7595 xcb_image_text_8_request_t xcb_out;
7596
7597 xcb_out.string_len = string_len;
7598 xcb_out.drawable = drawable;
7599 xcb_out.gc = gc;
7600 xcb_out.x = x;
7601 xcb_out.y = y;
7602
7603 xcb_parts[2].iov_base = (char *) &xcb_out;
7604 xcb_parts[2].iov_len = sizeof(xcb_out);
7605 xcb_parts[3].iov_base = 0;
7606 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
7607 /* char string */
7608 xcb_parts[4].iov_base = (char *) string;
7609 xcb_parts[4].iov_len = string_len * sizeof(char);
7610 xcb_parts[5].iov_base = 0;
7611 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
7612
7613 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
7614 return xcb_ret;
7615 }
7616
7617 xcb_void_cookie_t
xcb_image_text_8(xcb_connection_t * c,uint8_t string_len,xcb_drawable_t drawable,xcb_gcontext_t gc,int16_t x,int16_t y,const char * string)7618 xcb_image_text_8 (xcb_connection_t *c /**< */,
7619 uint8_t string_len /**< */,
7620 xcb_drawable_t drawable /**< */,
7621 xcb_gcontext_t gc /**< */,
7622 int16_t x /**< */,
7623 int16_t y /**< */,
7624 const char *string /**< */)
7625 {
7626 static const xcb_protocol_request_t xcb_req = {
7627 /* count */ 4,
7628 /* ext */ 0,
7629 /* opcode */ XCB_IMAGE_TEXT_8,
7630 /* isvoid */ 1
7631 };
7632
7633 struct iovec xcb_parts[6];
7634 xcb_void_cookie_t xcb_ret;
7635 xcb_image_text_8_request_t xcb_out;
7636
7637 xcb_out.string_len = string_len;
7638 xcb_out.drawable = drawable;
7639 xcb_out.gc = gc;
7640 xcb_out.x = x;
7641 xcb_out.y = y;
7642
7643 xcb_parts[2].iov_base = (char *) &xcb_out;
7644 xcb_parts[2].iov_len = sizeof(xcb_out);
7645 xcb_parts[3].iov_base = 0;
7646 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
7647 /* char string */
7648 xcb_parts[4].iov_base = (char *) string;
7649 xcb_parts[4].iov_len = string_len * sizeof(char);
7650 xcb_parts[5].iov_base = 0;
7651 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
7652
7653 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
7654 return xcb_ret;
7655 }
7656
7657 int
xcb_image_text_16_sizeof(const void * _buffer)7658 xcb_image_text_16_sizeof (const void *_buffer /**< */)
7659 {
7660 char *xcb_tmp = (char *)_buffer;
7661 const xcb_image_text_16_request_t *_aux = (xcb_image_text_16_request_t *)_buffer;
7662 unsigned int xcb_buffer_len = 0;
7663 unsigned int xcb_block_len = 0;
7664 unsigned int xcb_pad = 0;
7665 unsigned int xcb_align_to = 0;
7666
7667
7668 xcb_block_len += sizeof(xcb_image_text_16_request_t);
7669 xcb_tmp += xcb_block_len;
7670 xcb_buffer_len += xcb_block_len;
7671 xcb_block_len = 0;
7672 /* string */
7673 xcb_block_len += _aux->string_len * sizeof(xcb_char2b_t);
7674 xcb_tmp += xcb_block_len;
7675 xcb_align_to = ALIGNOF(xcb_char2b_t);
7676 /* insert padding */
7677 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
7678 xcb_buffer_len += xcb_block_len + xcb_pad;
7679 if (0 != xcb_pad) {
7680 xcb_tmp += xcb_pad;
7681 xcb_pad = 0;
7682 }
7683 xcb_block_len = 0;
7684
7685 return xcb_buffer_len;
7686 }
7687
7688 xcb_void_cookie_t
xcb_image_text_16_checked(xcb_connection_t * c,uint8_t string_len,xcb_drawable_t drawable,xcb_gcontext_t gc,int16_t x,int16_t y,const xcb_char2b_t * string)7689 xcb_image_text_16_checked (xcb_connection_t *c /**< */,
7690 uint8_t string_len /**< */,
7691 xcb_drawable_t drawable /**< */,
7692 xcb_gcontext_t gc /**< */,
7693 int16_t x /**< */,
7694 int16_t y /**< */,
7695 const xcb_char2b_t *string /**< */)
7696 {
7697 static const xcb_protocol_request_t xcb_req = {
7698 /* count */ 4,
7699 /* ext */ 0,
7700 /* opcode */ XCB_IMAGE_TEXT_16,
7701 /* isvoid */ 1
7702 };
7703
7704 struct iovec xcb_parts[6];
7705 xcb_void_cookie_t xcb_ret;
7706 xcb_image_text_16_request_t xcb_out;
7707
7708 xcb_out.string_len = string_len;
7709 xcb_out.drawable = drawable;
7710 xcb_out.gc = gc;
7711 xcb_out.x = x;
7712 xcb_out.y = y;
7713
7714 xcb_parts[2].iov_base = (char *) &xcb_out;
7715 xcb_parts[2].iov_len = sizeof(xcb_out);
7716 xcb_parts[3].iov_base = 0;
7717 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
7718 /* xcb_char2b_t string */
7719 xcb_parts[4].iov_base = (char *) string;
7720 xcb_parts[4].iov_len = string_len * sizeof(xcb_char2b_t);
7721 xcb_parts[5].iov_base = 0;
7722 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
7723
7724 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
7725 return xcb_ret;
7726 }
7727
7728 xcb_void_cookie_t
xcb_image_text_16(xcb_connection_t * c,uint8_t string_len,xcb_drawable_t drawable,xcb_gcontext_t gc,int16_t x,int16_t y,const xcb_char2b_t * string)7729 xcb_image_text_16 (xcb_connection_t *c /**< */,
7730 uint8_t string_len /**< */,
7731 xcb_drawable_t drawable /**< */,
7732 xcb_gcontext_t gc /**< */,
7733 int16_t x /**< */,
7734 int16_t y /**< */,
7735 const xcb_char2b_t *string /**< */)
7736 {
7737 static const xcb_protocol_request_t xcb_req = {
7738 /* count */ 4,
7739 /* ext */ 0,
7740 /* opcode */ XCB_IMAGE_TEXT_16,
7741 /* isvoid */ 1
7742 };
7743
7744 struct iovec xcb_parts[6];
7745 xcb_void_cookie_t xcb_ret;
7746 xcb_image_text_16_request_t xcb_out;
7747
7748 xcb_out.string_len = string_len;
7749 xcb_out.drawable = drawable;
7750 xcb_out.gc = gc;
7751 xcb_out.x = x;
7752 xcb_out.y = y;
7753
7754 xcb_parts[2].iov_base = (char *) &xcb_out;
7755 xcb_parts[2].iov_len = sizeof(xcb_out);
7756 xcb_parts[3].iov_base = 0;
7757 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
7758 /* xcb_char2b_t string */
7759 xcb_parts[4].iov_base = (char *) string;
7760 xcb_parts[4].iov_len = string_len * sizeof(xcb_char2b_t);
7761 xcb_parts[5].iov_base = 0;
7762 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
7763
7764 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
7765 return xcb_ret;
7766 }
7767
7768 xcb_void_cookie_t
xcb_create_colormap_checked(xcb_connection_t * c,uint8_t alloc,xcb_colormap_t mid,xcb_window_t window,xcb_visualid_t visual)7769 xcb_create_colormap_checked (xcb_connection_t *c /**< */,
7770 uint8_t alloc /**< */,
7771 xcb_colormap_t mid /**< */,
7772 xcb_window_t window /**< */,
7773 xcb_visualid_t visual /**< */)
7774 {
7775 static const xcb_protocol_request_t xcb_req = {
7776 /* count */ 2,
7777 /* ext */ 0,
7778 /* opcode */ XCB_CREATE_COLORMAP,
7779 /* isvoid */ 1
7780 };
7781
7782 struct iovec xcb_parts[4];
7783 xcb_void_cookie_t xcb_ret;
7784 xcb_create_colormap_request_t xcb_out;
7785
7786 xcb_out.alloc = alloc;
7787 xcb_out.mid = mid;
7788 xcb_out.window = window;
7789 xcb_out.visual = visual;
7790
7791 xcb_parts[2].iov_base = (char *) &xcb_out;
7792 xcb_parts[2].iov_len = sizeof(xcb_out);
7793 xcb_parts[3].iov_base = 0;
7794 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
7795
7796 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
7797 return xcb_ret;
7798 }
7799
7800 xcb_void_cookie_t
xcb_create_colormap(xcb_connection_t * c,uint8_t alloc,xcb_colormap_t mid,xcb_window_t window,xcb_visualid_t visual)7801 xcb_create_colormap (xcb_connection_t *c /**< */,
7802 uint8_t alloc /**< */,
7803 xcb_colormap_t mid /**< */,
7804 xcb_window_t window /**< */,
7805 xcb_visualid_t visual /**< */)
7806 {
7807 static const xcb_protocol_request_t xcb_req = {
7808 /* count */ 2,
7809 /* ext */ 0,
7810 /* opcode */ XCB_CREATE_COLORMAP,
7811 /* isvoid */ 1
7812 };
7813
7814 struct iovec xcb_parts[4];
7815 xcb_void_cookie_t xcb_ret;
7816 xcb_create_colormap_request_t xcb_out;
7817
7818 xcb_out.alloc = alloc;
7819 xcb_out.mid = mid;
7820 xcb_out.window = window;
7821 xcb_out.visual = visual;
7822
7823 xcb_parts[2].iov_base = (char *) &xcb_out;
7824 xcb_parts[2].iov_len = sizeof(xcb_out);
7825 xcb_parts[3].iov_base = 0;
7826 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
7827
7828 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
7829 return xcb_ret;
7830 }
7831
7832 xcb_void_cookie_t
xcb_free_colormap_checked(xcb_connection_t * c,xcb_colormap_t cmap)7833 xcb_free_colormap_checked (xcb_connection_t *c /**< */,
7834 xcb_colormap_t cmap /**< */)
7835 {
7836 static const xcb_protocol_request_t xcb_req = {
7837 /* count */ 2,
7838 /* ext */ 0,
7839 /* opcode */ XCB_FREE_COLORMAP,
7840 /* isvoid */ 1
7841 };
7842
7843 struct iovec xcb_parts[4];
7844 xcb_void_cookie_t xcb_ret;
7845 xcb_free_colormap_request_t xcb_out;
7846
7847 xcb_out.pad0 = 0;
7848 xcb_out.cmap = cmap;
7849
7850 xcb_parts[2].iov_base = (char *) &xcb_out;
7851 xcb_parts[2].iov_len = sizeof(xcb_out);
7852 xcb_parts[3].iov_base = 0;
7853 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
7854
7855 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
7856 return xcb_ret;
7857 }
7858
7859 xcb_void_cookie_t
xcb_free_colormap(xcb_connection_t * c,xcb_colormap_t cmap)7860 xcb_free_colormap (xcb_connection_t *c /**< */,
7861 xcb_colormap_t cmap /**< */)
7862 {
7863 static const xcb_protocol_request_t xcb_req = {
7864 /* count */ 2,
7865 /* ext */ 0,
7866 /* opcode */ XCB_FREE_COLORMAP,
7867 /* isvoid */ 1
7868 };
7869
7870 struct iovec xcb_parts[4];
7871 xcb_void_cookie_t xcb_ret;
7872 xcb_free_colormap_request_t xcb_out;
7873
7874 xcb_out.pad0 = 0;
7875 xcb_out.cmap = cmap;
7876
7877 xcb_parts[2].iov_base = (char *) &xcb_out;
7878 xcb_parts[2].iov_len = sizeof(xcb_out);
7879 xcb_parts[3].iov_base = 0;
7880 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
7881
7882 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
7883 return xcb_ret;
7884 }
7885
7886 xcb_void_cookie_t
xcb_copy_colormap_and_free_checked(xcb_connection_t * c,xcb_colormap_t mid,xcb_colormap_t src_cmap)7887 xcb_copy_colormap_and_free_checked (xcb_connection_t *c /**< */,
7888 xcb_colormap_t mid /**< */,
7889 xcb_colormap_t src_cmap /**< */)
7890 {
7891 static const xcb_protocol_request_t xcb_req = {
7892 /* count */ 2,
7893 /* ext */ 0,
7894 /* opcode */ XCB_COPY_COLORMAP_AND_FREE,
7895 /* isvoid */ 1
7896 };
7897
7898 struct iovec xcb_parts[4];
7899 xcb_void_cookie_t xcb_ret;
7900 xcb_copy_colormap_and_free_request_t xcb_out;
7901
7902 xcb_out.pad0 = 0;
7903 xcb_out.mid = mid;
7904 xcb_out.src_cmap = src_cmap;
7905
7906 xcb_parts[2].iov_base = (char *) &xcb_out;
7907 xcb_parts[2].iov_len = sizeof(xcb_out);
7908 xcb_parts[3].iov_base = 0;
7909 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
7910
7911 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
7912 return xcb_ret;
7913 }
7914
7915 xcb_void_cookie_t
xcb_copy_colormap_and_free(xcb_connection_t * c,xcb_colormap_t mid,xcb_colormap_t src_cmap)7916 xcb_copy_colormap_and_free (xcb_connection_t *c /**< */,
7917 xcb_colormap_t mid /**< */,
7918 xcb_colormap_t src_cmap /**< */)
7919 {
7920 static const xcb_protocol_request_t xcb_req = {
7921 /* count */ 2,
7922 /* ext */ 0,
7923 /* opcode */ XCB_COPY_COLORMAP_AND_FREE,
7924 /* isvoid */ 1
7925 };
7926
7927 struct iovec xcb_parts[4];
7928 xcb_void_cookie_t xcb_ret;
7929 xcb_copy_colormap_and_free_request_t xcb_out;
7930
7931 xcb_out.pad0 = 0;
7932 xcb_out.mid = mid;
7933 xcb_out.src_cmap = src_cmap;
7934
7935 xcb_parts[2].iov_base = (char *) &xcb_out;
7936 xcb_parts[2].iov_len = sizeof(xcb_out);
7937 xcb_parts[3].iov_base = 0;
7938 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
7939
7940 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
7941 return xcb_ret;
7942 }
7943
7944 xcb_void_cookie_t
xcb_install_colormap_checked(xcb_connection_t * c,xcb_colormap_t cmap)7945 xcb_install_colormap_checked (xcb_connection_t *c /**< */,
7946 xcb_colormap_t cmap /**< */)
7947 {
7948 static const xcb_protocol_request_t xcb_req = {
7949 /* count */ 2,
7950 /* ext */ 0,
7951 /* opcode */ XCB_INSTALL_COLORMAP,
7952 /* isvoid */ 1
7953 };
7954
7955 struct iovec xcb_parts[4];
7956 xcb_void_cookie_t xcb_ret;
7957 xcb_install_colormap_request_t xcb_out;
7958
7959 xcb_out.pad0 = 0;
7960 xcb_out.cmap = cmap;
7961
7962 xcb_parts[2].iov_base = (char *) &xcb_out;
7963 xcb_parts[2].iov_len = sizeof(xcb_out);
7964 xcb_parts[3].iov_base = 0;
7965 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
7966
7967 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
7968 return xcb_ret;
7969 }
7970
7971 xcb_void_cookie_t
xcb_install_colormap(xcb_connection_t * c,xcb_colormap_t cmap)7972 xcb_install_colormap (xcb_connection_t *c /**< */,
7973 xcb_colormap_t cmap /**< */)
7974 {
7975 static const xcb_protocol_request_t xcb_req = {
7976 /* count */ 2,
7977 /* ext */ 0,
7978 /* opcode */ XCB_INSTALL_COLORMAP,
7979 /* isvoid */ 1
7980 };
7981
7982 struct iovec xcb_parts[4];
7983 xcb_void_cookie_t xcb_ret;
7984 xcb_install_colormap_request_t xcb_out;
7985
7986 xcb_out.pad0 = 0;
7987 xcb_out.cmap = cmap;
7988
7989 xcb_parts[2].iov_base = (char *) &xcb_out;
7990 xcb_parts[2].iov_len = sizeof(xcb_out);
7991 xcb_parts[3].iov_base = 0;
7992 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
7993
7994 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
7995 return xcb_ret;
7996 }
7997
7998 xcb_void_cookie_t
xcb_uninstall_colormap_checked(xcb_connection_t * c,xcb_colormap_t cmap)7999 xcb_uninstall_colormap_checked (xcb_connection_t *c /**< */,
8000 xcb_colormap_t cmap /**< */)
8001 {
8002 static const xcb_protocol_request_t xcb_req = {
8003 /* count */ 2,
8004 /* ext */ 0,
8005 /* opcode */ XCB_UNINSTALL_COLORMAP,
8006 /* isvoid */ 1
8007 };
8008
8009 struct iovec xcb_parts[4];
8010 xcb_void_cookie_t xcb_ret;
8011 xcb_uninstall_colormap_request_t xcb_out;
8012
8013 xcb_out.pad0 = 0;
8014 xcb_out.cmap = cmap;
8015
8016 xcb_parts[2].iov_base = (char *) &xcb_out;
8017 xcb_parts[2].iov_len = sizeof(xcb_out);
8018 xcb_parts[3].iov_base = 0;
8019 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
8020
8021 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
8022 return xcb_ret;
8023 }
8024
8025 xcb_void_cookie_t
xcb_uninstall_colormap(xcb_connection_t * c,xcb_colormap_t cmap)8026 xcb_uninstall_colormap (xcb_connection_t *c /**< */,
8027 xcb_colormap_t cmap /**< */)
8028 {
8029 static const xcb_protocol_request_t xcb_req = {
8030 /* count */ 2,
8031 /* ext */ 0,
8032 /* opcode */ XCB_UNINSTALL_COLORMAP,
8033 /* isvoid */ 1
8034 };
8035
8036 struct iovec xcb_parts[4];
8037 xcb_void_cookie_t xcb_ret;
8038 xcb_uninstall_colormap_request_t xcb_out;
8039
8040 xcb_out.pad0 = 0;
8041 xcb_out.cmap = cmap;
8042
8043 xcb_parts[2].iov_base = (char *) &xcb_out;
8044 xcb_parts[2].iov_len = sizeof(xcb_out);
8045 xcb_parts[3].iov_base = 0;
8046 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
8047
8048 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
8049 return xcb_ret;
8050 }
8051
8052 int
xcb_list_installed_colormaps_sizeof(const void * _buffer)8053 xcb_list_installed_colormaps_sizeof (const void *_buffer /**< */)
8054 {
8055 char *xcb_tmp = (char *)_buffer;
8056 const xcb_list_installed_colormaps_reply_t *_aux = (xcb_list_installed_colormaps_reply_t *)_buffer;
8057 unsigned int xcb_buffer_len = 0;
8058 unsigned int xcb_block_len = 0;
8059 unsigned int xcb_pad = 0;
8060 unsigned int xcb_align_to = 0;
8061
8062
8063 xcb_block_len += sizeof(xcb_list_installed_colormaps_reply_t);
8064 xcb_tmp += xcb_block_len;
8065 xcb_buffer_len += xcb_block_len;
8066 xcb_block_len = 0;
8067 /* cmaps */
8068 xcb_block_len += _aux->cmaps_len * sizeof(xcb_colormap_t);
8069 xcb_tmp += xcb_block_len;
8070 xcb_align_to = ALIGNOF(xcb_colormap_t);
8071 /* insert padding */
8072 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
8073 xcb_buffer_len += xcb_block_len + xcb_pad;
8074 if (0 != xcb_pad) {
8075 xcb_tmp += xcb_pad;
8076 xcb_pad = 0;
8077 }
8078 xcb_block_len = 0;
8079
8080 return xcb_buffer_len;
8081 }
8082
8083 xcb_list_installed_colormaps_cookie_t
xcb_list_installed_colormaps(xcb_connection_t * c,xcb_window_t window)8084 xcb_list_installed_colormaps (xcb_connection_t *c /**< */,
8085 xcb_window_t window /**< */)
8086 {
8087 static const xcb_protocol_request_t xcb_req = {
8088 /* count */ 2,
8089 /* ext */ 0,
8090 /* opcode */ XCB_LIST_INSTALLED_COLORMAPS,
8091 /* isvoid */ 0
8092 };
8093
8094 struct iovec xcb_parts[4];
8095 xcb_list_installed_colormaps_cookie_t xcb_ret;
8096 xcb_list_installed_colormaps_request_t xcb_out;
8097
8098 xcb_out.pad0 = 0;
8099 xcb_out.window = window;
8100
8101 xcb_parts[2].iov_base = (char *) &xcb_out;
8102 xcb_parts[2].iov_len = sizeof(xcb_out);
8103 xcb_parts[3].iov_base = 0;
8104 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
8105
8106 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
8107 return xcb_ret;
8108 }
8109
8110 xcb_list_installed_colormaps_cookie_t
xcb_list_installed_colormaps_unchecked(xcb_connection_t * c,xcb_window_t window)8111 xcb_list_installed_colormaps_unchecked (xcb_connection_t *c /**< */,
8112 xcb_window_t window /**< */)
8113 {
8114 static const xcb_protocol_request_t xcb_req = {
8115 /* count */ 2,
8116 /* ext */ 0,
8117 /* opcode */ XCB_LIST_INSTALLED_COLORMAPS,
8118 /* isvoid */ 0
8119 };
8120
8121 struct iovec xcb_parts[4];
8122 xcb_list_installed_colormaps_cookie_t xcb_ret;
8123 xcb_list_installed_colormaps_request_t xcb_out;
8124
8125 xcb_out.pad0 = 0;
8126 xcb_out.window = window;
8127
8128 xcb_parts[2].iov_base = (char *) &xcb_out;
8129 xcb_parts[2].iov_len = sizeof(xcb_out);
8130 xcb_parts[3].iov_base = 0;
8131 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
8132
8133 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
8134 return xcb_ret;
8135 }
8136
8137 xcb_colormap_t *
xcb_list_installed_colormaps_cmaps(const xcb_list_installed_colormaps_reply_t * R)8138 xcb_list_installed_colormaps_cmaps (const xcb_list_installed_colormaps_reply_t *R /**< */)
8139 {
8140 return (xcb_colormap_t *) (R + 1);
8141 }
8142
8143 int
xcb_list_installed_colormaps_cmaps_length(const xcb_list_installed_colormaps_reply_t * R)8144 xcb_list_installed_colormaps_cmaps_length (const xcb_list_installed_colormaps_reply_t *R /**< */)
8145 {
8146 return R->cmaps_len;
8147 }
8148
8149 xcb_generic_iterator_t
xcb_list_installed_colormaps_cmaps_end(const xcb_list_installed_colormaps_reply_t * R)8150 xcb_list_installed_colormaps_cmaps_end (const xcb_list_installed_colormaps_reply_t *R /**< */)
8151 {
8152 xcb_generic_iterator_t i;
8153 i.data = ((xcb_colormap_t *) (R + 1)) + (R->cmaps_len);
8154 i.rem = 0;
8155 i.index = (char *) i.data - (char *) R;
8156 return i;
8157 }
8158
8159 xcb_list_installed_colormaps_reply_t *
xcb_list_installed_colormaps_reply(xcb_connection_t * c,xcb_list_installed_colormaps_cookie_t cookie,xcb_generic_error_t ** e)8160 xcb_list_installed_colormaps_reply (xcb_connection_t *c /**< */,
8161 xcb_list_installed_colormaps_cookie_t cookie /**< */,
8162 xcb_generic_error_t **e /**< */)
8163 {
8164 return (xcb_list_installed_colormaps_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
8165 }
8166
8167 xcb_alloc_color_cookie_t
xcb_alloc_color(xcb_connection_t * c,xcb_colormap_t cmap,uint16_t red,uint16_t green,uint16_t blue)8168 xcb_alloc_color (xcb_connection_t *c /**< */,
8169 xcb_colormap_t cmap /**< */,
8170 uint16_t red /**< */,
8171 uint16_t green /**< */,
8172 uint16_t blue /**< */)
8173 {
8174 static const xcb_protocol_request_t xcb_req = {
8175 /* count */ 2,
8176 /* ext */ 0,
8177 /* opcode */ XCB_ALLOC_COLOR,
8178 /* isvoid */ 0
8179 };
8180
8181 struct iovec xcb_parts[4];
8182 xcb_alloc_color_cookie_t xcb_ret;
8183 xcb_alloc_color_request_t xcb_out;
8184
8185 xcb_out.pad0 = 0;
8186 xcb_out.cmap = cmap;
8187 xcb_out.red = red;
8188 xcb_out.green = green;
8189 xcb_out.blue = blue;
8190 memset(xcb_out.pad1, 0, 2);
8191
8192 xcb_parts[2].iov_base = (char *) &xcb_out;
8193 xcb_parts[2].iov_len = sizeof(xcb_out);
8194 xcb_parts[3].iov_base = 0;
8195 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
8196
8197 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
8198 return xcb_ret;
8199 }
8200
8201 xcb_alloc_color_cookie_t
xcb_alloc_color_unchecked(xcb_connection_t * c,xcb_colormap_t cmap,uint16_t red,uint16_t green,uint16_t blue)8202 xcb_alloc_color_unchecked (xcb_connection_t *c /**< */,
8203 xcb_colormap_t cmap /**< */,
8204 uint16_t red /**< */,
8205 uint16_t green /**< */,
8206 uint16_t blue /**< */)
8207 {
8208 static const xcb_protocol_request_t xcb_req = {
8209 /* count */ 2,
8210 /* ext */ 0,
8211 /* opcode */ XCB_ALLOC_COLOR,
8212 /* isvoid */ 0
8213 };
8214
8215 struct iovec xcb_parts[4];
8216 xcb_alloc_color_cookie_t xcb_ret;
8217 xcb_alloc_color_request_t xcb_out;
8218
8219 xcb_out.pad0 = 0;
8220 xcb_out.cmap = cmap;
8221 xcb_out.red = red;
8222 xcb_out.green = green;
8223 xcb_out.blue = blue;
8224 memset(xcb_out.pad1, 0, 2);
8225
8226 xcb_parts[2].iov_base = (char *) &xcb_out;
8227 xcb_parts[2].iov_len = sizeof(xcb_out);
8228 xcb_parts[3].iov_base = 0;
8229 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
8230
8231 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
8232 return xcb_ret;
8233 }
8234
8235 xcb_alloc_color_reply_t *
xcb_alloc_color_reply(xcb_connection_t * c,xcb_alloc_color_cookie_t cookie,xcb_generic_error_t ** e)8236 xcb_alloc_color_reply (xcb_connection_t *c /**< */,
8237 xcb_alloc_color_cookie_t cookie /**< */,
8238 xcb_generic_error_t **e /**< */)
8239 {
8240 return (xcb_alloc_color_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
8241 }
8242
8243 int
xcb_alloc_named_color_sizeof(const void * _buffer)8244 xcb_alloc_named_color_sizeof (const void *_buffer /**< */)
8245 {
8246 char *xcb_tmp = (char *)_buffer;
8247 const xcb_alloc_named_color_request_t *_aux = (xcb_alloc_named_color_request_t *)_buffer;
8248 unsigned int xcb_buffer_len = 0;
8249 unsigned int xcb_block_len = 0;
8250 unsigned int xcb_pad = 0;
8251 unsigned int xcb_align_to = 0;
8252
8253
8254 xcb_block_len += sizeof(xcb_alloc_named_color_request_t);
8255 xcb_tmp += xcb_block_len;
8256 xcb_buffer_len += xcb_block_len;
8257 xcb_block_len = 0;
8258 /* name */
8259 xcb_block_len += _aux->name_len * sizeof(char);
8260 xcb_tmp += xcb_block_len;
8261 xcb_align_to = ALIGNOF(char);
8262 /* insert padding */
8263 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
8264 xcb_buffer_len += xcb_block_len + xcb_pad;
8265 if (0 != xcb_pad) {
8266 xcb_tmp += xcb_pad;
8267 xcb_pad = 0;
8268 }
8269 xcb_block_len = 0;
8270
8271 return xcb_buffer_len;
8272 }
8273
8274 xcb_alloc_named_color_cookie_t
xcb_alloc_named_color(xcb_connection_t * c,xcb_colormap_t cmap,uint16_t name_len,const char * name)8275 xcb_alloc_named_color (xcb_connection_t *c /**< */,
8276 xcb_colormap_t cmap /**< */,
8277 uint16_t name_len /**< */,
8278 const char *name /**< */)
8279 {
8280 static const xcb_protocol_request_t xcb_req = {
8281 /* count */ 4,
8282 /* ext */ 0,
8283 /* opcode */ XCB_ALLOC_NAMED_COLOR,
8284 /* isvoid */ 0
8285 };
8286
8287 struct iovec xcb_parts[6];
8288 xcb_alloc_named_color_cookie_t xcb_ret;
8289 xcb_alloc_named_color_request_t xcb_out;
8290
8291 xcb_out.pad0 = 0;
8292 xcb_out.cmap = cmap;
8293 xcb_out.name_len = name_len;
8294 memset(xcb_out.pad1, 0, 2);
8295
8296 xcb_parts[2].iov_base = (char *) &xcb_out;
8297 xcb_parts[2].iov_len = sizeof(xcb_out);
8298 xcb_parts[3].iov_base = 0;
8299 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
8300 /* char name */
8301 xcb_parts[4].iov_base = (char *) name;
8302 xcb_parts[4].iov_len = name_len * sizeof(char);
8303 xcb_parts[5].iov_base = 0;
8304 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
8305
8306 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
8307 return xcb_ret;
8308 }
8309
8310 xcb_alloc_named_color_cookie_t
xcb_alloc_named_color_unchecked(xcb_connection_t * c,xcb_colormap_t cmap,uint16_t name_len,const char * name)8311 xcb_alloc_named_color_unchecked (xcb_connection_t *c /**< */,
8312 xcb_colormap_t cmap /**< */,
8313 uint16_t name_len /**< */,
8314 const char *name /**< */)
8315 {
8316 static const xcb_protocol_request_t xcb_req = {
8317 /* count */ 4,
8318 /* ext */ 0,
8319 /* opcode */ XCB_ALLOC_NAMED_COLOR,
8320 /* isvoid */ 0
8321 };
8322
8323 struct iovec xcb_parts[6];
8324 xcb_alloc_named_color_cookie_t xcb_ret;
8325 xcb_alloc_named_color_request_t xcb_out;
8326
8327 xcb_out.pad0 = 0;
8328 xcb_out.cmap = cmap;
8329 xcb_out.name_len = name_len;
8330 memset(xcb_out.pad1, 0, 2);
8331
8332 xcb_parts[2].iov_base = (char *) &xcb_out;
8333 xcb_parts[2].iov_len = sizeof(xcb_out);
8334 xcb_parts[3].iov_base = 0;
8335 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
8336 /* char name */
8337 xcb_parts[4].iov_base = (char *) name;
8338 xcb_parts[4].iov_len = name_len * sizeof(char);
8339 xcb_parts[5].iov_base = 0;
8340 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
8341
8342 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
8343 return xcb_ret;
8344 }
8345
8346 xcb_alloc_named_color_reply_t *
xcb_alloc_named_color_reply(xcb_connection_t * c,xcb_alloc_named_color_cookie_t cookie,xcb_generic_error_t ** e)8347 xcb_alloc_named_color_reply (xcb_connection_t *c /**< */,
8348 xcb_alloc_named_color_cookie_t cookie /**< */,
8349 xcb_generic_error_t **e /**< */)
8350 {
8351 return (xcb_alloc_named_color_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
8352 }
8353
8354 int
xcb_alloc_color_cells_sizeof(const void * _buffer)8355 xcb_alloc_color_cells_sizeof (const void *_buffer /**< */)
8356 {
8357 char *xcb_tmp = (char *)_buffer;
8358 const xcb_alloc_color_cells_reply_t *_aux = (xcb_alloc_color_cells_reply_t *)_buffer;
8359 unsigned int xcb_buffer_len = 0;
8360 unsigned int xcb_block_len = 0;
8361 unsigned int xcb_pad = 0;
8362 unsigned int xcb_align_to = 0;
8363
8364
8365 xcb_block_len += sizeof(xcb_alloc_color_cells_reply_t);
8366 xcb_tmp += xcb_block_len;
8367 xcb_buffer_len += xcb_block_len;
8368 xcb_block_len = 0;
8369 /* pixels */
8370 xcb_block_len += _aux->pixels_len * sizeof(uint32_t);
8371 xcb_tmp += xcb_block_len;
8372 xcb_align_to = ALIGNOF(uint32_t);
8373 /* insert padding */
8374 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
8375 xcb_buffer_len += xcb_block_len + xcb_pad;
8376 if (0 != xcb_pad) {
8377 xcb_tmp += xcb_pad;
8378 xcb_pad = 0;
8379 }
8380 xcb_block_len = 0;
8381 /* masks */
8382 xcb_block_len += _aux->masks_len * sizeof(uint32_t);
8383 xcb_tmp += xcb_block_len;
8384 xcb_align_to = ALIGNOF(uint32_t);
8385 /* insert padding */
8386 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
8387 xcb_buffer_len += xcb_block_len + xcb_pad;
8388 if (0 != xcb_pad) {
8389 xcb_tmp += xcb_pad;
8390 xcb_pad = 0;
8391 }
8392 xcb_block_len = 0;
8393
8394 return xcb_buffer_len;
8395 }
8396
8397 xcb_alloc_color_cells_cookie_t
xcb_alloc_color_cells(xcb_connection_t * c,uint8_t contiguous,xcb_colormap_t cmap,uint16_t colors,uint16_t planes)8398 xcb_alloc_color_cells (xcb_connection_t *c /**< */,
8399 uint8_t contiguous /**< */,
8400 xcb_colormap_t cmap /**< */,
8401 uint16_t colors /**< */,
8402 uint16_t planes /**< */)
8403 {
8404 static const xcb_protocol_request_t xcb_req = {
8405 /* count */ 2,
8406 /* ext */ 0,
8407 /* opcode */ XCB_ALLOC_COLOR_CELLS,
8408 /* isvoid */ 0
8409 };
8410
8411 struct iovec xcb_parts[4];
8412 xcb_alloc_color_cells_cookie_t xcb_ret;
8413 xcb_alloc_color_cells_request_t xcb_out;
8414
8415 xcb_out.contiguous = contiguous;
8416 xcb_out.cmap = cmap;
8417 xcb_out.colors = colors;
8418 xcb_out.planes = planes;
8419
8420 xcb_parts[2].iov_base = (char *) &xcb_out;
8421 xcb_parts[2].iov_len = sizeof(xcb_out);
8422 xcb_parts[3].iov_base = 0;
8423 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
8424
8425 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
8426 return xcb_ret;
8427 }
8428
8429 xcb_alloc_color_cells_cookie_t
xcb_alloc_color_cells_unchecked(xcb_connection_t * c,uint8_t contiguous,xcb_colormap_t cmap,uint16_t colors,uint16_t planes)8430 xcb_alloc_color_cells_unchecked (xcb_connection_t *c /**< */,
8431 uint8_t contiguous /**< */,
8432 xcb_colormap_t cmap /**< */,
8433 uint16_t colors /**< */,
8434 uint16_t planes /**< */)
8435 {
8436 static const xcb_protocol_request_t xcb_req = {
8437 /* count */ 2,
8438 /* ext */ 0,
8439 /* opcode */ XCB_ALLOC_COLOR_CELLS,
8440 /* isvoid */ 0
8441 };
8442
8443 struct iovec xcb_parts[4];
8444 xcb_alloc_color_cells_cookie_t xcb_ret;
8445 xcb_alloc_color_cells_request_t xcb_out;
8446
8447 xcb_out.contiguous = contiguous;
8448 xcb_out.cmap = cmap;
8449 xcb_out.colors = colors;
8450 xcb_out.planes = planes;
8451
8452 xcb_parts[2].iov_base = (char *) &xcb_out;
8453 xcb_parts[2].iov_len = sizeof(xcb_out);
8454 xcb_parts[3].iov_base = 0;
8455 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
8456
8457 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
8458 return xcb_ret;
8459 }
8460
8461 uint32_t *
xcb_alloc_color_cells_pixels(const xcb_alloc_color_cells_reply_t * R)8462 xcb_alloc_color_cells_pixels (const xcb_alloc_color_cells_reply_t *R /**< */)
8463 {
8464 return (uint32_t *) (R + 1);
8465 }
8466
8467 int
xcb_alloc_color_cells_pixels_length(const xcb_alloc_color_cells_reply_t * R)8468 xcb_alloc_color_cells_pixels_length (const xcb_alloc_color_cells_reply_t *R /**< */)
8469 {
8470 return R->pixels_len;
8471 }
8472
8473 xcb_generic_iterator_t
xcb_alloc_color_cells_pixels_end(const xcb_alloc_color_cells_reply_t * R)8474 xcb_alloc_color_cells_pixels_end (const xcb_alloc_color_cells_reply_t *R /**< */)
8475 {
8476 xcb_generic_iterator_t i;
8477 i.data = ((uint32_t *) (R + 1)) + (R->pixels_len);
8478 i.rem = 0;
8479 i.index = (char *) i.data - (char *) R;
8480 return i;
8481 }
8482
8483 uint32_t *
xcb_alloc_color_cells_masks(const xcb_alloc_color_cells_reply_t * R)8484 xcb_alloc_color_cells_masks (const xcb_alloc_color_cells_reply_t *R /**< */)
8485 {
8486 xcb_generic_iterator_t prev = xcb_alloc_color_cells_pixels_end(R);
8487 return (uint32_t *) ((char *) prev.data + XCB_TYPE_PAD(uint32_t, prev.index) + 0);
8488 }
8489
8490 int
xcb_alloc_color_cells_masks_length(const xcb_alloc_color_cells_reply_t * R)8491 xcb_alloc_color_cells_masks_length (const xcb_alloc_color_cells_reply_t *R /**< */)
8492 {
8493 return R->masks_len;
8494 }
8495
8496 xcb_generic_iterator_t
xcb_alloc_color_cells_masks_end(const xcb_alloc_color_cells_reply_t * R)8497 xcb_alloc_color_cells_masks_end (const xcb_alloc_color_cells_reply_t *R /**< */)
8498 {
8499 xcb_generic_iterator_t i;
8500 xcb_generic_iterator_t child = xcb_alloc_color_cells_pixels_end(R);
8501 i.data = ((uint32_t *) child.data) + (R->masks_len);
8502 i.rem = 0;
8503 i.index = (char *) i.data - (char *) R;
8504 return i;
8505 }
8506
8507 xcb_alloc_color_cells_reply_t *
xcb_alloc_color_cells_reply(xcb_connection_t * c,xcb_alloc_color_cells_cookie_t cookie,xcb_generic_error_t ** e)8508 xcb_alloc_color_cells_reply (xcb_connection_t *c /**< */,
8509 xcb_alloc_color_cells_cookie_t cookie /**< */,
8510 xcb_generic_error_t **e /**< */)
8511 {
8512 return (xcb_alloc_color_cells_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
8513 }
8514
8515 int
xcb_alloc_color_planes_sizeof(const void * _buffer)8516 xcb_alloc_color_planes_sizeof (const void *_buffer /**< */)
8517 {
8518 char *xcb_tmp = (char *)_buffer;
8519 const xcb_alloc_color_planes_reply_t *_aux = (xcb_alloc_color_planes_reply_t *)_buffer;
8520 unsigned int xcb_buffer_len = 0;
8521 unsigned int xcb_block_len = 0;
8522 unsigned int xcb_pad = 0;
8523 unsigned int xcb_align_to = 0;
8524
8525
8526 xcb_block_len += sizeof(xcb_alloc_color_planes_reply_t);
8527 xcb_tmp += xcb_block_len;
8528 xcb_buffer_len += xcb_block_len;
8529 xcb_block_len = 0;
8530 /* pixels */
8531 xcb_block_len += _aux->pixels_len * sizeof(uint32_t);
8532 xcb_tmp += xcb_block_len;
8533 xcb_align_to = ALIGNOF(uint32_t);
8534 /* insert padding */
8535 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
8536 xcb_buffer_len += xcb_block_len + xcb_pad;
8537 if (0 != xcb_pad) {
8538 xcb_tmp += xcb_pad;
8539 xcb_pad = 0;
8540 }
8541 xcb_block_len = 0;
8542
8543 return xcb_buffer_len;
8544 }
8545
8546 xcb_alloc_color_planes_cookie_t
xcb_alloc_color_planes(xcb_connection_t * c,uint8_t contiguous,xcb_colormap_t cmap,uint16_t colors,uint16_t reds,uint16_t greens,uint16_t blues)8547 xcb_alloc_color_planes (xcb_connection_t *c /**< */,
8548 uint8_t contiguous /**< */,
8549 xcb_colormap_t cmap /**< */,
8550 uint16_t colors /**< */,
8551 uint16_t reds /**< */,
8552 uint16_t greens /**< */,
8553 uint16_t blues /**< */)
8554 {
8555 static const xcb_protocol_request_t xcb_req = {
8556 /* count */ 2,
8557 /* ext */ 0,
8558 /* opcode */ XCB_ALLOC_COLOR_PLANES,
8559 /* isvoid */ 0
8560 };
8561
8562 struct iovec xcb_parts[4];
8563 xcb_alloc_color_planes_cookie_t xcb_ret;
8564 xcb_alloc_color_planes_request_t xcb_out;
8565
8566 xcb_out.contiguous = contiguous;
8567 xcb_out.cmap = cmap;
8568 xcb_out.colors = colors;
8569 xcb_out.reds = reds;
8570 xcb_out.greens = greens;
8571 xcb_out.blues = blues;
8572
8573 xcb_parts[2].iov_base = (char *) &xcb_out;
8574 xcb_parts[2].iov_len = sizeof(xcb_out);
8575 xcb_parts[3].iov_base = 0;
8576 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
8577
8578 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
8579 return xcb_ret;
8580 }
8581
8582 xcb_alloc_color_planes_cookie_t
xcb_alloc_color_planes_unchecked(xcb_connection_t * c,uint8_t contiguous,xcb_colormap_t cmap,uint16_t colors,uint16_t reds,uint16_t greens,uint16_t blues)8583 xcb_alloc_color_planes_unchecked (xcb_connection_t *c /**< */,
8584 uint8_t contiguous /**< */,
8585 xcb_colormap_t cmap /**< */,
8586 uint16_t colors /**< */,
8587 uint16_t reds /**< */,
8588 uint16_t greens /**< */,
8589 uint16_t blues /**< */)
8590 {
8591 static const xcb_protocol_request_t xcb_req = {
8592 /* count */ 2,
8593 /* ext */ 0,
8594 /* opcode */ XCB_ALLOC_COLOR_PLANES,
8595 /* isvoid */ 0
8596 };
8597
8598 struct iovec xcb_parts[4];
8599 xcb_alloc_color_planes_cookie_t xcb_ret;
8600 xcb_alloc_color_planes_request_t xcb_out;
8601
8602 xcb_out.contiguous = contiguous;
8603 xcb_out.cmap = cmap;
8604 xcb_out.colors = colors;
8605 xcb_out.reds = reds;
8606 xcb_out.greens = greens;
8607 xcb_out.blues = blues;
8608
8609 xcb_parts[2].iov_base = (char *) &xcb_out;
8610 xcb_parts[2].iov_len = sizeof(xcb_out);
8611 xcb_parts[3].iov_base = 0;
8612 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
8613
8614 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
8615 return xcb_ret;
8616 }
8617
8618 uint32_t *
xcb_alloc_color_planes_pixels(const xcb_alloc_color_planes_reply_t * R)8619 xcb_alloc_color_planes_pixels (const xcb_alloc_color_planes_reply_t *R /**< */)
8620 {
8621 return (uint32_t *) (R + 1);
8622 }
8623
8624 int
xcb_alloc_color_planes_pixels_length(const xcb_alloc_color_planes_reply_t * R)8625 xcb_alloc_color_planes_pixels_length (const xcb_alloc_color_planes_reply_t *R /**< */)
8626 {
8627 return R->pixels_len;
8628 }
8629
8630 xcb_generic_iterator_t
xcb_alloc_color_planes_pixels_end(const xcb_alloc_color_planes_reply_t * R)8631 xcb_alloc_color_planes_pixels_end (const xcb_alloc_color_planes_reply_t *R /**< */)
8632 {
8633 xcb_generic_iterator_t i;
8634 i.data = ((uint32_t *) (R + 1)) + (R->pixels_len);
8635 i.rem = 0;
8636 i.index = (char *) i.data - (char *) R;
8637 return i;
8638 }
8639
8640 xcb_alloc_color_planes_reply_t *
xcb_alloc_color_planes_reply(xcb_connection_t * c,xcb_alloc_color_planes_cookie_t cookie,xcb_generic_error_t ** e)8641 xcb_alloc_color_planes_reply (xcb_connection_t *c /**< */,
8642 xcb_alloc_color_planes_cookie_t cookie /**< */,
8643 xcb_generic_error_t **e /**< */)
8644 {
8645 return (xcb_alloc_color_planes_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
8646 }
8647
8648 int
xcb_free_colors_sizeof(const void * _buffer,uint32_t pixels_len)8649 xcb_free_colors_sizeof (const void *_buffer /**< */,
8650 uint32_t pixels_len /**< */)
8651 {
8652 char *xcb_tmp = (char *)_buffer;
8653 unsigned int xcb_buffer_len = 0;
8654 unsigned int xcb_block_len = 0;
8655 unsigned int xcb_pad = 0;
8656 unsigned int xcb_align_to = 0;
8657
8658
8659 xcb_block_len += sizeof(xcb_free_colors_request_t);
8660 xcb_tmp += xcb_block_len;
8661 xcb_buffer_len += xcb_block_len;
8662 xcb_block_len = 0;
8663 /* pixels */
8664 xcb_block_len += pixels_len * sizeof(uint32_t);
8665 xcb_tmp += xcb_block_len;
8666 xcb_align_to = ALIGNOF(uint32_t);
8667 /* insert padding */
8668 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
8669 xcb_buffer_len += xcb_block_len + xcb_pad;
8670 if (0 != xcb_pad) {
8671 xcb_tmp += xcb_pad;
8672 xcb_pad = 0;
8673 }
8674 xcb_block_len = 0;
8675
8676 return xcb_buffer_len;
8677 }
8678
8679 xcb_void_cookie_t
xcb_free_colors_checked(xcb_connection_t * c,xcb_colormap_t cmap,uint32_t plane_mask,uint32_t pixels_len,const uint32_t * pixels)8680 xcb_free_colors_checked (xcb_connection_t *c /**< */,
8681 xcb_colormap_t cmap /**< */,
8682 uint32_t plane_mask /**< */,
8683 uint32_t pixels_len /**< */,
8684 const uint32_t *pixels /**< */)
8685 {
8686 static const xcb_protocol_request_t xcb_req = {
8687 /* count */ 4,
8688 /* ext */ 0,
8689 /* opcode */ XCB_FREE_COLORS,
8690 /* isvoid */ 1
8691 };
8692
8693 struct iovec xcb_parts[6];
8694 xcb_void_cookie_t xcb_ret;
8695 xcb_free_colors_request_t xcb_out;
8696
8697 xcb_out.pad0 = 0;
8698 xcb_out.cmap = cmap;
8699 xcb_out.plane_mask = plane_mask;
8700
8701 xcb_parts[2].iov_base = (char *) &xcb_out;
8702 xcb_parts[2].iov_len = sizeof(xcb_out);
8703 xcb_parts[3].iov_base = 0;
8704 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
8705 /* uint32_t pixels */
8706 xcb_parts[4].iov_base = (char *) pixels;
8707 xcb_parts[4].iov_len = pixels_len * sizeof(uint32_t);
8708 xcb_parts[5].iov_base = 0;
8709 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
8710
8711 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
8712 return xcb_ret;
8713 }
8714
8715 xcb_void_cookie_t
xcb_free_colors(xcb_connection_t * c,xcb_colormap_t cmap,uint32_t plane_mask,uint32_t pixels_len,const uint32_t * pixels)8716 xcb_free_colors (xcb_connection_t *c /**< */,
8717 xcb_colormap_t cmap /**< */,
8718 uint32_t plane_mask /**< */,
8719 uint32_t pixels_len /**< */,
8720 const uint32_t *pixels /**< */)
8721 {
8722 static const xcb_protocol_request_t xcb_req = {
8723 /* count */ 4,
8724 /* ext */ 0,
8725 /* opcode */ XCB_FREE_COLORS,
8726 /* isvoid */ 1
8727 };
8728
8729 struct iovec xcb_parts[6];
8730 xcb_void_cookie_t xcb_ret;
8731 xcb_free_colors_request_t xcb_out;
8732
8733 xcb_out.pad0 = 0;
8734 xcb_out.cmap = cmap;
8735 xcb_out.plane_mask = plane_mask;
8736
8737 xcb_parts[2].iov_base = (char *) &xcb_out;
8738 xcb_parts[2].iov_len = sizeof(xcb_out);
8739 xcb_parts[3].iov_base = 0;
8740 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
8741 /* uint32_t pixels */
8742 xcb_parts[4].iov_base = (char *) pixels;
8743 xcb_parts[4].iov_len = pixels_len * sizeof(uint32_t);
8744 xcb_parts[5].iov_base = 0;
8745 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
8746
8747 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
8748 return xcb_ret;
8749 }
8750
8751 void
xcb_coloritem_next(xcb_coloritem_iterator_t * i)8752 xcb_coloritem_next (xcb_coloritem_iterator_t *i /**< */)
8753 {
8754 --i->rem;
8755 ++i->data;
8756 i->index += sizeof(xcb_coloritem_t);
8757 }
8758
8759 xcb_generic_iterator_t
xcb_coloritem_end(xcb_coloritem_iterator_t i)8760 xcb_coloritem_end (xcb_coloritem_iterator_t i /**< */)
8761 {
8762 xcb_generic_iterator_t ret;
8763 ret.data = i.data + i.rem;
8764 ret.index = i.index + ((char *) ret.data - (char *) i.data);
8765 ret.rem = 0;
8766 return ret;
8767 }
8768
8769 int
xcb_store_colors_sizeof(const void * _buffer,uint32_t items_len)8770 xcb_store_colors_sizeof (const void *_buffer /**< */,
8771 uint32_t items_len /**< */)
8772 {
8773 char *xcb_tmp = (char *)_buffer;
8774 unsigned int xcb_buffer_len = 0;
8775 unsigned int xcb_block_len = 0;
8776 unsigned int xcb_pad = 0;
8777 unsigned int xcb_align_to = 0;
8778
8779
8780 xcb_block_len += sizeof(xcb_store_colors_request_t);
8781 xcb_tmp += xcb_block_len;
8782 xcb_buffer_len += xcb_block_len;
8783 xcb_block_len = 0;
8784 /* items */
8785 xcb_block_len += items_len * sizeof(xcb_coloritem_t);
8786 xcb_tmp += xcb_block_len;
8787 xcb_align_to = ALIGNOF(xcb_coloritem_t);
8788 /* insert padding */
8789 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
8790 xcb_buffer_len += xcb_block_len + xcb_pad;
8791 if (0 != xcb_pad) {
8792 xcb_tmp += xcb_pad;
8793 xcb_pad = 0;
8794 }
8795 xcb_block_len = 0;
8796
8797 return xcb_buffer_len;
8798 }
8799
8800 xcb_void_cookie_t
xcb_store_colors_checked(xcb_connection_t * c,xcb_colormap_t cmap,uint32_t items_len,const xcb_coloritem_t * items)8801 xcb_store_colors_checked (xcb_connection_t *c /**< */,
8802 xcb_colormap_t cmap /**< */,
8803 uint32_t items_len /**< */,
8804 const xcb_coloritem_t *items /**< */)
8805 {
8806 static const xcb_protocol_request_t xcb_req = {
8807 /* count */ 4,
8808 /* ext */ 0,
8809 /* opcode */ XCB_STORE_COLORS,
8810 /* isvoid */ 1
8811 };
8812
8813 struct iovec xcb_parts[6];
8814 xcb_void_cookie_t xcb_ret;
8815 xcb_store_colors_request_t xcb_out;
8816
8817 xcb_out.pad0 = 0;
8818 xcb_out.cmap = cmap;
8819
8820 xcb_parts[2].iov_base = (char *) &xcb_out;
8821 xcb_parts[2].iov_len = sizeof(xcb_out);
8822 xcb_parts[3].iov_base = 0;
8823 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
8824 /* xcb_coloritem_t items */
8825 xcb_parts[4].iov_base = (char *) items;
8826 xcb_parts[4].iov_len = items_len * sizeof(xcb_coloritem_t);
8827 xcb_parts[5].iov_base = 0;
8828 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
8829
8830 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
8831 return xcb_ret;
8832 }
8833
8834 xcb_void_cookie_t
xcb_store_colors(xcb_connection_t * c,xcb_colormap_t cmap,uint32_t items_len,const xcb_coloritem_t * items)8835 xcb_store_colors (xcb_connection_t *c /**< */,
8836 xcb_colormap_t cmap /**< */,
8837 uint32_t items_len /**< */,
8838 const xcb_coloritem_t *items /**< */)
8839 {
8840 static const xcb_protocol_request_t xcb_req = {
8841 /* count */ 4,
8842 /* ext */ 0,
8843 /* opcode */ XCB_STORE_COLORS,
8844 /* isvoid */ 1
8845 };
8846
8847 struct iovec xcb_parts[6];
8848 xcb_void_cookie_t xcb_ret;
8849 xcb_store_colors_request_t xcb_out;
8850
8851 xcb_out.pad0 = 0;
8852 xcb_out.cmap = cmap;
8853
8854 xcb_parts[2].iov_base = (char *) &xcb_out;
8855 xcb_parts[2].iov_len = sizeof(xcb_out);
8856 xcb_parts[3].iov_base = 0;
8857 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
8858 /* xcb_coloritem_t items */
8859 xcb_parts[4].iov_base = (char *) items;
8860 xcb_parts[4].iov_len = items_len * sizeof(xcb_coloritem_t);
8861 xcb_parts[5].iov_base = 0;
8862 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
8863
8864 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
8865 return xcb_ret;
8866 }
8867
8868 int
xcb_store_named_color_sizeof(const void * _buffer)8869 xcb_store_named_color_sizeof (const void *_buffer /**< */)
8870 {
8871 char *xcb_tmp = (char *)_buffer;
8872 const xcb_store_named_color_request_t *_aux = (xcb_store_named_color_request_t *)_buffer;
8873 unsigned int xcb_buffer_len = 0;
8874 unsigned int xcb_block_len = 0;
8875 unsigned int xcb_pad = 0;
8876 unsigned int xcb_align_to = 0;
8877
8878
8879 xcb_block_len += sizeof(xcb_store_named_color_request_t);
8880 xcb_tmp += xcb_block_len;
8881 xcb_buffer_len += xcb_block_len;
8882 xcb_block_len = 0;
8883 /* name */
8884 xcb_block_len += _aux->name_len * sizeof(char);
8885 xcb_tmp += xcb_block_len;
8886 xcb_align_to = ALIGNOF(char);
8887 /* insert padding */
8888 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
8889 xcb_buffer_len += xcb_block_len + xcb_pad;
8890 if (0 != xcb_pad) {
8891 xcb_tmp += xcb_pad;
8892 xcb_pad = 0;
8893 }
8894 xcb_block_len = 0;
8895
8896 return xcb_buffer_len;
8897 }
8898
8899 xcb_void_cookie_t
xcb_store_named_color_checked(xcb_connection_t * c,uint8_t flags,xcb_colormap_t cmap,uint32_t pixel,uint16_t name_len,const char * name)8900 xcb_store_named_color_checked (xcb_connection_t *c /**< */,
8901 uint8_t flags /**< */,
8902 xcb_colormap_t cmap /**< */,
8903 uint32_t pixel /**< */,
8904 uint16_t name_len /**< */,
8905 const char *name /**< */)
8906 {
8907 static const xcb_protocol_request_t xcb_req = {
8908 /* count */ 4,
8909 /* ext */ 0,
8910 /* opcode */ XCB_STORE_NAMED_COLOR,
8911 /* isvoid */ 1
8912 };
8913
8914 struct iovec xcb_parts[6];
8915 xcb_void_cookie_t xcb_ret;
8916 xcb_store_named_color_request_t xcb_out;
8917
8918 xcb_out.flags = flags;
8919 xcb_out.cmap = cmap;
8920 xcb_out.pixel = pixel;
8921 xcb_out.name_len = name_len;
8922 memset(xcb_out.pad0, 0, 2);
8923
8924 xcb_parts[2].iov_base = (char *) &xcb_out;
8925 xcb_parts[2].iov_len = sizeof(xcb_out);
8926 xcb_parts[3].iov_base = 0;
8927 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
8928 /* char name */
8929 xcb_parts[4].iov_base = (char *) name;
8930 xcb_parts[4].iov_len = name_len * sizeof(char);
8931 xcb_parts[5].iov_base = 0;
8932 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
8933
8934 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
8935 return xcb_ret;
8936 }
8937
8938 xcb_void_cookie_t
xcb_store_named_color(xcb_connection_t * c,uint8_t flags,xcb_colormap_t cmap,uint32_t pixel,uint16_t name_len,const char * name)8939 xcb_store_named_color (xcb_connection_t *c /**< */,
8940 uint8_t flags /**< */,
8941 xcb_colormap_t cmap /**< */,
8942 uint32_t pixel /**< */,
8943 uint16_t name_len /**< */,
8944 const char *name /**< */)
8945 {
8946 static const xcb_protocol_request_t xcb_req = {
8947 /* count */ 4,
8948 /* ext */ 0,
8949 /* opcode */ XCB_STORE_NAMED_COLOR,
8950 /* isvoid */ 1
8951 };
8952
8953 struct iovec xcb_parts[6];
8954 xcb_void_cookie_t xcb_ret;
8955 xcb_store_named_color_request_t xcb_out;
8956
8957 xcb_out.flags = flags;
8958 xcb_out.cmap = cmap;
8959 xcb_out.pixel = pixel;
8960 xcb_out.name_len = name_len;
8961 memset(xcb_out.pad0, 0, 2);
8962
8963 xcb_parts[2].iov_base = (char *) &xcb_out;
8964 xcb_parts[2].iov_len = sizeof(xcb_out);
8965 xcb_parts[3].iov_base = 0;
8966 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
8967 /* char name */
8968 xcb_parts[4].iov_base = (char *) name;
8969 xcb_parts[4].iov_len = name_len * sizeof(char);
8970 xcb_parts[5].iov_base = 0;
8971 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
8972
8973 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
8974 return xcb_ret;
8975 }
8976
8977 void
xcb_rgb_next(xcb_rgb_iterator_t * i)8978 xcb_rgb_next (xcb_rgb_iterator_t *i /**< */)
8979 {
8980 --i->rem;
8981 ++i->data;
8982 i->index += sizeof(xcb_rgb_t);
8983 }
8984
8985 xcb_generic_iterator_t
xcb_rgb_end(xcb_rgb_iterator_t i)8986 xcb_rgb_end (xcb_rgb_iterator_t i /**< */)
8987 {
8988 xcb_generic_iterator_t ret;
8989 ret.data = i.data + i.rem;
8990 ret.index = i.index + ((char *) ret.data - (char *) i.data);
8991 ret.rem = 0;
8992 return ret;
8993 }
8994
8995 int
xcb_query_colors_sizeof(const void * _buffer,uint32_t pixels_len)8996 xcb_query_colors_sizeof (const void *_buffer /**< */,
8997 uint32_t pixels_len /**< */)
8998 {
8999 char *xcb_tmp = (char *)_buffer;
9000 unsigned int xcb_buffer_len = 0;
9001 unsigned int xcb_block_len = 0;
9002 unsigned int xcb_pad = 0;
9003 unsigned int xcb_align_to = 0;
9004
9005
9006 xcb_block_len += sizeof(xcb_query_colors_request_t);
9007 xcb_tmp += xcb_block_len;
9008 xcb_buffer_len += xcb_block_len;
9009 xcb_block_len = 0;
9010 /* pixels */
9011 xcb_block_len += pixels_len * sizeof(uint32_t);
9012 xcb_tmp += xcb_block_len;
9013 xcb_align_to = ALIGNOF(uint32_t);
9014 /* insert padding */
9015 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
9016 xcb_buffer_len += xcb_block_len + xcb_pad;
9017 if (0 != xcb_pad) {
9018 xcb_tmp += xcb_pad;
9019 xcb_pad = 0;
9020 }
9021 xcb_block_len = 0;
9022
9023 return xcb_buffer_len;
9024 }
9025
9026 xcb_query_colors_cookie_t
xcb_query_colors(xcb_connection_t * c,xcb_colormap_t cmap,uint32_t pixels_len,const uint32_t * pixels)9027 xcb_query_colors (xcb_connection_t *c /**< */,
9028 xcb_colormap_t cmap /**< */,
9029 uint32_t pixels_len /**< */,
9030 const uint32_t *pixels /**< */)
9031 {
9032 static const xcb_protocol_request_t xcb_req = {
9033 /* count */ 4,
9034 /* ext */ 0,
9035 /* opcode */ XCB_QUERY_COLORS,
9036 /* isvoid */ 0
9037 };
9038
9039 struct iovec xcb_parts[6];
9040 xcb_query_colors_cookie_t xcb_ret;
9041 xcb_query_colors_request_t xcb_out;
9042
9043 xcb_out.pad0 = 0;
9044 xcb_out.cmap = cmap;
9045
9046 xcb_parts[2].iov_base = (char *) &xcb_out;
9047 xcb_parts[2].iov_len = sizeof(xcb_out);
9048 xcb_parts[3].iov_base = 0;
9049 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
9050 /* uint32_t pixels */
9051 xcb_parts[4].iov_base = (char *) pixels;
9052 xcb_parts[4].iov_len = pixels_len * sizeof(uint32_t);
9053 xcb_parts[5].iov_base = 0;
9054 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
9055
9056 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
9057 return xcb_ret;
9058 }
9059
9060 xcb_query_colors_cookie_t
xcb_query_colors_unchecked(xcb_connection_t * c,xcb_colormap_t cmap,uint32_t pixels_len,const uint32_t * pixels)9061 xcb_query_colors_unchecked (xcb_connection_t *c /**< */,
9062 xcb_colormap_t cmap /**< */,
9063 uint32_t pixels_len /**< */,
9064 const uint32_t *pixels /**< */)
9065 {
9066 static const xcb_protocol_request_t xcb_req = {
9067 /* count */ 4,
9068 /* ext */ 0,
9069 /* opcode */ XCB_QUERY_COLORS,
9070 /* isvoid */ 0
9071 };
9072
9073 struct iovec xcb_parts[6];
9074 xcb_query_colors_cookie_t xcb_ret;
9075 xcb_query_colors_request_t xcb_out;
9076
9077 xcb_out.pad0 = 0;
9078 xcb_out.cmap = cmap;
9079
9080 xcb_parts[2].iov_base = (char *) &xcb_out;
9081 xcb_parts[2].iov_len = sizeof(xcb_out);
9082 xcb_parts[3].iov_base = 0;
9083 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
9084 /* uint32_t pixels */
9085 xcb_parts[4].iov_base = (char *) pixels;
9086 xcb_parts[4].iov_len = pixels_len * sizeof(uint32_t);
9087 xcb_parts[5].iov_base = 0;
9088 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
9089
9090 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
9091 return xcb_ret;
9092 }
9093
9094 xcb_rgb_t *
xcb_query_colors_colors(const xcb_query_colors_reply_t * R)9095 xcb_query_colors_colors (const xcb_query_colors_reply_t *R /**< */)
9096 {
9097 return (xcb_rgb_t *) (R + 1);
9098 }
9099
9100 int
xcb_query_colors_colors_length(const xcb_query_colors_reply_t * R)9101 xcb_query_colors_colors_length (const xcb_query_colors_reply_t *R /**< */)
9102 {
9103 return R->colors_len;
9104 }
9105
9106 xcb_rgb_iterator_t
xcb_query_colors_colors_iterator(const xcb_query_colors_reply_t * R)9107 xcb_query_colors_colors_iterator (const xcb_query_colors_reply_t *R /**< */)
9108 {
9109 xcb_rgb_iterator_t i;
9110 i.data = (xcb_rgb_t *) (R + 1);
9111 i.rem = R->colors_len;
9112 i.index = (char *) i.data - (char *) R;
9113 return i;
9114 }
9115
9116 xcb_query_colors_reply_t *
xcb_query_colors_reply(xcb_connection_t * c,xcb_query_colors_cookie_t cookie,xcb_generic_error_t ** e)9117 xcb_query_colors_reply (xcb_connection_t *c /**< */,
9118 xcb_query_colors_cookie_t cookie /**< */,
9119 xcb_generic_error_t **e /**< */)
9120 {
9121 return (xcb_query_colors_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
9122 }
9123
9124 int
xcb_lookup_color_sizeof(const void * _buffer)9125 xcb_lookup_color_sizeof (const void *_buffer /**< */)
9126 {
9127 char *xcb_tmp = (char *)_buffer;
9128 const xcb_lookup_color_request_t *_aux = (xcb_lookup_color_request_t *)_buffer;
9129 unsigned int xcb_buffer_len = 0;
9130 unsigned int xcb_block_len = 0;
9131 unsigned int xcb_pad = 0;
9132 unsigned int xcb_align_to = 0;
9133
9134
9135 xcb_block_len += sizeof(xcb_lookup_color_request_t);
9136 xcb_tmp += xcb_block_len;
9137 xcb_buffer_len += xcb_block_len;
9138 xcb_block_len = 0;
9139 /* name */
9140 xcb_block_len += _aux->name_len * sizeof(char);
9141 xcb_tmp += xcb_block_len;
9142 xcb_align_to = ALIGNOF(char);
9143 /* insert padding */
9144 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
9145 xcb_buffer_len += xcb_block_len + xcb_pad;
9146 if (0 != xcb_pad) {
9147 xcb_tmp += xcb_pad;
9148 xcb_pad = 0;
9149 }
9150 xcb_block_len = 0;
9151
9152 return xcb_buffer_len;
9153 }
9154
9155 xcb_lookup_color_cookie_t
xcb_lookup_color(xcb_connection_t * c,xcb_colormap_t cmap,uint16_t name_len,const char * name)9156 xcb_lookup_color (xcb_connection_t *c /**< */,
9157 xcb_colormap_t cmap /**< */,
9158 uint16_t name_len /**< */,
9159 const char *name /**< */)
9160 {
9161 static const xcb_protocol_request_t xcb_req = {
9162 /* count */ 4,
9163 /* ext */ 0,
9164 /* opcode */ XCB_LOOKUP_COLOR,
9165 /* isvoid */ 0
9166 };
9167
9168 struct iovec xcb_parts[6];
9169 xcb_lookup_color_cookie_t xcb_ret;
9170 xcb_lookup_color_request_t xcb_out;
9171
9172 xcb_out.pad0 = 0;
9173 xcb_out.cmap = cmap;
9174 xcb_out.name_len = name_len;
9175 memset(xcb_out.pad1, 0, 2);
9176
9177 xcb_parts[2].iov_base = (char *) &xcb_out;
9178 xcb_parts[2].iov_len = sizeof(xcb_out);
9179 xcb_parts[3].iov_base = 0;
9180 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
9181 /* char name */
9182 xcb_parts[4].iov_base = (char *) name;
9183 xcb_parts[4].iov_len = name_len * sizeof(char);
9184 xcb_parts[5].iov_base = 0;
9185 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
9186
9187 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
9188 return xcb_ret;
9189 }
9190
9191 xcb_lookup_color_cookie_t
xcb_lookup_color_unchecked(xcb_connection_t * c,xcb_colormap_t cmap,uint16_t name_len,const char * name)9192 xcb_lookup_color_unchecked (xcb_connection_t *c /**< */,
9193 xcb_colormap_t cmap /**< */,
9194 uint16_t name_len /**< */,
9195 const char *name /**< */)
9196 {
9197 static const xcb_protocol_request_t xcb_req = {
9198 /* count */ 4,
9199 /* ext */ 0,
9200 /* opcode */ XCB_LOOKUP_COLOR,
9201 /* isvoid */ 0
9202 };
9203
9204 struct iovec xcb_parts[6];
9205 xcb_lookup_color_cookie_t xcb_ret;
9206 xcb_lookup_color_request_t xcb_out;
9207
9208 xcb_out.pad0 = 0;
9209 xcb_out.cmap = cmap;
9210 xcb_out.name_len = name_len;
9211 memset(xcb_out.pad1, 0, 2);
9212
9213 xcb_parts[2].iov_base = (char *) &xcb_out;
9214 xcb_parts[2].iov_len = sizeof(xcb_out);
9215 xcb_parts[3].iov_base = 0;
9216 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
9217 /* char name */
9218 xcb_parts[4].iov_base = (char *) name;
9219 xcb_parts[4].iov_len = name_len * sizeof(char);
9220 xcb_parts[5].iov_base = 0;
9221 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
9222
9223 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
9224 return xcb_ret;
9225 }
9226
9227 xcb_lookup_color_reply_t *
xcb_lookup_color_reply(xcb_connection_t * c,xcb_lookup_color_cookie_t cookie,xcb_generic_error_t ** e)9228 xcb_lookup_color_reply (xcb_connection_t *c /**< */,
9229 xcb_lookup_color_cookie_t cookie /**< */,
9230 xcb_generic_error_t **e /**< */)
9231 {
9232 return (xcb_lookup_color_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
9233 }
9234
9235 xcb_void_cookie_t
xcb_create_cursor_checked(xcb_connection_t * c,xcb_cursor_t cid,xcb_pixmap_t source,xcb_pixmap_t mask,uint16_t fore_red,uint16_t fore_green,uint16_t fore_blue,uint16_t back_red,uint16_t back_green,uint16_t back_blue,uint16_t x,uint16_t y)9236 xcb_create_cursor_checked (xcb_connection_t *c /**< */,
9237 xcb_cursor_t cid /**< */,
9238 xcb_pixmap_t source /**< */,
9239 xcb_pixmap_t mask /**< */,
9240 uint16_t fore_red /**< */,
9241 uint16_t fore_green /**< */,
9242 uint16_t fore_blue /**< */,
9243 uint16_t back_red /**< */,
9244 uint16_t back_green /**< */,
9245 uint16_t back_blue /**< */,
9246 uint16_t x /**< */,
9247 uint16_t y /**< */)
9248 {
9249 static const xcb_protocol_request_t xcb_req = {
9250 /* count */ 2,
9251 /* ext */ 0,
9252 /* opcode */ XCB_CREATE_CURSOR,
9253 /* isvoid */ 1
9254 };
9255
9256 struct iovec xcb_parts[4];
9257 xcb_void_cookie_t xcb_ret;
9258 xcb_create_cursor_request_t xcb_out;
9259
9260 xcb_out.pad0 = 0;
9261 xcb_out.cid = cid;
9262 xcb_out.source = source;
9263 xcb_out.mask = mask;
9264 xcb_out.fore_red = fore_red;
9265 xcb_out.fore_green = fore_green;
9266 xcb_out.fore_blue = fore_blue;
9267 xcb_out.back_red = back_red;
9268 xcb_out.back_green = back_green;
9269 xcb_out.back_blue = back_blue;
9270 xcb_out.x = x;
9271 xcb_out.y = y;
9272
9273 xcb_parts[2].iov_base = (char *) &xcb_out;
9274 xcb_parts[2].iov_len = sizeof(xcb_out);
9275 xcb_parts[3].iov_base = 0;
9276 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
9277
9278 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
9279 return xcb_ret;
9280 }
9281
9282 xcb_void_cookie_t
xcb_create_cursor(xcb_connection_t * c,xcb_cursor_t cid,xcb_pixmap_t source,xcb_pixmap_t mask,uint16_t fore_red,uint16_t fore_green,uint16_t fore_blue,uint16_t back_red,uint16_t back_green,uint16_t back_blue,uint16_t x,uint16_t y)9283 xcb_create_cursor (xcb_connection_t *c /**< */,
9284 xcb_cursor_t cid /**< */,
9285 xcb_pixmap_t source /**< */,
9286 xcb_pixmap_t mask /**< */,
9287 uint16_t fore_red /**< */,
9288 uint16_t fore_green /**< */,
9289 uint16_t fore_blue /**< */,
9290 uint16_t back_red /**< */,
9291 uint16_t back_green /**< */,
9292 uint16_t back_blue /**< */,
9293 uint16_t x /**< */,
9294 uint16_t y /**< */)
9295 {
9296 static const xcb_protocol_request_t xcb_req = {
9297 /* count */ 2,
9298 /* ext */ 0,
9299 /* opcode */ XCB_CREATE_CURSOR,
9300 /* isvoid */ 1
9301 };
9302
9303 struct iovec xcb_parts[4];
9304 xcb_void_cookie_t xcb_ret;
9305 xcb_create_cursor_request_t xcb_out;
9306
9307 xcb_out.pad0 = 0;
9308 xcb_out.cid = cid;
9309 xcb_out.source = source;
9310 xcb_out.mask = mask;
9311 xcb_out.fore_red = fore_red;
9312 xcb_out.fore_green = fore_green;
9313 xcb_out.fore_blue = fore_blue;
9314 xcb_out.back_red = back_red;
9315 xcb_out.back_green = back_green;
9316 xcb_out.back_blue = back_blue;
9317 xcb_out.x = x;
9318 xcb_out.y = y;
9319
9320 xcb_parts[2].iov_base = (char *) &xcb_out;
9321 xcb_parts[2].iov_len = sizeof(xcb_out);
9322 xcb_parts[3].iov_base = 0;
9323 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
9324
9325 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
9326 return xcb_ret;
9327 }
9328
9329 xcb_void_cookie_t
xcb_create_glyph_cursor_checked(xcb_connection_t * c,xcb_cursor_t cid,xcb_font_t source_font,xcb_font_t mask_font,uint16_t source_char,uint16_t mask_char,uint16_t fore_red,uint16_t fore_green,uint16_t fore_blue,uint16_t back_red,uint16_t back_green,uint16_t back_blue)9330 xcb_create_glyph_cursor_checked (xcb_connection_t *c /**< */,
9331 xcb_cursor_t cid /**< */,
9332 xcb_font_t source_font /**< */,
9333 xcb_font_t mask_font /**< */,
9334 uint16_t source_char /**< */,
9335 uint16_t mask_char /**< */,
9336 uint16_t fore_red /**< */,
9337 uint16_t fore_green /**< */,
9338 uint16_t fore_blue /**< */,
9339 uint16_t back_red /**< */,
9340 uint16_t back_green /**< */,
9341 uint16_t back_blue /**< */)
9342 {
9343 static const xcb_protocol_request_t xcb_req = {
9344 /* count */ 2,
9345 /* ext */ 0,
9346 /* opcode */ XCB_CREATE_GLYPH_CURSOR,
9347 /* isvoid */ 1
9348 };
9349
9350 struct iovec xcb_parts[4];
9351 xcb_void_cookie_t xcb_ret;
9352 xcb_create_glyph_cursor_request_t xcb_out;
9353
9354 xcb_out.pad0 = 0;
9355 xcb_out.cid = cid;
9356 xcb_out.source_font = source_font;
9357 xcb_out.mask_font = mask_font;
9358 xcb_out.source_char = source_char;
9359 xcb_out.mask_char = mask_char;
9360 xcb_out.fore_red = fore_red;
9361 xcb_out.fore_green = fore_green;
9362 xcb_out.fore_blue = fore_blue;
9363 xcb_out.back_red = back_red;
9364 xcb_out.back_green = back_green;
9365 xcb_out.back_blue = back_blue;
9366
9367 xcb_parts[2].iov_base = (char *) &xcb_out;
9368 xcb_parts[2].iov_len = sizeof(xcb_out);
9369 xcb_parts[3].iov_base = 0;
9370 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
9371
9372 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
9373 return xcb_ret;
9374 }
9375
9376 xcb_void_cookie_t
xcb_create_glyph_cursor(xcb_connection_t * c,xcb_cursor_t cid,xcb_font_t source_font,xcb_font_t mask_font,uint16_t source_char,uint16_t mask_char,uint16_t fore_red,uint16_t fore_green,uint16_t fore_blue,uint16_t back_red,uint16_t back_green,uint16_t back_blue)9377 xcb_create_glyph_cursor (xcb_connection_t *c /**< */,
9378 xcb_cursor_t cid /**< */,
9379 xcb_font_t source_font /**< */,
9380 xcb_font_t mask_font /**< */,
9381 uint16_t source_char /**< */,
9382 uint16_t mask_char /**< */,
9383 uint16_t fore_red /**< */,
9384 uint16_t fore_green /**< */,
9385 uint16_t fore_blue /**< */,
9386 uint16_t back_red /**< */,
9387 uint16_t back_green /**< */,
9388 uint16_t back_blue /**< */)
9389 {
9390 static const xcb_protocol_request_t xcb_req = {
9391 /* count */ 2,
9392 /* ext */ 0,
9393 /* opcode */ XCB_CREATE_GLYPH_CURSOR,
9394 /* isvoid */ 1
9395 };
9396
9397 struct iovec xcb_parts[4];
9398 xcb_void_cookie_t xcb_ret;
9399 xcb_create_glyph_cursor_request_t xcb_out;
9400
9401 xcb_out.pad0 = 0;
9402 xcb_out.cid = cid;
9403 xcb_out.source_font = source_font;
9404 xcb_out.mask_font = mask_font;
9405 xcb_out.source_char = source_char;
9406 xcb_out.mask_char = mask_char;
9407 xcb_out.fore_red = fore_red;
9408 xcb_out.fore_green = fore_green;
9409 xcb_out.fore_blue = fore_blue;
9410 xcb_out.back_red = back_red;
9411 xcb_out.back_green = back_green;
9412 xcb_out.back_blue = back_blue;
9413
9414 xcb_parts[2].iov_base = (char *) &xcb_out;
9415 xcb_parts[2].iov_len = sizeof(xcb_out);
9416 xcb_parts[3].iov_base = 0;
9417 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
9418
9419 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
9420 return xcb_ret;
9421 }
9422
9423 xcb_void_cookie_t
xcb_free_cursor_checked(xcb_connection_t * c,xcb_cursor_t cursor)9424 xcb_free_cursor_checked (xcb_connection_t *c /**< */,
9425 xcb_cursor_t cursor /**< */)
9426 {
9427 static const xcb_protocol_request_t xcb_req = {
9428 /* count */ 2,
9429 /* ext */ 0,
9430 /* opcode */ XCB_FREE_CURSOR,
9431 /* isvoid */ 1
9432 };
9433
9434 struct iovec xcb_parts[4];
9435 xcb_void_cookie_t xcb_ret;
9436 xcb_free_cursor_request_t xcb_out;
9437
9438 xcb_out.pad0 = 0;
9439 xcb_out.cursor = cursor;
9440
9441 xcb_parts[2].iov_base = (char *) &xcb_out;
9442 xcb_parts[2].iov_len = sizeof(xcb_out);
9443 xcb_parts[3].iov_base = 0;
9444 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
9445
9446 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
9447 return xcb_ret;
9448 }
9449
9450 xcb_void_cookie_t
xcb_free_cursor(xcb_connection_t * c,xcb_cursor_t cursor)9451 xcb_free_cursor (xcb_connection_t *c /**< */,
9452 xcb_cursor_t cursor /**< */)
9453 {
9454 static const xcb_protocol_request_t xcb_req = {
9455 /* count */ 2,
9456 /* ext */ 0,
9457 /* opcode */ XCB_FREE_CURSOR,
9458 /* isvoid */ 1
9459 };
9460
9461 struct iovec xcb_parts[4];
9462 xcb_void_cookie_t xcb_ret;
9463 xcb_free_cursor_request_t xcb_out;
9464
9465 xcb_out.pad0 = 0;
9466 xcb_out.cursor = cursor;
9467
9468 xcb_parts[2].iov_base = (char *) &xcb_out;
9469 xcb_parts[2].iov_len = sizeof(xcb_out);
9470 xcb_parts[3].iov_base = 0;
9471 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
9472
9473 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
9474 return xcb_ret;
9475 }
9476
9477 xcb_void_cookie_t
xcb_recolor_cursor_checked(xcb_connection_t * c,xcb_cursor_t cursor,uint16_t fore_red,uint16_t fore_green,uint16_t fore_blue,uint16_t back_red,uint16_t back_green,uint16_t back_blue)9478 xcb_recolor_cursor_checked (xcb_connection_t *c /**< */,
9479 xcb_cursor_t cursor /**< */,
9480 uint16_t fore_red /**< */,
9481 uint16_t fore_green /**< */,
9482 uint16_t fore_blue /**< */,
9483 uint16_t back_red /**< */,
9484 uint16_t back_green /**< */,
9485 uint16_t back_blue /**< */)
9486 {
9487 static const xcb_protocol_request_t xcb_req = {
9488 /* count */ 2,
9489 /* ext */ 0,
9490 /* opcode */ XCB_RECOLOR_CURSOR,
9491 /* isvoid */ 1
9492 };
9493
9494 struct iovec xcb_parts[4];
9495 xcb_void_cookie_t xcb_ret;
9496 xcb_recolor_cursor_request_t xcb_out;
9497
9498 xcb_out.pad0 = 0;
9499 xcb_out.cursor = cursor;
9500 xcb_out.fore_red = fore_red;
9501 xcb_out.fore_green = fore_green;
9502 xcb_out.fore_blue = fore_blue;
9503 xcb_out.back_red = back_red;
9504 xcb_out.back_green = back_green;
9505 xcb_out.back_blue = back_blue;
9506
9507 xcb_parts[2].iov_base = (char *) &xcb_out;
9508 xcb_parts[2].iov_len = sizeof(xcb_out);
9509 xcb_parts[3].iov_base = 0;
9510 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
9511
9512 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
9513 return xcb_ret;
9514 }
9515
9516 xcb_void_cookie_t
xcb_recolor_cursor(xcb_connection_t * c,xcb_cursor_t cursor,uint16_t fore_red,uint16_t fore_green,uint16_t fore_blue,uint16_t back_red,uint16_t back_green,uint16_t back_blue)9517 xcb_recolor_cursor (xcb_connection_t *c /**< */,
9518 xcb_cursor_t cursor /**< */,
9519 uint16_t fore_red /**< */,
9520 uint16_t fore_green /**< */,
9521 uint16_t fore_blue /**< */,
9522 uint16_t back_red /**< */,
9523 uint16_t back_green /**< */,
9524 uint16_t back_blue /**< */)
9525 {
9526 static const xcb_protocol_request_t xcb_req = {
9527 /* count */ 2,
9528 /* ext */ 0,
9529 /* opcode */ XCB_RECOLOR_CURSOR,
9530 /* isvoid */ 1
9531 };
9532
9533 struct iovec xcb_parts[4];
9534 xcb_void_cookie_t xcb_ret;
9535 xcb_recolor_cursor_request_t xcb_out;
9536
9537 xcb_out.pad0 = 0;
9538 xcb_out.cursor = cursor;
9539 xcb_out.fore_red = fore_red;
9540 xcb_out.fore_green = fore_green;
9541 xcb_out.fore_blue = fore_blue;
9542 xcb_out.back_red = back_red;
9543 xcb_out.back_green = back_green;
9544 xcb_out.back_blue = back_blue;
9545
9546 xcb_parts[2].iov_base = (char *) &xcb_out;
9547 xcb_parts[2].iov_len = sizeof(xcb_out);
9548 xcb_parts[3].iov_base = 0;
9549 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
9550
9551 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
9552 return xcb_ret;
9553 }
9554
9555 xcb_query_best_size_cookie_t
xcb_query_best_size(xcb_connection_t * c,uint8_t _class,xcb_drawable_t drawable,uint16_t width,uint16_t height)9556 xcb_query_best_size (xcb_connection_t *c /**< */,
9557 uint8_t _class /**< */,
9558 xcb_drawable_t drawable /**< */,
9559 uint16_t width /**< */,
9560 uint16_t height /**< */)
9561 {
9562 static const xcb_protocol_request_t xcb_req = {
9563 /* count */ 2,
9564 /* ext */ 0,
9565 /* opcode */ XCB_QUERY_BEST_SIZE,
9566 /* isvoid */ 0
9567 };
9568
9569 struct iovec xcb_parts[4];
9570 xcb_query_best_size_cookie_t xcb_ret;
9571 xcb_query_best_size_request_t xcb_out;
9572
9573 xcb_out._class = _class;
9574 xcb_out.drawable = drawable;
9575 xcb_out.width = width;
9576 xcb_out.height = height;
9577
9578 xcb_parts[2].iov_base = (char *) &xcb_out;
9579 xcb_parts[2].iov_len = sizeof(xcb_out);
9580 xcb_parts[3].iov_base = 0;
9581 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
9582
9583 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
9584 return xcb_ret;
9585 }
9586
9587 xcb_query_best_size_cookie_t
xcb_query_best_size_unchecked(xcb_connection_t * c,uint8_t _class,xcb_drawable_t drawable,uint16_t width,uint16_t height)9588 xcb_query_best_size_unchecked (xcb_connection_t *c /**< */,
9589 uint8_t _class /**< */,
9590 xcb_drawable_t drawable /**< */,
9591 uint16_t width /**< */,
9592 uint16_t height /**< */)
9593 {
9594 static const xcb_protocol_request_t xcb_req = {
9595 /* count */ 2,
9596 /* ext */ 0,
9597 /* opcode */ XCB_QUERY_BEST_SIZE,
9598 /* isvoid */ 0
9599 };
9600
9601 struct iovec xcb_parts[4];
9602 xcb_query_best_size_cookie_t xcb_ret;
9603 xcb_query_best_size_request_t xcb_out;
9604
9605 xcb_out._class = _class;
9606 xcb_out.drawable = drawable;
9607 xcb_out.width = width;
9608 xcb_out.height = height;
9609
9610 xcb_parts[2].iov_base = (char *) &xcb_out;
9611 xcb_parts[2].iov_len = sizeof(xcb_out);
9612 xcb_parts[3].iov_base = 0;
9613 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
9614
9615 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
9616 return xcb_ret;
9617 }
9618
9619 xcb_query_best_size_reply_t *
xcb_query_best_size_reply(xcb_connection_t * c,xcb_query_best_size_cookie_t cookie,xcb_generic_error_t ** e)9620 xcb_query_best_size_reply (xcb_connection_t *c /**< */,
9621 xcb_query_best_size_cookie_t cookie /**< */,
9622 xcb_generic_error_t **e /**< */)
9623 {
9624 return (xcb_query_best_size_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
9625 }
9626
9627 int
xcb_query_extension_sizeof(const void * _buffer)9628 xcb_query_extension_sizeof (const void *_buffer /**< */)
9629 {
9630 char *xcb_tmp = (char *)_buffer;
9631 const xcb_query_extension_request_t *_aux = (xcb_query_extension_request_t *)_buffer;
9632 unsigned int xcb_buffer_len = 0;
9633 unsigned int xcb_block_len = 0;
9634 unsigned int xcb_pad = 0;
9635 unsigned int xcb_align_to = 0;
9636
9637
9638 xcb_block_len += sizeof(xcb_query_extension_request_t);
9639 xcb_tmp += xcb_block_len;
9640 xcb_buffer_len += xcb_block_len;
9641 xcb_block_len = 0;
9642 /* name */
9643 xcb_block_len += _aux->name_len * sizeof(char);
9644 xcb_tmp += xcb_block_len;
9645 xcb_align_to = ALIGNOF(char);
9646 /* insert padding */
9647 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
9648 xcb_buffer_len += xcb_block_len + xcb_pad;
9649 if (0 != xcb_pad) {
9650 xcb_tmp += xcb_pad;
9651 xcb_pad = 0;
9652 }
9653 xcb_block_len = 0;
9654
9655 return xcb_buffer_len;
9656 }
9657
9658 xcb_query_extension_cookie_t
xcb_query_extension(xcb_connection_t * c,uint16_t name_len,const char * name)9659 xcb_query_extension (xcb_connection_t *c /**< */,
9660 uint16_t name_len /**< */,
9661 const char *name /**< */)
9662 {
9663 static const xcb_protocol_request_t xcb_req = {
9664 /* count */ 4,
9665 /* ext */ 0,
9666 /* opcode */ XCB_QUERY_EXTENSION,
9667 /* isvoid */ 0
9668 };
9669
9670 struct iovec xcb_parts[6];
9671 xcb_query_extension_cookie_t xcb_ret;
9672 xcb_query_extension_request_t xcb_out;
9673
9674 xcb_out.pad0 = 0;
9675 xcb_out.name_len = name_len;
9676 memset(xcb_out.pad1, 0, 2);
9677
9678 xcb_parts[2].iov_base = (char *) &xcb_out;
9679 xcb_parts[2].iov_len = sizeof(xcb_out);
9680 xcb_parts[3].iov_base = 0;
9681 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
9682 /* char name */
9683 xcb_parts[4].iov_base = (char *) name;
9684 xcb_parts[4].iov_len = name_len * sizeof(char);
9685 xcb_parts[5].iov_base = 0;
9686 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
9687
9688 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
9689 return xcb_ret;
9690 }
9691
9692 xcb_query_extension_cookie_t
xcb_query_extension_unchecked(xcb_connection_t * c,uint16_t name_len,const char * name)9693 xcb_query_extension_unchecked (xcb_connection_t *c /**< */,
9694 uint16_t name_len /**< */,
9695 const char *name /**< */)
9696 {
9697 static const xcb_protocol_request_t xcb_req = {
9698 /* count */ 4,
9699 /* ext */ 0,
9700 /* opcode */ XCB_QUERY_EXTENSION,
9701 /* isvoid */ 0
9702 };
9703
9704 struct iovec xcb_parts[6];
9705 xcb_query_extension_cookie_t xcb_ret;
9706 xcb_query_extension_request_t xcb_out;
9707
9708 xcb_out.pad0 = 0;
9709 xcb_out.name_len = name_len;
9710 memset(xcb_out.pad1, 0, 2);
9711
9712 xcb_parts[2].iov_base = (char *) &xcb_out;
9713 xcb_parts[2].iov_len = sizeof(xcb_out);
9714 xcb_parts[3].iov_base = 0;
9715 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
9716 /* char name */
9717 xcb_parts[4].iov_base = (char *) name;
9718 xcb_parts[4].iov_len = name_len * sizeof(char);
9719 xcb_parts[5].iov_base = 0;
9720 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
9721
9722 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
9723 return xcb_ret;
9724 }
9725
9726 xcb_query_extension_reply_t *
xcb_query_extension_reply(xcb_connection_t * c,xcb_query_extension_cookie_t cookie,xcb_generic_error_t ** e)9727 xcb_query_extension_reply (xcb_connection_t *c /**< */,
9728 xcb_query_extension_cookie_t cookie /**< */,
9729 xcb_generic_error_t **e /**< */)
9730 {
9731 return (xcb_query_extension_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
9732 }
9733
9734 int
xcb_list_extensions_sizeof(const void * _buffer)9735 xcb_list_extensions_sizeof (const void *_buffer /**< */)
9736 {
9737 char *xcb_tmp = (char *)_buffer;
9738 const xcb_list_extensions_reply_t *_aux = (xcb_list_extensions_reply_t *)_buffer;
9739 unsigned int xcb_buffer_len = 0;
9740 unsigned int xcb_block_len = 0;
9741 unsigned int xcb_pad = 0;
9742 unsigned int xcb_align_to = 0;
9743
9744 unsigned int i;
9745 unsigned int xcb_tmp_len;
9746
9747 xcb_block_len += sizeof(xcb_list_extensions_reply_t);
9748 xcb_tmp += xcb_block_len;
9749 xcb_buffer_len += xcb_block_len;
9750 xcb_block_len = 0;
9751 /* names */
9752 for(i=0; i<_aux->names_len; i++) {
9753 xcb_tmp_len = xcb_str_sizeof(xcb_tmp);
9754 xcb_block_len += xcb_tmp_len;
9755 xcb_tmp += xcb_tmp_len;
9756 }
9757 xcb_align_to = ALIGNOF(xcb_str_t);
9758 /* insert padding */
9759 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
9760 xcb_buffer_len += xcb_block_len + xcb_pad;
9761 if (0 != xcb_pad) {
9762 xcb_tmp += xcb_pad;
9763 xcb_pad = 0;
9764 }
9765 xcb_block_len = 0;
9766
9767 return xcb_buffer_len;
9768 }
9769
9770 xcb_list_extensions_cookie_t
xcb_list_extensions(xcb_connection_t * c)9771 xcb_list_extensions (xcb_connection_t *c /**< */)
9772 {
9773 static const xcb_protocol_request_t xcb_req = {
9774 /* count */ 2,
9775 /* ext */ 0,
9776 /* opcode */ XCB_LIST_EXTENSIONS,
9777 /* isvoid */ 0
9778 };
9779
9780 struct iovec xcb_parts[4];
9781 xcb_list_extensions_cookie_t xcb_ret;
9782 xcb_list_extensions_request_t xcb_out;
9783
9784 xcb_out.pad0 = 0;
9785
9786 xcb_parts[2].iov_base = (char *) &xcb_out;
9787 xcb_parts[2].iov_len = sizeof(xcb_out);
9788 xcb_parts[3].iov_base = 0;
9789 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
9790
9791 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
9792 return xcb_ret;
9793 }
9794
9795 xcb_list_extensions_cookie_t
xcb_list_extensions_unchecked(xcb_connection_t * c)9796 xcb_list_extensions_unchecked (xcb_connection_t *c /**< */)
9797 {
9798 static const xcb_protocol_request_t xcb_req = {
9799 /* count */ 2,
9800 /* ext */ 0,
9801 /* opcode */ XCB_LIST_EXTENSIONS,
9802 /* isvoid */ 0
9803 };
9804
9805 struct iovec xcb_parts[4];
9806 xcb_list_extensions_cookie_t xcb_ret;
9807 xcb_list_extensions_request_t xcb_out;
9808
9809 xcb_out.pad0 = 0;
9810
9811 xcb_parts[2].iov_base = (char *) &xcb_out;
9812 xcb_parts[2].iov_len = sizeof(xcb_out);
9813 xcb_parts[3].iov_base = 0;
9814 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
9815
9816 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
9817 return xcb_ret;
9818 }
9819
9820 int
xcb_list_extensions_names_length(const xcb_list_extensions_reply_t * R)9821 xcb_list_extensions_names_length (const xcb_list_extensions_reply_t *R /**< */)
9822 {
9823 return R->names_len;
9824 }
9825
9826 xcb_str_iterator_t
xcb_list_extensions_names_iterator(const xcb_list_extensions_reply_t * R)9827 xcb_list_extensions_names_iterator (const xcb_list_extensions_reply_t *R /**< */)
9828 {
9829 xcb_str_iterator_t i;
9830 i.data = (xcb_str_t *) (R + 1);
9831 i.rem = R->names_len;
9832 i.index = (char *) i.data - (char *) R;
9833 return i;
9834 }
9835
9836 xcb_list_extensions_reply_t *
xcb_list_extensions_reply(xcb_connection_t * c,xcb_list_extensions_cookie_t cookie,xcb_generic_error_t ** e)9837 xcb_list_extensions_reply (xcb_connection_t *c /**< */,
9838 xcb_list_extensions_cookie_t cookie /**< */,
9839 xcb_generic_error_t **e /**< */)
9840 {
9841 return (xcb_list_extensions_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
9842 }
9843
9844 int
xcb_change_keyboard_mapping_sizeof(const void * _buffer)9845 xcb_change_keyboard_mapping_sizeof (const void *_buffer /**< */)
9846 {
9847 char *xcb_tmp = (char *)_buffer;
9848 const xcb_change_keyboard_mapping_request_t *_aux = (xcb_change_keyboard_mapping_request_t *)_buffer;
9849 unsigned int xcb_buffer_len = 0;
9850 unsigned int xcb_block_len = 0;
9851 unsigned int xcb_pad = 0;
9852 unsigned int xcb_align_to = 0;
9853
9854
9855 xcb_block_len += sizeof(xcb_change_keyboard_mapping_request_t);
9856 xcb_tmp += xcb_block_len;
9857 xcb_buffer_len += xcb_block_len;
9858 xcb_block_len = 0;
9859 /* keysyms */
9860 xcb_block_len += (_aux->keycode_count * _aux->keysyms_per_keycode) * sizeof(xcb_keysym_t);
9861 xcb_tmp += xcb_block_len;
9862 xcb_align_to = ALIGNOF(xcb_keysym_t);
9863 /* insert padding */
9864 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
9865 xcb_buffer_len += xcb_block_len + xcb_pad;
9866 if (0 != xcb_pad) {
9867 xcb_tmp += xcb_pad;
9868 xcb_pad = 0;
9869 }
9870 xcb_block_len = 0;
9871
9872 return xcb_buffer_len;
9873 }
9874
9875 xcb_void_cookie_t
xcb_change_keyboard_mapping_checked(xcb_connection_t * c,uint8_t keycode_count,xcb_keycode_t first_keycode,uint8_t keysyms_per_keycode,const xcb_keysym_t * keysyms)9876 xcb_change_keyboard_mapping_checked (xcb_connection_t *c /**< */,
9877 uint8_t keycode_count /**< */,
9878 xcb_keycode_t first_keycode /**< */,
9879 uint8_t keysyms_per_keycode /**< */,
9880 const xcb_keysym_t *keysyms /**< */)
9881 {
9882 static const xcb_protocol_request_t xcb_req = {
9883 /* count */ 4,
9884 /* ext */ 0,
9885 /* opcode */ XCB_CHANGE_KEYBOARD_MAPPING,
9886 /* isvoid */ 1
9887 };
9888
9889 struct iovec xcb_parts[6];
9890 xcb_void_cookie_t xcb_ret;
9891 xcb_change_keyboard_mapping_request_t xcb_out;
9892
9893 xcb_out.keycode_count = keycode_count;
9894 xcb_out.first_keycode = first_keycode;
9895 xcb_out.keysyms_per_keycode = keysyms_per_keycode;
9896 memset(xcb_out.pad0, 0, 2);
9897
9898 xcb_parts[2].iov_base = (char *) &xcb_out;
9899 xcb_parts[2].iov_len = sizeof(xcb_out);
9900 xcb_parts[3].iov_base = 0;
9901 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
9902 /* xcb_keysym_t keysyms */
9903 xcb_parts[4].iov_base = (char *) keysyms;
9904 xcb_parts[4].iov_len = (keycode_count * keysyms_per_keycode) * sizeof(xcb_keysym_t);
9905 xcb_parts[5].iov_base = 0;
9906 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
9907
9908 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
9909 return xcb_ret;
9910 }
9911
9912 xcb_void_cookie_t
xcb_change_keyboard_mapping(xcb_connection_t * c,uint8_t keycode_count,xcb_keycode_t first_keycode,uint8_t keysyms_per_keycode,const xcb_keysym_t * keysyms)9913 xcb_change_keyboard_mapping (xcb_connection_t *c /**< */,
9914 uint8_t keycode_count /**< */,
9915 xcb_keycode_t first_keycode /**< */,
9916 uint8_t keysyms_per_keycode /**< */,
9917 const xcb_keysym_t *keysyms /**< */)
9918 {
9919 static const xcb_protocol_request_t xcb_req = {
9920 /* count */ 4,
9921 /* ext */ 0,
9922 /* opcode */ XCB_CHANGE_KEYBOARD_MAPPING,
9923 /* isvoid */ 1
9924 };
9925
9926 struct iovec xcb_parts[6];
9927 xcb_void_cookie_t xcb_ret;
9928 xcb_change_keyboard_mapping_request_t xcb_out;
9929
9930 xcb_out.keycode_count = keycode_count;
9931 xcb_out.first_keycode = first_keycode;
9932 xcb_out.keysyms_per_keycode = keysyms_per_keycode;
9933 memset(xcb_out.pad0, 0, 2);
9934
9935 xcb_parts[2].iov_base = (char *) &xcb_out;
9936 xcb_parts[2].iov_len = sizeof(xcb_out);
9937 xcb_parts[3].iov_base = 0;
9938 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
9939 /* xcb_keysym_t keysyms */
9940 xcb_parts[4].iov_base = (char *) keysyms;
9941 xcb_parts[4].iov_len = (keycode_count * keysyms_per_keycode) * sizeof(xcb_keysym_t);
9942 xcb_parts[5].iov_base = 0;
9943 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
9944
9945 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
9946 return xcb_ret;
9947 }
9948
9949 int
xcb_get_keyboard_mapping_sizeof(const void * _buffer)9950 xcb_get_keyboard_mapping_sizeof (const void *_buffer /**< */)
9951 {
9952 char *xcb_tmp = (char *)_buffer;
9953 const xcb_get_keyboard_mapping_reply_t *_aux = (xcb_get_keyboard_mapping_reply_t *)_buffer;
9954 unsigned int xcb_buffer_len = 0;
9955 unsigned int xcb_block_len = 0;
9956 unsigned int xcb_pad = 0;
9957 unsigned int xcb_align_to = 0;
9958
9959
9960 xcb_block_len += sizeof(xcb_get_keyboard_mapping_reply_t);
9961 xcb_tmp += xcb_block_len;
9962 xcb_buffer_len += xcb_block_len;
9963 xcb_block_len = 0;
9964 /* keysyms */
9965 xcb_block_len += _aux->length * sizeof(xcb_keysym_t);
9966 xcb_tmp += xcb_block_len;
9967 xcb_align_to = ALIGNOF(xcb_keysym_t);
9968 /* insert padding */
9969 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
9970 xcb_buffer_len += xcb_block_len + xcb_pad;
9971 if (0 != xcb_pad) {
9972 xcb_tmp += xcb_pad;
9973 xcb_pad = 0;
9974 }
9975 xcb_block_len = 0;
9976
9977 return xcb_buffer_len;
9978 }
9979
9980 xcb_get_keyboard_mapping_cookie_t
xcb_get_keyboard_mapping(xcb_connection_t * c,xcb_keycode_t first_keycode,uint8_t count)9981 xcb_get_keyboard_mapping (xcb_connection_t *c /**< */,
9982 xcb_keycode_t first_keycode /**< */,
9983 uint8_t count /**< */)
9984 {
9985 static const xcb_protocol_request_t xcb_req = {
9986 /* count */ 2,
9987 /* ext */ 0,
9988 /* opcode */ XCB_GET_KEYBOARD_MAPPING,
9989 /* isvoid */ 0
9990 };
9991
9992 struct iovec xcb_parts[4];
9993 xcb_get_keyboard_mapping_cookie_t xcb_ret;
9994 xcb_get_keyboard_mapping_request_t xcb_out;
9995
9996 xcb_out.pad0 = 0;
9997 xcb_out.first_keycode = first_keycode;
9998 xcb_out.count = count;
9999
10000 xcb_parts[2].iov_base = (char *) &xcb_out;
10001 xcb_parts[2].iov_len = sizeof(xcb_out);
10002 xcb_parts[3].iov_base = 0;
10003 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10004
10005 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
10006 return xcb_ret;
10007 }
10008
10009 xcb_get_keyboard_mapping_cookie_t
xcb_get_keyboard_mapping_unchecked(xcb_connection_t * c,xcb_keycode_t first_keycode,uint8_t count)10010 xcb_get_keyboard_mapping_unchecked (xcb_connection_t *c /**< */,
10011 xcb_keycode_t first_keycode /**< */,
10012 uint8_t count /**< */)
10013 {
10014 static const xcb_protocol_request_t xcb_req = {
10015 /* count */ 2,
10016 /* ext */ 0,
10017 /* opcode */ XCB_GET_KEYBOARD_MAPPING,
10018 /* isvoid */ 0
10019 };
10020
10021 struct iovec xcb_parts[4];
10022 xcb_get_keyboard_mapping_cookie_t xcb_ret;
10023 xcb_get_keyboard_mapping_request_t xcb_out;
10024
10025 xcb_out.pad0 = 0;
10026 xcb_out.first_keycode = first_keycode;
10027 xcb_out.count = count;
10028
10029 xcb_parts[2].iov_base = (char *) &xcb_out;
10030 xcb_parts[2].iov_len = sizeof(xcb_out);
10031 xcb_parts[3].iov_base = 0;
10032 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10033
10034 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
10035 return xcb_ret;
10036 }
10037
10038 xcb_keysym_t *
xcb_get_keyboard_mapping_keysyms(const xcb_get_keyboard_mapping_reply_t * R)10039 xcb_get_keyboard_mapping_keysyms (const xcb_get_keyboard_mapping_reply_t *R /**< */)
10040 {
10041 return (xcb_keysym_t *) (R + 1);
10042 }
10043
10044 int
xcb_get_keyboard_mapping_keysyms_length(const xcb_get_keyboard_mapping_reply_t * R)10045 xcb_get_keyboard_mapping_keysyms_length (const xcb_get_keyboard_mapping_reply_t *R /**< */)
10046 {
10047 return R->length;
10048 }
10049
10050 xcb_generic_iterator_t
xcb_get_keyboard_mapping_keysyms_end(const xcb_get_keyboard_mapping_reply_t * R)10051 xcb_get_keyboard_mapping_keysyms_end (const xcb_get_keyboard_mapping_reply_t *R /**< */)
10052 {
10053 xcb_generic_iterator_t i;
10054 i.data = ((xcb_keysym_t *) (R + 1)) + (R->length);
10055 i.rem = 0;
10056 i.index = (char *) i.data - (char *) R;
10057 return i;
10058 }
10059
10060 xcb_get_keyboard_mapping_reply_t *
xcb_get_keyboard_mapping_reply(xcb_connection_t * c,xcb_get_keyboard_mapping_cookie_t cookie,xcb_generic_error_t ** e)10061 xcb_get_keyboard_mapping_reply (xcb_connection_t *c /**< */,
10062 xcb_get_keyboard_mapping_cookie_t cookie /**< */,
10063 xcb_generic_error_t **e /**< */)
10064 {
10065 return (xcb_get_keyboard_mapping_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
10066 }
10067
10068 int
xcb_change_keyboard_control_sizeof(const void * _buffer)10069 xcb_change_keyboard_control_sizeof (const void *_buffer /**< */)
10070 {
10071 char *xcb_tmp = (char *)_buffer;
10072 const xcb_change_keyboard_control_request_t *_aux = (xcb_change_keyboard_control_request_t *)_buffer;
10073 unsigned int xcb_buffer_len = 0;
10074 unsigned int xcb_block_len = 0;
10075 unsigned int xcb_pad = 0;
10076 unsigned int xcb_align_to = 0;
10077
10078
10079 xcb_block_len += sizeof(xcb_change_keyboard_control_request_t);
10080 xcb_tmp += xcb_block_len;
10081 xcb_buffer_len += xcb_block_len;
10082 xcb_block_len = 0;
10083 /* value_list */
10084 xcb_block_len += xcb_popcount(_aux->value_mask) * sizeof(uint32_t);
10085 xcb_tmp += xcb_block_len;
10086 xcb_align_to = ALIGNOF(uint32_t);
10087 /* insert padding */
10088 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
10089 xcb_buffer_len += xcb_block_len + xcb_pad;
10090 if (0 != xcb_pad) {
10091 xcb_tmp += xcb_pad;
10092 xcb_pad = 0;
10093 }
10094 xcb_block_len = 0;
10095
10096 return xcb_buffer_len;
10097 }
10098
10099 xcb_void_cookie_t
xcb_change_keyboard_control_checked(xcb_connection_t * c,uint32_t value_mask,const uint32_t * value_list)10100 xcb_change_keyboard_control_checked (xcb_connection_t *c /**< */,
10101 uint32_t value_mask /**< */,
10102 const uint32_t *value_list /**< */)
10103 {
10104 static const xcb_protocol_request_t xcb_req = {
10105 /* count */ 4,
10106 /* ext */ 0,
10107 /* opcode */ XCB_CHANGE_KEYBOARD_CONTROL,
10108 /* isvoid */ 1
10109 };
10110
10111 struct iovec xcb_parts[6];
10112 xcb_void_cookie_t xcb_ret;
10113 xcb_change_keyboard_control_request_t xcb_out;
10114
10115 xcb_out.pad0 = 0;
10116 xcb_out.value_mask = value_mask;
10117
10118 xcb_parts[2].iov_base = (char *) &xcb_out;
10119 xcb_parts[2].iov_len = sizeof(xcb_out);
10120 xcb_parts[3].iov_base = 0;
10121 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10122 /* uint32_t value_list */
10123 xcb_parts[4].iov_base = (char *) value_list;
10124 xcb_parts[4].iov_len = xcb_popcount(value_mask) * sizeof(uint32_t);
10125 xcb_parts[5].iov_base = 0;
10126 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
10127
10128 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
10129 return xcb_ret;
10130 }
10131
10132 xcb_void_cookie_t
xcb_change_keyboard_control(xcb_connection_t * c,uint32_t value_mask,const uint32_t * value_list)10133 xcb_change_keyboard_control (xcb_connection_t *c /**< */,
10134 uint32_t value_mask /**< */,
10135 const uint32_t *value_list /**< */)
10136 {
10137 static const xcb_protocol_request_t xcb_req = {
10138 /* count */ 4,
10139 /* ext */ 0,
10140 /* opcode */ XCB_CHANGE_KEYBOARD_CONTROL,
10141 /* isvoid */ 1
10142 };
10143
10144 struct iovec xcb_parts[6];
10145 xcb_void_cookie_t xcb_ret;
10146 xcb_change_keyboard_control_request_t xcb_out;
10147
10148 xcb_out.pad0 = 0;
10149 xcb_out.value_mask = value_mask;
10150
10151 xcb_parts[2].iov_base = (char *) &xcb_out;
10152 xcb_parts[2].iov_len = sizeof(xcb_out);
10153 xcb_parts[3].iov_base = 0;
10154 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10155 /* uint32_t value_list */
10156 xcb_parts[4].iov_base = (char *) value_list;
10157 xcb_parts[4].iov_len = xcb_popcount(value_mask) * sizeof(uint32_t);
10158 xcb_parts[5].iov_base = 0;
10159 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
10160
10161 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
10162 return xcb_ret;
10163 }
10164
10165 xcb_get_keyboard_control_cookie_t
xcb_get_keyboard_control(xcb_connection_t * c)10166 xcb_get_keyboard_control (xcb_connection_t *c /**< */)
10167 {
10168 static const xcb_protocol_request_t xcb_req = {
10169 /* count */ 2,
10170 /* ext */ 0,
10171 /* opcode */ XCB_GET_KEYBOARD_CONTROL,
10172 /* isvoid */ 0
10173 };
10174
10175 struct iovec xcb_parts[4];
10176 xcb_get_keyboard_control_cookie_t xcb_ret;
10177 xcb_get_keyboard_control_request_t xcb_out;
10178
10179 xcb_out.pad0 = 0;
10180
10181 xcb_parts[2].iov_base = (char *) &xcb_out;
10182 xcb_parts[2].iov_len = sizeof(xcb_out);
10183 xcb_parts[3].iov_base = 0;
10184 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10185
10186 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
10187 return xcb_ret;
10188 }
10189
10190 xcb_get_keyboard_control_cookie_t
xcb_get_keyboard_control_unchecked(xcb_connection_t * c)10191 xcb_get_keyboard_control_unchecked (xcb_connection_t *c /**< */)
10192 {
10193 static const xcb_protocol_request_t xcb_req = {
10194 /* count */ 2,
10195 /* ext */ 0,
10196 /* opcode */ XCB_GET_KEYBOARD_CONTROL,
10197 /* isvoid */ 0
10198 };
10199
10200 struct iovec xcb_parts[4];
10201 xcb_get_keyboard_control_cookie_t xcb_ret;
10202 xcb_get_keyboard_control_request_t xcb_out;
10203
10204 xcb_out.pad0 = 0;
10205
10206 xcb_parts[2].iov_base = (char *) &xcb_out;
10207 xcb_parts[2].iov_len = sizeof(xcb_out);
10208 xcb_parts[3].iov_base = 0;
10209 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10210
10211 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
10212 return xcb_ret;
10213 }
10214
10215 xcb_get_keyboard_control_reply_t *
xcb_get_keyboard_control_reply(xcb_connection_t * c,xcb_get_keyboard_control_cookie_t cookie,xcb_generic_error_t ** e)10216 xcb_get_keyboard_control_reply (xcb_connection_t *c /**< */,
10217 xcb_get_keyboard_control_cookie_t cookie /**< */,
10218 xcb_generic_error_t **e /**< */)
10219 {
10220 return (xcb_get_keyboard_control_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
10221 }
10222
10223 xcb_void_cookie_t
xcb_bell_checked(xcb_connection_t * c,int8_t percent)10224 xcb_bell_checked (xcb_connection_t *c /**< */,
10225 int8_t percent /**< */)
10226 {
10227 static const xcb_protocol_request_t xcb_req = {
10228 /* count */ 2,
10229 /* ext */ 0,
10230 /* opcode */ XCB_BELL,
10231 /* isvoid */ 1
10232 };
10233
10234 struct iovec xcb_parts[4];
10235 xcb_void_cookie_t xcb_ret;
10236 xcb_bell_request_t xcb_out;
10237
10238 xcb_out.percent = percent;
10239
10240 xcb_parts[2].iov_base = (char *) &xcb_out;
10241 xcb_parts[2].iov_len = sizeof(xcb_out);
10242 xcb_parts[3].iov_base = 0;
10243 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10244
10245 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
10246 return xcb_ret;
10247 }
10248
10249 xcb_void_cookie_t
xcb_bell(xcb_connection_t * c,int8_t percent)10250 xcb_bell (xcb_connection_t *c /**< */,
10251 int8_t percent /**< */)
10252 {
10253 static const xcb_protocol_request_t xcb_req = {
10254 /* count */ 2,
10255 /* ext */ 0,
10256 /* opcode */ XCB_BELL,
10257 /* isvoid */ 1
10258 };
10259
10260 struct iovec xcb_parts[4];
10261 xcb_void_cookie_t xcb_ret;
10262 xcb_bell_request_t xcb_out;
10263
10264 xcb_out.percent = percent;
10265
10266 xcb_parts[2].iov_base = (char *) &xcb_out;
10267 xcb_parts[2].iov_len = sizeof(xcb_out);
10268 xcb_parts[3].iov_base = 0;
10269 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10270
10271 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
10272 return xcb_ret;
10273 }
10274
10275 xcb_void_cookie_t
xcb_change_pointer_control_checked(xcb_connection_t * c,int16_t acceleration_numerator,int16_t acceleration_denominator,int16_t threshold,uint8_t do_acceleration,uint8_t do_threshold)10276 xcb_change_pointer_control_checked (xcb_connection_t *c /**< */,
10277 int16_t acceleration_numerator /**< */,
10278 int16_t acceleration_denominator /**< */,
10279 int16_t threshold /**< */,
10280 uint8_t do_acceleration /**< */,
10281 uint8_t do_threshold /**< */)
10282 {
10283 static const xcb_protocol_request_t xcb_req = {
10284 /* count */ 2,
10285 /* ext */ 0,
10286 /* opcode */ XCB_CHANGE_POINTER_CONTROL,
10287 /* isvoid */ 1
10288 };
10289
10290 struct iovec xcb_parts[4];
10291 xcb_void_cookie_t xcb_ret;
10292 xcb_change_pointer_control_request_t xcb_out;
10293
10294 xcb_out.pad0 = 0;
10295 xcb_out.acceleration_numerator = acceleration_numerator;
10296 xcb_out.acceleration_denominator = acceleration_denominator;
10297 xcb_out.threshold = threshold;
10298 xcb_out.do_acceleration = do_acceleration;
10299 xcb_out.do_threshold = do_threshold;
10300
10301 xcb_parts[2].iov_base = (char *) &xcb_out;
10302 xcb_parts[2].iov_len = sizeof(xcb_out);
10303 xcb_parts[3].iov_base = 0;
10304 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10305
10306 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
10307 return xcb_ret;
10308 }
10309
10310 xcb_void_cookie_t
xcb_change_pointer_control(xcb_connection_t * c,int16_t acceleration_numerator,int16_t acceleration_denominator,int16_t threshold,uint8_t do_acceleration,uint8_t do_threshold)10311 xcb_change_pointer_control (xcb_connection_t *c /**< */,
10312 int16_t acceleration_numerator /**< */,
10313 int16_t acceleration_denominator /**< */,
10314 int16_t threshold /**< */,
10315 uint8_t do_acceleration /**< */,
10316 uint8_t do_threshold /**< */)
10317 {
10318 static const xcb_protocol_request_t xcb_req = {
10319 /* count */ 2,
10320 /* ext */ 0,
10321 /* opcode */ XCB_CHANGE_POINTER_CONTROL,
10322 /* isvoid */ 1
10323 };
10324
10325 struct iovec xcb_parts[4];
10326 xcb_void_cookie_t xcb_ret;
10327 xcb_change_pointer_control_request_t xcb_out;
10328
10329 xcb_out.pad0 = 0;
10330 xcb_out.acceleration_numerator = acceleration_numerator;
10331 xcb_out.acceleration_denominator = acceleration_denominator;
10332 xcb_out.threshold = threshold;
10333 xcb_out.do_acceleration = do_acceleration;
10334 xcb_out.do_threshold = do_threshold;
10335
10336 xcb_parts[2].iov_base = (char *) &xcb_out;
10337 xcb_parts[2].iov_len = sizeof(xcb_out);
10338 xcb_parts[3].iov_base = 0;
10339 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10340
10341 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
10342 return xcb_ret;
10343 }
10344
10345 xcb_get_pointer_control_cookie_t
xcb_get_pointer_control(xcb_connection_t * c)10346 xcb_get_pointer_control (xcb_connection_t *c /**< */)
10347 {
10348 static const xcb_protocol_request_t xcb_req = {
10349 /* count */ 2,
10350 /* ext */ 0,
10351 /* opcode */ XCB_GET_POINTER_CONTROL,
10352 /* isvoid */ 0
10353 };
10354
10355 struct iovec xcb_parts[4];
10356 xcb_get_pointer_control_cookie_t xcb_ret;
10357 xcb_get_pointer_control_request_t xcb_out;
10358
10359 xcb_out.pad0 = 0;
10360
10361 xcb_parts[2].iov_base = (char *) &xcb_out;
10362 xcb_parts[2].iov_len = sizeof(xcb_out);
10363 xcb_parts[3].iov_base = 0;
10364 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10365
10366 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
10367 return xcb_ret;
10368 }
10369
10370 xcb_get_pointer_control_cookie_t
xcb_get_pointer_control_unchecked(xcb_connection_t * c)10371 xcb_get_pointer_control_unchecked (xcb_connection_t *c /**< */)
10372 {
10373 static const xcb_protocol_request_t xcb_req = {
10374 /* count */ 2,
10375 /* ext */ 0,
10376 /* opcode */ XCB_GET_POINTER_CONTROL,
10377 /* isvoid */ 0
10378 };
10379
10380 struct iovec xcb_parts[4];
10381 xcb_get_pointer_control_cookie_t xcb_ret;
10382 xcb_get_pointer_control_request_t xcb_out;
10383
10384 xcb_out.pad0 = 0;
10385
10386 xcb_parts[2].iov_base = (char *) &xcb_out;
10387 xcb_parts[2].iov_len = sizeof(xcb_out);
10388 xcb_parts[3].iov_base = 0;
10389 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10390
10391 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
10392 return xcb_ret;
10393 }
10394
10395 xcb_get_pointer_control_reply_t *
xcb_get_pointer_control_reply(xcb_connection_t * c,xcb_get_pointer_control_cookie_t cookie,xcb_generic_error_t ** e)10396 xcb_get_pointer_control_reply (xcb_connection_t *c /**< */,
10397 xcb_get_pointer_control_cookie_t cookie /**< */,
10398 xcb_generic_error_t **e /**< */)
10399 {
10400 return (xcb_get_pointer_control_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
10401 }
10402
10403 xcb_void_cookie_t
xcb_set_screen_saver_checked(xcb_connection_t * c,int16_t timeout,int16_t interval,uint8_t prefer_blanking,uint8_t allow_exposures)10404 xcb_set_screen_saver_checked (xcb_connection_t *c /**< */,
10405 int16_t timeout /**< */,
10406 int16_t interval /**< */,
10407 uint8_t prefer_blanking /**< */,
10408 uint8_t allow_exposures /**< */)
10409 {
10410 static const xcb_protocol_request_t xcb_req = {
10411 /* count */ 2,
10412 /* ext */ 0,
10413 /* opcode */ XCB_SET_SCREEN_SAVER,
10414 /* isvoid */ 1
10415 };
10416
10417 struct iovec xcb_parts[4];
10418 xcb_void_cookie_t xcb_ret;
10419 xcb_set_screen_saver_request_t xcb_out;
10420
10421 xcb_out.pad0 = 0;
10422 xcb_out.timeout = timeout;
10423 xcb_out.interval = interval;
10424 xcb_out.prefer_blanking = prefer_blanking;
10425 xcb_out.allow_exposures = allow_exposures;
10426
10427 xcb_parts[2].iov_base = (char *) &xcb_out;
10428 xcb_parts[2].iov_len = sizeof(xcb_out);
10429 xcb_parts[3].iov_base = 0;
10430 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10431
10432 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
10433 return xcb_ret;
10434 }
10435
10436 xcb_void_cookie_t
xcb_set_screen_saver(xcb_connection_t * c,int16_t timeout,int16_t interval,uint8_t prefer_blanking,uint8_t allow_exposures)10437 xcb_set_screen_saver (xcb_connection_t *c /**< */,
10438 int16_t timeout /**< */,
10439 int16_t interval /**< */,
10440 uint8_t prefer_blanking /**< */,
10441 uint8_t allow_exposures /**< */)
10442 {
10443 static const xcb_protocol_request_t xcb_req = {
10444 /* count */ 2,
10445 /* ext */ 0,
10446 /* opcode */ XCB_SET_SCREEN_SAVER,
10447 /* isvoid */ 1
10448 };
10449
10450 struct iovec xcb_parts[4];
10451 xcb_void_cookie_t xcb_ret;
10452 xcb_set_screen_saver_request_t xcb_out;
10453
10454 xcb_out.pad0 = 0;
10455 xcb_out.timeout = timeout;
10456 xcb_out.interval = interval;
10457 xcb_out.prefer_blanking = prefer_blanking;
10458 xcb_out.allow_exposures = allow_exposures;
10459
10460 xcb_parts[2].iov_base = (char *) &xcb_out;
10461 xcb_parts[2].iov_len = sizeof(xcb_out);
10462 xcb_parts[3].iov_base = 0;
10463 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10464
10465 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
10466 return xcb_ret;
10467 }
10468
10469 xcb_get_screen_saver_cookie_t
xcb_get_screen_saver(xcb_connection_t * c)10470 xcb_get_screen_saver (xcb_connection_t *c /**< */)
10471 {
10472 static const xcb_protocol_request_t xcb_req = {
10473 /* count */ 2,
10474 /* ext */ 0,
10475 /* opcode */ XCB_GET_SCREEN_SAVER,
10476 /* isvoid */ 0
10477 };
10478
10479 struct iovec xcb_parts[4];
10480 xcb_get_screen_saver_cookie_t xcb_ret;
10481 xcb_get_screen_saver_request_t xcb_out;
10482
10483 xcb_out.pad0 = 0;
10484
10485 xcb_parts[2].iov_base = (char *) &xcb_out;
10486 xcb_parts[2].iov_len = sizeof(xcb_out);
10487 xcb_parts[3].iov_base = 0;
10488 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10489
10490 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
10491 return xcb_ret;
10492 }
10493
10494 xcb_get_screen_saver_cookie_t
xcb_get_screen_saver_unchecked(xcb_connection_t * c)10495 xcb_get_screen_saver_unchecked (xcb_connection_t *c /**< */)
10496 {
10497 static const xcb_protocol_request_t xcb_req = {
10498 /* count */ 2,
10499 /* ext */ 0,
10500 /* opcode */ XCB_GET_SCREEN_SAVER,
10501 /* isvoid */ 0
10502 };
10503
10504 struct iovec xcb_parts[4];
10505 xcb_get_screen_saver_cookie_t xcb_ret;
10506 xcb_get_screen_saver_request_t xcb_out;
10507
10508 xcb_out.pad0 = 0;
10509
10510 xcb_parts[2].iov_base = (char *) &xcb_out;
10511 xcb_parts[2].iov_len = sizeof(xcb_out);
10512 xcb_parts[3].iov_base = 0;
10513 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10514
10515 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
10516 return xcb_ret;
10517 }
10518
10519 xcb_get_screen_saver_reply_t *
xcb_get_screen_saver_reply(xcb_connection_t * c,xcb_get_screen_saver_cookie_t cookie,xcb_generic_error_t ** e)10520 xcb_get_screen_saver_reply (xcb_connection_t *c /**< */,
10521 xcb_get_screen_saver_cookie_t cookie /**< */,
10522 xcb_generic_error_t **e /**< */)
10523 {
10524 return (xcb_get_screen_saver_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
10525 }
10526
10527 int
xcb_change_hosts_sizeof(const void * _buffer)10528 xcb_change_hosts_sizeof (const void *_buffer /**< */)
10529 {
10530 char *xcb_tmp = (char *)_buffer;
10531 const xcb_change_hosts_request_t *_aux = (xcb_change_hosts_request_t *)_buffer;
10532 unsigned int xcb_buffer_len = 0;
10533 unsigned int xcb_block_len = 0;
10534 unsigned int xcb_pad = 0;
10535 unsigned int xcb_align_to = 0;
10536
10537
10538 xcb_block_len += sizeof(xcb_change_hosts_request_t);
10539 xcb_tmp += xcb_block_len;
10540 xcb_buffer_len += xcb_block_len;
10541 xcb_block_len = 0;
10542 /* address */
10543 xcb_block_len += _aux->address_len * sizeof(uint8_t);
10544 xcb_tmp += xcb_block_len;
10545 xcb_align_to = ALIGNOF(uint8_t);
10546 /* insert padding */
10547 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
10548 xcb_buffer_len += xcb_block_len + xcb_pad;
10549 if (0 != xcb_pad) {
10550 xcb_tmp += xcb_pad;
10551 xcb_pad = 0;
10552 }
10553 xcb_block_len = 0;
10554
10555 return xcb_buffer_len;
10556 }
10557
10558 xcb_void_cookie_t
xcb_change_hosts_checked(xcb_connection_t * c,uint8_t mode,uint8_t family,uint16_t address_len,const uint8_t * address)10559 xcb_change_hosts_checked (xcb_connection_t *c /**< */,
10560 uint8_t mode /**< */,
10561 uint8_t family /**< */,
10562 uint16_t address_len /**< */,
10563 const uint8_t *address /**< */)
10564 {
10565 static const xcb_protocol_request_t xcb_req = {
10566 /* count */ 4,
10567 /* ext */ 0,
10568 /* opcode */ XCB_CHANGE_HOSTS,
10569 /* isvoid */ 1
10570 };
10571
10572 struct iovec xcb_parts[6];
10573 xcb_void_cookie_t xcb_ret;
10574 xcb_change_hosts_request_t xcb_out;
10575
10576 xcb_out.mode = mode;
10577 xcb_out.family = family;
10578 xcb_out.pad0 = 0;
10579 xcb_out.address_len = address_len;
10580
10581 xcb_parts[2].iov_base = (char *) &xcb_out;
10582 xcb_parts[2].iov_len = sizeof(xcb_out);
10583 xcb_parts[3].iov_base = 0;
10584 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10585 /* uint8_t address */
10586 xcb_parts[4].iov_base = (char *) address;
10587 xcb_parts[4].iov_len = address_len * sizeof(uint8_t);
10588 xcb_parts[5].iov_base = 0;
10589 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
10590
10591 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
10592 return xcb_ret;
10593 }
10594
10595 xcb_void_cookie_t
xcb_change_hosts(xcb_connection_t * c,uint8_t mode,uint8_t family,uint16_t address_len,const uint8_t * address)10596 xcb_change_hosts (xcb_connection_t *c /**< */,
10597 uint8_t mode /**< */,
10598 uint8_t family /**< */,
10599 uint16_t address_len /**< */,
10600 const uint8_t *address /**< */)
10601 {
10602 static const xcb_protocol_request_t xcb_req = {
10603 /* count */ 4,
10604 /* ext */ 0,
10605 /* opcode */ XCB_CHANGE_HOSTS,
10606 /* isvoid */ 1
10607 };
10608
10609 struct iovec xcb_parts[6];
10610 xcb_void_cookie_t xcb_ret;
10611 xcb_change_hosts_request_t xcb_out;
10612
10613 xcb_out.mode = mode;
10614 xcb_out.family = family;
10615 xcb_out.pad0 = 0;
10616 xcb_out.address_len = address_len;
10617
10618 xcb_parts[2].iov_base = (char *) &xcb_out;
10619 xcb_parts[2].iov_len = sizeof(xcb_out);
10620 xcb_parts[3].iov_base = 0;
10621 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10622 /* uint8_t address */
10623 xcb_parts[4].iov_base = (char *) address;
10624 xcb_parts[4].iov_len = address_len * sizeof(uint8_t);
10625 xcb_parts[5].iov_base = 0;
10626 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
10627
10628 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
10629 return xcb_ret;
10630 }
10631
10632 int
xcb_host_sizeof(const void * _buffer)10633 xcb_host_sizeof (const void *_buffer /**< */)
10634 {
10635 char *xcb_tmp = (char *)_buffer;
10636 const xcb_host_t *_aux = (xcb_host_t *)_buffer;
10637 unsigned int xcb_buffer_len = 0;
10638 unsigned int xcb_block_len = 0;
10639 unsigned int xcb_pad = 0;
10640 unsigned int xcb_align_to = 0;
10641
10642
10643 xcb_block_len += sizeof(xcb_host_t);
10644 xcb_tmp += xcb_block_len;
10645 xcb_buffer_len += xcb_block_len;
10646 xcb_block_len = 0;
10647 /* address */
10648 xcb_block_len += _aux->address_len * sizeof(uint8_t);
10649 xcb_tmp += xcb_block_len;
10650 xcb_align_to = ALIGNOF(uint8_t);
10651 /* insert padding */
10652 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
10653 xcb_buffer_len += xcb_block_len + xcb_pad;
10654 if (0 != xcb_pad) {
10655 xcb_tmp += xcb_pad;
10656 xcb_pad = 0;
10657 }
10658 xcb_block_len = 0;
10659
10660 return xcb_buffer_len;
10661 }
10662
10663 uint8_t *
xcb_host_address(const xcb_host_t * R)10664 xcb_host_address (const xcb_host_t *R /**< */)
10665 {
10666 return (uint8_t *) (R + 1);
10667 }
10668
10669 int
xcb_host_address_length(const xcb_host_t * R)10670 xcb_host_address_length (const xcb_host_t *R /**< */)
10671 {
10672 return R->address_len;
10673 }
10674
10675 xcb_generic_iterator_t
xcb_host_address_end(const xcb_host_t * R)10676 xcb_host_address_end (const xcb_host_t *R /**< */)
10677 {
10678 xcb_generic_iterator_t i;
10679 i.data = ((uint8_t *) (R + 1)) + (R->address_len);
10680 i.rem = 0;
10681 i.index = (char *) i.data - (char *) R;
10682 return i;
10683 }
10684
10685 void
xcb_host_next(xcb_host_iterator_t * i)10686 xcb_host_next (xcb_host_iterator_t *i /**< */)
10687 {
10688 xcb_host_t *R = i->data;
10689 xcb_generic_iterator_t child;
10690 child.data = (xcb_host_t *)(((char *)R) + xcb_host_sizeof(R));
10691 i->index = (char *) child.data - (char *) i->data;
10692 --i->rem;
10693 i->data = (xcb_host_t *) child.data;
10694 }
10695
10696 xcb_generic_iterator_t
xcb_host_end(xcb_host_iterator_t i)10697 xcb_host_end (xcb_host_iterator_t i /**< */)
10698 {
10699 xcb_generic_iterator_t ret;
10700 while(i.rem > 0)
10701 xcb_host_next(&i);
10702 ret.data = i.data;
10703 ret.rem = i.rem;
10704 ret.index = i.index;
10705 return ret;
10706 }
10707
10708 int
xcb_list_hosts_sizeof(const void * _buffer)10709 xcb_list_hosts_sizeof (const void *_buffer /**< */)
10710 {
10711 char *xcb_tmp = (char *)_buffer;
10712 const xcb_list_hosts_reply_t *_aux = (xcb_list_hosts_reply_t *)_buffer;
10713 unsigned int xcb_buffer_len = 0;
10714 unsigned int xcb_block_len = 0;
10715 unsigned int xcb_pad = 0;
10716 unsigned int xcb_align_to = 0;
10717
10718 unsigned int i;
10719 unsigned int xcb_tmp_len;
10720
10721 xcb_block_len += sizeof(xcb_list_hosts_reply_t);
10722 xcb_tmp += xcb_block_len;
10723 xcb_buffer_len += xcb_block_len;
10724 xcb_block_len = 0;
10725 /* hosts */
10726 for(i=0; i<_aux->hosts_len; i++) {
10727 xcb_tmp_len = xcb_host_sizeof(xcb_tmp);
10728 xcb_block_len += xcb_tmp_len;
10729 xcb_tmp += xcb_tmp_len;
10730 }
10731 xcb_align_to = ALIGNOF(xcb_host_t);
10732 /* insert padding */
10733 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
10734 xcb_buffer_len += xcb_block_len + xcb_pad;
10735 if (0 != xcb_pad) {
10736 xcb_tmp += xcb_pad;
10737 xcb_pad = 0;
10738 }
10739 xcb_block_len = 0;
10740
10741 return xcb_buffer_len;
10742 }
10743
10744 xcb_list_hosts_cookie_t
xcb_list_hosts(xcb_connection_t * c)10745 xcb_list_hosts (xcb_connection_t *c /**< */)
10746 {
10747 static const xcb_protocol_request_t xcb_req = {
10748 /* count */ 2,
10749 /* ext */ 0,
10750 /* opcode */ XCB_LIST_HOSTS,
10751 /* isvoid */ 0
10752 };
10753
10754 struct iovec xcb_parts[4];
10755 xcb_list_hosts_cookie_t xcb_ret;
10756 xcb_list_hosts_request_t xcb_out;
10757
10758 xcb_out.pad0 = 0;
10759
10760 xcb_parts[2].iov_base = (char *) &xcb_out;
10761 xcb_parts[2].iov_len = sizeof(xcb_out);
10762 xcb_parts[3].iov_base = 0;
10763 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10764
10765 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
10766 return xcb_ret;
10767 }
10768
10769 xcb_list_hosts_cookie_t
xcb_list_hosts_unchecked(xcb_connection_t * c)10770 xcb_list_hosts_unchecked (xcb_connection_t *c /**< */)
10771 {
10772 static const xcb_protocol_request_t xcb_req = {
10773 /* count */ 2,
10774 /* ext */ 0,
10775 /* opcode */ XCB_LIST_HOSTS,
10776 /* isvoid */ 0
10777 };
10778
10779 struct iovec xcb_parts[4];
10780 xcb_list_hosts_cookie_t xcb_ret;
10781 xcb_list_hosts_request_t xcb_out;
10782
10783 xcb_out.pad0 = 0;
10784
10785 xcb_parts[2].iov_base = (char *) &xcb_out;
10786 xcb_parts[2].iov_len = sizeof(xcb_out);
10787 xcb_parts[3].iov_base = 0;
10788 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10789
10790 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
10791 return xcb_ret;
10792 }
10793
10794 int
xcb_list_hosts_hosts_length(const xcb_list_hosts_reply_t * R)10795 xcb_list_hosts_hosts_length (const xcb_list_hosts_reply_t *R /**< */)
10796 {
10797 return R->hosts_len;
10798 }
10799
10800 xcb_host_iterator_t
xcb_list_hosts_hosts_iterator(const xcb_list_hosts_reply_t * R)10801 xcb_list_hosts_hosts_iterator (const xcb_list_hosts_reply_t *R /**< */)
10802 {
10803 xcb_host_iterator_t i;
10804 i.data = (xcb_host_t *) (R + 1);
10805 i.rem = R->hosts_len;
10806 i.index = (char *) i.data - (char *) R;
10807 return i;
10808 }
10809
10810 xcb_list_hosts_reply_t *
xcb_list_hosts_reply(xcb_connection_t * c,xcb_list_hosts_cookie_t cookie,xcb_generic_error_t ** e)10811 xcb_list_hosts_reply (xcb_connection_t *c /**< */,
10812 xcb_list_hosts_cookie_t cookie /**< */,
10813 xcb_generic_error_t **e /**< */)
10814 {
10815 return (xcb_list_hosts_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
10816 }
10817
10818 xcb_void_cookie_t
xcb_set_access_control_checked(xcb_connection_t * c,uint8_t mode)10819 xcb_set_access_control_checked (xcb_connection_t *c /**< */,
10820 uint8_t mode /**< */)
10821 {
10822 static const xcb_protocol_request_t xcb_req = {
10823 /* count */ 2,
10824 /* ext */ 0,
10825 /* opcode */ XCB_SET_ACCESS_CONTROL,
10826 /* isvoid */ 1
10827 };
10828
10829 struct iovec xcb_parts[4];
10830 xcb_void_cookie_t xcb_ret;
10831 xcb_set_access_control_request_t xcb_out;
10832
10833 xcb_out.mode = mode;
10834
10835 xcb_parts[2].iov_base = (char *) &xcb_out;
10836 xcb_parts[2].iov_len = sizeof(xcb_out);
10837 xcb_parts[3].iov_base = 0;
10838 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10839
10840 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
10841 return xcb_ret;
10842 }
10843
10844 xcb_void_cookie_t
xcb_set_access_control(xcb_connection_t * c,uint8_t mode)10845 xcb_set_access_control (xcb_connection_t *c /**< */,
10846 uint8_t mode /**< */)
10847 {
10848 static const xcb_protocol_request_t xcb_req = {
10849 /* count */ 2,
10850 /* ext */ 0,
10851 /* opcode */ XCB_SET_ACCESS_CONTROL,
10852 /* isvoid */ 1
10853 };
10854
10855 struct iovec xcb_parts[4];
10856 xcb_void_cookie_t xcb_ret;
10857 xcb_set_access_control_request_t xcb_out;
10858
10859 xcb_out.mode = mode;
10860
10861 xcb_parts[2].iov_base = (char *) &xcb_out;
10862 xcb_parts[2].iov_len = sizeof(xcb_out);
10863 xcb_parts[3].iov_base = 0;
10864 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10865
10866 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
10867 return xcb_ret;
10868 }
10869
10870 xcb_void_cookie_t
xcb_set_close_down_mode_checked(xcb_connection_t * c,uint8_t mode)10871 xcb_set_close_down_mode_checked (xcb_connection_t *c /**< */,
10872 uint8_t mode /**< */)
10873 {
10874 static const xcb_protocol_request_t xcb_req = {
10875 /* count */ 2,
10876 /* ext */ 0,
10877 /* opcode */ XCB_SET_CLOSE_DOWN_MODE,
10878 /* isvoid */ 1
10879 };
10880
10881 struct iovec xcb_parts[4];
10882 xcb_void_cookie_t xcb_ret;
10883 xcb_set_close_down_mode_request_t xcb_out;
10884
10885 xcb_out.mode = mode;
10886
10887 xcb_parts[2].iov_base = (char *) &xcb_out;
10888 xcb_parts[2].iov_len = sizeof(xcb_out);
10889 xcb_parts[3].iov_base = 0;
10890 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10891
10892 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
10893 return xcb_ret;
10894 }
10895
10896 xcb_void_cookie_t
xcb_set_close_down_mode(xcb_connection_t * c,uint8_t mode)10897 xcb_set_close_down_mode (xcb_connection_t *c /**< */,
10898 uint8_t mode /**< */)
10899 {
10900 static const xcb_protocol_request_t xcb_req = {
10901 /* count */ 2,
10902 /* ext */ 0,
10903 /* opcode */ XCB_SET_CLOSE_DOWN_MODE,
10904 /* isvoid */ 1
10905 };
10906
10907 struct iovec xcb_parts[4];
10908 xcb_void_cookie_t xcb_ret;
10909 xcb_set_close_down_mode_request_t xcb_out;
10910
10911 xcb_out.mode = mode;
10912
10913 xcb_parts[2].iov_base = (char *) &xcb_out;
10914 xcb_parts[2].iov_len = sizeof(xcb_out);
10915 xcb_parts[3].iov_base = 0;
10916 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10917
10918 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
10919 return xcb_ret;
10920 }
10921
10922 xcb_void_cookie_t
xcb_kill_client_checked(xcb_connection_t * c,uint32_t resource)10923 xcb_kill_client_checked (xcb_connection_t *c /**< */,
10924 uint32_t resource /**< */)
10925 {
10926 static const xcb_protocol_request_t xcb_req = {
10927 /* count */ 2,
10928 /* ext */ 0,
10929 /* opcode */ XCB_KILL_CLIENT,
10930 /* isvoid */ 1
10931 };
10932
10933 struct iovec xcb_parts[4];
10934 xcb_void_cookie_t xcb_ret;
10935 xcb_kill_client_request_t xcb_out;
10936
10937 xcb_out.pad0 = 0;
10938 xcb_out.resource = resource;
10939
10940 xcb_parts[2].iov_base = (char *) &xcb_out;
10941 xcb_parts[2].iov_len = sizeof(xcb_out);
10942 xcb_parts[3].iov_base = 0;
10943 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10944
10945 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
10946 return xcb_ret;
10947 }
10948
10949 xcb_void_cookie_t
xcb_kill_client(xcb_connection_t * c,uint32_t resource)10950 xcb_kill_client (xcb_connection_t *c /**< */,
10951 uint32_t resource /**< */)
10952 {
10953 static const xcb_protocol_request_t xcb_req = {
10954 /* count */ 2,
10955 /* ext */ 0,
10956 /* opcode */ XCB_KILL_CLIENT,
10957 /* isvoid */ 1
10958 };
10959
10960 struct iovec xcb_parts[4];
10961 xcb_void_cookie_t xcb_ret;
10962 xcb_kill_client_request_t xcb_out;
10963
10964 xcb_out.pad0 = 0;
10965 xcb_out.resource = resource;
10966
10967 xcb_parts[2].iov_base = (char *) &xcb_out;
10968 xcb_parts[2].iov_len = sizeof(xcb_out);
10969 xcb_parts[3].iov_base = 0;
10970 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
10971
10972 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
10973 return xcb_ret;
10974 }
10975
10976 int
xcb_rotate_properties_sizeof(const void * _buffer)10977 xcb_rotate_properties_sizeof (const void *_buffer /**< */)
10978 {
10979 char *xcb_tmp = (char *)_buffer;
10980 const xcb_rotate_properties_request_t *_aux = (xcb_rotate_properties_request_t *)_buffer;
10981 unsigned int xcb_buffer_len = 0;
10982 unsigned int xcb_block_len = 0;
10983 unsigned int xcb_pad = 0;
10984 unsigned int xcb_align_to = 0;
10985
10986
10987 xcb_block_len += sizeof(xcb_rotate_properties_request_t);
10988 xcb_tmp += xcb_block_len;
10989 xcb_buffer_len += xcb_block_len;
10990 xcb_block_len = 0;
10991 /* atoms */
10992 xcb_block_len += _aux->atoms_len * sizeof(xcb_atom_t);
10993 xcb_tmp += xcb_block_len;
10994 xcb_align_to = ALIGNOF(xcb_atom_t);
10995 /* insert padding */
10996 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
10997 xcb_buffer_len += xcb_block_len + xcb_pad;
10998 if (0 != xcb_pad) {
10999 xcb_tmp += xcb_pad;
11000 xcb_pad = 0;
11001 }
11002 xcb_block_len = 0;
11003
11004 return xcb_buffer_len;
11005 }
11006
11007 xcb_void_cookie_t
xcb_rotate_properties_checked(xcb_connection_t * c,xcb_window_t window,uint16_t atoms_len,int16_t delta,const xcb_atom_t * atoms)11008 xcb_rotate_properties_checked (xcb_connection_t *c /**< */,
11009 xcb_window_t window /**< */,
11010 uint16_t atoms_len /**< */,
11011 int16_t delta /**< */,
11012 const xcb_atom_t *atoms /**< */)
11013 {
11014 static const xcb_protocol_request_t xcb_req = {
11015 /* count */ 4,
11016 /* ext */ 0,
11017 /* opcode */ XCB_ROTATE_PROPERTIES,
11018 /* isvoid */ 1
11019 };
11020
11021 struct iovec xcb_parts[6];
11022 xcb_void_cookie_t xcb_ret;
11023 xcb_rotate_properties_request_t xcb_out;
11024
11025 xcb_out.pad0 = 0;
11026 xcb_out.window = window;
11027 xcb_out.atoms_len = atoms_len;
11028 xcb_out.delta = delta;
11029
11030 xcb_parts[2].iov_base = (char *) &xcb_out;
11031 xcb_parts[2].iov_len = sizeof(xcb_out);
11032 xcb_parts[3].iov_base = 0;
11033 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
11034 /* xcb_atom_t atoms */
11035 xcb_parts[4].iov_base = (char *) atoms;
11036 xcb_parts[4].iov_len = atoms_len * sizeof(xcb_atom_t);
11037 xcb_parts[5].iov_base = 0;
11038 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
11039
11040 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
11041 return xcb_ret;
11042 }
11043
11044 xcb_void_cookie_t
xcb_rotate_properties(xcb_connection_t * c,xcb_window_t window,uint16_t atoms_len,int16_t delta,const xcb_atom_t * atoms)11045 xcb_rotate_properties (xcb_connection_t *c /**< */,
11046 xcb_window_t window /**< */,
11047 uint16_t atoms_len /**< */,
11048 int16_t delta /**< */,
11049 const xcb_atom_t *atoms /**< */)
11050 {
11051 static const xcb_protocol_request_t xcb_req = {
11052 /* count */ 4,
11053 /* ext */ 0,
11054 /* opcode */ XCB_ROTATE_PROPERTIES,
11055 /* isvoid */ 1
11056 };
11057
11058 struct iovec xcb_parts[6];
11059 xcb_void_cookie_t xcb_ret;
11060 xcb_rotate_properties_request_t xcb_out;
11061
11062 xcb_out.pad0 = 0;
11063 xcb_out.window = window;
11064 xcb_out.atoms_len = atoms_len;
11065 xcb_out.delta = delta;
11066
11067 xcb_parts[2].iov_base = (char *) &xcb_out;
11068 xcb_parts[2].iov_len = sizeof(xcb_out);
11069 xcb_parts[3].iov_base = 0;
11070 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
11071 /* xcb_atom_t atoms */
11072 xcb_parts[4].iov_base = (char *) atoms;
11073 xcb_parts[4].iov_len = atoms_len * sizeof(xcb_atom_t);
11074 xcb_parts[5].iov_base = 0;
11075 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
11076
11077 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
11078 return xcb_ret;
11079 }
11080
11081 xcb_void_cookie_t
xcb_force_screen_saver_checked(xcb_connection_t * c,uint8_t mode)11082 xcb_force_screen_saver_checked (xcb_connection_t *c /**< */,
11083 uint8_t mode /**< */)
11084 {
11085 static const xcb_protocol_request_t xcb_req = {
11086 /* count */ 2,
11087 /* ext */ 0,
11088 /* opcode */ XCB_FORCE_SCREEN_SAVER,
11089 /* isvoid */ 1
11090 };
11091
11092 struct iovec xcb_parts[4];
11093 xcb_void_cookie_t xcb_ret;
11094 xcb_force_screen_saver_request_t xcb_out;
11095
11096 xcb_out.mode = mode;
11097
11098 xcb_parts[2].iov_base = (char *) &xcb_out;
11099 xcb_parts[2].iov_len = sizeof(xcb_out);
11100 xcb_parts[3].iov_base = 0;
11101 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
11102
11103 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
11104 return xcb_ret;
11105 }
11106
11107 xcb_void_cookie_t
xcb_force_screen_saver(xcb_connection_t * c,uint8_t mode)11108 xcb_force_screen_saver (xcb_connection_t *c /**< */,
11109 uint8_t mode /**< */)
11110 {
11111 static const xcb_protocol_request_t xcb_req = {
11112 /* count */ 2,
11113 /* ext */ 0,
11114 /* opcode */ XCB_FORCE_SCREEN_SAVER,
11115 /* isvoid */ 1
11116 };
11117
11118 struct iovec xcb_parts[4];
11119 xcb_void_cookie_t xcb_ret;
11120 xcb_force_screen_saver_request_t xcb_out;
11121
11122 xcb_out.mode = mode;
11123
11124 xcb_parts[2].iov_base = (char *) &xcb_out;
11125 xcb_parts[2].iov_len = sizeof(xcb_out);
11126 xcb_parts[3].iov_base = 0;
11127 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
11128
11129 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
11130 return xcb_ret;
11131 }
11132
11133 int
xcb_set_pointer_mapping_sizeof(const void * _buffer)11134 xcb_set_pointer_mapping_sizeof (const void *_buffer /**< */)
11135 {
11136 char *xcb_tmp = (char *)_buffer;
11137 const xcb_set_pointer_mapping_request_t *_aux = (xcb_set_pointer_mapping_request_t *)_buffer;
11138 unsigned int xcb_buffer_len = 0;
11139 unsigned int xcb_block_len = 0;
11140 unsigned int xcb_pad = 0;
11141 unsigned int xcb_align_to = 0;
11142
11143
11144 xcb_block_len += sizeof(xcb_set_pointer_mapping_request_t);
11145 xcb_tmp += xcb_block_len;
11146 xcb_buffer_len += xcb_block_len;
11147 xcb_block_len = 0;
11148 /* map */
11149 xcb_block_len += _aux->map_len * sizeof(uint8_t);
11150 xcb_tmp += xcb_block_len;
11151 xcb_align_to = ALIGNOF(uint8_t);
11152 /* insert padding */
11153 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
11154 xcb_buffer_len += xcb_block_len + xcb_pad;
11155 if (0 != xcb_pad) {
11156 xcb_tmp += xcb_pad;
11157 xcb_pad = 0;
11158 }
11159 xcb_block_len = 0;
11160
11161 return xcb_buffer_len;
11162 }
11163
11164 xcb_set_pointer_mapping_cookie_t
xcb_set_pointer_mapping(xcb_connection_t * c,uint8_t map_len,const uint8_t * map)11165 xcb_set_pointer_mapping (xcb_connection_t *c /**< */,
11166 uint8_t map_len /**< */,
11167 const uint8_t *map /**< */)
11168 {
11169 static const xcb_protocol_request_t xcb_req = {
11170 /* count */ 4,
11171 /* ext */ 0,
11172 /* opcode */ XCB_SET_POINTER_MAPPING,
11173 /* isvoid */ 0
11174 };
11175
11176 struct iovec xcb_parts[6];
11177 xcb_set_pointer_mapping_cookie_t xcb_ret;
11178 xcb_set_pointer_mapping_request_t xcb_out;
11179
11180 xcb_out.map_len = map_len;
11181
11182 xcb_parts[2].iov_base = (char *) &xcb_out;
11183 xcb_parts[2].iov_len = sizeof(xcb_out);
11184 xcb_parts[3].iov_base = 0;
11185 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
11186 /* uint8_t map */
11187 xcb_parts[4].iov_base = (char *) map;
11188 xcb_parts[4].iov_len = map_len * sizeof(uint8_t);
11189 xcb_parts[5].iov_base = 0;
11190 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
11191
11192 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
11193 return xcb_ret;
11194 }
11195
11196 xcb_set_pointer_mapping_cookie_t
xcb_set_pointer_mapping_unchecked(xcb_connection_t * c,uint8_t map_len,const uint8_t * map)11197 xcb_set_pointer_mapping_unchecked (xcb_connection_t *c /**< */,
11198 uint8_t map_len /**< */,
11199 const uint8_t *map /**< */)
11200 {
11201 static const xcb_protocol_request_t xcb_req = {
11202 /* count */ 4,
11203 /* ext */ 0,
11204 /* opcode */ XCB_SET_POINTER_MAPPING,
11205 /* isvoid */ 0
11206 };
11207
11208 struct iovec xcb_parts[6];
11209 xcb_set_pointer_mapping_cookie_t xcb_ret;
11210 xcb_set_pointer_mapping_request_t xcb_out;
11211
11212 xcb_out.map_len = map_len;
11213
11214 xcb_parts[2].iov_base = (char *) &xcb_out;
11215 xcb_parts[2].iov_len = sizeof(xcb_out);
11216 xcb_parts[3].iov_base = 0;
11217 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
11218 /* uint8_t map */
11219 xcb_parts[4].iov_base = (char *) map;
11220 xcb_parts[4].iov_len = map_len * sizeof(uint8_t);
11221 xcb_parts[5].iov_base = 0;
11222 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
11223
11224 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
11225 return xcb_ret;
11226 }
11227
11228 xcb_set_pointer_mapping_reply_t *
xcb_set_pointer_mapping_reply(xcb_connection_t * c,xcb_set_pointer_mapping_cookie_t cookie,xcb_generic_error_t ** e)11229 xcb_set_pointer_mapping_reply (xcb_connection_t *c /**< */,
11230 xcb_set_pointer_mapping_cookie_t cookie /**< */,
11231 xcb_generic_error_t **e /**< */)
11232 {
11233 return (xcb_set_pointer_mapping_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
11234 }
11235
11236 int
xcb_get_pointer_mapping_sizeof(const void * _buffer)11237 xcb_get_pointer_mapping_sizeof (const void *_buffer /**< */)
11238 {
11239 char *xcb_tmp = (char *)_buffer;
11240 const xcb_get_pointer_mapping_reply_t *_aux = (xcb_get_pointer_mapping_reply_t *)_buffer;
11241 unsigned int xcb_buffer_len = 0;
11242 unsigned int xcb_block_len = 0;
11243 unsigned int xcb_pad = 0;
11244 unsigned int xcb_align_to = 0;
11245
11246
11247 xcb_block_len += sizeof(xcb_get_pointer_mapping_reply_t);
11248 xcb_tmp += xcb_block_len;
11249 xcb_buffer_len += xcb_block_len;
11250 xcb_block_len = 0;
11251 /* map */
11252 xcb_block_len += _aux->map_len * sizeof(uint8_t);
11253 xcb_tmp += xcb_block_len;
11254 xcb_align_to = ALIGNOF(uint8_t);
11255 /* insert padding */
11256 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
11257 xcb_buffer_len += xcb_block_len + xcb_pad;
11258 if (0 != xcb_pad) {
11259 xcb_tmp += xcb_pad;
11260 xcb_pad = 0;
11261 }
11262 xcb_block_len = 0;
11263
11264 return xcb_buffer_len;
11265 }
11266
11267 xcb_get_pointer_mapping_cookie_t
xcb_get_pointer_mapping(xcb_connection_t * c)11268 xcb_get_pointer_mapping (xcb_connection_t *c /**< */)
11269 {
11270 static const xcb_protocol_request_t xcb_req = {
11271 /* count */ 2,
11272 /* ext */ 0,
11273 /* opcode */ XCB_GET_POINTER_MAPPING,
11274 /* isvoid */ 0
11275 };
11276
11277 struct iovec xcb_parts[4];
11278 xcb_get_pointer_mapping_cookie_t xcb_ret;
11279 xcb_get_pointer_mapping_request_t xcb_out;
11280
11281 xcb_out.pad0 = 0;
11282
11283 xcb_parts[2].iov_base = (char *) &xcb_out;
11284 xcb_parts[2].iov_len = sizeof(xcb_out);
11285 xcb_parts[3].iov_base = 0;
11286 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
11287
11288 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
11289 return xcb_ret;
11290 }
11291
11292 xcb_get_pointer_mapping_cookie_t
xcb_get_pointer_mapping_unchecked(xcb_connection_t * c)11293 xcb_get_pointer_mapping_unchecked (xcb_connection_t *c /**< */)
11294 {
11295 static const xcb_protocol_request_t xcb_req = {
11296 /* count */ 2,
11297 /* ext */ 0,
11298 /* opcode */ XCB_GET_POINTER_MAPPING,
11299 /* isvoid */ 0
11300 };
11301
11302 struct iovec xcb_parts[4];
11303 xcb_get_pointer_mapping_cookie_t xcb_ret;
11304 xcb_get_pointer_mapping_request_t xcb_out;
11305
11306 xcb_out.pad0 = 0;
11307
11308 xcb_parts[2].iov_base = (char *) &xcb_out;
11309 xcb_parts[2].iov_len = sizeof(xcb_out);
11310 xcb_parts[3].iov_base = 0;
11311 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
11312
11313 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
11314 return xcb_ret;
11315 }
11316
11317 uint8_t *
xcb_get_pointer_mapping_map(const xcb_get_pointer_mapping_reply_t * R)11318 xcb_get_pointer_mapping_map (const xcb_get_pointer_mapping_reply_t *R /**< */)
11319 {
11320 return (uint8_t *) (R + 1);
11321 }
11322
11323 int
xcb_get_pointer_mapping_map_length(const xcb_get_pointer_mapping_reply_t * R)11324 xcb_get_pointer_mapping_map_length (const xcb_get_pointer_mapping_reply_t *R /**< */)
11325 {
11326 return R->map_len;
11327 }
11328
11329 xcb_generic_iterator_t
xcb_get_pointer_mapping_map_end(const xcb_get_pointer_mapping_reply_t * R)11330 xcb_get_pointer_mapping_map_end (const xcb_get_pointer_mapping_reply_t *R /**< */)
11331 {
11332 xcb_generic_iterator_t i;
11333 i.data = ((uint8_t *) (R + 1)) + (R->map_len);
11334 i.rem = 0;
11335 i.index = (char *) i.data - (char *) R;
11336 return i;
11337 }
11338
11339 xcb_get_pointer_mapping_reply_t *
xcb_get_pointer_mapping_reply(xcb_connection_t * c,xcb_get_pointer_mapping_cookie_t cookie,xcb_generic_error_t ** e)11340 xcb_get_pointer_mapping_reply (xcb_connection_t *c /**< */,
11341 xcb_get_pointer_mapping_cookie_t cookie /**< */,
11342 xcb_generic_error_t **e /**< */)
11343 {
11344 return (xcb_get_pointer_mapping_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
11345 }
11346
11347 int
xcb_set_modifier_mapping_sizeof(const void * _buffer)11348 xcb_set_modifier_mapping_sizeof (const void *_buffer /**< */)
11349 {
11350 char *xcb_tmp = (char *)_buffer;
11351 const xcb_set_modifier_mapping_request_t *_aux = (xcb_set_modifier_mapping_request_t *)_buffer;
11352 unsigned int xcb_buffer_len = 0;
11353 unsigned int xcb_block_len = 0;
11354 unsigned int xcb_pad = 0;
11355 unsigned int xcb_align_to = 0;
11356
11357
11358 xcb_block_len += sizeof(xcb_set_modifier_mapping_request_t);
11359 xcb_tmp += xcb_block_len;
11360 xcb_buffer_len += xcb_block_len;
11361 xcb_block_len = 0;
11362 /* keycodes */
11363 xcb_block_len += (_aux->keycodes_per_modifier * 8) * sizeof(xcb_keycode_t);
11364 xcb_tmp += xcb_block_len;
11365 xcb_align_to = ALIGNOF(xcb_keycode_t);
11366 /* insert padding */
11367 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
11368 xcb_buffer_len += xcb_block_len + xcb_pad;
11369 if (0 != xcb_pad) {
11370 xcb_tmp += xcb_pad;
11371 xcb_pad = 0;
11372 }
11373 xcb_block_len = 0;
11374
11375 return xcb_buffer_len;
11376 }
11377
11378 xcb_set_modifier_mapping_cookie_t
xcb_set_modifier_mapping(xcb_connection_t * c,uint8_t keycodes_per_modifier,const xcb_keycode_t * keycodes)11379 xcb_set_modifier_mapping (xcb_connection_t *c /**< */,
11380 uint8_t keycodes_per_modifier /**< */,
11381 const xcb_keycode_t *keycodes /**< */)
11382 {
11383 static const xcb_protocol_request_t xcb_req = {
11384 /* count */ 4,
11385 /* ext */ 0,
11386 /* opcode */ XCB_SET_MODIFIER_MAPPING,
11387 /* isvoid */ 0
11388 };
11389
11390 struct iovec xcb_parts[6];
11391 xcb_set_modifier_mapping_cookie_t xcb_ret;
11392 xcb_set_modifier_mapping_request_t xcb_out;
11393
11394 xcb_out.keycodes_per_modifier = keycodes_per_modifier;
11395
11396 xcb_parts[2].iov_base = (char *) &xcb_out;
11397 xcb_parts[2].iov_len = sizeof(xcb_out);
11398 xcb_parts[3].iov_base = 0;
11399 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
11400 /* xcb_keycode_t keycodes */
11401 xcb_parts[4].iov_base = (char *) keycodes;
11402 xcb_parts[4].iov_len = (keycodes_per_modifier * 8) * sizeof(uint8_t);
11403 xcb_parts[5].iov_base = 0;
11404 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
11405
11406 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
11407 return xcb_ret;
11408 }
11409
11410 xcb_set_modifier_mapping_cookie_t
xcb_set_modifier_mapping_unchecked(xcb_connection_t * c,uint8_t keycodes_per_modifier,const xcb_keycode_t * keycodes)11411 xcb_set_modifier_mapping_unchecked (xcb_connection_t *c /**< */,
11412 uint8_t keycodes_per_modifier /**< */,
11413 const xcb_keycode_t *keycodes /**< */)
11414 {
11415 static const xcb_protocol_request_t xcb_req = {
11416 /* count */ 4,
11417 /* ext */ 0,
11418 /* opcode */ XCB_SET_MODIFIER_MAPPING,
11419 /* isvoid */ 0
11420 };
11421
11422 struct iovec xcb_parts[6];
11423 xcb_set_modifier_mapping_cookie_t xcb_ret;
11424 xcb_set_modifier_mapping_request_t xcb_out;
11425
11426 xcb_out.keycodes_per_modifier = keycodes_per_modifier;
11427
11428 xcb_parts[2].iov_base = (char *) &xcb_out;
11429 xcb_parts[2].iov_len = sizeof(xcb_out);
11430 xcb_parts[3].iov_base = 0;
11431 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
11432 /* xcb_keycode_t keycodes */
11433 xcb_parts[4].iov_base = (char *) keycodes;
11434 xcb_parts[4].iov_len = (keycodes_per_modifier * 8) * sizeof(uint8_t);
11435 xcb_parts[5].iov_base = 0;
11436 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
11437
11438 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
11439 return xcb_ret;
11440 }
11441
11442 xcb_set_modifier_mapping_reply_t *
xcb_set_modifier_mapping_reply(xcb_connection_t * c,xcb_set_modifier_mapping_cookie_t cookie,xcb_generic_error_t ** e)11443 xcb_set_modifier_mapping_reply (xcb_connection_t *c /**< */,
11444 xcb_set_modifier_mapping_cookie_t cookie /**< */,
11445 xcb_generic_error_t **e /**< */)
11446 {
11447 return (xcb_set_modifier_mapping_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
11448 }
11449
11450 int
xcb_get_modifier_mapping_sizeof(const void * _buffer)11451 xcb_get_modifier_mapping_sizeof (const void *_buffer /**< */)
11452 {
11453 char *xcb_tmp = (char *)_buffer;
11454 const xcb_get_modifier_mapping_reply_t *_aux = (xcb_get_modifier_mapping_reply_t *)_buffer;
11455 unsigned int xcb_buffer_len = 0;
11456 unsigned int xcb_block_len = 0;
11457 unsigned int xcb_pad = 0;
11458 unsigned int xcb_align_to = 0;
11459
11460
11461 xcb_block_len += sizeof(xcb_get_modifier_mapping_reply_t);
11462 xcb_tmp += xcb_block_len;
11463 xcb_buffer_len += xcb_block_len;
11464 xcb_block_len = 0;
11465 /* keycodes */
11466 xcb_block_len += (_aux->keycodes_per_modifier * 8) * sizeof(xcb_keycode_t);
11467 xcb_tmp += xcb_block_len;
11468 xcb_align_to = ALIGNOF(xcb_keycode_t);
11469 /* insert padding */
11470 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
11471 xcb_buffer_len += xcb_block_len + xcb_pad;
11472 if (0 != xcb_pad) {
11473 xcb_tmp += xcb_pad;
11474 xcb_pad = 0;
11475 }
11476 xcb_block_len = 0;
11477
11478 return xcb_buffer_len;
11479 }
11480
11481 xcb_get_modifier_mapping_cookie_t
xcb_get_modifier_mapping(xcb_connection_t * c)11482 xcb_get_modifier_mapping (xcb_connection_t *c /**< */)
11483 {
11484 static const xcb_protocol_request_t xcb_req = {
11485 /* count */ 2,
11486 /* ext */ 0,
11487 /* opcode */ XCB_GET_MODIFIER_MAPPING,
11488 /* isvoid */ 0
11489 };
11490
11491 struct iovec xcb_parts[4];
11492 xcb_get_modifier_mapping_cookie_t xcb_ret;
11493 xcb_get_modifier_mapping_request_t xcb_out;
11494
11495 xcb_out.pad0 = 0;
11496
11497 xcb_parts[2].iov_base = (char *) &xcb_out;
11498 xcb_parts[2].iov_len = sizeof(xcb_out);
11499 xcb_parts[3].iov_base = 0;
11500 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
11501
11502 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
11503 return xcb_ret;
11504 }
11505
11506 xcb_get_modifier_mapping_cookie_t
xcb_get_modifier_mapping_unchecked(xcb_connection_t * c)11507 xcb_get_modifier_mapping_unchecked (xcb_connection_t *c /**< */)
11508 {
11509 static const xcb_protocol_request_t xcb_req = {
11510 /* count */ 2,
11511 /* ext */ 0,
11512 /* opcode */ XCB_GET_MODIFIER_MAPPING,
11513 /* isvoid */ 0
11514 };
11515
11516 struct iovec xcb_parts[4];
11517 xcb_get_modifier_mapping_cookie_t xcb_ret;
11518 xcb_get_modifier_mapping_request_t xcb_out;
11519
11520 xcb_out.pad0 = 0;
11521
11522 xcb_parts[2].iov_base = (char *) &xcb_out;
11523 xcb_parts[2].iov_len = sizeof(xcb_out);
11524 xcb_parts[3].iov_base = 0;
11525 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
11526
11527 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
11528 return xcb_ret;
11529 }
11530
11531 xcb_keycode_t *
xcb_get_modifier_mapping_keycodes(const xcb_get_modifier_mapping_reply_t * R)11532 xcb_get_modifier_mapping_keycodes (const xcb_get_modifier_mapping_reply_t *R /**< */)
11533 {
11534 return (xcb_keycode_t *) (R + 1);
11535 }
11536
11537 int
xcb_get_modifier_mapping_keycodes_length(const xcb_get_modifier_mapping_reply_t * R)11538 xcb_get_modifier_mapping_keycodes_length (const xcb_get_modifier_mapping_reply_t *R /**< */)
11539 {
11540 return (R->keycodes_per_modifier * 8);
11541 }
11542
11543 xcb_generic_iterator_t
xcb_get_modifier_mapping_keycodes_end(const xcb_get_modifier_mapping_reply_t * R)11544 xcb_get_modifier_mapping_keycodes_end (const xcb_get_modifier_mapping_reply_t *R /**< */)
11545 {
11546 xcb_generic_iterator_t i;
11547 i.data = ((xcb_keycode_t *) (R + 1)) + ((R->keycodes_per_modifier * 8));
11548 i.rem = 0;
11549 i.index = (char *) i.data - (char *) R;
11550 return i;
11551 }
11552
11553 xcb_get_modifier_mapping_reply_t *
xcb_get_modifier_mapping_reply(xcb_connection_t * c,xcb_get_modifier_mapping_cookie_t cookie,xcb_generic_error_t ** e)11554 xcb_get_modifier_mapping_reply (xcb_connection_t *c /**< */,
11555 xcb_get_modifier_mapping_cookie_t cookie /**< */,
11556 xcb_generic_error_t **e /**< */)
11557 {
11558 return (xcb_get_modifier_mapping_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
11559 }
11560
11561 xcb_void_cookie_t
xcb_no_operation_checked(xcb_connection_t * c)11562 xcb_no_operation_checked (xcb_connection_t *c /**< */)
11563 {
11564 static const xcb_protocol_request_t xcb_req = {
11565 /* count */ 2,
11566 /* ext */ 0,
11567 /* opcode */ XCB_NO_OPERATION,
11568 /* isvoid */ 1
11569 };
11570
11571 struct iovec xcb_parts[4];
11572 xcb_void_cookie_t xcb_ret;
11573 xcb_no_operation_request_t xcb_out;
11574
11575 xcb_out.pad0 = 0;
11576
11577 xcb_parts[2].iov_base = (char *) &xcb_out;
11578 xcb_parts[2].iov_len = sizeof(xcb_out);
11579 xcb_parts[3].iov_base = 0;
11580 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
11581
11582 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
11583 return xcb_ret;
11584 }
11585
11586 xcb_void_cookie_t
xcb_no_operation(xcb_connection_t * c)11587 xcb_no_operation (xcb_connection_t *c /**< */)
11588 {
11589 static const xcb_protocol_request_t xcb_req = {
11590 /* count */ 2,
11591 /* ext */ 0,
11592 /* opcode */ XCB_NO_OPERATION,
11593 /* isvoid */ 1
11594 };
11595
11596 struct iovec xcb_parts[4];
11597 xcb_void_cookie_t xcb_ret;
11598 xcb_no_operation_request_t xcb_out;
11599
11600 xcb_out.pad0 = 0;
11601
11602 xcb_parts[2].iov_base = (char *) &xcb_out;
11603 xcb_parts[2].iov_len = sizeof(xcb_out);
11604 xcb_parts[3].iov_base = 0;
11605 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
11606
11607 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
11608 return xcb_ret;
11609 }
11610
11611