Home | History | Annotate | Line # | Download | only in files
      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
     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
     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
     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
     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
     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
     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
     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
     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
     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
     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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    199 xcb_bool32_next (xcb_bool32_iterator_t *i)
    200 {
    201     --i->rem;
    202     ++i->data;
    203     i->index += sizeof(xcb_bool32_t);
    204 }
    205 
    206 xcb_generic_iterator_t
    207 xcb_bool32_end (xcb_bool32_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
    217 xcb_visualid_next (xcb_visualid_iterator_t *i)
    218 {
    219     --i->rem;
    220     ++i->data;
    221     i->index += sizeof(xcb_visualid_t);
    222 }
    223 
    224 xcb_generic_iterator_t
    225 xcb_visualid_end (xcb_visualid_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
    235 xcb_timestamp_next (xcb_timestamp_iterator_t *i)
    236 {
    237     --i->rem;
    238     ++i->data;
    239     i->index += sizeof(xcb_timestamp_t);
    240 }
    241 
    242 xcb_generic_iterator_t
    243 xcb_timestamp_end (xcb_timestamp_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
    253 xcb_keysym_next (xcb_keysym_iterator_t *i)
    254 {
    255     --i->rem;
    256     ++i->data;
    257     i->index += sizeof(xcb_keysym_t);
    258 }
    259 
    260 xcb_generic_iterator_t
    261 xcb_keysym_end (xcb_keysym_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
    271 xcb_keycode_next (xcb_keycode_iterator_t *i)
    272 {
    273     --i->rem;
    274     ++i->data;
    275     i->index += sizeof(xcb_keycode_t);
    276 }
    277 
    278 xcb_generic_iterator_t
    279 xcb_keycode_end (xcb_keycode_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
    289 xcb_keycode32_next (xcb_keycode32_iterator_t *i)
    290 {
    291     --i->rem;
    292     ++i->data;
    293     i->index += sizeof(xcb_keycode32_t);
    294 }
    295 
    296 xcb_generic_iterator_t
    297 xcb_keycode32_end (xcb_keycode32_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
    307 xcb_button_next (xcb_button_iterator_t *i)
    308 {
    309     --i->rem;
    310     ++i->data;
    311     i->index += sizeof(xcb_button_t);
    312 }
    313 
    314 xcb_generic_iterator_t
    315 xcb_button_end (xcb_button_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
    325 xcb_point_next (xcb_point_iterator_t *i)
    326 {
    327     --i->rem;
    328     ++i->data;
    329     i->index += sizeof(xcb_point_t);
    330 }
    331 
    332 xcb_generic_iterator_t
    333 xcb_point_end (xcb_point_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
    343 xcb_rectangle_next (xcb_rectangle_iterator_t *i)
    344 {
    345     --i->rem;
    346     ++i->data;
    347     i->index += sizeof(xcb_rectangle_t);
    348 }
    349 
    350 xcb_generic_iterator_t
    351 xcb_rectangle_end (xcb_rectangle_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
    361 xcb_arc_next (xcb_arc_iterator_t *i)
    362 {
    363     --i->rem;
    364     ++i->data;
    365     i->index += sizeof(xcb_arc_t);
    366 }
    367 
    368 xcb_generic_iterator_t
    369 xcb_arc_end (xcb_arc_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 void
    379 xcb_format_next (xcb_format_iterator_t *i)
    380 {
    381     --i->rem;
    382     ++i->data;
    383     i->index += sizeof(xcb_format_t);
    384 }
    385 
    386 xcb_generic_iterator_t
    387 xcb_format_end (xcb_format_iterator_t i)
    388 {
    389     xcb_generic_iterator_t ret;
    390     ret.data = i.data + i.rem;
    391     ret.index = i.index + ((char *) ret.data - (char *) i.data);
    392     ret.rem = 0;
    393     return ret;
    394 }
    395 
    396 void
    397 xcb_visualtype_next (xcb_visualtype_iterator_t *i)
    398 {
    399     --i->rem;
    400     ++i->data;
    401     i->index += sizeof(xcb_visualtype_t);
    402 }
    403 
    404 xcb_generic_iterator_t
    405 xcb_visualtype_end (xcb_visualtype_iterator_t i)
    406 {
    407     xcb_generic_iterator_t ret;
    408     ret.data = i.data + i.rem;
    409     ret.index = i.index + ((char *) ret.data - (char *) i.data);
    410     ret.rem = 0;
    411     return ret;
    412 }
    413 
    414 int
    415 xcb_depth_sizeof (const void  *_buffer)
    416 {
    417     char *xcb_tmp = (char *)_buffer;
    418     const xcb_depth_t *_aux = (xcb_depth_t *)_buffer;
    419     unsigned int xcb_buffer_len = 0;
    420     unsigned int xcb_block_len = 0;
    421     unsigned int xcb_pad = 0;
    422     unsigned int xcb_align_to = 0;
    423 
    424 
    425     xcb_block_len += sizeof(xcb_depth_t);
    426     xcb_tmp += xcb_block_len;
    427     xcb_buffer_len += xcb_block_len;
    428     xcb_block_len = 0;
    429     /* visuals */
    430     xcb_block_len += _aux->visuals_len * sizeof(xcb_visualtype_t);
    431     xcb_tmp += xcb_block_len;
    432     xcb_align_to = ALIGNOF(xcb_visualtype_t);
    433     /* insert padding */
    434     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    435     xcb_buffer_len += xcb_block_len + xcb_pad;
    436     if (0 != xcb_pad) {
    437         xcb_tmp += xcb_pad;
    438         xcb_pad = 0;
    439     }
    440     xcb_block_len = 0;
    441 
    442     return xcb_buffer_len;
    443 }
    444 
    445 xcb_visualtype_t *
    446 xcb_depth_visuals (const xcb_depth_t *R)
    447 {
    448     return (xcb_visualtype_t *) (R + 1);
    449 }
    450 
    451 int
    452 xcb_depth_visuals_length (const xcb_depth_t *R)
    453 {
    454     return R->visuals_len;
    455 }
    456 
    457 xcb_visualtype_iterator_t
    458 xcb_depth_visuals_iterator (const xcb_depth_t *R)
    459 {
    460     xcb_visualtype_iterator_t i;
    461     i.data = (xcb_visualtype_t *) (R + 1);
    462     i.rem = R->visuals_len;
    463     i.index = (char *) i.data - (char *) R;
    464     return i;
    465 }
    466 
    467 void
    468 xcb_depth_next (xcb_depth_iterator_t *i)
    469 {
    470     xcb_depth_t *R = i->data;
    471     xcb_generic_iterator_t child;
    472     child.data = (xcb_depth_t *)(((char *)R) + xcb_depth_sizeof(R));
    473     i->index = (char *) child.data - (char *) i->data;
    474     --i->rem;
    475     i->data = (xcb_depth_t *) child.data;
    476 }
    477 
    478 xcb_generic_iterator_t
    479 xcb_depth_end (xcb_depth_iterator_t i)
    480 {
    481     xcb_generic_iterator_t ret;
    482     while(i.rem > 0)
    483         xcb_depth_next(&i);
    484     ret.data = i.data;
    485     ret.rem = i.rem;
    486     ret.index = i.index;
    487     return ret;
    488 }
    489 
    490 int
    491 xcb_screen_sizeof (const void  *_buffer)
    492 {
    493     char *xcb_tmp = (char *)_buffer;
    494     const xcb_screen_t *_aux = (xcb_screen_t *)_buffer;
    495     unsigned int xcb_buffer_len = 0;
    496     unsigned int xcb_block_len = 0;
    497     unsigned int xcb_pad = 0;
    498     unsigned int xcb_align_to = 0;
    499 
    500     unsigned int i;
    501     unsigned int xcb_tmp_len;
    502 
    503     xcb_block_len += sizeof(xcb_screen_t);
    504     xcb_tmp += xcb_block_len;
    505     xcb_buffer_len += xcb_block_len;
    506     xcb_block_len = 0;
    507     /* allowed_depths */
    508     for(i=0; i<_aux->allowed_depths_len; i++) {
    509         xcb_tmp_len = xcb_depth_sizeof(xcb_tmp);
    510         xcb_block_len += xcb_tmp_len;
    511         xcb_tmp += xcb_tmp_len;
    512     }
    513     xcb_align_to = ALIGNOF(xcb_depth_t);
    514     /* insert padding */
    515     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    516     xcb_buffer_len += xcb_block_len + xcb_pad;
    517     if (0 != xcb_pad) {
    518         xcb_tmp += xcb_pad;
    519         xcb_pad = 0;
    520     }
    521     xcb_block_len = 0;
    522 
    523     return xcb_buffer_len;
    524 }
    525 
    526 int
    527 xcb_screen_allowed_depths_length (const xcb_screen_t *R)
    528 {
    529     return R->allowed_depths_len;
    530 }
    531 
    532 xcb_depth_iterator_t
    533 xcb_screen_allowed_depths_iterator (const xcb_screen_t *R)
    534 {
    535     xcb_depth_iterator_t i;
    536     i.data = (xcb_depth_t *) (R + 1);
    537     i.rem = R->allowed_depths_len;
    538     i.index = (char *) i.data - (char *) R;
    539     return i;
    540 }
    541 
    542 void
    543 xcb_screen_next (xcb_screen_iterator_t *i)
    544 {
    545     xcb_screen_t *R = i->data;
    546     xcb_generic_iterator_t child;
    547     child.data = (xcb_screen_t *)(((char *)R) + xcb_screen_sizeof(R));
    548     i->index = (char *) child.data - (char *) i->data;
    549     --i->rem;
    550     i->data = (xcb_screen_t *) child.data;
    551 }
    552 
    553 xcb_generic_iterator_t
    554 xcb_screen_end (xcb_screen_iterator_t i)
    555 {
    556     xcb_generic_iterator_t ret;
    557     while(i.rem > 0)
    558         xcb_screen_next(&i);
    559     ret.data = i.data;
    560     ret.rem = i.rem;
    561     ret.index = i.index;
    562     return ret;
    563 }
    564 
    565 int
    566 xcb_setup_request_sizeof (const void  *_buffer)
    567 {
    568     char *xcb_tmp = (char *)_buffer;
    569     const xcb_setup_request_t *_aux = (xcb_setup_request_t *)_buffer;
    570     unsigned int xcb_buffer_len = 0;
    571     unsigned int xcb_block_len = 0;
    572     unsigned int xcb_pad = 0;
    573     unsigned int xcb_align_to = 0;
    574 
    575 
    576     xcb_block_len += sizeof(xcb_setup_request_t);
    577     xcb_tmp += xcb_block_len;
    578     xcb_buffer_len += xcb_block_len;
    579     xcb_block_len = 0;
    580     /* authorization_protocol_name */
    581     xcb_block_len += _aux->authorization_protocol_name_len * sizeof(char);
    582     xcb_tmp += xcb_block_len;
    583     xcb_align_to = ALIGNOF(char);
    584     xcb_align_to = 4;
    585     /* insert padding */
    586     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    587     xcb_buffer_len += xcb_block_len + xcb_pad;
    588     if (0 != xcb_pad) {
    589         xcb_tmp += xcb_pad;
    590         xcb_pad = 0;
    591     }
    592     xcb_block_len = 0;
    593     /* insert padding */
    594     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    595     xcb_buffer_len += xcb_block_len + xcb_pad;
    596     if (0 != xcb_pad) {
    597         xcb_tmp += xcb_pad;
    598         xcb_pad = 0;
    599     }
    600     xcb_block_len = 0;
    601     /* authorization_protocol_data */
    602     xcb_block_len += _aux->authorization_protocol_data_len * sizeof(char);
    603     xcb_tmp += xcb_block_len;
    604     xcb_align_to = ALIGNOF(char);
    605     xcb_align_to = 4;
    606     /* insert padding */
    607     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    608     xcb_buffer_len += xcb_block_len + xcb_pad;
    609     if (0 != xcb_pad) {
    610         xcb_tmp += xcb_pad;
    611         xcb_pad = 0;
    612     }
    613     xcb_block_len = 0;
    614     /* insert padding */
    615     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    616     xcb_buffer_len += xcb_block_len + xcb_pad;
    617     if (0 != xcb_pad) {
    618         xcb_tmp += xcb_pad;
    619         xcb_pad = 0;
    620     }
    621     xcb_block_len = 0;
    622 
    623     return xcb_buffer_len;
    624 }
    625 
    626 char *
    627 xcb_setup_request_authorization_protocol_name (const xcb_setup_request_t *R)
    628 {
    629     return (char *) (R + 1);
    630 }
    631 
    632 int
    633 xcb_setup_request_authorization_protocol_name_length (const xcb_setup_request_t *R)
    634 {
    635     return R->authorization_protocol_name_len;
    636 }
    637 
    638 xcb_generic_iterator_t
    639 xcb_setup_request_authorization_protocol_name_end (const xcb_setup_request_t *R)
    640 {
    641     xcb_generic_iterator_t i;
    642     i.data = ((char *) (R + 1)) + (R->authorization_protocol_name_len);
    643     i.rem = 0;
    644     i.index = (char *) i.data - (char *) R;
    645     return i;
    646 }
    647 
    648 char *
    649 xcb_setup_request_authorization_protocol_data (const xcb_setup_request_t *R)
    650 {
    651     xcb_generic_iterator_t prev = xcb_setup_request_authorization_protocol_name_end(R);
    652     return (char *) ((char *) prev.data + ((-prev.index) & (4 - 1)) + 0);
    653 }
    654 
    655 int
    656 xcb_setup_request_authorization_protocol_data_length (const xcb_setup_request_t *R)
    657 {
    658     return R->authorization_protocol_data_len;
    659 }
    660 
    661 xcb_generic_iterator_t
    662 xcb_setup_request_authorization_protocol_data_end (const xcb_setup_request_t *R)
    663 {
    664     xcb_generic_iterator_t i;
    665     xcb_generic_iterator_t prev = xcb_setup_request_authorization_protocol_name_end(R);
    666     i.data = ((char *) ((char*) prev.data + ((-prev.index) & (4 - 1)))) + (R->authorization_protocol_data_len);
    667     i.rem = 0;
    668     i.index = (char *) i.data - (char *) R;
    669     return i;
    670 }
    671 
    672 void
    673 xcb_setup_request_next (xcb_setup_request_iterator_t *i)
    674 {
    675     xcb_setup_request_t *R = i->data;
    676     xcb_generic_iterator_t child;
    677     child.data = (xcb_setup_request_t *)(((char *)R) + xcb_setup_request_sizeof(R));
    678     i->index = (char *) child.data - (char *) i->data;
    679     --i->rem;
    680     i->data = (xcb_setup_request_t *) child.data;
    681 }
    682 
    683 xcb_generic_iterator_t
    684 xcb_setup_request_end (xcb_setup_request_iterator_t i)
    685 {
    686     xcb_generic_iterator_t ret;
    687     while(i.rem > 0)
    688         xcb_setup_request_next(&i);
    689     ret.data = i.data;
    690     ret.rem = i.rem;
    691     ret.index = i.index;
    692     return ret;
    693 }
    694 
    695 int
    696 xcb_setup_failed_sizeof (const void  *_buffer)
    697 {
    698     char *xcb_tmp = (char *)_buffer;
    699     const xcb_setup_failed_t *_aux = (xcb_setup_failed_t *)_buffer;
    700     unsigned int xcb_buffer_len = 0;
    701     unsigned int xcb_block_len = 0;
    702     unsigned int xcb_pad = 0;
    703     unsigned int xcb_align_to = 0;
    704 
    705 
    706     xcb_block_len += sizeof(xcb_setup_failed_t);
    707     xcb_tmp += xcb_block_len;
    708     xcb_buffer_len += xcb_block_len;
    709     xcb_block_len = 0;
    710     /* reason */
    711     xcb_block_len += _aux->reason_len * sizeof(char);
    712     xcb_tmp += xcb_block_len;
    713     xcb_align_to = ALIGNOF(char);
    714     /* insert padding */
    715     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    716     xcb_buffer_len += xcb_block_len + xcb_pad;
    717     if (0 != xcb_pad) {
    718         xcb_tmp += xcb_pad;
    719         xcb_pad = 0;
    720     }
    721     xcb_block_len = 0;
    722 
    723     return xcb_buffer_len;
    724 }
    725 
    726 char *
    727 xcb_setup_failed_reason (const xcb_setup_failed_t *R)
    728 {
    729     return (char *) (R + 1);
    730 }
    731 
    732 int
    733 xcb_setup_failed_reason_length (const xcb_setup_failed_t *R)
    734 {
    735     return R->reason_len;
    736 }
    737 
    738 xcb_generic_iterator_t
    739 xcb_setup_failed_reason_end (const xcb_setup_failed_t *R)
    740 {
    741     xcb_generic_iterator_t i;
    742     i.data = ((char *) (R + 1)) + (R->reason_len);
    743     i.rem = 0;
    744     i.index = (char *) i.data - (char *) R;
    745     return i;
    746 }
    747 
    748 void
    749 xcb_setup_failed_next (xcb_setup_failed_iterator_t *i)
    750 {
    751     xcb_setup_failed_t *R = i->data;
    752     xcb_generic_iterator_t child;
    753     child.data = (xcb_setup_failed_t *)(((char *)R) + xcb_setup_failed_sizeof(R));
    754     i->index = (char *) child.data - (char *) i->data;
    755     --i->rem;
    756     i->data = (xcb_setup_failed_t *) child.data;
    757 }
    758 
    759 xcb_generic_iterator_t
    760 xcb_setup_failed_end (xcb_setup_failed_iterator_t i)
    761 {
    762     xcb_generic_iterator_t ret;
    763     while(i.rem > 0)
    764         xcb_setup_failed_next(&i);
    765     ret.data = i.data;
    766     ret.rem = i.rem;
    767     ret.index = i.index;
    768     return ret;
    769 }
    770 
    771 int
    772 xcb_setup_authenticate_sizeof (const void  *_buffer)
    773 {
    774     char *xcb_tmp = (char *)_buffer;
    775     const xcb_setup_authenticate_t *_aux = (xcb_setup_authenticate_t *)_buffer;
    776     unsigned int xcb_buffer_len = 0;
    777     unsigned int xcb_block_len = 0;
    778     unsigned int xcb_pad = 0;
    779     unsigned int xcb_align_to = 0;
    780 
    781 
    782     xcb_block_len += sizeof(xcb_setup_authenticate_t);
    783     xcb_tmp += xcb_block_len;
    784     xcb_buffer_len += xcb_block_len;
    785     xcb_block_len = 0;
    786     /* reason */
    787     xcb_block_len += (_aux->length * 4) * sizeof(char);
    788     xcb_tmp += xcb_block_len;
    789     xcb_align_to = ALIGNOF(char);
    790     /* insert padding */
    791     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    792     xcb_buffer_len += xcb_block_len + xcb_pad;
    793     if (0 != xcb_pad) {
    794         xcb_tmp += xcb_pad;
    795         xcb_pad = 0;
    796     }
    797     xcb_block_len = 0;
    798 
    799     return xcb_buffer_len;
    800 }
    801 
    802 char *
    803 xcb_setup_authenticate_reason (const xcb_setup_authenticate_t *R)
    804 {
    805     return (char *) (R + 1);
    806 }
    807 
    808 int
    809 xcb_setup_authenticate_reason_length (const xcb_setup_authenticate_t *R)
    810 {
    811     return (R->length * 4);
    812 }
    813 
    814 xcb_generic_iterator_t
    815 xcb_setup_authenticate_reason_end (const xcb_setup_authenticate_t *R)
    816 {
    817     xcb_generic_iterator_t i;
    818     i.data = ((char *) (R + 1)) + ((R->length * 4));
    819     i.rem = 0;
    820     i.index = (char *) i.data - (char *) R;
    821     return i;
    822 }
    823 
    824 void
    825 xcb_setup_authenticate_next (xcb_setup_authenticate_iterator_t *i)
    826 {
    827     xcb_setup_authenticate_t *R = i->data;
    828     xcb_generic_iterator_t child;
    829     child.data = (xcb_setup_authenticate_t *)(((char *)R) + xcb_setup_authenticate_sizeof(R));
    830     i->index = (char *) child.data - (char *) i->data;
    831     --i->rem;
    832     i->data = (xcb_setup_authenticate_t *) child.data;
    833 }
    834 
    835 xcb_generic_iterator_t
    836 xcb_setup_authenticate_end (xcb_setup_authenticate_iterator_t i)
    837 {
    838     xcb_generic_iterator_t ret;
    839     while(i.rem > 0)
    840         xcb_setup_authenticate_next(&i);
    841     ret.data = i.data;
    842     ret.rem = i.rem;
    843     ret.index = i.index;
    844     return ret;
    845 }
    846 
    847 int
    848 xcb_setup_sizeof (const void  *_buffer)
    849 {
    850     char *xcb_tmp = (char *)_buffer;
    851     const xcb_setup_t *_aux = (xcb_setup_t *)_buffer;
    852     unsigned int xcb_buffer_len = 0;
    853     unsigned int xcb_block_len = 0;
    854     unsigned int xcb_pad = 0;
    855     unsigned int xcb_align_to = 0;
    856 
    857     unsigned int i;
    858     unsigned int xcb_tmp_len;
    859 
    860     xcb_block_len += sizeof(xcb_setup_t);
    861     xcb_tmp += xcb_block_len;
    862     xcb_buffer_len += xcb_block_len;
    863     xcb_block_len = 0;
    864     /* vendor */
    865     xcb_block_len += _aux->vendor_len * sizeof(char);
    866     xcb_tmp += xcb_block_len;
    867     xcb_align_to = ALIGNOF(char);
    868     xcb_align_to = 4;
    869     /* insert padding */
    870     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    871     xcb_buffer_len += xcb_block_len + xcb_pad;
    872     if (0 != xcb_pad) {
    873         xcb_tmp += xcb_pad;
    874         xcb_pad = 0;
    875     }
    876     xcb_block_len = 0;
    877     /* insert padding */
    878     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    879     xcb_buffer_len += xcb_block_len + xcb_pad;
    880     if (0 != xcb_pad) {
    881         xcb_tmp += xcb_pad;
    882         xcb_pad = 0;
    883     }
    884     xcb_block_len = 0;
    885     /* pixmap_formats */
    886     xcb_block_len += _aux->pixmap_formats_len * sizeof(xcb_format_t);
    887     xcb_tmp += xcb_block_len;
    888     xcb_align_to = ALIGNOF(xcb_format_t);
    889     /* insert padding */
    890     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    891     xcb_buffer_len += xcb_block_len + xcb_pad;
    892     if (0 != xcb_pad) {
    893         xcb_tmp += xcb_pad;
    894         xcb_pad = 0;
    895     }
    896     xcb_block_len = 0;
    897     /* roots */
    898     for(i=0; i<_aux->roots_len; i++) {
    899         xcb_tmp_len = xcb_screen_sizeof(xcb_tmp);
    900         xcb_block_len += xcb_tmp_len;
    901         xcb_tmp += xcb_tmp_len;
    902     }
    903     xcb_align_to = ALIGNOF(xcb_screen_t);
    904     /* insert padding */
    905     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    906     xcb_buffer_len += xcb_block_len + xcb_pad;
    907     if (0 != xcb_pad) {
    908         xcb_tmp += xcb_pad;
    909         xcb_pad = 0;
    910     }
    911     xcb_block_len = 0;
    912 
    913     return xcb_buffer_len;
    914 }
    915 
    916 char *
    917 xcb_setup_vendor (const xcb_setup_t *R)
    918 {
    919     return (char *) (R + 1);
    920 }
    921 
    922 int
    923 xcb_setup_vendor_length (const xcb_setup_t *R)
    924 {
    925     return R->vendor_len;
    926 }
    927 
    928 xcb_generic_iterator_t
    929 xcb_setup_vendor_end (const xcb_setup_t *R)
    930 {
    931     xcb_generic_iterator_t i;
    932     i.data = ((char *) (R + 1)) + (R->vendor_len);
    933     i.rem = 0;
    934     i.index = (char *) i.data - (char *) R;
    935     return i;
    936 }
    937 
    938 xcb_format_t *
    939 xcb_setup_pixmap_formats (const xcb_setup_t *R)
    940 {
    941     xcb_generic_iterator_t prev = xcb_setup_vendor_end(R);
    942     return (xcb_format_t *) ((char *) prev.data + ((-prev.index) & (4 - 1)) + 0);
    943 }
    944 
    945 int
    946 xcb_setup_pixmap_formats_length (const xcb_setup_t *R)
    947 {
    948     return R->pixmap_formats_len;
    949 }
    950 
    951 xcb_format_iterator_t
    952 xcb_setup_pixmap_formats_iterator (const xcb_setup_t *R)
    953 {
    954     xcb_format_iterator_t i;
    955     xcb_generic_iterator_t prev = xcb_setup_vendor_end(R);
    956     i.data = (xcb_format_t *) ((char *) prev.data + ((-prev.index) & (4 - 1)));
    957     i.rem = R->pixmap_formats_len;
    958     i.index = (char *) i.data - (char *) R;
    959     return i;
    960 }
    961 
    962 int
    963 xcb_setup_roots_length (const xcb_setup_t *R)
    964 {
    965     return R->roots_len;
    966 }
    967 
    968 xcb_screen_iterator_t
    969 xcb_setup_roots_iterator (const xcb_setup_t *R)
    970 {
    971     xcb_screen_iterator_t i;
    972     xcb_generic_iterator_t prev = xcb_format_end(xcb_setup_pixmap_formats_iterator(R));
    973     i.data = (xcb_screen_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_screen_t, prev.index));
    974     i.rem = R->roots_len;
    975     i.index = (char *) i.data - (char *) R;
    976     return i;
    977 }
    978 
    979 void
    980 xcb_setup_next (xcb_setup_iterator_t *i)
    981 {
    982     xcb_setup_t *R = i->data;
    983     xcb_generic_iterator_t child;
    984     child.data = (xcb_setup_t *)(((char *)R) + xcb_setup_sizeof(R));
    985     i->index = (char *) child.data - (char *) i->data;
    986     --i->rem;
    987     i->data = (xcb_setup_t *) child.data;
    988 }
    989 
    990 xcb_generic_iterator_t
    991 xcb_setup_end (xcb_setup_iterator_t i)
    992 {
    993     xcb_generic_iterator_t ret;
    994     while(i.rem > 0)
    995         xcb_setup_next(&i);
    996     ret.data = i.data;
    997     ret.rem = i.rem;
    998     ret.index = i.index;
    999     return ret;
   1000 }
   1001 
   1002 void
   1003 xcb_client_message_data_next (xcb_client_message_data_iterator_t *i)
   1004 {
   1005     --i->rem;
   1006     ++i->data;
   1007     i->index += sizeof(xcb_client_message_data_t);
   1008 }
   1009 
   1010 xcb_generic_iterator_t
   1011 xcb_client_message_data_end (xcb_client_message_data_iterator_t i)
   1012 {
   1013     xcb_generic_iterator_t ret;
   1014     ret.data = i.data + i.rem;
   1015     ret.index = i.index + ((char *) ret.data - (char *) i.data);
   1016     ret.rem = 0;
   1017     return ret;
   1018 }
   1019 
   1020 int
   1021 xcb_create_window_value_list_serialize (void                                 **_buffer,
   1022                                         uint32_t                               value_mask,
   1023                                         const xcb_create_window_value_list_t  *_aux)
   1024 {
   1025     char *xcb_out = *_buffer;
   1026     unsigned int xcb_buffer_len = 0;
   1027     unsigned int xcb_align_to = 0;
   1028     unsigned int xcb_padding_offset = 0;
   1029 
   1030     unsigned int xcb_pad = 0;
   1031     char xcb_pad0[3] = {0, 0, 0};
   1032     struct iovec xcb_parts[16];
   1033     unsigned int xcb_parts_idx = 0;
   1034     unsigned int xcb_block_len = 0;
   1035     unsigned int i;
   1036     char *xcb_tmp;
   1037 
   1038     if(value_mask & XCB_CW_BACK_PIXMAP) {
   1039         /* xcb_create_window_value_list_t.background_pixmap */
   1040         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->background_pixmap;
   1041         xcb_block_len += sizeof(xcb_pixmap_t);
   1042         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_pixmap_t);
   1043         xcb_parts_idx++;
   1044         xcb_align_to = ALIGNOF(xcb_pixmap_t);
   1045     }
   1046     if(value_mask & XCB_CW_BACK_PIXEL) {
   1047         /* xcb_create_window_value_list_t.background_pixel */
   1048         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->background_pixel;
   1049         xcb_block_len += sizeof(uint32_t);
   1050         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   1051         xcb_parts_idx++;
   1052         xcb_align_to = ALIGNOF(uint32_t);
   1053     }
   1054     if(value_mask & XCB_CW_BORDER_PIXMAP) {
   1055         /* xcb_create_window_value_list_t.border_pixmap */
   1056         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->border_pixmap;
   1057         xcb_block_len += sizeof(xcb_pixmap_t);
   1058         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_pixmap_t);
   1059         xcb_parts_idx++;
   1060         xcb_align_to = ALIGNOF(xcb_pixmap_t);
   1061     }
   1062     if(value_mask & XCB_CW_BORDER_PIXEL) {
   1063         /* xcb_create_window_value_list_t.border_pixel */
   1064         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->border_pixel;
   1065         xcb_block_len += sizeof(uint32_t);
   1066         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   1067         xcb_parts_idx++;
   1068         xcb_align_to = ALIGNOF(uint32_t);
   1069     }
   1070     if(value_mask & XCB_CW_BIT_GRAVITY) {
   1071         /* xcb_create_window_value_list_t.bit_gravity */
   1072         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->bit_gravity;
   1073         xcb_block_len += sizeof(uint32_t);
   1074         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   1075         xcb_parts_idx++;
   1076         xcb_align_to = ALIGNOF(uint32_t);
   1077     }
   1078     if(value_mask & XCB_CW_WIN_GRAVITY) {
   1079         /* xcb_create_window_value_list_t.win_gravity */
   1080         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->win_gravity;
   1081         xcb_block_len += sizeof(uint32_t);
   1082         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   1083         xcb_parts_idx++;
   1084         xcb_align_to = ALIGNOF(uint32_t);
   1085     }
   1086     if(value_mask & XCB_CW_BACKING_STORE) {
   1087         /* xcb_create_window_value_list_t.backing_store */
   1088         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->backing_store;
   1089         xcb_block_len += sizeof(uint32_t);
   1090         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   1091         xcb_parts_idx++;
   1092         xcb_align_to = ALIGNOF(uint32_t);
   1093     }
   1094     if(value_mask & XCB_CW_BACKING_PLANES) {
   1095         /* xcb_create_window_value_list_t.backing_planes */
   1096         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->backing_planes;
   1097         xcb_block_len += sizeof(uint32_t);
   1098         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   1099         xcb_parts_idx++;
   1100         xcb_align_to = ALIGNOF(uint32_t);
   1101     }
   1102     if(value_mask & XCB_CW_BACKING_PIXEL) {
   1103         /* xcb_create_window_value_list_t.backing_pixel */
   1104         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->backing_pixel;
   1105         xcb_block_len += sizeof(uint32_t);
   1106         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   1107         xcb_parts_idx++;
   1108         xcb_align_to = ALIGNOF(uint32_t);
   1109     }
   1110     if(value_mask & XCB_CW_OVERRIDE_REDIRECT) {
   1111         /* xcb_create_window_value_list_t.override_redirect */
   1112         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->override_redirect;
   1113         xcb_block_len += sizeof(xcb_bool32_t);
   1114         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_bool32_t);
   1115         xcb_parts_idx++;
   1116         xcb_align_to = ALIGNOF(xcb_bool32_t);
   1117     }
   1118     if(value_mask & XCB_CW_SAVE_UNDER) {
   1119         /* xcb_create_window_value_list_t.save_under */
   1120         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->save_under;
   1121         xcb_block_len += sizeof(xcb_bool32_t);
   1122         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_bool32_t);
   1123         xcb_parts_idx++;
   1124         xcb_align_to = ALIGNOF(xcb_bool32_t);
   1125     }
   1126     if(value_mask & XCB_CW_EVENT_MASK) {
   1127         /* xcb_create_window_value_list_t.event_mask */
   1128         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->event_mask;
   1129         xcb_block_len += sizeof(uint32_t);
   1130         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   1131         xcb_parts_idx++;
   1132         xcb_align_to = ALIGNOF(uint32_t);
   1133     }
   1134     if(value_mask & XCB_CW_DONT_PROPAGATE) {
   1135         /* xcb_create_window_value_list_t.do_not_propogate_mask */
   1136         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->do_not_propogate_mask;
   1137         xcb_block_len += sizeof(uint32_t);
   1138         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   1139         xcb_parts_idx++;
   1140         xcb_align_to = ALIGNOF(uint32_t);
   1141     }
   1142     if(value_mask & XCB_CW_COLORMAP) {
   1143         /* xcb_create_window_value_list_t.colormap */
   1144         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->colormap;
   1145         xcb_block_len += sizeof(xcb_colormap_t);
   1146         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_colormap_t);
   1147         xcb_parts_idx++;
   1148         xcb_align_to = ALIGNOF(xcb_colormap_t);
   1149     }
   1150     if(value_mask & XCB_CW_CURSOR) {
   1151         /* xcb_create_window_value_list_t.cursor */
   1152         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->cursor;
   1153         xcb_block_len += sizeof(xcb_cursor_t);
   1154         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_cursor_t);
   1155         xcb_parts_idx++;
   1156         xcb_align_to = ALIGNOF(xcb_cursor_t);
   1157     }
   1158     /* insert padding */
   1159     xcb_pad = -(xcb_block_len + xcb_padding_offset) & (xcb_align_to - 1);
   1160     xcb_buffer_len += xcb_block_len + xcb_pad;
   1161     if (0 != xcb_pad) {
   1162         xcb_parts[xcb_parts_idx].iov_base = xcb_pad0;
   1163         xcb_parts[xcb_parts_idx].iov_len = xcb_pad;
   1164         xcb_parts_idx++;
   1165         xcb_pad = 0;
   1166     }
   1167     xcb_block_len = 0;
   1168     xcb_padding_offset = 0;
   1169 
   1170     if (NULL == xcb_out) {
   1171         /* allocate memory */
   1172         xcb_out = malloc(xcb_buffer_len);
   1173         *_buffer = xcb_out;
   1174     }
   1175 
   1176     xcb_tmp = xcb_out;
   1177     for(i=0; i<xcb_parts_idx; i++) {
   1178         if (0 != xcb_parts[i].iov_base && 0 != xcb_parts[i].iov_len)
   1179             memcpy(xcb_tmp, xcb_parts[i].iov_base, xcb_parts[i].iov_len);
   1180         if (0 != xcb_parts[i].iov_len)
   1181             xcb_tmp += xcb_parts[i].iov_len;
   1182     }
   1183 
   1184     return xcb_buffer_len;
   1185 }
   1186 
   1187 int
   1188 xcb_create_window_value_list_unpack (const void                      *_buffer,
   1189                                      uint32_t                         value_mask,
   1190                                      xcb_create_window_value_list_t  *_aux)
   1191 {
   1192     char *xcb_tmp = (char *)_buffer;
   1193     unsigned int xcb_buffer_len = 0;
   1194     unsigned int xcb_block_len = 0;
   1195     unsigned int xcb_pad = 0;
   1196     unsigned int xcb_align_to = 0;
   1197     unsigned int xcb_padding_offset = 0;
   1198 
   1199 
   1200     if(value_mask & XCB_CW_BACK_PIXMAP) {
   1201         /* xcb_create_window_value_list_t.background_pixmap */
   1202         _aux->background_pixmap = *(xcb_pixmap_t *)xcb_tmp;
   1203         xcb_block_len += sizeof(xcb_pixmap_t);
   1204         xcb_tmp += sizeof(xcb_pixmap_t);
   1205         xcb_align_to = ALIGNOF(xcb_pixmap_t);
   1206     }
   1207     if(value_mask & XCB_CW_BACK_PIXEL) {
   1208         /* xcb_create_window_value_list_t.background_pixel */
   1209         _aux->background_pixel = *(uint32_t *)xcb_tmp;
   1210         xcb_block_len += sizeof(uint32_t);
   1211         xcb_tmp += sizeof(uint32_t);
   1212         xcb_align_to = ALIGNOF(uint32_t);
   1213     }
   1214     if(value_mask & XCB_CW_BORDER_PIXMAP) {
   1215         /* xcb_create_window_value_list_t.border_pixmap */
   1216         _aux->border_pixmap = *(xcb_pixmap_t *)xcb_tmp;
   1217         xcb_block_len += sizeof(xcb_pixmap_t);
   1218         xcb_tmp += sizeof(xcb_pixmap_t);
   1219         xcb_align_to = ALIGNOF(xcb_pixmap_t);
   1220     }
   1221     if(value_mask & XCB_CW_BORDER_PIXEL) {
   1222         /* xcb_create_window_value_list_t.border_pixel */
   1223         _aux->border_pixel = *(uint32_t *)xcb_tmp;
   1224         xcb_block_len += sizeof(uint32_t);
   1225         xcb_tmp += sizeof(uint32_t);
   1226         xcb_align_to = ALIGNOF(uint32_t);
   1227     }
   1228     if(value_mask & XCB_CW_BIT_GRAVITY) {
   1229         /* xcb_create_window_value_list_t.bit_gravity */
   1230         _aux->bit_gravity = *(uint32_t *)xcb_tmp;
   1231         xcb_block_len += sizeof(uint32_t);
   1232         xcb_tmp += sizeof(uint32_t);
   1233         xcb_align_to = ALIGNOF(uint32_t);
   1234     }
   1235     if(value_mask & XCB_CW_WIN_GRAVITY) {
   1236         /* xcb_create_window_value_list_t.win_gravity */
   1237         _aux->win_gravity = *(uint32_t *)xcb_tmp;
   1238         xcb_block_len += sizeof(uint32_t);
   1239         xcb_tmp += sizeof(uint32_t);
   1240         xcb_align_to = ALIGNOF(uint32_t);
   1241     }
   1242     if(value_mask & XCB_CW_BACKING_STORE) {
   1243         /* xcb_create_window_value_list_t.backing_store */
   1244         _aux->backing_store = *(uint32_t *)xcb_tmp;
   1245         xcb_block_len += sizeof(uint32_t);
   1246         xcb_tmp += sizeof(uint32_t);
   1247         xcb_align_to = ALIGNOF(uint32_t);
   1248     }
   1249     if(value_mask & XCB_CW_BACKING_PLANES) {
   1250         /* xcb_create_window_value_list_t.backing_planes */
   1251         _aux->backing_planes = *(uint32_t *)xcb_tmp;
   1252         xcb_block_len += sizeof(uint32_t);
   1253         xcb_tmp += sizeof(uint32_t);
   1254         xcb_align_to = ALIGNOF(uint32_t);
   1255     }
   1256     if(value_mask & XCB_CW_BACKING_PIXEL) {
   1257         /* xcb_create_window_value_list_t.backing_pixel */
   1258         _aux->backing_pixel = *(uint32_t *)xcb_tmp;
   1259         xcb_block_len += sizeof(uint32_t);
   1260         xcb_tmp += sizeof(uint32_t);
   1261         xcb_align_to = ALIGNOF(uint32_t);
   1262     }
   1263     if(value_mask & XCB_CW_OVERRIDE_REDIRECT) {
   1264         /* xcb_create_window_value_list_t.override_redirect */
   1265         _aux->override_redirect = *(xcb_bool32_t *)xcb_tmp;
   1266         xcb_block_len += sizeof(xcb_bool32_t);
   1267         xcb_tmp += sizeof(xcb_bool32_t);
   1268         xcb_align_to = ALIGNOF(xcb_bool32_t);
   1269     }
   1270     if(value_mask & XCB_CW_SAVE_UNDER) {
   1271         /* xcb_create_window_value_list_t.save_under */
   1272         _aux->save_under = *(xcb_bool32_t *)xcb_tmp;
   1273         xcb_block_len += sizeof(xcb_bool32_t);
   1274         xcb_tmp += sizeof(xcb_bool32_t);
   1275         xcb_align_to = ALIGNOF(xcb_bool32_t);
   1276     }
   1277     if(value_mask & XCB_CW_EVENT_MASK) {
   1278         /* xcb_create_window_value_list_t.event_mask */
   1279         _aux->event_mask = *(uint32_t *)xcb_tmp;
   1280         xcb_block_len += sizeof(uint32_t);
   1281         xcb_tmp += sizeof(uint32_t);
   1282         xcb_align_to = ALIGNOF(uint32_t);
   1283     }
   1284     if(value_mask & XCB_CW_DONT_PROPAGATE) {
   1285         /* xcb_create_window_value_list_t.do_not_propogate_mask */
   1286         _aux->do_not_propogate_mask = *(uint32_t *)xcb_tmp;
   1287         xcb_block_len += sizeof(uint32_t);
   1288         xcb_tmp += sizeof(uint32_t);
   1289         xcb_align_to = ALIGNOF(uint32_t);
   1290     }
   1291     if(value_mask & XCB_CW_COLORMAP) {
   1292         /* xcb_create_window_value_list_t.colormap */
   1293         _aux->colormap = *(xcb_colormap_t *)xcb_tmp;
   1294         xcb_block_len += sizeof(xcb_colormap_t);
   1295         xcb_tmp += sizeof(xcb_colormap_t);
   1296         xcb_align_to = ALIGNOF(xcb_colormap_t);
   1297     }
   1298     if(value_mask & XCB_CW_CURSOR) {
   1299         /* xcb_create_window_value_list_t.cursor */
   1300         _aux->cursor = *(xcb_cursor_t *)xcb_tmp;
   1301         xcb_block_len += sizeof(xcb_cursor_t);
   1302         xcb_tmp += sizeof(xcb_cursor_t);
   1303         xcb_align_to = ALIGNOF(xcb_cursor_t);
   1304     }
   1305     /* insert padding */
   1306     xcb_pad = -(xcb_block_len + xcb_padding_offset) & (xcb_align_to - 1);
   1307     xcb_buffer_len += xcb_block_len + xcb_pad;
   1308     if (0 != xcb_pad) {
   1309         xcb_tmp += xcb_pad;
   1310         xcb_pad = 0;
   1311     }
   1312     xcb_block_len = 0;
   1313     xcb_padding_offset = 0;
   1314 
   1315     return xcb_buffer_len;
   1316 }
   1317 
   1318 int
   1319 xcb_create_window_value_list_sizeof (const void  *_buffer,
   1320                                      uint32_t     value_mask)
   1321 {
   1322     xcb_create_window_value_list_t _aux;
   1323     return xcb_create_window_value_list_unpack(_buffer, value_mask, &_aux);
   1324 }
   1325 
   1326 int
   1327 xcb_create_window_sizeof (const void  *_buffer)
   1328 {
   1329     char *xcb_tmp = (char *)_buffer;
   1330     const xcb_create_window_request_t *_aux = (xcb_create_window_request_t *)_buffer;
   1331     unsigned int xcb_buffer_len = 0;
   1332     unsigned int xcb_block_len = 0;
   1333     unsigned int xcb_pad = 0;
   1334     unsigned int xcb_align_to = 0;
   1335 
   1336 
   1337     xcb_block_len += sizeof(xcb_create_window_request_t);
   1338     xcb_tmp += xcb_block_len;
   1339     xcb_buffer_len += xcb_block_len;
   1340     xcb_block_len = 0;
   1341     /* value_list */
   1342     xcb_block_len += xcb_create_window_value_list_sizeof(xcb_tmp, _aux->value_mask);
   1343     xcb_tmp += xcb_block_len;
   1344     xcb_align_to = ALIGNOF(char);
   1345     /* insert padding */
   1346     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   1347     xcb_buffer_len += xcb_block_len + xcb_pad;
   1348     if (0 != xcb_pad) {
   1349         xcb_tmp += xcb_pad;
   1350         xcb_pad = 0;
   1351     }
   1352     xcb_block_len = 0;
   1353 
   1354     return xcb_buffer_len;
   1355 }
   1356 
   1357 xcb_void_cookie_t
   1358 xcb_create_window_checked (xcb_connection_t *c,
   1359                            uint8_t           depth,
   1360                            xcb_window_t      wid,
   1361                            xcb_window_t      parent,
   1362                            int16_t           x,
   1363                            int16_t           y,
   1364                            uint16_t          width,
   1365                            uint16_t          height,
   1366                            uint16_t          border_width,
   1367                            uint16_t          _class,
   1368                            xcb_visualid_t    visual,
   1369                            uint32_t          value_mask,
   1370                            const void       *value_list)
   1371 {
   1372     static const xcb_protocol_request_t xcb_req = {
   1373         .count = 3,
   1374         .ext = 0,
   1375         .opcode = XCB_CREATE_WINDOW,
   1376         .isvoid = 1
   1377     };
   1378 
   1379     struct iovec xcb_parts[5];
   1380     xcb_void_cookie_t xcb_ret;
   1381     xcb_create_window_request_t xcb_out;
   1382 
   1383     xcb_out.depth = depth;
   1384     xcb_out.wid = wid;
   1385     xcb_out.parent = parent;
   1386     xcb_out.x = x;
   1387     xcb_out.y = y;
   1388     xcb_out.width = width;
   1389     xcb_out.height = height;
   1390     xcb_out.border_width = border_width;
   1391     xcb_out._class = _class;
   1392     xcb_out.visual = visual;
   1393     xcb_out.value_mask = value_mask;
   1394 
   1395     xcb_parts[2].iov_base = (char *) &xcb_out;
   1396     xcb_parts[2].iov_len = sizeof(xcb_out);
   1397     xcb_parts[3].iov_base = 0;
   1398     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   1399     /* xcb_create_window_value_list_t value_list */
   1400     xcb_parts[4].iov_base = (char *) value_list;
   1401     xcb_parts[4].iov_len =
   1402       xcb_create_window_value_list_sizeof (value_list, value_mask);
   1403 
   1404     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   1405     return xcb_ret;
   1406 }
   1407 
   1408 xcb_void_cookie_t
   1409 xcb_create_window (xcb_connection_t *c,
   1410                    uint8_t           depth,
   1411                    xcb_window_t      wid,
   1412                    xcb_window_t      parent,
   1413                    int16_t           x,
   1414                    int16_t           y,
   1415                    uint16_t          width,
   1416                    uint16_t          height,
   1417                    uint16_t          border_width,
   1418                    uint16_t          _class,
   1419                    xcb_visualid_t    visual,
   1420                    uint32_t          value_mask,
   1421                    const void       *value_list)
   1422 {
   1423     static const xcb_protocol_request_t xcb_req = {
   1424         .count = 3,
   1425         .ext = 0,
   1426         .opcode = XCB_CREATE_WINDOW,
   1427         .isvoid = 1
   1428     };
   1429 
   1430     struct iovec xcb_parts[5];
   1431     xcb_void_cookie_t xcb_ret;
   1432     xcb_create_window_request_t xcb_out;
   1433 
   1434     xcb_out.depth = depth;
   1435     xcb_out.wid = wid;
   1436     xcb_out.parent = parent;
   1437     xcb_out.x = x;
   1438     xcb_out.y = y;
   1439     xcb_out.width = width;
   1440     xcb_out.height = height;
   1441     xcb_out.border_width = border_width;
   1442     xcb_out._class = _class;
   1443     xcb_out.visual = visual;
   1444     xcb_out.value_mask = value_mask;
   1445 
   1446     xcb_parts[2].iov_base = (char *) &xcb_out;
   1447     xcb_parts[2].iov_len = sizeof(xcb_out);
   1448     xcb_parts[3].iov_base = 0;
   1449     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   1450     /* xcb_create_window_value_list_t value_list */
   1451     xcb_parts[4].iov_base = (char *) value_list;
   1452     xcb_parts[4].iov_len =
   1453       xcb_create_window_value_list_sizeof (value_list, value_mask);
   1454 
   1455     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   1456     return xcb_ret;
   1457 }
   1458 
   1459 xcb_void_cookie_t
   1460 xcb_create_window_aux_checked (xcb_connection_t                     *c,
   1461                                uint8_t                               depth,
   1462                                xcb_window_t                          wid,
   1463                                xcb_window_t                          parent,
   1464                                int16_t                               x,
   1465                                int16_t                               y,
   1466                                uint16_t                              width,
   1467                                uint16_t                              height,
   1468                                uint16_t                              border_width,
   1469                                uint16_t                              _class,
   1470                                xcb_visualid_t                        visual,
   1471                                uint32_t                              value_mask,
   1472                                const xcb_create_window_value_list_t *value_list)
   1473 {
   1474     static const xcb_protocol_request_t xcb_req = {
   1475         .count = 3,
   1476         .ext = 0,
   1477         .opcode = XCB_CREATE_WINDOW,
   1478         .isvoid = 1
   1479     };
   1480 
   1481     struct iovec xcb_parts[5];
   1482     xcb_void_cookie_t xcb_ret;
   1483     xcb_create_window_request_t xcb_out;
   1484     void *xcb_aux0 = 0;
   1485 
   1486     xcb_out.depth = depth;
   1487     xcb_out.wid = wid;
   1488     xcb_out.parent = parent;
   1489     xcb_out.x = x;
   1490     xcb_out.y = y;
   1491     xcb_out.width = width;
   1492     xcb_out.height = height;
   1493     xcb_out.border_width = border_width;
   1494     xcb_out._class = _class;
   1495     xcb_out.visual = visual;
   1496     xcb_out.value_mask = value_mask;
   1497 
   1498     xcb_parts[2].iov_base = (char *) &xcb_out;
   1499     xcb_parts[2].iov_len = sizeof(xcb_out);
   1500     xcb_parts[3].iov_base = 0;
   1501     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   1502     /* xcb_create_window_value_list_t value_list */
   1503     xcb_parts[4].iov_len =
   1504       xcb_create_window_value_list_serialize (&xcb_aux0, value_mask, value_list);
   1505     xcb_parts[4].iov_base = xcb_aux0;
   1506 
   1507     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   1508     free(xcb_aux0);
   1509     return xcb_ret;
   1510 }
   1511 
   1512 xcb_void_cookie_t
   1513 xcb_create_window_aux (xcb_connection_t                     *c,
   1514                        uint8_t                               depth,
   1515                        xcb_window_t                          wid,
   1516                        xcb_window_t                          parent,
   1517                        int16_t                               x,
   1518                        int16_t                               y,
   1519                        uint16_t                              width,
   1520                        uint16_t                              height,
   1521                        uint16_t                              border_width,
   1522                        uint16_t                              _class,
   1523                        xcb_visualid_t                        visual,
   1524                        uint32_t                              value_mask,
   1525                        const xcb_create_window_value_list_t *value_list)
   1526 {
   1527     static const xcb_protocol_request_t xcb_req = {
   1528         .count = 3,
   1529         .ext = 0,
   1530         .opcode = XCB_CREATE_WINDOW,
   1531         .isvoid = 1
   1532     };
   1533 
   1534     struct iovec xcb_parts[5];
   1535     xcb_void_cookie_t xcb_ret;
   1536     xcb_create_window_request_t xcb_out;
   1537     void *xcb_aux0 = 0;
   1538 
   1539     xcb_out.depth = depth;
   1540     xcb_out.wid = wid;
   1541     xcb_out.parent = parent;
   1542     xcb_out.x = x;
   1543     xcb_out.y = y;
   1544     xcb_out.width = width;
   1545     xcb_out.height = height;
   1546     xcb_out.border_width = border_width;
   1547     xcb_out._class = _class;
   1548     xcb_out.visual = visual;
   1549     xcb_out.value_mask = value_mask;
   1550 
   1551     xcb_parts[2].iov_base = (char *) &xcb_out;
   1552     xcb_parts[2].iov_len = sizeof(xcb_out);
   1553     xcb_parts[3].iov_base = 0;
   1554     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   1555     /* xcb_create_window_value_list_t value_list */
   1556     xcb_parts[4].iov_len =
   1557       xcb_create_window_value_list_serialize (&xcb_aux0, value_mask, value_list);
   1558     xcb_parts[4].iov_base = xcb_aux0;
   1559 
   1560     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   1561     free(xcb_aux0);
   1562     return xcb_ret;
   1563 }
   1564 
   1565 void *
   1566 xcb_create_window_value_list (const xcb_create_window_request_t *R)
   1567 {
   1568     return (void *) (R + 1);
   1569 }
   1570 
   1571 int
   1572 xcb_change_window_attributes_value_list_serialize (void                                            **_buffer,
   1573                                                    uint32_t                                          value_mask,
   1574                                                    const xcb_change_window_attributes_value_list_t  *_aux)
   1575 {
   1576     char *xcb_out = *_buffer;
   1577     unsigned int xcb_buffer_len = 0;
   1578     unsigned int xcb_align_to = 0;
   1579     unsigned int xcb_padding_offset = 0;
   1580 
   1581     unsigned int xcb_pad = 0;
   1582     char xcb_pad0[3] = {0, 0, 0};
   1583     struct iovec xcb_parts[16];
   1584     unsigned int xcb_parts_idx = 0;
   1585     unsigned int xcb_block_len = 0;
   1586     unsigned int i;
   1587     char *xcb_tmp;
   1588 
   1589     if(value_mask & XCB_CW_BACK_PIXMAP) {
   1590         /* xcb_change_window_attributes_value_list_t.background_pixmap */
   1591         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->background_pixmap;
   1592         xcb_block_len += sizeof(xcb_pixmap_t);
   1593         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_pixmap_t);
   1594         xcb_parts_idx++;
   1595         xcb_align_to = ALIGNOF(xcb_pixmap_t);
   1596     }
   1597     if(value_mask & XCB_CW_BACK_PIXEL) {
   1598         /* xcb_change_window_attributes_value_list_t.background_pixel */
   1599         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->background_pixel;
   1600         xcb_block_len += sizeof(uint32_t);
   1601         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   1602         xcb_parts_idx++;
   1603         xcb_align_to = ALIGNOF(uint32_t);
   1604     }
   1605     if(value_mask & XCB_CW_BORDER_PIXMAP) {
   1606         /* xcb_change_window_attributes_value_list_t.border_pixmap */
   1607         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->border_pixmap;
   1608         xcb_block_len += sizeof(xcb_pixmap_t);
   1609         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_pixmap_t);
   1610         xcb_parts_idx++;
   1611         xcb_align_to = ALIGNOF(xcb_pixmap_t);
   1612     }
   1613     if(value_mask & XCB_CW_BORDER_PIXEL) {
   1614         /* xcb_change_window_attributes_value_list_t.border_pixel */
   1615         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->border_pixel;
   1616         xcb_block_len += sizeof(uint32_t);
   1617         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   1618         xcb_parts_idx++;
   1619         xcb_align_to = ALIGNOF(uint32_t);
   1620     }
   1621     if(value_mask & XCB_CW_BIT_GRAVITY) {
   1622         /* xcb_change_window_attributes_value_list_t.bit_gravity */
   1623         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->bit_gravity;
   1624         xcb_block_len += sizeof(uint32_t);
   1625         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   1626         xcb_parts_idx++;
   1627         xcb_align_to = ALIGNOF(uint32_t);
   1628     }
   1629     if(value_mask & XCB_CW_WIN_GRAVITY) {
   1630         /* xcb_change_window_attributes_value_list_t.win_gravity */
   1631         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->win_gravity;
   1632         xcb_block_len += sizeof(uint32_t);
   1633         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   1634         xcb_parts_idx++;
   1635         xcb_align_to = ALIGNOF(uint32_t);
   1636     }
   1637     if(value_mask & XCB_CW_BACKING_STORE) {
   1638         /* xcb_change_window_attributes_value_list_t.backing_store */
   1639         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->backing_store;
   1640         xcb_block_len += sizeof(uint32_t);
   1641         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   1642         xcb_parts_idx++;
   1643         xcb_align_to = ALIGNOF(uint32_t);
   1644     }
   1645     if(value_mask & XCB_CW_BACKING_PLANES) {
   1646         /* xcb_change_window_attributes_value_list_t.backing_planes */
   1647         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->backing_planes;
   1648         xcb_block_len += sizeof(uint32_t);
   1649         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   1650         xcb_parts_idx++;
   1651         xcb_align_to = ALIGNOF(uint32_t);
   1652     }
   1653     if(value_mask & XCB_CW_BACKING_PIXEL) {
   1654         /* xcb_change_window_attributes_value_list_t.backing_pixel */
   1655         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->backing_pixel;
   1656         xcb_block_len += sizeof(uint32_t);
   1657         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   1658         xcb_parts_idx++;
   1659         xcb_align_to = ALIGNOF(uint32_t);
   1660     }
   1661     if(value_mask & XCB_CW_OVERRIDE_REDIRECT) {
   1662         /* xcb_change_window_attributes_value_list_t.override_redirect */
   1663         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->override_redirect;
   1664         xcb_block_len += sizeof(xcb_bool32_t);
   1665         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_bool32_t);
   1666         xcb_parts_idx++;
   1667         xcb_align_to = ALIGNOF(xcb_bool32_t);
   1668     }
   1669     if(value_mask & XCB_CW_SAVE_UNDER) {
   1670         /* xcb_change_window_attributes_value_list_t.save_under */
   1671         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->save_under;
   1672         xcb_block_len += sizeof(xcb_bool32_t);
   1673         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_bool32_t);
   1674         xcb_parts_idx++;
   1675         xcb_align_to = ALIGNOF(xcb_bool32_t);
   1676     }
   1677     if(value_mask & XCB_CW_EVENT_MASK) {
   1678         /* xcb_change_window_attributes_value_list_t.event_mask */
   1679         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->event_mask;
   1680         xcb_block_len += sizeof(uint32_t);
   1681         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   1682         xcb_parts_idx++;
   1683         xcb_align_to = ALIGNOF(uint32_t);
   1684     }
   1685     if(value_mask & XCB_CW_DONT_PROPAGATE) {
   1686         /* xcb_change_window_attributes_value_list_t.do_not_propogate_mask */
   1687         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->do_not_propogate_mask;
   1688         xcb_block_len += sizeof(uint32_t);
   1689         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   1690         xcb_parts_idx++;
   1691         xcb_align_to = ALIGNOF(uint32_t);
   1692     }
   1693     if(value_mask & XCB_CW_COLORMAP) {
   1694         /* xcb_change_window_attributes_value_list_t.colormap */
   1695         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->colormap;
   1696         xcb_block_len += sizeof(xcb_colormap_t);
   1697         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_colormap_t);
   1698         xcb_parts_idx++;
   1699         xcb_align_to = ALIGNOF(xcb_colormap_t);
   1700     }
   1701     if(value_mask & XCB_CW_CURSOR) {
   1702         /* xcb_change_window_attributes_value_list_t.cursor */
   1703         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->cursor;
   1704         xcb_block_len += sizeof(xcb_cursor_t);
   1705         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_cursor_t);
   1706         xcb_parts_idx++;
   1707         xcb_align_to = ALIGNOF(xcb_cursor_t);
   1708     }
   1709     /* insert padding */
   1710     xcb_pad = -(xcb_block_len + xcb_padding_offset) & (xcb_align_to - 1);
   1711     xcb_buffer_len += xcb_block_len + xcb_pad;
   1712     if (0 != xcb_pad) {
   1713         xcb_parts[xcb_parts_idx].iov_base = xcb_pad0;
   1714         xcb_parts[xcb_parts_idx].iov_len = xcb_pad;
   1715         xcb_parts_idx++;
   1716         xcb_pad = 0;
   1717     }
   1718     xcb_block_len = 0;
   1719     xcb_padding_offset = 0;
   1720 
   1721     if (NULL == xcb_out) {
   1722         /* allocate memory */
   1723         xcb_out = malloc(xcb_buffer_len);
   1724         *_buffer = xcb_out;
   1725     }
   1726 
   1727     xcb_tmp = xcb_out;
   1728     for(i=0; i<xcb_parts_idx; i++) {
   1729         if (0 != xcb_parts[i].iov_base && 0 != xcb_parts[i].iov_len)
   1730             memcpy(xcb_tmp, xcb_parts[i].iov_base, xcb_parts[i].iov_len);
   1731         if (0 != xcb_parts[i].iov_len)
   1732             xcb_tmp += xcb_parts[i].iov_len;
   1733     }
   1734 
   1735     return xcb_buffer_len;
   1736 }
   1737 
   1738 int
   1739 xcb_change_window_attributes_value_list_unpack (const void                                 *_buffer,
   1740                                                 uint32_t                                    value_mask,
   1741                                                 xcb_change_window_attributes_value_list_t  *_aux)
   1742 {
   1743     char *xcb_tmp = (char *)_buffer;
   1744     unsigned int xcb_buffer_len = 0;
   1745     unsigned int xcb_block_len = 0;
   1746     unsigned int xcb_pad = 0;
   1747     unsigned int xcb_align_to = 0;
   1748     unsigned int xcb_padding_offset = 0;
   1749 
   1750 
   1751     if(value_mask & XCB_CW_BACK_PIXMAP) {
   1752         /* xcb_change_window_attributes_value_list_t.background_pixmap */
   1753         _aux->background_pixmap = *(xcb_pixmap_t *)xcb_tmp;
   1754         xcb_block_len += sizeof(xcb_pixmap_t);
   1755         xcb_tmp += sizeof(xcb_pixmap_t);
   1756         xcb_align_to = ALIGNOF(xcb_pixmap_t);
   1757     }
   1758     if(value_mask & XCB_CW_BACK_PIXEL) {
   1759         /* xcb_change_window_attributes_value_list_t.background_pixel */
   1760         _aux->background_pixel = *(uint32_t *)xcb_tmp;
   1761         xcb_block_len += sizeof(uint32_t);
   1762         xcb_tmp += sizeof(uint32_t);
   1763         xcb_align_to = ALIGNOF(uint32_t);
   1764     }
   1765     if(value_mask & XCB_CW_BORDER_PIXMAP) {
   1766         /* xcb_change_window_attributes_value_list_t.border_pixmap */
   1767         _aux->border_pixmap = *(xcb_pixmap_t *)xcb_tmp;
   1768         xcb_block_len += sizeof(xcb_pixmap_t);
   1769         xcb_tmp += sizeof(xcb_pixmap_t);
   1770         xcb_align_to = ALIGNOF(xcb_pixmap_t);
   1771     }
   1772     if(value_mask & XCB_CW_BORDER_PIXEL) {
   1773         /* xcb_change_window_attributes_value_list_t.border_pixel */
   1774         _aux->border_pixel = *(uint32_t *)xcb_tmp;
   1775         xcb_block_len += sizeof(uint32_t);
   1776         xcb_tmp += sizeof(uint32_t);
   1777         xcb_align_to = ALIGNOF(uint32_t);
   1778     }
   1779     if(value_mask & XCB_CW_BIT_GRAVITY) {
   1780         /* xcb_change_window_attributes_value_list_t.bit_gravity */
   1781         _aux->bit_gravity = *(uint32_t *)xcb_tmp;
   1782         xcb_block_len += sizeof(uint32_t);
   1783         xcb_tmp += sizeof(uint32_t);
   1784         xcb_align_to = ALIGNOF(uint32_t);
   1785     }
   1786     if(value_mask & XCB_CW_WIN_GRAVITY) {
   1787         /* xcb_change_window_attributes_value_list_t.win_gravity */
   1788         _aux->win_gravity = *(uint32_t *)xcb_tmp;
   1789         xcb_block_len += sizeof(uint32_t);
   1790         xcb_tmp += sizeof(uint32_t);
   1791         xcb_align_to = ALIGNOF(uint32_t);
   1792     }
   1793     if(value_mask & XCB_CW_BACKING_STORE) {
   1794         /* xcb_change_window_attributes_value_list_t.backing_store */
   1795         _aux->backing_store = *(uint32_t *)xcb_tmp;
   1796         xcb_block_len += sizeof(uint32_t);
   1797         xcb_tmp += sizeof(uint32_t);
   1798         xcb_align_to = ALIGNOF(uint32_t);
   1799     }
   1800     if(value_mask & XCB_CW_BACKING_PLANES) {
   1801         /* xcb_change_window_attributes_value_list_t.backing_planes */
   1802         _aux->backing_planes = *(uint32_t *)xcb_tmp;
   1803         xcb_block_len += sizeof(uint32_t);
   1804         xcb_tmp += sizeof(uint32_t);
   1805         xcb_align_to = ALIGNOF(uint32_t);
   1806     }
   1807     if(value_mask & XCB_CW_BACKING_PIXEL) {
   1808         /* xcb_change_window_attributes_value_list_t.backing_pixel */
   1809         _aux->backing_pixel = *(uint32_t *)xcb_tmp;
   1810         xcb_block_len += sizeof(uint32_t);
   1811         xcb_tmp += sizeof(uint32_t);
   1812         xcb_align_to = ALIGNOF(uint32_t);
   1813     }
   1814     if(value_mask & XCB_CW_OVERRIDE_REDIRECT) {
   1815         /* xcb_change_window_attributes_value_list_t.override_redirect */
   1816         _aux->override_redirect = *(xcb_bool32_t *)xcb_tmp;
   1817         xcb_block_len += sizeof(xcb_bool32_t);
   1818         xcb_tmp += sizeof(xcb_bool32_t);
   1819         xcb_align_to = ALIGNOF(xcb_bool32_t);
   1820     }
   1821     if(value_mask & XCB_CW_SAVE_UNDER) {
   1822         /* xcb_change_window_attributes_value_list_t.save_under */
   1823         _aux->save_under = *(xcb_bool32_t *)xcb_tmp;
   1824         xcb_block_len += sizeof(xcb_bool32_t);
   1825         xcb_tmp += sizeof(xcb_bool32_t);
   1826         xcb_align_to = ALIGNOF(xcb_bool32_t);
   1827     }
   1828     if(value_mask & XCB_CW_EVENT_MASK) {
   1829         /* xcb_change_window_attributes_value_list_t.event_mask */
   1830         _aux->event_mask = *(uint32_t *)xcb_tmp;
   1831         xcb_block_len += sizeof(uint32_t);
   1832         xcb_tmp += sizeof(uint32_t);
   1833         xcb_align_to = ALIGNOF(uint32_t);
   1834     }
   1835     if(value_mask & XCB_CW_DONT_PROPAGATE) {
   1836         /* xcb_change_window_attributes_value_list_t.do_not_propogate_mask */
   1837         _aux->do_not_propogate_mask = *(uint32_t *)xcb_tmp;
   1838         xcb_block_len += sizeof(uint32_t);
   1839         xcb_tmp += sizeof(uint32_t);
   1840         xcb_align_to = ALIGNOF(uint32_t);
   1841     }
   1842     if(value_mask & XCB_CW_COLORMAP) {
   1843         /* xcb_change_window_attributes_value_list_t.colormap */
   1844         _aux->colormap = *(xcb_colormap_t *)xcb_tmp;
   1845         xcb_block_len += sizeof(xcb_colormap_t);
   1846         xcb_tmp += sizeof(xcb_colormap_t);
   1847         xcb_align_to = ALIGNOF(xcb_colormap_t);
   1848     }
   1849     if(value_mask & XCB_CW_CURSOR) {
   1850         /* xcb_change_window_attributes_value_list_t.cursor */
   1851         _aux->cursor = *(xcb_cursor_t *)xcb_tmp;
   1852         xcb_block_len += sizeof(xcb_cursor_t);
   1853         xcb_tmp += sizeof(xcb_cursor_t);
   1854         xcb_align_to = ALIGNOF(xcb_cursor_t);
   1855     }
   1856     /* insert padding */
   1857     xcb_pad = -(xcb_block_len + xcb_padding_offset) & (xcb_align_to - 1);
   1858     xcb_buffer_len += xcb_block_len + xcb_pad;
   1859     if (0 != xcb_pad) {
   1860         xcb_tmp += xcb_pad;
   1861         xcb_pad = 0;
   1862     }
   1863     xcb_block_len = 0;
   1864     xcb_padding_offset = 0;
   1865 
   1866     return xcb_buffer_len;
   1867 }
   1868 
   1869 int
   1870 xcb_change_window_attributes_value_list_sizeof (const void  *_buffer,
   1871                                                 uint32_t     value_mask)
   1872 {
   1873     xcb_change_window_attributes_value_list_t _aux;
   1874     return xcb_change_window_attributes_value_list_unpack(_buffer, value_mask, &_aux);
   1875 }
   1876 
   1877 int
   1878 xcb_change_window_attributes_sizeof (const void  *_buffer)
   1879 {
   1880     char *xcb_tmp = (char *)_buffer;
   1881     const xcb_change_window_attributes_request_t *_aux = (xcb_change_window_attributes_request_t *)_buffer;
   1882     unsigned int xcb_buffer_len = 0;
   1883     unsigned int xcb_block_len = 0;
   1884     unsigned int xcb_pad = 0;
   1885     unsigned int xcb_align_to = 0;
   1886 
   1887 
   1888     xcb_block_len += sizeof(xcb_change_window_attributes_request_t);
   1889     xcb_tmp += xcb_block_len;
   1890     xcb_buffer_len += xcb_block_len;
   1891     xcb_block_len = 0;
   1892     /* value_list */
   1893     xcb_block_len += xcb_change_window_attributes_value_list_sizeof(xcb_tmp, _aux->value_mask);
   1894     xcb_tmp += xcb_block_len;
   1895     xcb_align_to = ALIGNOF(char);
   1896     /* insert padding */
   1897     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   1898     xcb_buffer_len += xcb_block_len + xcb_pad;
   1899     if (0 != xcb_pad) {
   1900         xcb_tmp += xcb_pad;
   1901         xcb_pad = 0;
   1902     }
   1903     xcb_block_len = 0;
   1904 
   1905     return xcb_buffer_len;
   1906 }
   1907 
   1908 xcb_void_cookie_t
   1909 xcb_change_window_attributes_checked (xcb_connection_t *c,
   1910                                       xcb_window_t      window,
   1911                                       uint32_t          value_mask,
   1912                                       const void       *value_list)
   1913 {
   1914     static const xcb_protocol_request_t xcb_req = {
   1915         .count = 3,
   1916         .ext = 0,
   1917         .opcode = XCB_CHANGE_WINDOW_ATTRIBUTES,
   1918         .isvoid = 1
   1919     };
   1920 
   1921     struct iovec xcb_parts[5];
   1922     xcb_void_cookie_t xcb_ret;
   1923     xcb_change_window_attributes_request_t xcb_out;
   1924 
   1925     xcb_out.pad0 = 0;
   1926     xcb_out.window = window;
   1927     xcb_out.value_mask = value_mask;
   1928 
   1929     xcb_parts[2].iov_base = (char *) &xcb_out;
   1930     xcb_parts[2].iov_len = sizeof(xcb_out);
   1931     xcb_parts[3].iov_base = 0;
   1932     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   1933     /* xcb_change_window_attributes_value_list_t value_list */
   1934     xcb_parts[4].iov_base = (char *) value_list;
   1935     xcb_parts[4].iov_len =
   1936       xcb_change_window_attributes_value_list_sizeof (value_list, value_mask);
   1937 
   1938     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   1939     return xcb_ret;
   1940 }
   1941 
   1942 xcb_void_cookie_t
   1943 xcb_change_window_attributes (xcb_connection_t *c,
   1944                               xcb_window_t      window,
   1945                               uint32_t          value_mask,
   1946                               const void       *value_list)
   1947 {
   1948     static const xcb_protocol_request_t xcb_req = {
   1949         .count = 3,
   1950         .ext = 0,
   1951         .opcode = XCB_CHANGE_WINDOW_ATTRIBUTES,
   1952         .isvoid = 1
   1953     };
   1954 
   1955     struct iovec xcb_parts[5];
   1956     xcb_void_cookie_t xcb_ret;
   1957     xcb_change_window_attributes_request_t xcb_out;
   1958 
   1959     xcb_out.pad0 = 0;
   1960     xcb_out.window = window;
   1961     xcb_out.value_mask = value_mask;
   1962 
   1963     xcb_parts[2].iov_base = (char *) &xcb_out;
   1964     xcb_parts[2].iov_len = sizeof(xcb_out);
   1965     xcb_parts[3].iov_base = 0;
   1966     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   1967     /* xcb_change_window_attributes_value_list_t value_list */
   1968     xcb_parts[4].iov_base = (char *) value_list;
   1969     xcb_parts[4].iov_len =
   1970       xcb_change_window_attributes_value_list_sizeof (value_list, value_mask);
   1971 
   1972     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   1973     return xcb_ret;
   1974 }
   1975 
   1976 xcb_void_cookie_t
   1977 xcb_change_window_attributes_aux_checked (xcb_connection_t                                *c,
   1978                                           xcb_window_t                                     window,
   1979                                           uint32_t                                         value_mask,
   1980                                           const xcb_change_window_attributes_value_list_t *value_list)
   1981 {
   1982     static const xcb_protocol_request_t xcb_req = {
   1983         .count = 3,
   1984         .ext = 0,
   1985         .opcode = XCB_CHANGE_WINDOW_ATTRIBUTES,
   1986         .isvoid = 1
   1987     };
   1988 
   1989     struct iovec xcb_parts[5];
   1990     xcb_void_cookie_t xcb_ret;
   1991     xcb_change_window_attributes_request_t xcb_out;
   1992     void *xcb_aux0 = 0;
   1993 
   1994     xcb_out.pad0 = 0;
   1995     xcb_out.window = window;
   1996     xcb_out.value_mask = value_mask;
   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     /* xcb_change_window_attributes_value_list_t value_list */
   2003     xcb_parts[4].iov_len =
   2004       xcb_change_window_attributes_value_list_serialize (&xcb_aux0, value_mask, value_list);
   2005     xcb_parts[4].iov_base = xcb_aux0;
   2006 
   2007     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   2008     free(xcb_aux0);
   2009     return xcb_ret;
   2010 }
   2011 
   2012 xcb_void_cookie_t
   2013 xcb_change_window_attributes_aux (xcb_connection_t                                *c,
   2014                                   xcb_window_t                                     window,
   2015                                   uint32_t                                         value_mask,
   2016                                   const xcb_change_window_attributes_value_list_t *value_list)
   2017 {
   2018     static const xcb_protocol_request_t xcb_req = {
   2019         .count = 3,
   2020         .ext = 0,
   2021         .opcode = XCB_CHANGE_WINDOW_ATTRIBUTES,
   2022         .isvoid = 1
   2023     };
   2024 
   2025     struct iovec xcb_parts[5];
   2026     xcb_void_cookie_t xcb_ret;
   2027     xcb_change_window_attributes_request_t xcb_out;
   2028     void *xcb_aux0 = 0;
   2029 
   2030     xcb_out.pad0 = 0;
   2031     xcb_out.window = window;
   2032     xcb_out.value_mask = value_mask;
   2033 
   2034     xcb_parts[2].iov_base = (char *) &xcb_out;
   2035     xcb_parts[2].iov_len = sizeof(xcb_out);
   2036     xcb_parts[3].iov_base = 0;
   2037     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2038     /* xcb_change_window_attributes_value_list_t value_list */
   2039     xcb_parts[4].iov_len =
   2040       xcb_change_window_attributes_value_list_serialize (&xcb_aux0, value_mask, value_list);
   2041     xcb_parts[4].iov_base = xcb_aux0;
   2042 
   2043     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   2044     free(xcb_aux0);
   2045     return xcb_ret;
   2046 }
   2047 
   2048 void *
   2049 xcb_change_window_attributes_value_list (const xcb_change_window_attributes_request_t *R)
   2050 {
   2051     return (void *) (R + 1);
   2052 }
   2053 
   2054 xcb_get_window_attributes_cookie_t
   2055 xcb_get_window_attributes (xcb_connection_t *c,
   2056                            xcb_window_t      window)
   2057 {
   2058     static const xcb_protocol_request_t xcb_req = {
   2059         .count = 2,
   2060         .ext = 0,
   2061         .opcode = XCB_GET_WINDOW_ATTRIBUTES,
   2062         .isvoid = 0
   2063     };
   2064 
   2065     struct iovec xcb_parts[4];
   2066     xcb_get_window_attributes_cookie_t xcb_ret;
   2067     xcb_get_window_attributes_request_t xcb_out;
   2068 
   2069     xcb_out.pad0 = 0;
   2070     xcb_out.window = window;
   2071 
   2072     xcb_parts[2].iov_base = (char *) &xcb_out;
   2073     xcb_parts[2].iov_len = sizeof(xcb_out);
   2074     xcb_parts[3].iov_base = 0;
   2075     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2076 
   2077     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   2078     return xcb_ret;
   2079 }
   2080 
   2081 xcb_get_window_attributes_cookie_t
   2082 xcb_get_window_attributes_unchecked (xcb_connection_t *c,
   2083                                      xcb_window_t      window)
   2084 {
   2085     static const xcb_protocol_request_t xcb_req = {
   2086         .count = 2,
   2087         .ext = 0,
   2088         .opcode = XCB_GET_WINDOW_ATTRIBUTES,
   2089         .isvoid = 0
   2090     };
   2091 
   2092     struct iovec xcb_parts[4];
   2093     xcb_get_window_attributes_cookie_t xcb_ret;
   2094     xcb_get_window_attributes_request_t xcb_out;
   2095 
   2096     xcb_out.pad0 = 0;
   2097     xcb_out.window = window;
   2098 
   2099     xcb_parts[2].iov_base = (char *) &xcb_out;
   2100     xcb_parts[2].iov_len = sizeof(xcb_out);
   2101     xcb_parts[3].iov_base = 0;
   2102     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2103 
   2104     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   2105     return xcb_ret;
   2106 }
   2107 
   2108 xcb_get_window_attributes_reply_t *
   2109 xcb_get_window_attributes_reply (xcb_connection_t                    *c,
   2110                                  xcb_get_window_attributes_cookie_t   cookie  /**< */,
   2111                                  xcb_generic_error_t                **e)
   2112 {
   2113     return (xcb_get_window_attributes_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   2114 }
   2115 
   2116 xcb_void_cookie_t
   2117 xcb_destroy_window_checked (xcb_connection_t *c,
   2118                             xcb_window_t      window)
   2119 {
   2120     static const xcb_protocol_request_t xcb_req = {
   2121         .count = 2,
   2122         .ext = 0,
   2123         .opcode = XCB_DESTROY_WINDOW,
   2124         .isvoid = 1
   2125     };
   2126 
   2127     struct iovec xcb_parts[4];
   2128     xcb_void_cookie_t xcb_ret;
   2129     xcb_destroy_window_request_t xcb_out;
   2130 
   2131     xcb_out.pad0 = 0;
   2132     xcb_out.window = window;
   2133 
   2134     xcb_parts[2].iov_base = (char *) &xcb_out;
   2135     xcb_parts[2].iov_len = sizeof(xcb_out);
   2136     xcb_parts[3].iov_base = 0;
   2137     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2138 
   2139     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   2140     return xcb_ret;
   2141 }
   2142 
   2143 xcb_void_cookie_t
   2144 xcb_destroy_window (xcb_connection_t *c,
   2145                     xcb_window_t      window)
   2146 {
   2147     static const xcb_protocol_request_t xcb_req = {
   2148         .count = 2,
   2149         .ext = 0,
   2150         .opcode = XCB_DESTROY_WINDOW,
   2151         .isvoid = 1
   2152     };
   2153 
   2154     struct iovec xcb_parts[4];
   2155     xcb_void_cookie_t xcb_ret;
   2156     xcb_destroy_window_request_t xcb_out;
   2157 
   2158     xcb_out.pad0 = 0;
   2159     xcb_out.window = window;
   2160 
   2161     xcb_parts[2].iov_base = (char *) &xcb_out;
   2162     xcb_parts[2].iov_len = sizeof(xcb_out);
   2163     xcb_parts[3].iov_base = 0;
   2164     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2165 
   2166     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   2167     return xcb_ret;
   2168 }
   2169 
   2170 xcb_void_cookie_t
   2171 xcb_destroy_subwindows_checked (xcb_connection_t *c,
   2172                                 xcb_window_t      window)
   2173 {
   2174     static const xcb_protocol_request_t xcb_req = {
   2175         .count = 2,
   2176         .ext = 0,
   2177         .opcode = XCB_DESTROY_SUBWINDOWS,
   2178         .isvoid = 1
   2179     };
   2180 
   2181     struct iovec xcb_parts[4];
   2182     xcb_void_cookie_t xcb_ret;
   2183     xcb_destroy_subwindows_request_t xcb_out;
   2184 
   2185     xcb_out.pad0 = 0;
   2186     xcb_out.window = window;
   2187 
   2188     xcb_parts[2].iov_base = (char *) &xcb_out;
   2189     xcb_parts[2].iov_len = sizeof(xcb_out);
   2190     xcb_parts[3].iov_base = 0;
   2191     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2192 
   2193     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   2194     return xcb_ret;
   2195 }
   2196 
   2197 xcb_void_cookie_t
   2198 xcb_destroy_subwindows (xcb_connection_t *c,
   2199                         xcb_window_t      window)
   2200 {
   2201     static const xcb_protocol_request_t xcb_req = {
   2202         .count = 2,
   2203         .ext = 0,
   2204         .opcode = XCB_DESTROY_SUBWINDOWS,
   2205         .isvoid = 1
   2206     };
   2207 
   2208     struct iovec xcb_parts[4];
   2209     xcb_void_cookie_t xcb_ret;
   2210     xcb_destroy_subwindows_request_t xcb_out;
   2211 
   2212     xcb_out.pad0 = 0;
   2213     xcb_out.window = window;
   2214 
   2215     xcb_parts[2].iov_base = (char *) &xcb_out;
   2216     xcb_parts[2].iov_len = sizeof(xcb_out);
   2217     xcb_parts[3].iov_base = 0;
   2218     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2219 
   2220     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   2221     return xcb_ret;
   2222 }
   2223 
   2224 xcb_void_cookie_t
   2225 xcb_change_save_set_checked (xcb_connection_t *c,
   2226                              uint8_t           mode,
   2227                              xcb_window_t      window)
   2228 {
   2229     static const xcb_protocol_request_t xcb_req = {
   2230         .count = 2,
   2231         .ext = 0,
   2232         .opcode = XCB_CHANGE_SAVE_SET,
   2233         .isvoid = 1
   2234     };
   2235 
   2236     struct iovec xcb_parts[4];
   2237     xcb_void_cookie_t xcb_ret;
   2238     xcb_change_save_set_request_t xcb_out;
   2239 
   2240     xcb_out.mode = mode;
   2241     xcb_out.window = window;
   2242 
   2243     xcb_parts[2].iov_base = (char *) &xcb_out;
   2244     xcb_parts[2].iov_len = sizeof(xcb_out);
   2245     xcb_parts[3].iov_base = 0;
   2246     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2247 
   2248     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   2249     return xcb_ret;
   2250 }
   2251 
   2252 xcb_void_cookie_t
   2253 xcb_change_save_set (xcb_connection_t *c,
   2254                      uint8_t           mode,
   2255                      xcb_window_t      window)
   2256 {
   2257     static const xcb_protocol_request_t xcb_req = {
   2258         .count = 2,
   2259         .ext = 0,
   2260         .opcode = XCB_CHANGE_SAVE_SET,
   2261         .isvoid = 1
   2262     };
   2263 
   2264     struct iovec xcb_parts[4];
   2265     xcb_void_cookie_t xcb_ret;
   2266     xcb_change_save_set_request_t xcb_out;
   2267 
   2268     xcb_out.mode = mode;
   2269     xcb_out.window = window;
   2270 
   2271     xcb_parts[2].iov_base = (char *) &xcb_out;
   2272     xcb_parts[2].iov_len = sizeof(xcb_out);
   2273     xcb_parts[3].iov_base = 0;
   2274     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2275 
   2276     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   2277     return xcb_ret;
   2278 }
   2279 
   2280 xcb_void_cookie_t
   2281 xcb_reparent_window_checked (xcb_connection_t *c,
   2282                              xcb_window_t      window,
   2283                              xcb_window_t      parent,
   2284                              int16_t           x,
   2285                              int16_t           y)
   2286 {
   2287     static const xcb_protocol_request_t xcb_req = {
   2288         .count = 2,
   2289         .ext = 0,
   2290         .opcode = XCB_REPARENT_WINDOW,
   2291         .isvoid = 1
   2292     };
   2293 
   2294     struct iovec xcb_parts[4];
   2295     xcb_void_cookie_t xcb_ret;
   2296     xcb_reparent_window_request_t xcb_out;
   2297 
   2298     xcb_out.pad0 = 0;
   2299     xcb_out.window = window;
   2300     xcb_out.parent = parent;
   2301     xcb_out.x = x;
   2302     xcb_out.y = y;
   2303 
   2304     xcb_parts[2].iov_base = (char *) &xcb_out;
   2305     xcb_parts[2].iov_len = sizeof(xcb_out);
   2306     xcb_parts[3].iov_base = 0;
   2307     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2308 
   2309     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   2310     return xcb_ret;
   2311 }
   2312 
   2313 xcb_void_cookie_t
   2314 xcb_reparent_window (xcb_connection_t *c,
   2315                      xcb_window_t      window,
   2316                      xcb_window_t      parent,
   2317                      int16_t           x,
   2318                      int16_t           y)
   2319 {
   2320     static const xcb_protocol_request_t xcb_req = {
   2321         .count = 2,
   2322         .ext = 0,
   2323         .opcode = XCB_REPARENT_WINDOW,
   2324         .isvoid = 1
   2325     };
   2326 
   2327     struct iovec xcb_parts[4];
   2328     xcb_void_cookie_t xcb_ret;
   2329     xcb_reparent_window_request_t xcb_out;
   2330 
   2331     xcb_out.pad0 = 0;
   2332     xcb_out.window = window;
   2333     xcb_out.parent = parent;
   2334     xcb_out.x = x;
   2335     xcb_out.y = y;
   2336 
   2337     xcb_parts[2].iov_base = (char *) &xcb_out;
   2338     xcb_parts[2].iov_len = sizeof(xcb_out);
   2339     xcb_parts[3].iov_base = 0;
   2340     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2341 
   2342     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   2343     return xcb_ret;
   2344 }
   2345 
   2346 xcb_void_cookie_t
   2347 xcb_map_window_checked (xcb_connection_t *c,
   2348                         xcb_window_t      window)
   2349 {
   2350     static const xcb_protocol_request_t xcb_req = {
   2351         .count = 2,
   2352         .ext = 0,
   2353         .opcode = XCB_MAP_WINDOW,
   2354         .isvoid = 1
   2355     };
   2356 
   2357     struct iovec xcb_parts[4];
   2358     xcb_void_cookie_t xcb_ret;
   2359     xcb_map_window_request_t xcb_out;
   2360 
   2361     xcb_out.pad0 = 0;
   2362     xcb_out.window = window;
   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 
   2369     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   2370     return xcb_ret;
   2371 }
   2372 
   2373 xcb_void_cookie_t
   2374 xcb_map_window (xcb_connection_t *c,
   2375                 xcb_window_t      window)
   2376 {
   2377     static const xcb_protocol_request_t xcb_req = {
   2378         .count = 2,
   2379         .ext = 0,
   2380         .opcode = XCB_MAP_WINDOW,
   2381         .isvoid = 1
   2382     };
   2383 
   2384     struct iovec xcb_parts[4];
   2385     xcb_void_cookie_t xcb_ret;
   2386     xcb_map_window_request_t xcb_out;
   2387 
   2388     xcb_out.pad0 = 0;
   2389     xcb_out.window = window;
   2390 
   2391     xcb_parts[2].iov_base = (char *) &xcb_out;
   2392     xcb_parts[2].iov_len = sizeof(xcb_out);
   2393     xcb_parts[3].iov_base = 0;
   2394     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2395 
   2396     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   2397     return xcb_ret;
   2398 }
   2399 
   2400 xcb_void_cookie_t
   2401 xcb_map_subwindows_checked (xcb_connection_t *c,
   2402                             xcb_window_t      window)
   2403 {
   2404     static const xcb_protocol_request_t xcb_req = {
   2405         .count = 2,
   2406         .ext = 0,
   2407         .opcode = XCB_MAP_SUBWINDOWS,
   2408         .isvoid = 1
   2409     };
   2410 
   2411     struct iovec xcb_parts[4];
   2412     xcb_void_cookie_t xcb_ret;
   2413     xcb_map_subwindows_request_t xcb_out;
   2414 
   2415     xcb_out.pad0 = 0;
   2416     xcb_out.window = window;
   2417 
   2418     xcb_parts[2].iov_base = (char *) &xcb_out;
   2419     xcb_parts[2].iov_len = sizeof(xcb_out);
   2420     xcb_parts[3].iov_base = 0;
   2421     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2422 
   2423     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   2424     return xcb_ret;
   2425 }
   2426 
   2427 xcb_void_cookie_t
   2428 xcb_map_subwindows (xcb_connection_t *c,
   2429                     xcb_window_t      window)
   2430 {
   2431     static const xcb_protocol_request_t xcb_req = {
   2432         .count = 2,
   2433         .ext = 0,
   2434         .opcode = XCB_MAP_SUBWINDOWS,
   2435         .isvoid = 1
   2436     };
   2437 
   2438     struct iovec xcb_parts[4];
   2439     xcb_void_cookie_t xcb_ret;
   2440     xcb_map_subwindows_request_t xcb_out;
   2441 
   2442     xcb_out.pad0 = 0;
   2443     xcb_out.window = window;
   2444 
   2445     xcb_parts[2].iov_base = (char *) &xcb_out;
   2446     xcb_parts[2].iov_len = sizeof(xcb_out);
   2447     xcb_parts[3].iov_base = 0;
   2448     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2449 
   2450     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   2451     return xcb_ret;
   2452 }
   2453 
   2454 xcb_void_cookie_t
   2455 xcb_unmap_window_checked (xcb_connection_t *c,
   2456                           xcb_window_t      window)
   2457 {
   2458     static const xcb_protocol_request_t xcb_req = {
   2459         .count = 2,
   2460         .ext = 0,
   2461         .opcode = XCB_UNMAP_WINDOW,
   2462         .isvoid = 1
   2463     };
   2464 
   2465     struct iovec xcb_parts[4];
   2466     xcb_void_cookie_t xcb_ret;
   2467     xcb_unmap_window_request_t xcb_out;
   2468 
   2469     xcb_out.pad0 = 0;
   2470     xcb_out.window = window;
   2471 
   2472     xcb_parts[2].iov_base = (char *) &xcb_out;
   2473     xcb_parts[2].iov_len = sizeof(xcb_out);
   2474     xcb_parts[3].iov_base = 0;
   2475     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2476 
   2477     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   2478     return xcb_ret;
   2479 }
   2480 
   2481 xcb_void_cookie_t
   2482 xcb_unmap_window (xcb_connection_t *c,
   2483                   xcb_window_t      window)
   2484 {
   2485     static const xcb_protocol_request_t xcb_req = {
   2486         .count = 2,
   2487         .ext = 0,
   2488         .opcode = XCB_UNMAP_WINDOW,
   2489         .isvoid = 1
   2490     };
   2491 
   2492     struct iovec xcb_parts[4];
   2493     xcb_void_cookie_t xcb_ret;
   2494     xcb_unmap_window_request_t xcb_out;
   2495 
   2496     xcb_out.pad0 = 0;
   2497     xcb_out.window = window;
   2498 
   2499     xcb_parts[2].iov_base = (char *) &xcb_out;
   2500     xcb_parts[2].iov_len = sizeof(xcb_out);
   2501     xcb_parts[3].iov_base = 0;
   2502     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2503 
   2504     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   2505     return xcb_ret;
   2506 }
   2507 
   2508 xcb_void_cookie_t
   2509 xcb_unmap_subwindows_checked (xcb_connection_t *c,
   2510                               xcb_window_t      window)
   2511 {
   2512     static const xcb_protocol_request_t xcb_req = {
   2513         .count = 2,
   2514         .ext = 0,
   2515         .opcode = XCB_UNMAP_SUBWINDOWS,
   2516         .isvoid = 1
   2517     };
   2518 
   2519     struct iovec xcb_parts[4];
   2520     xcb_void_cookie_t xcb_ret;
   2521     xcb_unmap_subwindows_request_t xcb_out;
   2522 
   2523     xcb_out.pad0 = 0;
   2524     xcb_out.window = window;
   2525 
   2526     xcb_parts[2].iov_base = (char *) &xcb_out;
   2527     xcb_parts[2].iov_len = sizeof(xcb_out);
   2528     xcb_parts[3].iov_base = 0;
   2529     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2530 
   2531     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   2532     return xcb_ret;
   2533 }
   2534 
   2535 xcb_void_cookie_t
   2536 xcb_unmap_subwindows (xcb_connection_t *c,
   2537                       xcb_window_t      window)
   2538 {
   2539     static const xcb_protocol_request_t xcb_req = {
   2540         .count = 2,
   2541         .ext = 0,
   2542         .opcode = XCB_UNMAP_SUBWINDOWS,
   2543         .isvoid = 1
   2544     };
   2545 
   2546     struct iovec xcb_parts[4];
   2547     xcb_void_cookie_t xcb_ret;
   2548     xcb_unmap_subwindows_request_t xcb_out;
   2549 
   2550     xcb_out.pad0 = 0;
   2551     xcb_out.window = window;
   2552 
   2553     xcb_parts[2].iov_base = (char *) &xcb_out;
   2554     xcb_parts[2].iov_len = sizeof(xcb_out);
   2555     xcb_parts[3].iov_base = 0;
   2556     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2557 
   2558     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   2559     return xcb_ret;
   2560 }
   2561 
   2562 int
   2563 xcb_configure_window_value_list_serialize (void                                    **_buffer,
   2564                                            uint16_t                                  value_mask,
   2565                                            const xcb_configure_window_value_list_t  *_aux)
   2566 {
   2567     char *xcb_out = *_buffer;
   2568     unsigned int xcb_buffer_len = 0;
   2569     unsigned int xcb_align_to = 0;
   2570     unsigned int xcb_padding_offset = 0;
   2571 
   2572     unsigned int xcb_pad = 0;
   2573     char xcb_pad0[3] = {0, 0, 0};
   2574     struct iovec xcb_parts[8];
   2575     unsigned int xcb_parts_idx = 0;
   2576     unsigned int xcb_block_len = 0;
   2577     unsigned int i;
   2578     char *xcb_tmp;
   2579 
   2580     if(value_mask & XCB_CONFIG_WINDOW_X) {
   2581         /* xcb_configure_window_value_list_t.x */
   2582         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->x;
   2583         xcb_block_len += sizeof(int32_t);
   2584         xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t);
   2585         xcb_parts_idx++;
   2586         xcb_align_to = ALIGNOF(int32_t);
   2587     }
   2588     if(value_mask & XCB_CONFIG_WINDOW_Y) {
   2589         /* xcb_configure_window_value_list_t.y */
   2590         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->y;
   2591         xcb_block_len += sizeof(int32_t);
   2592         xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t);
   2593         xcb_parts_idx++;
   2594         xcb_align_to = ALIGNOF(int32_t);
   2595     }
   2596     if(value_mask & XCB_CONFIG_WINDOW_WIDTH) {
   2597         /* xcb_configure_window_value_list_t.width */
   2598         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->width;
   2599         xcb_block_len += sizeof(uint32_t);
   2600         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   2601         xcb_parts_idx++;
   2602         xcb_align_to = ALIGNOF(uint32_t);
   2603     }
   2604     if(value_mask & XCB_CONFIG_WINDOW_HEIGHT) {
   2605         /* xcb_configure_window_value_list_t.height */
   2606         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->height;
   2607         xcb_block_len += sizeof(uint32_t);
   2608         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   2609         xcb_parts_idx++;
   2610         xcb_align_to = ALIGNOF(uint32_t);
   2611     }
   2612     if(value_mask & XCB_CONFIG_WINDOW_BORDER_WIDTH) {
   2613         /* xcb_configure_window_value_list_t.border_width */
   2614         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->border_width;
   2615         xcb_block_len += sizeof(uint32_t);
   2616         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   2617         xcb_parts_idx++;
   2618         xcb_align_to = ALIGNOF(uint32_t);
   2619     }
   2620     if(value_mask & XCB_CONFIG_WINDOW_SIBLING) {
   2621         /* xcb_configure_window_value_list_t.sibling */
   2622         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->sibling;
   2623         xcb_block_len += sizeof(xcb_window_t);
   2624         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_window_t);
   2625         xcb_parts_idx++;
   2626         xcb_align_to = ALIGNOF(xcb_window_t);
   2627     }
   2628     if(value_mask & XCB_CONFIG_WINDOW_STACK_MODE) {
   2629         /* xcb_configure_window_value_list_t.stack_mode */
   2630         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->stack_mode;
   2631         xcb_block_len += sizeof(uint32_t);
   2632         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   2633         xcb_parts_idx++;
   2634         xcb_align_to = ALIGNOF(uint32_t);
   2635     }
   2636     /* insert padding */
   2637     xcb_pad = -(xcb_block_len + xcb_padding_offset) & (xcb_align_to - 1);
   2638     xcb_buffer_len += xcb_block_len + xcb_pad;
   2639     if (0 != xcb_pad) {
   2640         xcb_parts[xcb_parts_idx].iov_base = xcb_pad0;
   2641         xcb_parts[xcb_parts_idx].iov_len = xcb_pad;
   2642         xcb_parts_idx++;
   2643         xcb_pad = 0;
   2644     }
   2645     xcb_block_len = 0;
   2646     xcb_padding_offset = 0;
   2647 
   2648     if (NULL == xcb_out) {
   2649         /* allocate memory */
   2650         xcb_out = malloc(xcb_buffer_len);
   2651         *_buffer = xcb_out;
   2652     }
   2653 
   2654     xcb_tmp = xcb_out;
   2655     for(i=0; i<xcb_parts_idx; i++) {
   2656         if (0 != xcb_parts[i].iov_base && 0 != xcb_parts[i].iov_len)
   2657             memcpy(xcb_tmp, xcb_parts[i].iov_base, xcb_parts[i].iov_len);
   2658         if (0 != xcb_parts[i].iov_len)
   2659             xcb_tmp += xcb_parts[i].iov_len;
   2660     }
   2661 
   2662     return xcb_buffer_len;
   2663 }
   2664 
   2665 int
   2666 xcb_configure_window_value_list_unpack (const void                         *_buffer,
   2667                                         uint16_t                            value_mask,
   2668                                         xcb_configure_window_value_list_t  *_aux)
   2669 {
   2670     char *xcb_tmp = (char *)_buffer;
   2671     unsigned int xcb_buffer_len = 0;
   2672     unsigned int xcb_block_len = 0;
   2673     unsigned int xcb_pad = 0;
   2674     unsigned int xcb_align_to = 0;
   2675     unsigned int xcb_padding_offset = 0;
   2676 
   2677 
   2678     if(value_mask & XCB_CONFIG_WINDOW_X) {
   2679         /* xcb_configure_window_value_list_t.x */
   2680         _aux->x = *(int32_t *)xcb_tmp;
   2681         xcb_block_len += sizeof(int32_t);
   2682         xcb_tmp += sizeof(int32_t);
   2683         xcb_align_to = ALIGNOF(int32_t);
   2684     }
   2685     if(value_mask & XCB_CONFIG_WINDOW_Y) {
   2686         /* xcb_configure_window_value_list_t.y */
   2687         _aux->y = *(int32_t *)xcb_tmp;
   2688         xcb_block_len += sizeof(int32_t);
   2689         xcb_tmp += sizeof(int32_t);
   2690         xcb_align_to = ALIGNOF(int32_t);
   2691     }
   2692     if(value_mask & XCB_CONFIG_WINDOW_WIDTH) {
   2693         /* xcb_configure_window_value_list_t.width */
   2694         _aux->width = *(uint32_t *)xcb_tmp;
   2695         xcb_block_len += sizeof(uint32_t);
   2696         xcb_tmp += sizeof(uint32_t);
   2697         xcb_align_to = ALIGNOF(uint32_t);
   2698     }
   2699     if(value_mask & XCB_CONFIG_WINDOW_HEIGHT) {
   2700         /* xcb_configure_window_value_list_t.height */
   2701         _aux->height = *(uint32_t *)xcb_tmp;
   2702         xcb_block_len += sizeof(uint32_t);
   2703         xcb_tmp += sizeof(uint32_t);
   2704         xcb_align_to = ALIGNOF(uint32_t);
   2705     }
   2706     if(value_mask & XCB_CONFIG_WINDOW_BORDER_WIDTH) {
   2707         /* xcb_configure_window_value_list_t.border_width */
   2708         _aux->border_width = *(uint32_t *)xcb_tmp;
   2709         xcb_block_len += sizeof(uint32_t);
   2710         xcb_tmp += sizeof(uint32_t);
   2711         xcb_align_to = ALIGNOF(uint32_t);
   2712     }
   2713     if(value_mask & XCB_CONFIG_WINDOW_SIBLING) {
   2714         /* xcb_configure_window_value_list_t.sibling */
   2715         _aux->sibling = *(xcb_window_t *)xcb_tmp;
   2716         xcb_block_len += sizeof(xcb_window_t);
   2717         xcb_tmp += sizeof(xcb_window_t);
   2718         xcb_align_to = ALIGNOF(xcb_window_t);
   2719     }
   2720     if(value_mask & XCB_CONFIG_WINDOW_STACK_MODE) {
   2721         /* xcb_configure_window_value_list_t.stack_mode */
   2722         _aux->stack_mode = *(uint32_t *)xcb_tmp;
   2723         xcb_block_len += sizeof(uint32_t);
   2724         xcb_tmp += sizeof(uint32_t);
   2725         xcb_align_to = ALIGNOF(uint32_t);
   2726     }
   2727     /* insert padding */
   2728     xcb_pad = -(xcb_block_len + xcb_padding_offset) & (xcb_align_to - 1);
   2729     xcb_buffer_len += xcb_block_len + xcb_pad;
   2730     if (0 != xcb_pad) {
   2731         xcb_tmp += xcb_pad;
   2732         xcb_pad = 0;
   2733     }
   2734     xcb_block_len = 0;
   2735     xcb_padding_offset = 0;
   2736 
   2737     return xcb_buffer_len;
   2738 }
   2739 
   2740 int
   2741 xcb_configure_window_value_list_sizeof (const void  *_buffer,
   2742                                         uint16_t     value_mask)
   2743 {
   2744     xcb_configure_window_value_list_t _aux;
   2745     return xcb_configure_window_value_list_unpack(_buffer, value_mask, &_aux);
   2746 }
   2747 
   2748 int
   2749 xcb_configure_window_sizeof (const void  *_buffer)
   2750 {
   2751     char *xcb_tmp = (char *)_buffer;
   2752     const xcb_configure_window_request_t *_aux = (xcb_configure_window_request_t *)_buffer;
   2753     unsigned int xcb_buffer_len = 0;
   2754     unsigned int xcb_block_len = 0;
   2755     unsigned int xcb_pad = 0;
   2756     unsigned int xcb_align_to = 0;
   2757 
   2758 
   2759     xcb_block_len += sizeof(xcb_configure_window_request_t);
   2760     xcb_tmp += xcb_block_len;
   2761     xcb_buffer_len += xcb_block_len;
   2762     xcb_block_len = 0;
   2763     /* value_list */
   2764     xcb_block_len += xcb_configure_window_value_list_sizeof(xcb_tmp, _aux->value_mask);
   2765     xcb_tmp += xcb_block_len;
   2766     xcb_align_to = ALIGNOF(char);
   2767     /* insert padding */
   2768     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   2769     xcb_buffer_len += xcb_block_len + xcb_pad;
   2770     if (0 != xcb_pad) {
   2771         xcb_tmp += xcb_pad;
   2772         xcb_pad = 0;
   2773     }
   2774     xcb_block_len = 0;
   2775 
   2776     return xcb_buffer_len;
   2777 }
   2778 
   2779 xcb_void_cookie_t
   2780 xcb_configure_window_checked (xcb_connection_t *c,
   2781                               xcb_window_t      window,
   2782                               uint16_t          value_mask,
   2783                               const void       *value_list)
   2784 {
   2785     static const xcb_protocol_request_t xcb_req = {
   2786         .count = 3,
   2787         .ext = 0,
   2788         .opcode = XCB_CONFIGURE_WINDOW,
   2789         .isvoid = 1
   2790     };
   2791 
   2792     struct iovec xcb_parts[5];
   2793     xcb_void_cookie_t xcb_ret;
   2794     xcb_configure_window_request_t xcb_out;
   2795 
   2796     xcb_out.pad0 = 0;
   2797     xcb_out.window = window;
   2798     xcb_out.value_mask = value_mask;
   2799     memset(xcb_out.pad1, 0, 2);
   2800 
   2801     xcb_parts[2].iov_base = (char *) &xcb_out;
   2802     xcb_parts[2].iov_len = sizeof(xcb_out);
   2803     xcb_parts[3].iov_base = 0;
   2804     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2805     /* xcb_configure_window_value_list_t value_list */
   2806     xcb_parts[4].iov_base = (char *) value_list;
   2807     xcb_parts[4].iov_len =
   2808       xcb_configure_window_value_list_sizeof (value_list, value_mask);
   2809 
   2810     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   2811     return xcb_ret;
   2812 }
   2813 
   2814 xcb_void_cookie_t
   2815 xcb_configure_window (xcb_connection_t *c,
   2816                       xcb_window_t      window,
   2817                       uint16_t          value_mask,
   2818                       const void       *value_list)
   2819 {
   2820     static const xcb_protocol_request_t xcb_req = {
   2821         .count = 3,
   2822         .ext = 0,
   2823         .opcode = XCB_CONFIGURE_WINDOW,
   2824         .isvoid = 1
   2825     };
   2826 
   2827     struct iovec xcb_parts[5];
   2828     xcb_void_cookie_t xcb_ret;
   2829     xcb_configure_window_request_t xcb_out;
   2830 
   2831     xcb_out.pad0 = 0;
   2832     xcb_out.window = window;
   2833     xcb_out.value_mask = value_mask;
   2834     memset(xcb_out.pad1, 0, 2);
   2835 
   2836     xcb_parts[2].iov_base = (char *) &xcb_out;
   2837     xcb_parts[2].iov_len = sizeof(xcb_out);
   2838     xcb_parts[3].iov_base = 0;
   2839     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2840     /* xcb_configure_window_value_list_t value_list */
   2841     xcb_parts[4].iov_base = (char *) value_list;
   2842     xcb_parts[4].iov_len =
   2843       xcb_configure_window_value_list_sizeof (value_list, value_mask);
   2844 
   2845     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   2846     return xcb_ret;
   2847 }
   2848 
   2849 xcb_void_cookie_t
   2850 xcb_configure_window_aux_checked (xcb_connection_t                        *c,
   2851                                   xcb_window_t                             window,
   2852                                   uint16_t                                 value_mask,
   2853                                   const xcb_configure_window_value_list_t *value_list)
   2854 {
   2855     static const xcb_protocol_request_t xcb_req = {
   2856         .count = 3,
   2857         .ext = 0,
   2858         .opcode = XCB_CONFIGURE_WINDOW,
   2859         .isvoid = 1
   2860     };
   2861 
   2862     struct iovec xcb_parts[5];
   2863     xcb_void_cookie_t xcb_ret;
   2864     xcb_configure_window_request_t xcb_out;
   2865     void *xcb_aux0 = 0;
   2866 
   2867     xcb_out.pad0 = 0;
   2868     xcb_out.window = window;
   2869     xcb_out.value_mask = value_mask;
   2870     memset(xcb_out.pad1, 0, 2);
   2871 
   2872     xcb_parts[2].iov_base = (char *) &xcb_out;
   2873     xcb_parts[2].iov_len = sizeof(xcb_out);
   2874     xcb_parts[3].iov_base = 0;
   2875     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2876     /* xcb_configure_window_value_list_t value_list */
   2877     xcb_parts[4].iov_len =
   2878       xcb_configure_window_value_list_serialize (&xcb_aux0, value_mask, value_list);
   2879     xcb_parts[4].iov_base = xcb_aux0;
   2880 
   2881     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   2882     free(xcb_aux0);
   2883     return xcb_ret;
   2884 }
   2885 
   2886 xcb_void_cookie_t
   2887 xcb_configure_window_aux (xcb_connection_t                        *c,
   2888                           xcb_window_t                             window,
   2889                           uint16_t                                 value_mask,
   2890                           const xcb_configure_window_value_list_t *value_list)
   2891 {
   2892     static const xcb_protocol_request_t xcb_req = {
   2893         .count = 3,
   2894         .ext = 0,
   2895         .opcode = XCB_CONFIGURE_WINDOW,
   2896         .isvoid = 1
   2897     };
   2898 
   2899     struct iovec xcb_parts[5];
   2900     xcb_void_cookie_t xcb_ret;
   2901     xcb_configure_window_request_t xcb_out;
   2902     void *xcb_aux0 = 0;
   2903 
   2904     xcb_out.pad0 = 0;
   2905     xcb_out.window = window;
   2906     xcb_out.value_mask = value_mask;
   2907     memset(xcb_out.pad1, 0, 2);
   2908 
   2909     xcb_parts[2].iov_base = (char *) &xcb_out;
   2910     xcb_parts[2].iov_len = sizeof(xcb_out);
   2911     xcb_parts[3].iov_base = 0;
   2912     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2913     /* xcb_configure_window_value_list_t value_list */
   2914     xcb_parts[4].iov_len =
   2915       xcb_configure_window_value_list_serialize (&xcb_aux0, value_mask, value_list);
   2916     xcb_parts[4].iov_base = xcb_aux0;
   2917 
   2918     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   2919     free(xcb_aux0);
   2920     return xcb_ret;
   2921 }
   2922 
   2923 void *
   2924 xcb_configure_window_value_list (const xcb_configure_window_request_t *R)
   2925 {
   2926     return (void *) (R + 1);
   2927 }
   2928 
   2929 xcb_void_cookie_t
   2930 xcb_circulate_window_checked (xcb_connection_t *c,
   2931                               uint8_t           direction,
   2932                               xcb_window_t      window)
   2933 {
   2934     static const xcb_protocol_request_t xcb_req = {
   2935         .count = 2,
   2936         .ext = 0,
   2937         .opcode = XCB_CIRCULATE_WINDOW,
   2938         .isvoid = 1
   2939     };
   2940 
   2941     struct iovec xcb_parts[4];
   2942     xcb_void_cookie_t xcb_ret;
   2943     xcb_circulate_window_request_t xcb_out;
   2944 
   2945     xcb_out.direction = direction;
   2946     xcb_out.window = window;
   2947 
   2948     xcb_parts[2].iov_base = (char *) &xcb_out;
   2949     xcb_parts[2].iov_len = sizeof(xcb_out);
   2950     xcb_parts[3].iov_base = 0;
   2951     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2952 
   2953     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   2954     return xcb_ret;
   2955 }
   2956 
   2957 xcb_void_cookie_t
   2958 xcb_circulate_window (xcb_connection_t *c,
   2959                       uint8_t           direction,
   2960                       xcb_window_t      window)
   2961 {
   2962     static const xcb_protocol_request_t xcb_req = {
   2963         .count = 2,
   2964         .ext = 0,
   2965         .opcode = XCB_CIRCULATE_WINDOW,
   2966         .isvoid = 1
   2967     };
   2968 
   2969     struct iovec xcb_parts[4];
   2970     xcb_void_cookie_t xcb_ret;
   2971     xcb_circulate_window_request_t xcb_out;
   2972 
   2973     xcb_out.direction = direction;
   2974     xcb_out.window = window;
   2975 
   2976     xcb_parts[2].iov_base = (char *) &xcb_out;
   2977     xcb_parts[2].iov_len = sizeof(xcb_out);
   2978     xcb_parts[3].iov_base = 0;
   2979     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   2980 
   2981     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   2982     return xcb_ret;
   2983 }
   2984 
   2985 xcb_get_geometry_cookie_t
   2986 xcb_get_geometry (xcb_connection_t *c,
   2987                   xcb_drawable_t    drawable)
   2988 {
   2989     static const xcb_protocol_request_t xcb_req = {
   2990         .count = 2,
   2991         .ext = 0,
   2992         .opcode = XCB_GET_GEOMETRY,
   2993         .isvoid = 0
   2994     };
   2995 
   2996     struct iovec xcb_parts[4];
   2997     xcb_get_geometry_cookie_t xcb_ret;
   2998     xcb_get_geometry_request_t xcb_out;
   2999 
   3000     xcb_out.pad0 = 0;
   3001     xcb_out.drawable = drawable;
   3002 
   3003     xcb_parts[2].iov_base = (char *) &xcb_out;
   3004     xcb_parts[2].iov_len = sizeof(xcb_out);
   3005     xcb_parts[3].iov_base = 0;
   3006     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   3007 
   3008     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   3009     return xcb_ret;
   3010 }
   3011 
   3012 xcb_get_geometry_cookie_t
   3013 xcb_get_geometry_unchecked (xcb_connection_t *c,
   3014                             xcb_drawable_t    drawable)
   3015 {
   3016     static const xcb_protocol_request_t xcb_req = {
   3017         .count = 2,
   3018         .ext = 0,
   3019         .opcode = XCB_GET_GEOMETRY,
   3020         .isvoid = 0
   3021     };
   3022 
   3023     struct iovec xcb_parts[4];
   3024     xcb_get_geometry_cookie_t xcb_ret;
   3025     xcb_get_geometry_request_t xcb_out;
   3026 
   3027     xcb_out.pad0 = 0;
   3028     xcb_out.drawable = drawable;
   3029 
   3030     xcb_parts[2].iov_base = (char *) &xcb_out;
   3031     xcb_parts[2].iov_len = sizeof(xcb_out);
   3032     xcb_parts[3].iov_base = 0;
   3033     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   3034 
   3035     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   3036     return xcb_ret;
   3037 }
   3038 
   3039 xcb_get_geometry_reply_t *
   3040 xcb_get_geometry_reply (xcb_connection_t           *c,
   3041                         xcb_get_geometry_cookie_t   cookie  /**< */,
   3042                         xcb_generic_error_t       **e)
   3043 {
   3044     return (xcb_get_geometry_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   3045 }
   3046 
   3047 int
   3048 xcb_query_tree_sizeof (const void  *_buffer)
   3049 {
   3050     char *xcb_tmp = (char *)_buffer;
   3051     const xcb_query_tree_reply_t *_aux = (xcb_query_tree_reply_t *)_buffer;
   3052     unsigned int xcb_buffer_len = 0;
   3053     unsigned int xcb_block_len = 0;
   3054     unsigned int xcb_pad = 0;
   3055     unsigned int xcb_align_to = 0;
   3056 
   3057 
   3058     xcb_block_len += sizeof(xcb_query_tree_reply_t);
   3059     xcb_tmp += xcb_block_len;
   3060     xcb_buffer_len += xcb_block_len;
   3061     xcb_block_len = 0;
   3062     /* children */
   3063     xcb_block_len += _aux->children_len * sizeof(xcb_window_t);
   3064     xcb_tmp += xcb_block_len;
   3065     xcb_align_to = ALIGNOF(xcb_window_t);
   3066     /* insert padding */
   3067     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   3068     xcb_buffer_len += xcb_block_len + xcb_pad;
   3069     if (0 != xcb_pad) {
   3070         xcb_tmp += xcb_pad;
   3071         xcb_pad = 0;
   3072     }
   3073     xcb_block_len = 0;
   3074 
   3075     return xcb_buffer_len;
   3076 }
   3077 
   3078 xcb_query_tree_cookie_t
   3079 xcb_query_tree (xcb_connection_t *c,
   3080                 xcb_window_t      window)
   3081 {
   3082     static const xcb_protocol_request_t xcb_req = {
   3083         .count = 2,
   3084         .ext = 0,
   3085         .opcode = XCB_QUERY_TREE,
   3086         .isvoid = 0
   3087     };
   3088 
   3089     struct iovec xcb_parts[4];
   3090     xcb_query_tree_cookie_t xcb_ret;
   3091     xcb_query_tree_request_t xcb_out;
   3092 
   3093     xcb_out.pad0 = 0;
   3094     xcb_out.window = window;
   3095 
   3096     xcb_parts[2].iov_base = (char *) &xcb_out;
   3097     xcb_parts[2].iov_len = sizeof(xcb_out);
   3098     xcb_parts[3].iov_base = 0;
   3099     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   3100 
   3101     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   3102     return xcb_ret;
   3103 }
   3104 
   3105 xcb_query_tree_cookie_t
   3106 xcb_query_tree_unchecked (xcb_connection_t *c,
   3107                           xcb_window_t      window)
   3108 {
   3109     static const xcb_protocol_request_t xcb_req = {
   3110         .count = 2,
   3111         .ext = 0,
   3112         .opcode = XCB_QUERY_TREE,
   3113         .isvoid = 0
   3114     };
   3115 
   3116     struct iovec xcb_parts[4];
   3117     xcb_query_tree_cookie_t xcb_ret;
   3118     xcb_query_tree_request_t xcb_out;
   3119 
   3120     xcb_out.pad0 = 0;
   3121     xcb_out.window = window;
   3122 
   3123     xcb_parts[2].iov_base = (char *) &xcb_out;
   3124     xcb_parts[2].iov_len = sizeof(xcb_out);
   3125     xcb_parts[3].iov_base = 0;
   3126     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   3127 
   3128     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   3129     return xcb_ret;
   3130 }
   3131 
   3132 xcb_window_t *
   3133 xcb_query_tree_children (const xcb_query_tree_reply_t *R)
   3134 {
   3135     return (xcb_window_t *) (R + 1);
   3136 }
   3137 
   3138 int
   3139 xcb_query_tree_children_length (const xcb_query_tree_reply_t *R)
   3140 {
   3141     return R->children_len;
   3142 }
   3143 
   3144 xcb_generic_iterator_t
   3145 xcb_query_tree_children_end (const xcb_query_tree_reply_t *R)
   3146 {
   3147     xcb_generic_iterator_t i;
   3148     i.data = ((xcb_window_t *) (R + 1)) + (R->children_len);
   3149     i.rem = 0;
   3150     i.index = (char *) i.data - (char *) R;
   3151     return i;
   3152 }
   3153 
   3154 xcb_query_tree_reply_t *
   3155 xcb_query_tree_reply (xcb_connection_t         *c,
   3156                       xcb_query_tree_cookie_t   cookie  /**< */,
   3157                       xcb_generic_error_t     **e)
   3158 {
   3159     return (xcb_query_tree_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   3160 }
   3161 
   3162 int
   3163 xcb_intern_atom_sizeof (const void  *_buffer)
   3164 {
   3165     char *xcb_tmp = (char *)_buffer;
   3166     const xcb_intern_atom_request_t *_aux = (xcb_intern_atom_request_t *)_buffer;
   3167     unsigned int xcb_buffer_len = 0;
   3168     unsigned int xcb_block_len = 0;
   3169     unsigned int xcb_pad = 0;
   3170     unsigned int xcb_align_to = 0;
   3171 
   3172 
   3173     xcb_block_len += sizeof(xcb_intern_atom_request_t);
   3174     xcb_tmp += xcb_block_len;
   3175     xcb_buffer_len += xcb_block_len;
   3176     xcb_block_len = 0;
   3177     /* name */
   3178     xcb_block_len += _aux->name_len * sizeof(char);
   3179     xcb_tmp += xcb_block_len;
   3180     xcb_align_to = ALIGNOF(char);
   3181     /* insert padding */
   3182     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   3183     xcb_buffer_len += xcb_block_len + xcb_pad;
   3184     if (0 != xcb_pad) {
   3185         xcb_tmp += xcb_pad;
   3186         xcb_pad = 0;
   3187     }
   3188     xcb_block_len = 0;
   3189 
   3190     return xcb_buffer_len;
   3191 }
   3192 
   3193 xcb_intern_atom_cookie_t
   3194 xcb_intern_atom (xcb_connection_t *c,
   3195                  uint8_t           only_if_exists,
   3196                  uint16_t          name_len,
   3197                  const char       *name)
   3198 {
   3199     static const xcb_protocol_request_t xcb_req = {
   3200         .count = 4,
   3201         .ext = 0,
   3202         .opcode = XCB_INTERN_ATOM,
   3203         .isvoid = 0
   3204     };
   3205 
   3206     struct iovec xcb_parts[6];
   3207     xcb_intern_atom_cookie_t xcb_ret;
   3208     xcb_intern_atom_request_t xcb_out;
   3209 
   3210     xcb_out.only_if_exists = only_if_exists;
   3211     xcb_out.name_len = name_len;
   3212     memset(xcb_out.pad0, 0, 2);
   3213 
   3214     xcb_parts[2].iov_base = (char *) &xcb_out;
   3215     xcb_parts[2].iov_len = sizeof(xcb_out);
   3216     xcb_parts[3].iov_base = 0;
   3217     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   3218     /* char name */
   3219     xcb_parts[4].iov_base = (char *) name;
   3220     xcb_parts[4].iov_len = name_len * sizeof(char);
   3221     xcb_parts[5].iov_base = 0;
   3222     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   3223 
   3224     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   3225     return xcb_ret;
   3226 }
   3227 
   3228 xcb_intern_atom_cookie_t
   3229 xcb_intern_atom_unchecked (xcb_connection_t *c,
   3230                            uint8_t           only_if_exists,
   3231                            uint16_t          name_len,
   3232                            const char       *name)
   3233 {
   3234     static const xcb_protocol_request_t xcb_req = {
   3235         .count = 4,
   3236         .ext = 0,
   3237         .opcode = XCB_INTERN_ATOM,
   3238         .isvoid = 0
   3239     };
   3240 
   3241     struct iovec xcb_parts[6];
   3242     xcb_intern_atom_cookie_t xcb_ret;
   3243     xcb_intern_atom_request_t xcb_out;
   3244 
   3245     xcb_out.only_if_exists = only_if_exists;
   3246     xcb_out.name_len = name_len;
   3247     memset(xcb_out.pad0, 0, 2);
   3248 
   3249     xcb_parts[2].iov_base = (char *) &xcb_out;
   3250     xcb_parts[2].iov_len = sizeof(xcb_out);
   3251     xcb_parts[3].iov_base = 0;
   3252     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   3253     /* char name */
   3254     xcb_parts[4].iov_base = (char *) name;
   3255     xcb_parts[4].iov_len = name_len * sizeof(char);
   3256     xcb_parts[5].iov_base = 0;
   3257     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   3258 
   3259     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   3260     return xcb_ret;
   3261 }
   3262 
   3263 xcb_intern_atom_reply_t *
   3264 xcb_intern_atom_reply (xcb_connection_t          *c,
   3265                        xcb_intern_atom_cookie_t   cookie  /**< */,
   3266                        xcb_generic_error_t      **e)
   3267 {
   3268     return (xcb_intern_atom_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   3269 }
   3270 
   3271 int
   3272 xcb_get_atom_name_sizeof (const void  *_buffer)
   3273 {
   3274     char *xcb_tmp = (char *)_buffer;
   3275     const xcb_get_atom_name_reply_t *_aux = (xcb_get_atom_name_reply_t *)_buffer;
   3276     unsigned int xcb_buffer_len = 0;
   3277     unsigned int xcb_block_len = 0;
   3278     unsigned int xcb_pad = 0;
   3279     unsigned int xcb_align_to = 0;
   3280 
   3281 
   3282     xcb_block_len += sizeof(xcb_get_atom_name_reply_t);
   3283     xcb_tmp += xcb_block_len;
   3284     xcb_buffer_len += xcb_block_len;
   3285     xcb_block_len = 0;
   3286     /* name */
   3287     xcb_block_len += _aux->name_len * sizeof(char);
   3288     xcb_tmp += xcb_block_len;
   3289     xcb_align_to = ALIGNOF(char);
   3290     /* insert padding */
   3291     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   3292     xcb_buffer_len += xcb_block_len + xcb_pad;
   3293     if (0 != xcb_pad) {
   3294         xcb_tmp += xcb_pad;
   3295         xcb_pad = 0;
   3296     }
   3297     xcb_block_len = 0;
   3298 
   3299     return xcb_buffer_len;
   3300 }
   3301 
   3302 xcb_get_atom_name_cookie_t
   3303 xcb_get_atom_name (xcb_connection_t *c,
   3304                    xcb_atom_t        atom)
   3305 {
   3306     static const xcb_protocol_request_t xcb_req = {
   3307         .count = 2,
   3308         .ext = 0,
   3309         .opcode = XCB_GET_ATOM_NAME,
   3310         .isvoid = 0
   3311     };
   3312 
   3313     struct iovec xcb_parts[4];
   3314     xcb_get_atom_name_cookie_t xcb_ret;
   3315     xcb_get_atom_name_request_t xcb_out;
   3316 
   3317     xcb_out.pad0 = 0;
   3318     xcb_out.atom = atom;
   3319 
   3320     xcb_parts[2].iov_base = (char *) &xcb_out;
   3321     xcb_parts[2].iov_len = sizeof(xcb_out);
   3322     xcb_parts[3].iov_base = 0;
   3323     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   3324 
   3325     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   3326     return xcb_ret;
   3327 }
   3328 
   3329 xcb_get_atom_name_cookie_t
   3330 xcb_get_atom_name_unchecked (xcb_connection_t *c,
   3331                              xcb_atom_t        atom)
   3332 {
   3333     static const xcb_protocol_request_t xcb_req = {
   3334         .count = 2,
   3335         .ext = 0,
   3336         .opcode = XCB_GET_ATOM_NAME,
   3337         .isvoid = 0
   3338     };
   3339 
   3340     struct iovec xcb_parts[4];
   3341     xcb_get_atom_name_cookie_t xcb_ret;
   3342     xcb_get_atom_name_request_t xcb_out;
   3343 
   3344     xcb_out.pad0 = 0;
   3345     xcb_out.atom = atom;
   3346 
   3347     xcb_parts[2].iov_base = (char *) &xcb_out;
   3348     xcb_parts[2].iov_len = sizeof(xcb_out);
   3349     xcb_parts[3].iov_base = 0;
   3350     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   3351 
   3352     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   3353     return xcb_ret;
   3354 }
   3355 
   3356 char *
   3357 xcb_get_atom_name_name (const xcb_get_atom_name_reply_t *R)
   3358 {
   3359     return (char *) (R + 1);
   3360 }
   3361 
   3362 int
   3363 xcb_get_atom_name_name_length (const xcb_get_atom_name_reply_t *R)
   3364 {
   3365     return R->name_len;
   3366 }
   3367 
   3368 xcb_generic_iterator_t
   3369 xcb_get_atom_name_name_end (const xcb_get_atom_name_reply_t *R)
   3370 {
   3371     xcb_generic_iterator_t i;
   3372     i.data = ((char *) (R + 1)) + (R->name_len);
   3373     i.rem = 0;
   3374     i.index = (char *) i.data - (char *) R;
   3375     return i;
   3376 }
   3377 
   3378 xcb_get_atom_name_reply_t *
   3379 xcb_get_atom_name_reply (xcb_connection_t            *c,
   3380                          xcb_get_atom_name_cookie_t   cookie  /**< */,
   3381                          xcb_generic_error_t        **e)
   3382 {
   3383     return (xcb_get_atom_name_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   3384 }
   3385 
   3386 int
   3387 xcb_change_property_sizeof (const void  *_buffer)
   3388 {
   3389     char *xcb_tmp = (char *)_buffer;
   3390     const xcb_change_property_request_t *_aux = (xcb_change_property_request_t *)_buffer;
   3391     unsigned int xcb_buffer_len = 0;
   3392     unsigned int xcb_block_len = 0;
   3393     unsigned int xcb_pad = 0;
   3394     unsigned int xcb_align_to = 0;
   3395 
   3396 
   3397     xcb_block_len += sizeof(xcb_change_property_request_t);
   3398     xcb_tmp += xcb_block_len;
   3399     xcb_buffer_len += xcb_block_len;
   3400     xcb_block_len = 0;
   3401     /* data */
   3402     xcb_block_len += ((_aux->data_len * _aux->format) / 8) * sizeof(char);
   3403     xcb_tmp += xcb_block_len;
   3404     xcb_align_to = ALIGNOF(char);
   3405     /* insert padding */
   3406     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   3407     xcb_buffer_len += xcb_block_len + xcb_pad;
   3408     if (0 != xcb_pad) {
   3409         xcb_tmp += xcb_pad;
   3410         xcb_pad = 0;
   3411     }
   3412     xcb_block_len = 0;
   3413 
   3414     return xcb_buffer_len;
   3415 }
   3416 
   3417 xcb_void_cookie_t
   3418 xcb_change_property_checked (xcb_connection_t *c,
   3419                              uint8_t           mode,
   3420                              xcb_window_t      window,
   3421                              xcb_atom_t        property,
   3422                              xcb_atom_t        type,
   3423                              uint8_t           format,
   3424                              uint32_t          data_len,
   3425                              const void       *data)
   3426 {
   3427     static const xcb_protocol_request_t xcb_req = {
   3428         .count = 4,
   3429         .ext = 0,
   3430         .opcode = XCB_CHANGE_PROPERTY,
   3431         .isvoid = 1
   3432     };
   3433 
   3434     struct iovec xcb_parts[6];
   3435     xcb_void_cookie_t xcb_ret;
   3436     xcb_change_property_request_t xcb_out;
   3437 
   3438     xcb_out.mode = mode;
   3439     xcb_out.window = window;
   3440     xcb_out.property = property;
   3441     xcb_out.type = type;
   3442     xcb_out.format = format;
   3443     memset(xcb_out.pad0, 0, 3);
   3444     xcb_out.data_len = data_len;
   3445 
   3446     xcb_parts[2].iov_base = (char *) &xcb_out;
   3447     xcb_parts[2].iov_len = sizeof(xcb_out);
   3448     xcb_parts[3].iov_base = 0;
   3449     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   3450     /* void data */
   3451     xcb_parts[4].iov_base = (char *) data;
   3452     xcb_parts[4].iov_len = ((data_len * format) / 8) * sizeof(char);
   3453     xcb_parts[5].iov_base = 0;
   3454     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   3455 
   3456     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   3457     return xcb_ret;
   3458 }
   3459 
   3460 xcb_void_cookie_t
   3461 xcb_change_property (xcb_connection_t *c,
   3462                      uint8_t           mode,
   3463                      xcb_window_t      window,
   3464                      xcb_atom_t        property,
   3465                      xcb_atom_t        type,
   3466                      uint8_t           format,
   3467                      uint32_t          data_len,
   3468                      const void       *data)
   3469 {
   3470     static const xcb_protocol_request_t xcb_req = {
   3471         .count = 4,
   3472         .ext = 0,
   3473         .opcode = XCB_CHANGE_PROPERTY,
   3474         .isvoid = 1
   3475     };
   3476 
   3477     struct iovec xcb_parts[6];
   3478     xcb_void_cookie_t xcb_ret;
   3479     xcb_change_property_request_t xcb_out;
   3480 
   3481     xcb_out.mode = mode;
   3482     xcb_out.window = window;
   3483     xcb_out.property = property;
   3484     xcb_out.type = type;
   3485     xcb_out.format = format;
   3486     memset(xcb_out.pad0, 0, 3);
   3487     xcb_out.data_len = data_len;
   3488 
   3489     xcb_parts[2].iov_base = (char *) &xcb_out;
   3490     xcb_parts[2].iov_len = sizeof(xcb_out);
   3491     xcb_parts[3].iov_base = 0;
   3492     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   3493     /* void data */
   3494     xcb_parts[4].iov_base = (char *) data;
   3495     xcb_parts[4].iov_len = ((data_len * format) / 8) * sizeof(char);
   3496     xcb_parts[5].iov_base = 0;
   3497     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   3498 
   3499     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   3500     return xcb_ret;
   3501 }
   3502 
   3503 void *
   3504 xcb_change_property_data (const xcb_change_property_request_t *R)
   3505 {
   3506     return (void *) (R + 1);
   3507 }
   3508 
   3509 int
   3510 xcb_change_property_data_length (const xcb_change_property_request_t *R)
   3511 {
   3512     return ((R->data_len * R->format) / 8);
   3513 }
   3514 
   3515 xcb_generic_iterator_t
   3516 xcb_change_property_data_end (const xcb_change_property_request_t *R)
   3517 {
   3518     xcb_generic_iterator_t i;
   3519     i.data = ((char *) (R + 1)) + (((R->data_len * R->format) / 8));
   3520     i.rem = 0;
   3521     i.index = (char *) i.data - (char *) R;
   3522     return i;
   3523 }
   3524 
   3525 xcb_void_cookie_t
   3526 xcb_delete_property_checked (xcb_connection_t *c,
   3527                              xcb_window_t      window,
   3528                              xcb_atom_t        property)
   3529 {
   3530     static const xcb_protocol_request_t xcb_req = {
   3531         .count = 2,
   3532         .ext = 0,
   3533         .opcode = XCB_DELETE_PROPERTY,
   3534         .isvoid = 1
   3535     };
   3536 
   3537     struct iovec xcb_parts[4];
   3538     xcb_void_cookie_t xcb_ret;
   3539     xcb_delete_property_request_t xcb_out;
   3540 
   3541     xcb_out.pad0 = 0;
   3542     xcb_out.window = window;
   3543     xcb_out.property = property;
   3544 
   3545     xcb_parts[2].iov_base = (char *) &xcb_out;
   3546     xcb_parts[2].iov_len = sizeof(xcb_out);
   3547     xcb_parts[3].iov_base = 0;
   3548     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   3549 
   3550     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   3551     return xcb_ret;
   3552 }
   3553 
   3554 xcb_void_cookie_t
   3555 xcb_delete_property (xcb_connection_t *c,
   3556                      xcb_window_t      window,
   3557                      xcb_atom_t        property)
   3558 {
   3559     static const xcb_protocol_request_t xcb_req = {
   3560         .count = 2,
   3561         .ext = 0,
   3562         .opcode = XCB_DELETE_PROPERTY,
   3563         .isvoid = 1
   3564     };
   3565 
   3566     struct iovec xcb_parts[4];
   3567     xcb_void_cookie_t xcb_ret;
   3568     xcb_delete_property_request_t xcb_out;
   3569 
   3570     xcb_out.pad0 = 0;
   3571     xcb_out.window = window;
   3572     xcb_out.property = property;
   3573 
   3574     xcb_parts[2].iov_base = (char *) &xcb_out;
   3575     xcb_parts[2].iov_len = sizeof(xcb_out);
   3576     xcb_parts[3].iov_base = 0;
   3577     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   3578 
   3579     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   3580     return xcb_ret;
   3581 }
   3582 
   3583 int
   3584 xcb_get_property_sizeof (const void  *_buffer)
   3585 {
   3586     char *xcb_tmp = (char *)_buffer;
   3587     const xcb_get_property_reply_t *_aux = (xcb_get_property_reply_t *)_buffer;
   3588     unsigned int xcb_buffer_len = 0;
   3589     unsigned int xcb_block_len = 0;
   3590     unsigned int xcb_pad = 0;
   3591     unsigned int xcb_align_to = 0;
   3592 
   3593 
   3594     xcb_block_len += sizeof(xcb_get_property_reply_t);
   3595     xcb_tmp += xcb_block_len;
   3596     xcb_buffer_len += xcb_block_len;
   3597     xcb_block_len = 0;
   3598     /* value */
   3599     xcb_block_len += (_aux->value_len * (_aux->format / 8)) * sizeof(char);
   3600     xcb_tmp += xcb_block_len;
   3601     xcb_align_to = ALIGNOF(char);
   3602     /* insert padding */
   3603     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   3604     xcb_buffer_len += xcb_block_len + xcb_pad;
   3605     if (0 != xcb_pad) {
   3606         xcb_tmp += xcb_pad;
   3607         xcb_pad = 0;
   3608     }
   3609     xcb_block_len = 0;
   3610 
   3611     return xcb_buffer_len;
   3612 }
   3613 
   3614 xcb_get_property_cookie_t
   3615 xcb_get_property (xcb_connection_t *c,
   3616                   uint8_t           _delete,
   3617                   xcb_window_t      window,
   3618                   xcb_atom_t        property,
   3619                   xcb_atom_t        type,
   3620                   uint32_t          long_offset,
   3621                   uint32_t          long_length)
   3622 {
   3623     static const xcb_protocol_request_t xcb_req = {
   3624         .count = 2,
   3625         .ext = 0,
   3626         .opcode = XCB_GET_PROPERTY,
   3627         .isvoid = 0
   3628     };
   3629 
   3630     struct iovec xcb_parts[4];
   3631     xcb_get_property_cookie_t xcb_ret;
   3632     xcb_get_property_request_t xcb_out;
   3633 
   3634     xcb_out._delete = _delete;
   3635     xcb_out.window = window;
   3636     xcb_out.property = property;
   3637     xcb_out.type = type;
   3638     xcb_out.long_offset = long_offset;
   3639     xcb_out.long_length = long_length;
   3640 
   3641     xcb_parts[2].iov_base = (char *) &xcb_out;
   3642     xcb_parts[2].iov_len = sizeof(xcb_out);
   3643     xcb_parts[3].iov_base = 0;
   3644     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   3645 
   3646     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   3647     return xcb_ret;
   3648 }
   3649 
   3650 xcb_get_property_cookie_t
   3651 xcb_get_property_unchecked (xcb_connection_t *c,
   3652                             uint8_t           _delete,
   3653                             xcb_window_t      window,
   3654                             xcb_atom_t        property,
   3655                             xcb_atom_t        type,
   3656                             uint32_t          long_offset,
   3657                             uint32_t          long_length)
   3658 {
   3659     static const xcb_protocol_request_t xcb_req = {
   3660         .count = 2,
   3661         .ext = 0,
   3662         .opcode = XCB_GET_PROPERTY,
   3663         .isvoid = 0
   3664     };
   3665 
   3666     struct iovec xcb_parts[4];
   3667     xcb_get_property_cookie_t xcb_ret;
   3668     xcb_get_property_request_t xcb_out;
   3669 
   3670     xcb_out._delete = _delete;
   3671     xcb_out.window = window;
   3672     xcb_out.property = property;
   3673     xcb_out.type = type;
   3674     xcb_out.long_offset = long_offset;
   3675     xcb_out.long_length = long_length;
   3676 
   3677     xcb_parts[2].iov_base = (char *) &xcb_out;
   3678     xcb_parts[2].iov_len = sizeof(xcb_out);
   3679     xcb_parts[3].iov_base = 0;
   3680     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   3681 
   3682     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   3683     return xcb_ret;
   3684 }
   3685 
   3686 void *
   3687 xcb_get_property_value (const xcb_get_property_reply_t *R)
   3688 {
   3689     return (void *) (R + 1);
   3690 }
   3691 
   3692 int
   3693 xcb_get_property_value_length (const xcb_get_property_reply_t *R)
   3694 {
   3695     return (R->value_len * (R->format / 8));
   3696 }
   3697 
   3698 xcb_generic_iterator_t
   3699 xcb_get_property_value_end (const xcb_get_property_reply_t *R)
   3700 {
   3701     xcb_generic_iterator_t i;
   3702     i.data = ((char *) (R + 1)) + ((R->value_len * (R->format / 8)));
   3703     i.rem = 0;
   3704     i.index = (char *) i.data - (char *) R;
   3705     return i;
   3706 }
   3707 
   3708 xcb_get_property_reply_t *
   3709 xcb_get_property_reply (xcb_connection_t           *c,
   3710                         xcb_get_property_cookie_t   cookie  /**< */,
   3711                         xcb_generic_error_t       **e)
   3712 {
   3713     return (xcb_get_property_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   3714 }
   3715 
   3716 int
   3717 xcb_list_properties_sizeof (const void  *_buffer)
   3718 {
   3719     char *xcb_tmp = (char *)_buffer;
   3720     const xcb_list_properties_reply_t *_aux = (xcb_list_properties_reply_t *)_buffer;
   3721     unsigned int xcb_buffer_len = 0;
   3722     unsigned int xcb_block_len = 0;
   3723     unsigned int xcb_pad = 0;
   3724     unsigned int xcb_align_to = 0;
   3725 
   3726 
   3727     xcb_block_len += sizeof(xcb_list_properties_reply_t);
   3728     xcb_tmp += xcb_block_len;
   3729     xcb_buffer_len += xcb_block_len;
   3730     xcb_block_len = 0;
   3731     /* atoms */
   3732     xcb_block_len += _aux->atoms_len * sizeof(xcb_atom_t);
   3733     xcb_tmp += xcb_block_len;
   3734     xcb_align_to = ALIGNOF(xcb_atom_t);
   3735     /* insert padding */
   3736     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   3737     xcb_buffer_len += xcb_block_len + xcb_pad;
   3738     if (0 != xcb_pad) {
   3739         xcb_tmp += xcb_pad;
   3740         xcb_pad = 0;
   3741     }
   3742     xcb_block_len = 0;
   3743 
   3744     return xcb_buffer_len;
   3745 }
   3746 
   3747 xcb_list_properties_cookie_t
   3748 xcb_list_properties (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_LIST_PROPERTIES,
   3755         .isvoid = 0
   3756     };
   3757 
   3758     struct iovec xcb_parts[4];
   3759     xcb_list_properties_cookie_t xcb_ret;
   3760     xcb_list_properties_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, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   3771     return xcb_ret;
   3772 }
   3773 
   3774 xcb_list_properties_cookie_t
   3775 xcb_list_properties_unchecked (xcb_connection_t *c,
   3776                                xcb_window_t      window)
   3777 {
   3778     static const xcb_protocol_request_t xcb_req = {
   3779         .count = 2,
   3780         .ext = 0,
   3781         .opcode = XCB_LIST_PROPERTIES,
   3782         .isvoid = 0
   3783     };
   3784 
   3785     struct iovec xcb_parts[4];
   3786     xcb_list_properties_cookie_t xcb_ret;
   3787     xcb_list_properties_request_t xcb_out;
   3788 
   3789     xcb_out.pad0 = 0;
   3790     xcb_out.window = window;
   3791 
   3792     xcb_parts[2].iov_base = (char *) &xcb_out;
   3793     xcb_parts[2].iov_len = sizeof(xcb_out);
   3794     xcb_parts[3].iov_base = 0;
   3795     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   3796 
   3797     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   3798     return xcb_ret;
   3799 }
   3800 
   3801 xcb_atom_t *
   3802 xcb_list_properties_atoms (const xcb_list_properties_reply_t *R)
   3803 {
   3804     return (xcb_atom_t *) (R + 1);
   3805 }
   3806 
   3807 int
   3808 xcb_list_properties_atoms_length (const xcb_list_properties_reply_t *R)
   3809 {
   3810     return R->atoms_len;
   3811 }
   3812 
   3813 xcb_generic_iterator_t
   3814 xcb_list_properties_atoms_end (const xcb_list_properties_reply_t *R)
   3815 {
   3816     xcb_generic_iterator_t i;
   3817     i.data = ((xcb_atom_t *) (R + 1)) + (R->atoms_len);
   3818     i.rem = 0;
   3819     i.index = (char *) i.data - (char *) R;
   3820     return i;
   3821 }
   3822 
   3823 xcb_list_properties_reply_t *
   3824 xcb_list_properties_reply (xcb_connection_t              *c,
   3825                            xcb_list_properties_cookie_t   cookie  /**< */,
   3826                            xcb_generic_error_t          **e)
   3827 {
   3828     return (xcb_list_properties_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   3829 }
   3830 
   3831 xcb_void_cookie_t
   3832 xcb_set_selection_owner_checked (xcb_connection_t *c,
   3833                                  xcb_window_t      owner,
   3834                                  xcb_atom_t        selection,
   3835                                  xcb_timestamp_t   time)
   3836 {
   3837     static const xcb_protocol_request_t xcb_req = {
   3838         .count = 2,
   3839         .ext = 0,
   3840         .opcode = XCB_SET_SELECTION_OWNER,
   3841         .isvoid = 1
   3842     };
   3843 
   3844     struct iovec xcb_parts[4];
   3845     xcb_void_cookie_t xcb_ret;
   3846     xcb_set_selection_owner_request_t xcb_out;
   3847 
   3848     xcb_out.pad0 = 0;
   3849     xcb_out.owner = owner;
   3850     xcb_out.selection = selection;
   3851     xcb_out.time = time;
   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_void_cookie_t
   3863 xcb_set_selection_owner (xcb_connection_t *c,
   3864                          xcb_window_t      owner,
   3865                          xcb_atom_t        selection,
   3866                          xcb_timestamp_t   time)
   3867 {
   3868     static const xcb_protocol_request_t xcb_req = {
   3869         .count = 2,
   3870         .ext = 0,
   3871         .opcode = XCB_SET_SELECTION_OWNER,
   3872         .isvoid = 1
   3873     };
   3874 
   3875     struct iovec xcb_parts[4];
   3876     xcb_void_cookie_t xcb_ret;
   3877     xcb_set_selection_owner_request_t xcb_out;
   3878 
   3879     xcb_out.pad0 = 0;
   3880     xcb_out.owner = owner;
   3881     xcb_out.selection = selection;
   3882     xcb_out.time = time;
   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_get_selection_owner_cookie_t
   3894 xcb_get_selection_owner (xcb_connection_t *c,
   3895                          xcb_atom_t        selection)
   3896 {
   3897     static const xcb_protocol_request_t xcb_req = {
   3898         .count = 2,
   3899         .ext = 0,
   3900         .opcode = XCB_GET_SELECTION_OWNER,
   3901         .isvoid = 0
   3902     };
   3903 
   3904     struct iovec xcb_parts[4];
   3905     xcb_get_selection_owner_cookie_t xcb_ret;
   3906     xcb_get_selection_owner_request_t xcb_out;
   3907 
   3908     xcb_out.pad0 = 0;
   3909     xcb_out.selection = selection;
   3910 
   3911     xcb_parts[2].iov_base = (char *) &xcb_out;
   3912     xcb_parts[2].iov_len = sizeof(xcb_out);
   3913     xcb_parts[3].iov_base = 0;
   3914     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   3915 
   3916     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   3917     return xcb_ret;
   3918 }
   3919 
   3920 xcb_get_selection_owner_cookie_t
   3921 xcb_get_selection_owner_unchecked (xcb_connection_t *c,
   3922                                    xcb_atom_t        selection)
   3923 {
   3924     static const xcb_protocol_request_t xcb_req = {
   3925         .count = 2,
   3926         .ext = 0,
   3927         .opcode = XCB_GET_SELECTION_OWNER,
   3928         .isvoid = 0
   3929     };
   3930 
   3931     struct iovec xcb_parts[4];
   3932     xcb_get_selection_owner_cookie_t xcb_ret;
   3933     xcb_get_selection_owner_request_t xcb_out;
   3934 
   3935     xcb_out.pad0 = 0;
   3936     xcb_out.selection = selection;
   3937 
   3938     xcb_parts[2].iov_base = (char *) &xcb_out;
   3939     xcb_parts[2].iov_len = sizeof(xcb_out);
   3940     xcb_parts[3].iov_base = 0;
   3941     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   3942 
   3943     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   3944     return xcb_ret;
   3945 }
   3946 
   3947 xcb_get_selection_owner_reply_t *
   3948 xcb_get_selection_owner_reply (xcb_connection_t                  *c,
   3949                                xcb_get_selection_owner_cookie_t   cookie  /**< */,
   3950                                xcb_generic_error_t              **e)
   3951 {
   3952     return (xcb_get_selection_owner_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   3953 }
   3954 
   3955 xcb_void_cookie_t
   3956 xcb_convert_selection_checked (xcb_connection_t *c,
   3957                                xcb_window_t      requestor,
   3958                                xcb_atom_t        selection,
   3959                                xcb_atom_t        target,
   3960                                xcb_atom_t        property,
   3961                                xcb_timestamp_t   time)
   3962 {
   3963     static const xcb_protocol_request_t xcb_req = {
   3964         .count = 2,
   3965         .ext = 0,
   3966         .opcode = XCB_CONVERT_SELECTION,
   3967         .isvoid = 1
   3968     };
   3969 
   3970     struct iovec xcb_parts[4];
   3971     xcb_void_cookie_t xcb_ret;
   3972     xcb_convert_selection_request_t xcb_out;
   3973 
   3974     xcb_out.pad0 = 0;
   3975     xcb_out.requestor = requestor;
   3976     xcb_out.selection = selection;
   3977     xcb_out.target = target;
   3978     xcb_out.property = property;
   3979     xcb_out.time = time;
   3980 
   3981     xcb_parts[2].iov_base = (char *) &xcb_out;
   3982     xcb_parts[2].iov_len = sizeof(xcb_out);
   3983     xcb_parts[3].iov_base = 0;
   3984     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   3985 
   3986     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   3987     return xcb_ret;
   3988 }
   3989 
   3990 xcb_void_cookie_t
   3991 xcb_convert_selection (xcb_connection_t *c,
   3992                        xcb_window_t      requestor,
   3993                        xcb_atom_t        selection,
   3994                        xcb_atom_t        target,
   3995                        xcb_atom_t        property,
   3996                        xcb_timestamp_t   time)
   3997 {
   3998     static const xcb_protocol_request_t xcb_req = {
   3999         .count = 2,
   4000         .ext = 0,
   4001         .opcode = XCB_CONVERT_SELECTION,
   4002         .isvoid = 1
   4003     };
   4004 
   4005     struct iovec xcb_parts[4];
   4006     xcb_void_cookie_t xcb_ret;
   4007     xcb_convert_selection_request_t xcb_out;
   4008 
   4009     xcb_out.pad0 = 0;
   4010     xcb_out.requestor = requestor;
   4011     xcb_out.selection = selection;
   4012     xcb_out.target = target;
   4013     xcb_out.property = property;
   4014     xcb_out.time = time;
   4015 
   4016     xcb_parts[2].iov_base = (char *) &xcb_out;
   4017     xcb_parts[2].iov_len = sizeof(xcb_out);
   4018     xcb_parts[3].iov_base = 0;
   4019     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4020 
   4021     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   4022     return xcb_ret;
   4023 }
   4024 
   4025 xcb_void_cookie_t
   4026 xcb_send_event_checked (xcb_connection_t *c,
   4027                         uint8_t           propagate,
   4028                         xcb_window_t      destination,
   4029                         uint32_t          event_mask,
   4030                         const char       *event)
   4031 {
   4032     static const xcb_protocol_request_t xcb_req = {
   4033         .count = 2,
   4034         .ext = 0,
   4035         .opcode = XCB_SEND_EVENT,
   4036         .isvoid = 1
   4037     };
   4038 
   4039     struct iovec xcb_parts[4];
   4040     xcb_void_cookie_t xcb_ret;
   4041     xcb_send_event_request_t xcb_out;
   4042 
   4043     xcb_out.propagate = propagate;
   4044     xcb_out.destination = destination;
   4045     xcb_out.event_mask = event_mask;
   4046     memcpy(xcb_out.event, event, 32);
   4047 
   4048     xcb_parts[2].iov_base = (char *) &xcb_out;
   4049     xcb_parts[2].iov_len = sizeof(xcb_out);
   4050     xcb_parts[3].iov_base = 0;
   4051     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4052 
   4053     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   4054     return xcb_ret;
   4055 }
   4056 
   4057 xcb_void_cookie_t
   4058 xcb_send_event (xcb_connection_t *c,
   4059                 uint8_t           propagate,
   4060                 xcb_window_t      destination,
   4061                 uint32_t          event_mask,
   4062                 const char       *event)
   4063 {
   4064     static const xcb_protocol_request_t xcb_req = {
   4065         .count = 2,
   4066         .ext = 0,
   4067         .opcode = XCB_SEND_EVENT,
   4068         .isvoid = 1
   4069     };
   4070 
   4071     struct iovec xcb_parts[4];
   4072     xcb_void_cookie_t xcb_ret;
   4073     xcb_send_event_request_t xcb_out;
   4074 
   4075     xcb_out.propagate = propagate;
   4076     xcb_out.destination = destination;
   4077     xcb_out.event_mask = event_mask;
   4078     memcpy(xcb_out.event, event, 32);
   4079 
   4080     xcb_parts[2].iov_base = (char *) &xcb_out;
   4081     xcb_parts[2].iov_len = sizeof(xcb_out);
   4082     xcb_parts[3].iov_base = 0;
   4083     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4084 
   4085     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   4086     return xcb_ret;
   4087 }
   4088 
   4089 xcb_grab_pointer_cookie_t
   4090 xcb_grab_pointer (xcb_connection_t *c,
   4091                   uint8_t           owner_events,
   4092                   xcb_window_t      grab_window,
   4093                   uint16_t          event_mask,
   4094                   uint8_t           pointer_mode,
   4095                   uint8_t           keyboard_mode,
   4096                   xcb_window_t      confine_to,
   4097                   xcb_cursor_t      cursor,
   4098                   xcb_timestamp_t   time)
   4099 {
   4100     static const xcb_protocol_request_t xcb_req = {
   4101         .count = 2,
   4102         .ext = 0,
   4103         .opcode = XCB_GRAB_POINTER,
   4104         .isvoid = 0
   4105     };
   4106 
   4107     struct iovec xcb_parts[4];
   4108     xcb_grab_pointer_cookie_t xcb_ret;
   4109     xcb_grab_pointer_request_t xcb_out;
   4110 
   4111     xcb_out.owner_events = owner_events;
   4112     xcb_out.grab_window = grab_window;
   4113     xcb_out.event_mask = event_mask;
   4114     xcb_out.pointer_mode = pointer_mode;
   4115     xcb_out.keyboard_mode = keyboard_mode;
   4116     xcb_out.confine_to = confine_to;
   4117     xcb_out.cursor = cursor;
   4118     xcb_out.time = time;
   4119 
   4120     xcb_parts[2].iov_base = (char *) &xcb_out;
   4121     xcb_parts[2].iov_len = sizeof(xcb_out);
   4122     xcb_parts[3].iov_base = 0;
   4123     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4124 
   4125     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   4126     return xcb_ret;
   4127 }
   4128 
   4129 xcb_grab_pointer_cookie_t
   4130 xcb_grab_pointer_unchecked (xcb_connection_t *c,
   4131                             uint8_t           owner_events,
   4132                             xcb_window_t      grab_window,
   4133                             uint16_t          event_mask,
   4134                             uint8_t           pointer_mode,
   4135                             uint8_t           keyboard_mode,
   4136                             xcb_window_t      confine_to,
   4137                             xcb_cursor_t      cursor,
   4138                             xcb_timestamp_t   time)
   4139 {
   4140     static const xcb_protocol_request_t xcb_req = {
   4141         .count = 2,
   4142         .ext = 0,
   4143         .opcode = XCB_GRAB_POINTER,
   4144         .isvoid = 0
   4145     };
   4146 
   4147     struct iovec xcb_parts[4];
   4148     xcb_grab_pointer_cookie_t xcb_ret;
   4149     xcb_grab_pointer_request_t xcb_out;
   4150 
   4151     xcb_out.owner_events = owner_events;
   4152     xcb_out.grab_window = grab_window;
   4153     xcb_out.event_mask = event_mask;
   4154     xcb_out.pointer_mode = pointer_mode;
   4155     xcb_out.keyboard_mode = keyboard_mode;
   4156     xcb_out.confine_to = confine_to;
   4157     xcb_out.cursor = cursor;
   4158     xcb_out.time = time;
   4159 
   4160     xcb_parts[2].iov_base = (char *) &xcb_out;
   4161     xcb_parts[2].iov_len = sizeof(xcb_out);
   4162     xcb_parts[3].iov_base = 0;
   4163     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4164 
   4165     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   4166     return xcb_ret;
   4167 }
   4168 
   4169 xcb_grab_pointer_reply_t *
   4170 xcb_grab_pointer_reply (xcb_connection_t           *c,
   4171                         xcb_grab_pointer_cookie_t   cookie  /**< */,
   4172                         xcb_generic_error_t       **e)
   4173 {
   4174     return (xcb_grab_pointer_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   4175 }
   4176 
   4177 xcb_void_cookie_t
   4178 xcb_ungrab_pointer_checked (xcb_connection_t *c,
   4179                             xcb_timestamp_t   time)
   4180 {
   4181     static const xcb_protocol_request_t xcb_req = {
   4182         .count = 2,
   4183         .ext = 0,
   4184         .opcode = XCB_UNGRAB_POINTER,
   4185         .isvoid = 1
   4186     };
   4187 
   4188     struct iovec xcb_parts[4];
   4189     xcb_void_cookie_t xcb_ret;
   4190     xcb_ungrab_pointer_request_t xcb_out;
   4191 
   4192     xcb_out.pad0 = 0;
   4193     xcb_out.time = time;
   4194 
   4195     xcb_parts[2].iov_base = (char *) &xcb_out;
   4196     xcb_parts[2].iov_len = sizeof(xcb_out);
   4197     xcb_parts[3].iov_base = 0;
   4198     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4199 
   4200     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   4201     return xcb_ret;
   4202 }
   4203 
   4204 xcb_void_cookie_t
   4205 xcb_ungrab_pointer (xcb_connection_t *c,
   4206                     xcb_timestamp_t   time)
   4207 {
   4208     static const xcb_protocol_request_t xcb_req = {
   4209         .count = 2,
   4210         .ext = 0,
   4211         .opcode = XCB_UNGRAB_POINTER,
   4212         .isvoid = 1
   4213     };
   4214 
   4215     struct iovec xcb_parts[4];
   4216     xcb_void_cookie_t xcb_ret;
   4217     xcb_ungrab_pointer_request_t xcb_out;
   4218 
   4219     xcb_out.pad0 = 0;
   4220     xcb_out.time = time;
   4221 
   4222     xcb_parts[2].iov_base = (char *) &xcb_out;
   4223     xcb_parts[2].iov_len = sizeof(xcb_out);
   4224     xcb_parts[3].iov_base = 0;
   4225     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4226 
   4227     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   4228     return xcb_ret;
   4229 }
   4230 
   4231 xcb_void_cookie_t
   4232 xcb_grab_button_checked (xcb_connection_t *c,
   4233                          uint8_t           owner_events,
   4234                          xcb_window_t      grab_window,
   4235                          uint16_t          event_mask,
   4236                          uint8_t           pointer_mode,
   4237                          uint8_t           keyboard_mode,
   4238                          xcb_window_t      confine_to,
   4239                          xcb_cursor_t      cursor,
   4240                          uint8_t           button,
   4241                          uint16_t          modifiers)
   4242 {
   4243     static const xcb_protocol_request_t xcb_req = {
   4244         .count = 2,
   4245         .ext = 0,
   4246         .opcode = XCB_GRAB_BUTTON,
   4247         .isvoid = 1
   4248     };
   4249 
   4250     struct iovec xcb_parts[4];
   4251     xcb_void_cookie_t xcb_ret;
   4252     xcb_grab_button_request_t xcb_out;
   4253 
   4254     xcb_out.owner_events = owner_events;
   4255     xcb_out.grab_window = grab_window;
   4256     xcb_out.event_mask = event_mask;
   4257     xcb_out.pointer_mode = pointer_mode;
   4258     xcb_out.keyboard_mode = keyboard_mode;
   4259     xcb_out.confine_to = confine_to;
   4260     xcb_out.cursor = cursor;
   4261     xcb_out.button = button;
   4262     xcb_out.pad0 = 0;
   4263     xcb_out.modifiers = modifiers;
   4264 
   4265     xcb_parts[2].iov_base = (char *) &xcb_out;
   4266     xcb_parts[2].iov_len = sizeof(xcb_out);
   4267     xcb_parts[3].iov_base = 0;
   4268     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4269 
   4270     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   4271     return xcb_ret;
   4272 }
   4273 
   4274 xcb_void_cookie_t
   4275 xcb_grab_button (xcb_connection_t *c,
   4276                  uint8_t           owner_events,
   4277                  xcb_window_t      grab_window,
   4278                  uint16_t          event_mask,
   4279                  uint8_t           pointer_mode,
   4280                  uint8_t           keyboard_mode,
   4281                  xcb_window_t      confine_to,
   4282                  xcb_cursor_t      cursor,
   4283                  uint8_t           button,
   4284                  uint16_t          modifiers)
   4285 {
   4286     static const xcb_protocol_request_t xcb_req = {
   4287         .count = 2,
   4288         .ext = 0,
   4289         .opcode = XCB_GRAB_BUTTON,
   4290         .isvoid = 1
   4291     };
   4292 
   4293     struct iovec xcb_parts[4];
   4294     xcb_void_cookie_t xcb_ret;
   4295     xcb_grab_button_request_t xcb_out;
   4296 
   4297     xcb_out.owner_events = owner_events;
   4298     xcb_out.grab_window = grab_window;
   4299     xcb_out.event_mask = event_mask;
   4300     xcb_out.pointer_mode = pointer_mode;
   4301     xcb_out.keyboard_mode = keyboard_mode;
   4302     xcb_out.confine_to = confine_to;
   4303     xcb_out.cursor = cursor;
   4304     xcb_out.button = button;
   4305     xcb_out.pad0 = 0;
   4306     xcb_out.modifiers = modifiers;
   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 
   4313     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   4314     return xcb_ret;
   4315 }
   4316 
   4317 xcb_void_cookie_t
   4318 xcb_ungrab_button_checked (xcb_connection_t *c,
   4319                            uint8_t           button,
   4320                            xcb_window_t      grab_window,
   4321                            uint16_t          modifiers)
   4322 {
   4323     static const xcb_protocol_request_t xcb_req = {
   4324         .count = 2,
   4325         .ext = 0,
   4326         .opcode = XCB_UNGRAB_BUTTON,
   4327         .isvoid = 1
   4328     };
   4329 
   4330     struct iovec xcb_parts[4];
   4331     xcb_void_cookie_t xcb_ret;
   4332     xcb_ungrab_button_request_t xcb_out;
   4333 
   4334     xcb_out.button = button;
   4335     xcb_out.grab_window = grab_window;
   4336     xcb_out.modifiers = modifiers;
   4337     memset(xcb_out.pad0, 0, 2);
   4338 
   4339     xcb_parts[2].iov_base = (char *) &xcb_out;
   4340     xcb_parts[2].iov_len = sizeof(xcb_out);
   4341     xcb_parts[3].iov_base = 0;
   4342     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4343 
   4344     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   4345     return xcb_ret;
   4346 }
   4347 
   4348 xcb_void_cookie_t
   4349 xcb_ungrab_button (xcb_connection_t *c,
   4350                    uint8_t           button,
   4351                    xcb_window_t      grab_window,
   4352                    uint16_t          modifiers)
   4353 {
   4354     static const xcb_protocol_request_t xcb_req = {
   4355         .count = 2,
   4356         .ext = 0,
   4357         .opcode = XCB_UNGRAB_BUTTON,
   4358         .isvoid = 1
   4359     };
   4360 
   4361     struct iovec xcb_parts[4];
   4362     xcb_void_cookie_t xcb_ret;
   4363     xcb_ungrab_button_request_t xcb_out;
   4364 
   4365     xcb_out.button = button;
   4366     xcb_out.grab_window = grab_window;
   4367     xcb_out.modifiers = modifiers;
   4368     memset(xcb_out.pad0, 0, 2);
   4369 
   4370     xcb_parts[2].iov_base = (char *) &xcb_out;
   4371     xcb_parts[2].iov_len = sizeof(xcb_out);
   4372     xcb_parts[3].iov_base = 0;
   4373     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4374 
   4375     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   4376     return xcb_ret;
   4377 }
   4378 
   4379 xcb_void_cookie_t
   4380 xcb_change_active_pointer_grab_checked (xcb_connection_t *c,
   4381                                         xcb_cursor_t      cursor,
   4382                                         xcb_timestamp_t   time,
   4383                                         uint16_t          event_mask)
   4384 {
   4385     static const xcb_protocol_request_t xcb_req = {
   4386         .count = 2,
   4387         .ext = 0,
   4388         .opcode = XCB_CHANGE_ACTIVE_POINTER_GRAB,
   4389         .isvoid = 1
   4390     };
   4391 
   4392     struct iovec xcb_parts[4];
   4393     xcb_void_cookie_t xcb_ret;
   4394     xcb_change_active_pointer_grab_request_t xcb_out;
   4395 
   4396     xcb_out.pad0 = 0;
   4397     xcb_out.cursor = cursor;
   4398     xcb_out.time = time;
   4399     xcb_out.event_mask = event_mask;
   4400     memset(xcb_out.pad1, 0, 2);
   4401 
   4402     xcb_parts[2].iov_base = (char *) &xcb_out;
   4403     xcb_parts[2].iov_len = sizeof(xcb_out);
   4404     xcb_parts[3].iov_base = 0;
   4405     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4406 
   4407     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   4408     return xcb_ret;
   4409 }
   4410 
   4411 xcb_void_cookie_t
   4412 xcb_change_active_pointer_grab (xcb_connection_t *c,
   4413                                 xcb_cursor_t      cursor,
   4414                                 xcb_timestamp_t   time,
   4415                                 uint16_t          event_mask)
   4416 {
   4417     static const xcb_protocol_request_t xcb_req = {
   4418         .count = 2,
   4419         .ext = 0,
   4420         .opcode = XCB_CHANGE_ACTIVE_POINTER_GRAB,
   4421         .isvoid = 1
   4422     };
   4423 
   4424     struct iovec xcb_parts[4];
   4425     xcb_void_cookie_t xcb_ret;
   4426     xcb_change_active_pointer_grab_request_t xcb_out;
   4427 
   4428     xcb_out.pad0 = 0;
   4429     xcb_out.cursor = cursor;
   4430     xcb_out.time = time;
   4431     xcb_out.event_mask = event_mask;
   4432     memset(xcb_out.pad1, 0, 2);
   4433 
   4434     xcb_parts[2].iov_base = (char *) &xcb_out;
   4435     xcb_parts[2].iov_len = sizeof(xcb_out);
   4436     xcb_parts[3].iov_base = 0;
   4437     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4438 
   4439     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   4440     return xcb_ret;
   4441 }
   4442 
   4443 xcb_grab_keyboard_cookie_t
   4444 xcb_grab_keyboard (xcb_connection_t *c,
   4445                    uint8_t           owner_events,
   4446                    xcb_window_t      grab_window,
   4447                    xcb_timestamp_t   time,
   4448                    uint8_t           pointer_mode,
   4449                    uint8_t           keyboard_mode)
   4450 {
   4451     static const xcb_protocol_request_t xcb_req = {
   4452         .count = 2,
   4453         .ext = 0,
   4454         .opcode = XCB_GRAB_KEYBOARD,
   4455         .isvoid = 0
   4456     };
   4457 
   4458     struct iovec xcb_parts[4];
   4459     xcb_grab_keyboard_cookie_t xcb_ret;
   4460     xcb_grab_keyboard_request_t xcb_out;
   4461 
   4462     xcb_out.owner_events = owner_events;
   4463     xcb_out.grab_window = grab_window;
   4464     xcb_out.time = time;
   4465     xcb_out.pointer_mode = pointer_mode;
   4466     xcb_out.keyboard_mode = keyboard_mode;
   4467     memset(xcb_out.pad0, 0, 2);
   4468 
   4469     xcb_parts[2].iov_base = (char *) &xcb_out;
   4470     xcb_parts[2].iov_len = sizeof(xcb_out);
   4471     xcb_parts[3].iov_base = 0;
   4472     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4473 
   4474     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   4475     return xcb_ret;
   4476 }
   4477 
   4478 xcb_grab_keyboard_cookie_t
   4479 xcb_grab_keyboard_unchecked (xcb_connection_t *c,
   4480                              uint8_t           owner_events,
   4481                              xcb_window_t      grab_window,
   4482                              xcb_timestamp_t   time,
   4483                              uint8_t           pointer_mode,
   4484                              uint8_t           keyboard_mode)
   4485 {
   4486     static const xcb_protocol_request_t xcb_req = {
   4487         .count = 2,
   4488         .ext = 0,
   4489         .opcode = XCB_GRAB_KEYBOARD,
   4490         .isvoid = 0
   4491     };
   4492 
   4493     struct iovec xcb_parts[4];
   4494     xcb_grab_keyboard_cookie_t xcb_ret;
   4495     xcb_grab_keyboard_request_t xcb_out;
   4496 
   4497     xcb_out.owner_events = owner_events;
   4498     xcb_out.grab_window = grab_window;
   4499     xcb_out.time = time;
   4500     xcb_out.pointer_mode = pointer_mode;
   4501     xcb_out.keyboard_mode = keyboard_mode;
   4502     memset(xcb_out.pad0, 0, 2);
   4503 
   4504     xcb_parts[2].iov_base = (char *) &xcb_out;
   4505     xcb_parts[2].iov_len = sizeof(xcb_out);
   4506     xcb_parts[3].iov_base = 0;
   4507     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4508 
   4509     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   4510     return xcb_ret;
   4511 }
   4512 
   4513 xcb_grab_keyboard_reply_t *
   4514 xcb_grab_keyboard_reply (xcb_connection_t            *c,
   4515                          xcb_grab_keyboard_cookie_t   cookie  /**< */,
   4516                          xcb_generic_error_t        **e)
   4517 {
   4518     return (xcb_grab_keyboard_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   4519 }
   4520 
   4521 xcb_void_cookie_t
   4522 xcb_ungrab_keyboard_checked (xcb_connection_t *c,
   4523                              xcb_timestamp_t   time)
   4524 {
   4525     static const xcb_protocol_request_t xcb_req = {
   4526         .count = 2,
   4527         .ext = 0,
   4528         .opcode = XCB_UNGRAB_KEYBOARD,
   4529         .isvoid = 1
   4530     };
   4531 
   4532     struct iovec xcb_parts[4];
   4533     xcb_void_cookie_t xcb_ret;
   4534     xcb_ungrab_keyboard_request_t xcb_out;
   4535 
   4536     xcb_out.pad0 = 0;
   4537     xcb_out.time = time;
   4538 
   4539     xcb_parts[2].iov_base = (char *) &xcb_out;
   4540     xcb_parts[2].iov_len = sizeof(xcb_out);
   4541     xcb_parts[3].iov_base = 0;
   4542     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4543 
   4544     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   4545     return xcb_ret;
   4546 }
   4547 
   4548 xcb_void_cookie_t
   4549 xcb_ungrab_keyboard (xcb_connection_t *c,
   4550                      xcb_timestamp_t   time)
   4551 {
   4552     static const xcb_protocol_request_t xcb_req = {
   4553         .count = 2,
   4554         .ext = 0,
   4555         .opcode = XCB_UNGRAB_KEYBOARD,
   4556         .isvoid = 1
   4557     };
   4558 
   4559     struct iovec xcb_parts[4];
   4560     xcb_void_cookie_t xcb_ret;
   4561     xcb_ungrab_keyboard_request_t xcb_out;
   4562 
   4563     xcb_out.pad0 = 0;
   4564     xcb_out.time = time;
   4565 
   4566     xcb_parts[2].iov_base = (char *) &xcb_out;
   4567     xcb_parts[2].iov_len = sizeof(xcb_out);
   4568     xcb_parts[3].iov_base = 0;
   4569     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4570 
   4571     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   4572     return xcb_ret;
   4573 }
   4574 
   4575 xcb_void_cookie_t
   4576 xcb_grab_key_checked (xcb_connection_t *c,
   4577                       uint8_t           owner_events,
   4578                       xcb_window_t      grab_window,
   4579                       uint16_t          modifiers,
   4580                       xcb_keycode_t     key,
   4581                       uint8_t           pointer_mode,
   4582                       uint8_t           keyboard_mode)
   4583 {
   4584     static const xcb_protocol_request_t xcb_req = {
   4585         .count = 2,
   4586         .ext = 0,
   4587         .opcode = XCB_GRAB_KEY,
   4588         .isvoid = 1
   4589     };
   4590 
   4591     struct iovec xcb_parts[4];
   4592     xcb_void_cookie_t xcb_ret;
   4593     xcb_grab_key_request_t xcb_out;
   4594 
   4595     xcb_out.owner_events = owner_events;
   4596     xcb_out.grab_window = grab_window;
   4597     xcb_out.modifiers = modifiers;
   4598     xcb_out.key = key;
   4599     xcb_out.pointer_mode = pointer_mode;
   4600     xcb_out.keyboard_mode = keyboard_mode;
   4601     memset(xcb_out.pad0, 0, 3);
   4602 
   4603     xcb_parts[2].iov_base = (char *) &xcb_out;
   4604     xcb_parts[2].iov_len = sizeof(xcb_out);
   4605     xcb_parts[3].iov_base = 0;
   4606     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4607 
   4608     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   4609     return xcb_ret;
   4610 }
   4611 
   4612 xcb_void_cookie_t
   4613 xcb_grab_key (xcb_connection_t *c,
   4614               uint8_t           owner_events,
   4615               xcb_window_t      grab_window,
   4616               uint16_t          modifiers,
   4617               xcb_keycode_t     key,
   4618               uint8_t           pointer_mode,
   4619               uint8_t           keyboard_mode)
   4620 {
   4621     static const xcb_protocol_request_t xcb_req = {
   4622         .count = 2,
   4623         .ext = 0,
   4624         .opcode = XCB_GRAB_KEY,
   4625         .isvoid = 1
   4626     };
   4627 
   4628     struct iovec xcb_parts[4];
   4629     xcb_void_cookie_t xcb_ret;
   4630     xcb_grab_key_request_t xcb_out;
   4631 
   4632     xcb_out.owner_events = owner_events;
   4633     xcb_out.grab_window = grab_window;
   4634     xcb_out.modifiers = modifiers;
   4635     xcb_out.key = key;
   4636     xcb_out.pointer_mode = pointer_mode;
   4637     xcb_out.keyboard_mode = keyboard_mode;
   4638     memset(xcb_out.pad0, 0, 3);
   4639 
   4640     xcb_parts[2].iov_base = (char *) &xcb_out;
   4641     xcb_parts[2].iov_len = sizeof(xcb_out);
   4642     xcb_parts[3].iov_base = 0;
   4643     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4644 
   4645     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   4646     return xcb_ret;
   4647 }
   4648 
   4649 xcb_void_cookie_t
   4650 xcb_ungrab_key_checked (xcb_connection_t *c,
   4651                         xcb_keycode_t     key,
   4652                         xcb_window_t      grab_window,
   4653                         uint16_t          modifiers)
   4654 {
   4655     static const xcb_protocol_request_t xcb_req = {
   4656         .count = 2,
   4657         .ext = 0,
   4658         .opcode = XCB_UNGRAB_KEY,
   4659         .isvoid = 1
   4660     };
   4661 
   4662     struct iovec xcb_parts[4];
   4663     xcb_void_cookie_t xcb_ret;
   4664     xcb_ungrab_key_request_t xcb_out;
   4665 
   4666     xcb_out.key = key;
   4667     xcb_out.grab_window = grab_window;
   4668     xcb_out.modifiers = modifiers;
   4669     memset(xcb_out.pad0, 0, 2);
   4670 
   4671     xcb_parts[2].iov_base = (char *) &xcb_out;
   4672     xcb_parts[2].iov_len = sizeof(xcb_out);
   4673     xcb_parts[3].iov_base = 0;
   4674     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4675 
   4676     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   4677     return xcb_ret;
   4678 }
   4679 
   4680 xcb_void_cookie_t
   4681 xcb_ungrab_key (xcb_connection_t *c,
   4682                 xcb_keycode_t     key,
   4683                 xcb_window_t      grab_window,
   4684                 uint16_t          modifiers)
   4685 {
   4686     static const xcb_protocol_request_t xcb_req = {
   4687         .count = 2,
   4688         .ext = 0,
   4689         .opcode = XCB_UNGRAB_KEY,
   4690         .isvoid = 1
   4691     };
   4692 
   4693     struct iovec xcb_parts[4];
   4694     xcb_void_cookie_t xcb_ret;
   4695     xcb_ungrab_key_request_t xcb_out;
   4696 
   4697     xcb_out.key = key;
   4698     xcb_out.grab_window = grab_window;
   4699     xcb_out.modifiers = modifiers;
   4700     memset(xcb_out.pad0, 0, 2);
   4701 
   4702     xcb_parts[2].iov_base = (char *) &xcb_out;
   4703     xcb_parts[2].iov_len = sizeof(xcb_out);
   4704     xcb_parts[3].iov_base = 0;
   4705     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4706 
   4707     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   4708     return xcb_ret;
   4709 }
   4710 
   4711 xcb_void_cookie_t
   4712 xcb_allow_events_checked (xcb_connection_t *c,
   4713                           uint8_t           mode,
   4714                           xcb_timestamp_t   time)
   4715 {
   4716     static const xcb_protocol_request_t xcb_req = {
   4717         .count = 2,
   4718         .ext = 0,
   4719         .opcode = XCB_ALLOW_EVENTS,
   4720         .isvoid = 1
   4721     };
   4722 
   4723     struct iovec xcb_parts[4];
   4724     xcb_void_cookie_t xcb_ret;
   4725     xcb_allow_events_request_t xcb_out;
   4726 
   4727     xcb_out.mode = mode;
   4728     xcb_out.time = time;
   4729 
   4730     xcb_parts[2].iov_base = (char *) &xcb_out;
   4731     xcb_parts[2].iov_len = sizeof(xcb_out);
   4732     xcb_parts[3].iov_base = 0;
   4733     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4734 
   4735     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   4736     return xcb_ret;
   4737 }
   4738 
   4739 xcb_void_cookie_t
   4740 xcb_allow_events (xcb_connection_t *c,
   4741                   uint8_t           mode,
   4742                   xcb_timestamp_t   time)
   4743 {
   4744     static const xcb_protocol_request_t xcb_req = {
   4745         .count = 2,
   4746         .ext = 0,
   4747         .opcode = XCB_ALLOW_EVENTS,
   4748         .isvoid = 1
   4749     };
   4750 
   4751     struct iovec xcb_parts[4];
   4752     xcb_void_cookie_t xcb_ret;
   4753     xcb_allow_events_request_t xcb_out;
   4754 
   4755     xcb_out.mode = mode;
   4756     xcb_out.time = time;
   4757 
   4758     xcb_parts[2].iov_base = (char *) &xcb_out;
   4759     xcb_parts[2].iov_len = sizeof(xcb_out);
   4760     xcb_parts[3].iov_base = 0;
   4761     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4762 
   4763     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   4764     return xcb_ret;
   4765 }
   4766 
   4767 xcb_void_cookie_t
   4768 xcb_grab_server_checked (xcb_connection_t *c)
   4769 {
   4770     static const xcb_protocol_request_t xcb_req = {
   4771         .count = 2,
   4772         .ext = 0,
   4773         .opcode = XCB_GRAB_SERVER,
   4774         .isvoid = 1
   4775     };
   4776 
   4777     struct iovec xcb_parts[4];
   4778     xcb_void_cookie_t xcb_ret;
   4779     xcb_grab_server_request_t xcb_out;
   4780 
   4781     xcb_out.pad0 = 0;
   4782 
   4783     xcb_parts[2].iov_base = (char *) &xcb_out;
   4784     xcb_parts[2].iov_len = sizeof(xcb_out);
   4785     xcb_parts[3].iov_base = 0;
   4786     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4787 
   4788     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   4789     return xcb_ret;
   4790 }
   4791 
   4792 xcb_void_cookie_t
   4793 xcb_grab_server (xcb_connection_t *c)
   4794 {
   4795     static const xcb_protocol_request_t xcb_req = {
   4796         .count = 2,
   4797         .ext = 0,
   4798         .opcode = XCB_GRAB_SERVER,
   4799         .isvoid = 1
   4800     };
   4801 
   4802     struct iovec xcb_parts[4];
   4803     xcb_void_cookie_t xcb_ret;
   4804     xcb_grab_server_request_t xcb_out;
   4805 
   4806     xcb_out.pad0 = 0;
   4807 
   4808     xcb_parts[2].iov_base = (char *) &xcb_out;
   4809     xcb_parts[2].iov_len = sizeof(xcb_out);
   4810     xcb_parts[3].iov_base = 0;
   4811     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4812 
   4813     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   4814     return xcb_ret;
   4815 }
   4816 
   4817 xcb_void_cookie_t
   4818 xcb_ungrab_server_checked (xcb_connection_t *c)
   4819 {
   4820     static const xcb_protocol_request_t xcb_req = {
   4821         .count = 2,
   4822         .ext = 0,
   4823         .opcode = XCB_UNGRAB_SERVER,
   4824         .isvoid = 1
   4825     };
   4826 
   4827     struct iovec xcb_parts[4];
   4828     xcb_void_cookie_t xcb_ret;
   4829     xcb_ungrab_server_request_t xcb_out;
   4830 
   4831     xcb_out.pad0 = 0;
   4832 
   4833     xcb_parts[2].iov_base = (char *) &xcb_out;
   4834     xcb_parts[2].iov_len = sizeof(xcb_out);
   4835     xcb_parts[3].iov_base = 0;
   4836     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4837 
   4838     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   4839     return xcb_ret;
   4840 }
   4841 
   4842 xcb_void_cookie_t
   4843 xcb_ungrab_server (xcb_connection_t *c)
   4844 {
   4845     static const xcb_protocol_request_t xcb_req = {
   4846         .count = 2,
   4847         .ext = 0,
   4848         .opcode = XCB_UNGRAB_SERVER,
   4849         .isvoid = 1
   4850     };
   4851 
   4852     struct iovec xcb_parts[4];
   4853     xcb_void_cookie_t xcb_ret;
   4854     xcb_ungrab_server_request_t xcb_out;
   4855 
   4856     xcb_out.pad0 = 0;
   4857 
   4858     xcb_parts[2].iov_base = (char *) &xcb_out;
   4859     xcb_parts[2].iov_len = sizeof(xcb_out);
   4860     xcb_parts[3].iov_base = 0;
   4861     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4862 
   4863     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   4864     return xcb_ret;
   4865 }
   4866 
   4867 xcb_query_pointer_cookie_t
   4868 xcb_query_pointer (xcb_connection_t *c,
   4869                    xcb_window_t      window)
   4870 {
   4871     static const xcb_protocol_request_t xcb_req = {
   4872         .count = 2,
   4873         .ext = 0,
   4874         .opcode = XCB_QUERY_POINTER,
   4875         .isvoid = 0
   4876     };
   4877 
   4878     struct iovec xcb_parts[4];
   4879     xcb_query_pointer_cookie_t xcb_ret;
   4880     xcb_query_pointer_request_t xcb_out;
   4881 
   4882     xcb_out.pad0 = 0;
   4883     xcb_out.window = window;
   4884 
   4885     xcb_parts[2].iov_base = (char *) &xcb_out;
   4886     xcb_parts[2].iov_len = sizeof(xcb_out);
   4887     xcb_parts[3].iov_base = 0;
   4888     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4889 
   4890     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   4891     return xcb_ret;
   4892 }
   4893 
   4894 xcb_query_pointer_cookie_t
   4895 xcb_query_pointer_unchecked (xcb_connection_t *c,
   4896                              xcb_window_t      window)
   4897 {
   4898     static const xcb_protocol_request_t xcb_req = {
   4899         .count = 2,
   4900         .ext = 0,
   4901         .opcode = XCB_QUERY_POINTER,
   4902         .isvoid = 0
   4903     };
   4904 
   4905     struct iovec xcb_parts[4];
   4906     xcb_query_pointer_cookie_t xcb_ret;
   4907     xcb_query_pointer_request_t xcb_out;
   4908 
   4909     xcb_out.pad0 = 0;
   4910     xcb_out.window = window;
   4911 
   4912     xcb_parts[2].iov_base = (char *) &xcb_out;
   4913     xcb_parts[2].iov_len = sizeof(xcb_out);
   4914     xcb_parts[3].iov_base = 0;
   4915     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   4916 
   4917     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   4918     return xcb_ret;
   4919 }
   4920 
   4921 xcb_query_pointer_reply_t *
   4922 xcb_query_pointer_reply (xcb_connection_t            *c,
   4923                          xcb_query_pointer_cookie_t   cookie  /**< */,
   4924                          xcb_generic_error_t        **e)
   4925 {
   4926     return (xcb_query_pointer_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   4927 }
   4928 
   4929 void
   4930 xcb_timecoord_next (xcb_timecoord_iterator_t *i)
   4931 {
   4932     --i->rem;
   4933     ++i->data;
   4934     i->index += sizeof(xcb_timecoord_t);
   4935 }
   4936 
   4937 xcb_generic_iterator_t
   4938 xcb_timecoord_end (xcb_timecoord_iterator_t i)
   4939 {
   4940     xcb_generic_iterator_t ret;
   4941     ret.data = i.data + i.rem;
   4942     ret.index = i.index + ((char *) ret.data - (char *) i.data);
   4943     ret.rem = 0;
   4944     return ret;
   4945 }
   4946 
   4947 int
   4948 xcb_get_motion_events_sizeof (const void  *_buffer)
   4949 {
   4950     char *xcb_tmp = (char *)_buffer;
   4951     const xcb_get_motion_events_reply_t *_aux = (xcb_get_motion_events_reply_t *)_buffer;
   4952     unsigned int xcb_buffer_len = 0;
   4953     unsigned int xcb_block_len = 0;
   4954     unsigned int xcb_pad = 0;
   4955     unsigned int xcb_align_to = 0;
   4956 
   4957 
   4958     xcb_block_len += sizeof(xcb_get_motion_events_reply_t);
   4959     xcb_tmp += xcb_block_len;
   4960     xcb_buffer_len += xcb_block_len;
   4961     xcb_block_len = 0;
   4962     /* events */
   4963     xcb_block_len += _aux->events_len * sizeof(xcb_timecoord_t);
   4964     xcb_tmp += xcb_block_len;
   4965     xcb_align_to = ALIGNOF(xcb_timecoord_t);
   4966     /* insert padding */
   4967     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   4968     xcb_buffer_len += xcb_block_len + xcb_pad;
   4969     if (0 != xcb_pad) {
   4970         xcb_tmp += xcb_pad;
   4971         xcb_pad = 0;
   4972     }
   4973     xcb_block_len = 0;
   4974 
   4975     return xcb_buffer_len;
   4976 }
   4977 
   4978 xcb_get_motion_events_cookie_t
   4979 xcb_get_motion_events (xcb_connection_t *c,
   4980                        xcb_window_t      window,
   4981                        xcb_timestamp_t   start,
   4982                        xcb_timestamp_t   stop)
   4983 {
   4984     static const xcb_protocol_request_t xcb_req = {
   4985         .count = 2,
   4986         .ext = 0,
   4987         .opcode = XCB_GET_MOTION_EVENTS,
   4988         .isvoid = 0
   4989     };
   4990 
   4991     struct iovec xcb_parts[4];
   4992     xcb_get_motion_events_cookie_t xcb_ret;
   4993     xcb_get_motion_events_request_t xcb_out;
   4994 
   4995     xcb_out.pad0 = 0;
   4996     xcb_out.window = window;
   4997     xcb_out.start = start;
   4998     xcb_out.stop = stop;
   4999 
   5000     xcb_parts[2].iov_base = (char *) &xcb_out;
   5001     xcb_parts[2].iov_len = sizeof(xcb_out);
   5002     xcb_parts[3].iov_base = 0;
   5003     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   5004 
   5005     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   5006     return xcb_ret;
   5007 }
   5008 
   5009 xcb_get_motion_events_cookie_t
   5010 xcb_get_motion_events_unchecked (xcb_connection_t *c,
   5011                                  xcb_window_t      window,
   5012                                  xcb_timestamp_t   start,
   5013                                  xcb_timestamp_t   stop)
   5014 {
   5015     static const xcb_protocol_request_t xcb_req = {
   5016         .count = 2,
   5017         .ext = 0,
   5018         .opcode = XCB_GET_MOTION_EVENTS,
   5019         .isvoid = 0
   5020     };
   5021 
   5022     struct iovec xcb_parts[4];
   5023     xcb_get_motion_events_cookie_t xcb_ret;
   5024     xcb_get_motion_events_request_t xcb_out;
   5025 
   5026     xcb_out.pad0 = 0;
   5027     xcb_out.window = window;
   5028     xcb_out.start = start;
   5029     xcb_out.stop = stop;
   5030 
   5031     xcb_parts[2].iov_base = (char *) &xcb_out;
   5032     xcb_parts[2].iov_len = sizeof(xcb_out);
   5033     xcb_parts[3].iov_base = 0;
   5034     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   5035 
   5036     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   5037     return xcb_ret;
   5038 }
   5039 
   5040 xcb_timecoord_t *
   5041 xcb_get_motion_events_events (const xcb_get_motion_events_reply_t *R)
   5042 {
   5043     return (xcb_timecoord_t *) (R + 1);
   5044 }
   5045 
   5046 int
   5047 xcb_get_motion_events_events_length (const xcb_get_motion_events_reply_t *R)
   5048 {
   5049     return R->events_len;
   5050 }
   5051 
   5052 xcb_timecoord_iterator_t
   5053 xcb_get_motion_events_events_iterator (const xcb_get_motion_events_reply_t *R)
   5054 {
   5055     xcb_timecoord_iterator_t i;
   5056     i.data = (xcb_timecoord_t *) (R + 1);
   5057     i.rem = R->events_len;
   5058     i.index = (char *) i.data - (char *) R;
   5059     return i;
   5060 }
   5061 
   5062 xcb_get_motion_events_reply_t *
   5063 xcb_get_motion_events_reply (xcb_connection_t                *c,
   5064                              xcb_get_motion_events_cookie_t   cookie  /**< */,
   5065                              xcb_generic_error_t            **e)
   5066 {
   5067     return (xcb_get_motion_events_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   5068 }
   5069 
   5070 xcb_translate_coordinates_cookie_t
   5071 xcb_translate_coordinates (xcb_connection_t *c,
   5072                            xcb_window_t      src_window,
   5073                            xcb_window_t      dst_window,
   5074                            int16_t           src_x,
   5075                            int16_t           src_y)
   5076 {
   5077     static const xcb_protocol_request_t xcb_req = {
   5078         .count = 2,
   5079         .ext = 0,
   5080         .opcode = XCB_TRANSLATE_COORDINATES,
   5081         .isvoid = 0
   5082     };
   5083 
   5084     struct iovec xcb_parts[4];
   5085     xcb_translate_coordinates_cookie_t xcb_ret;
   5086     xcb_translate_coordinates_request_t xcb_out;
   5087 
   5088     xcb_out.pad0 = 0;
   5089     xcb_out.src_window = src_window;
   5090     xcb_out.dst_window = dst_window;
   5091     xcb_out.src_x = src_x;
   5092     xcb_out.src_y = src_y;
   5093 
   5094     xcb_parts[2].iov_base = (char *) &xcb_out;
   5095     xcb_parts[2].iov_len = sizeof(xcb_out);
   5096     xcb_parts[3].iov_base = 0;
   5097     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   5098 
   5099     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   5100     return xcb_ret;
   5101 }
   5102 
   5103 xcb_translate_coordinates_cookie_t
   5104 xcb_translate_coordinates_unchecked (xcb_connection_t *c,
   5105                                      xcb_window_t      src_window,
   5106                                      xcb_window_t      dst_window,
   5107                                      int16_t           src_x,
   5108                                      int16_t           src_y)
   5109 {
   5110     static const xcb_protocol_request_t xcb_req = {
   5111         .count = 2,
   5112         .ext = 0,
   5113         .opcode = XCB_TRANSLATE_COORDINATES,
   5114         .isvoid = 0
   5115     };
   5116 
   5117     struct iovec xcb_parts[4];
   5118     xcb_translate_coordinates_cookie_t xcb_ret;
   5119     xcb_translate_coordinates_request_t xcb_out;
   5120 
   5121     xcb_out.pad0 = 0;
   5122     xcb_out.src_window = src_window;
   5123     xcb_out.dst_window = dst_window;
   5124     xcb_out.src_x = src_x;
   5125     xcb_out.src_y = src_y;
   5126 
   5127     xcb_parts[2].iov_base = (char *) &xcb_out;
   5128     xcb_parts[2].iov_len = sizeof(xcb_out);
   5129     xcb_parts[3].iov_base = 0;
   5130     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   5131 
   5132     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   5133     return xcb_ret;
   5134 }
   5135 
   5136 xcb_translate_coordinates_reply_t *
   5137 xcb_translate_coordinates_reply (xcb_connection_t                    *c,
   5138                                  xcb_translate_coordinates_cookie_t   cookie  /**< */,
   5139                                  xcb_generic_error_t                **e)
   5140 {
   5141     return (xcb_translate_coordinates_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   5142 }
   5143 
   5144 xcb_void_cookie_t
   5145 xcb_warp_pointer_checked (xcb_connection_t *c,
   5146                           xcb_window_t      src_window,
   5147                           xcb_window_t      dst_window,
   5148                           int16_t           src_x,
   5149                           int16_t           src_y,
   5150                           uint16_t          src_width,
   5151                           uint16_t          src_height,
   5152                           int16_t           dst_x,
   5153                           int16_t           dst_y)
   5154 {
   5155     static const xcb_protocol_request_t xcb_req = {
   5156         .count = 2,
   5157         .ext = 0,
   5158         .opcode = XCB_WARP_POINTER,
   5159         .isvoid = 1
   5160     };
   5161 
   5162     struct iovec xcb_parts[4];
   5163     xcb_void_cookie_t xcb_ret;
   5164     xcb_warp_pointer_request_t xcb_out;
   5165 
   5166     xcb_out.pad0 = 0;
   5167     xcb_out.src_window = src_window;
   5168     xcb_out.dst_window = dst_window;
   5169     xcb_out.src_x = src_x;
   5170     xcb_out.src_y = src_y;
   5171     xcb_out.src_width = src_width;
   5172     xcb_out.src_height = src_height;
   5173     xcb_out.dst_x = dst_x;
   5174     xcb_out.dst_y = dst_y;
   5175 
   5176     xcb_parts[2].iov_base = (char *) &xcb_out;
   5177     xcb_parts[2].iov_len = sizeof(xcb_out);
   5178     xcb_parts[3].iov_base = 0;
   5179     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   5180 
   5181     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   5182     return xcb_ret;
   5183 }
   5184 
   5185 xcb_void_cookie_t
   5186 xcb_warp_pointer (xcb_connection_t *c,
   5187                   xcb_window_t      src_window,
   5188                   xcb_window_t      dst_window,
   5189                   int16_t           src_x,
   5190                   int16_t           src_y,
   5191                   uint16_t          src_width,
   5192                   uint16_t          src_height,
   5193                   int16_t           dst_x,
   5194                   int16_t           dst_y)
   5195 {
   5196     static const xcb_protocol_request_t xcb_req = {
   5197         .count = 2,
   5198         .ext = 0,
   5199         .opcode = XCB_WARP_POINTER,
   5200         .isvoid = 1
   5201     };
   5202 
   5203     struct iovec xcb_parts[4];
   5204     xcb_void_cookie_t xcb_ret;
   5205     xcb_warp_pointer_request_t xcb_out;
   5206 
   5207     xcb_out.pad0 = 0;
   5208     xcb_out.src_window = src_window;
   5209     xcb_out.dst_window = dst_window;
   5210     xcb_out.src_x = src_x;
   5211     xcb_out.src_y = src_y;
   5212     xcb_out.src_width = src_width;
   5213     xcb_out.src_height = src_height;
   5214     xcb_out.dst_x = dst_x;
   5215     xcb_out.dst_y = dst_y;
   5216 
   5217     xcb_parts[2].iov_base = (char *) &xcb_out;
   5218     xcb_parts[2].iov_len = sizeof(xcb_out);
   5219     xcb_parts[3].iov_base = 0;
   5220     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   5221 
   5222     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   5223     return xcb_ret;
   5224 }
   5225 
   5226 xcb_void_cookie_t
   5227 xcb_set_input_focus_checked (xcb_connection_t *c,
   5228                              uint8_t           revert_to,
   5229                              xcb_window_t      focus,
   5230                              xcb_timestamp_t   time)
   5231 {
   5232     static const xcb_protocol_request_t xcb_req = {
   5233         .count = 2,
   5234         .ext = 0,
   5235         .opcode = XCB_SET_INPUT_FOCUS,
   5236         .isvoid = 1
   5237     };
   5238 
   5239     struct iovec xcb_parts[4];
   5240     xcb_void_cookie_t xcb_ret;
   5241     xcb_set_input_focus_request_t xcb_out;
   5242 
   5243     xcb_out.revert_to = revert_to;
   5244     xcb_out.focus = focus;
   5245     xcb_out.time = time;
   5246 
   5247     xcb_parts[2].iov_base = (char *) &xcb_out;
   5248     xcb_parts[2].iov_len = sizeof(xcb_out);
   5249     xcb_parts[3].iov_base = 0;
   5250     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   5251 
   5252     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   5253     return xcb_ret;
   5254 }
   5255 
   5256 xcb_void_cookie_t
   5257 xcb_set_input_focus (xcb_connection_t *c,
   5258                      uint8_t           revert_to,
   5259                      xcb_window_t      focus,
   5260                      xcb_timestamp_t   time)
   5261 {
   5262     static const xcb_protocol_request_t xcb_req = {
   5263         .count = 2,
   5264         .ext = 0,
   5265         .opcode = XCB_SET_INPUT_FOCUS,
   5266         .isvoid = 1
   5267     };
   5268 
   5269     struct iovec xcb_parts[4];
   5270     xcb_void_cookie_t xcb_ret;
   5271     xcb_set_input_focus_request_t xcb_out;
   5272 
   5273     xcb_out.revert_to = revert_to;
   5274     xcb_out.focus = focus;
   5275     xcb_out.time = time;
   5276 
   5277     xcb_parts[2].iov_base = (char *) &xcb_out;
   5278     xcb_parts[2].iov_len = sizeof(xcb_out);
   5279     xcb_parts[3].iov_base = 0;
   5280     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   5281 
   5282     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   5283     return xcb_ret;
   5284 }
   5285 
   5286 xcb_get_input_focus_cookie_t
   5287 xcb_get_input_focus (xcb_connection_t *c)
   5288 {
   5289     static const xcb_protocol_request_t xcb_req = {
   5290         .count = 2,
   5291         .ext = 0,
   5292         .opcode = XCB_GET_INPUT_FOCUS,
   5293         .isvoid = 0
   5294     };
   5295 
   5296     struct iovec xcb_parts[4];
   5297     xcb_get_input_focus_cookie_t xcb_ret;
   5298     xcb_get_input_focus_request_t xcb_out;
   5299 
   5300     xcb_out.pad0 = 0;
   5301 
   5302     xcb_parts[2].iov_base = (char *) &xcb_out;
   5303     xcb_parts[2].iov_len = sizeof(xcb_out);
   5304     xcb_parts[3].iov_base = 0;
   5305     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   5306 
   5307     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   5308     return xcb_ret;
   5309 }
   5310 
   5311 xcb_get_input_focus_cookie_t
   5312 xcb_get_input_focus_unchecked (xcb_connection_t *c)
   5313 {
   5314     static const xcb_protocol_request_t xcb_req = {
   5315         .count = 2,
   5316         .ext = 0,
   5317         .opcode = XCB_GET_INPUT_FOCUS,
   5318         .isvoid = 0
   5319     };
   5320 
   5321     struct iovec xcb_parts[4];
   5322     xcb_get_input_focus_cookie_t xcb_ret;
   5323     xcb_get_input_focus_request_t xcb_out;
   5324 
   5325     xcb_out.pad0 = 0;
   5326 
   5327     xcb_parts[2].iov_base = (char *) &xcb_out;
   5328     xcb_parts[2].iov_len = sizeof(xcb_out);
   5329     xcb_parts[3].iov_base = 0;
   5330     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   5331 
   5332     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   5333     return xcb_ret;
   5334 }
   5335 
   5336 xcb_get_input_focus_reply_t *
   5337 xcb_get_input_focus_reply (xcb_connection_t              *c,
   5338                            xcb_get_input_focus_cookie_t   cookie  /**< */,
   5339                            xcb_generic_error_t          **e)
   5340 {
   5341     return (xcb_get_input_focus_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   5342 }
   5343 
   5344 xcb_query_keymap_cookie_t
   5345 xcb_query_keymap (xcb_connection_t *c)
   5346 {
   5347     static const xcb_protocol_request_t xcb_req = {
   5348         .count = 2,
   5349         .ext = 0,
   5350         .opcode = XCB_QUERY_KEYMAP,
   5351         .isvoid = 0
   5352     };
   5353 
   5354     struct iovec xcb_parts[4];
   5355     xcb_query_keymap_cookie_t xcb_ret;
   5356     xcb_query_keymap_request_t xcb_out;
   5357 
   5358     xcb_out.pad0 = 0;
   5359 
   5360     xcb_parts[2].iov_base = (char *) &xcb_out;
   5361     xcb_parts[2].iov_len = sizeof(xcb_out);
   5362     xcb_parts[3].iov_base = 0;
   5363     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   5364 
   5365     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   5366     return xcb_ret;
   5367 }
   5368 
   5369 xcb_query_keymap_cookie_t
   5370 xcb_query_keymap_unchecked (xcb_connection_t *c)
   5371 {
   5372     static const xcb_protocol_request_t xcb_req = {
   5373         .count = 2,
   5374         .ext = 0,
   5375         .opcode = XCB_QUERY_KEYMAP,
   5376         .isvoid = 0
   5377     };
   5378 
   5379     struct iovec xcb_parts[4];
   5380     xcb_query_keymap_cookie_t xcb_ret;
   5381     xcb_query_keymap_request_t xcb_out;
   5382 
   5383     xcb_out.pad0 = 0;
   5384 
   5385     xcb_parts[2].iov_base = (char *) &xcb_out;
   5386     xcb_parts[2].iov_len = sizeof(xcb_out);
   5387     xcb_parts[3].iov_base = 0;
   5388     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   5389 
   5390     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   5391     return xcb_ret;
   5392 }
   5393 
   5394 xcb_query_keymap_reply_t *
   5395 xcb_query_keymap_reply (xcb_connection_t           *c,
   5396                         xcb_query_keymap_cookie_t   cookie  /**< */,
   5397                         xcb_generic_error_t       **e)
   5398 {
   5399     return (xcb_query_keymap_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   5400 }
   5401 
   5402 int
   5403 xcb_open_font_sizeof (const void  *_buffer)
   5404 {
   5405     char *xcb_tmp = (char *)_buffer;
   5406     const xcb_open_font_request_t *_aux = (xcb_open_font_request_t *)_buffer;
   5407     unsigned int xcb_buffer_len = 0;
   5408     unsigned int xcb_block_len = 0;
   5409     unsigned int xcb_pad = 0;
   5410     unsigned int xcb_align_to = 0;
   5411 
   5412 
   5413     xcb_block_len += sizeof(xcb_open_font_request_t);
   5414     xcb_tmp += xcb_block_len;
   5415     xcb_buffer_len += xcb_block_len;
   5416     xcb_block_len = 0;
   5417     /* name */
   5418     xcb_block_len += _aux->name_len * sizeof(char);
   5419     xcb_tmp += xcb_block_len;
   5420     xcb_align_to = ALIGNOF(char);
   5421     /* insert padding */
   5422     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   5423     xcb_buffer_len += xcb_block_len + xcb_pad;
   5424     if (0 != xcb_pad) {
   5425         xcb_tmp += xcb_pad;
   5426         xcb_pad = 0;
   5427     }
   5428     xcb_block_len = 0;
   5429 
   5430     return xcb_buffer_len;
   5431 }
   5432 
   5433 xcb_void_cookie_t
   5434 xcb_open_font_checked (xcb_connection_t *c,
   5435                        xcb_font_t        fid,
   5436                        uint16_t          name_len,
   5437                        const char       *name)
   5438 {
   5439     static const xcb_protocol_request_t xcb_req = {
   5440         .count = 4,
   5441         .ext = 0,
   5442         .opcode = XCB_OPEN_FONT,
   5443         .isvoid = 1
   5444     };
   5445 
   5446     struct iovec xcb_parts[6];
   5447     xcb_void_cookie_t xcb_ret;
   5448     xcb_open_font_request_t xcb_out;
   5449 
   5450     xcb_out.pad0 = 0;
   5451     xcb_out.fid = fid;
   5452     xcb_out.name_len = name_len;
   5453     memset(xcb_out.pad1, 0, 2);
   5454 
   5455     xcb_parts[2].iov_base = (char *) &xcb_out;
   5456     xcb_parts[2].iov_len = sizeof(xcb_out);
   5457     xcb_parts[3].iov_base = 0;
   5458     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   5459     /* char name */
   5460     xcb_parts[4].iov_base = (char *) name;
   5461     xcb_parts[4].iov_len = name_len * sizeof(char);
   5462     xcb_parts[5].iov_base = 0;
   5463     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   5464 
   5465     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   5466     return xcb_ret;
   5467 }
   5468 
   5469 xcb_void_cookie_t
   5470 xcb_open_font (xcb_connection_t *c,
   5471                xcb_font_t        fid,
   5472                uint16_t          name_len,
   5473                const char       *name)
   5474 {
   5475     static const xcb_protocol_request_t xcb_req = {
   5476         .count = 4,
   5477         .ext = 0,
   5478         .opcode = XCB_OPEN_FONT,
   5479         .isvoid = 1
   5480     };
   5481 
   5482     struct iovec xcb_parts[6];
   5483     xcb_void_cookie_t xcb_ret;
   5484     xcb_open_font_request_t xcb_out;
   5485 
   5486     xcb_out.pad0 = 0;
   5487     xcb_out.fid = fid;
   5488     xcb_out.name_len = name_len;
   5489     memset(xcb_out.pad1, 0, 2);
   5490 
   5491     xcb_parts[2].iov_base = (char *) &xcb_out;
   5492     xcb_parts[2].iov_len = sizeof(xcb_out);
   5493     xcb_parts[3].iov_base = 0;
   5494     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   5495     /* char name */
   5496     xcb_parts[4].iov_base = (char *) name;
   5497     xcb_parts[4].iov_len = name_len * sizeof(char);
   5498     xcb_parts[5].iov_base = 0;
   5499     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   5500 
   5501     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   5502     return xcb_ret;
   5503 }
   5504 
   5505 char *
   5506 xcb_open_font_name (const xcb_open_font_request_t *R)
   5507 {
   5508     return (char *) (R + 1);
   5509 }
   5510 
   5511 int
   5512 xcb_open_font_name_length (const xcb_open_font_request_t *R)
   5513 {
   5514     return R->name_len;
   5515 }
   5516 
   5517 xcb_generic_iterator_t
   5518 xcb_open_font_name_end (const xcb_open_font_request_t *R)
   5519 {
   5520     xcb_generic_iterator_t i;
   5521     i.data = ((char *) (R + 1)) + (R->name_len);
   5522     i.rem = 0;
   5523     i.index = (char *) i.data - (char *) R;
   5524     return i;
   5525 }
   5526 
   5527 xcb_void_cookie_t
   5528 xcb_close_font_checked (xcb_connection_t *c,
   5529                         xcb_font_t        font)
   5530 {
   5531     static const xcb_protocol_request_t xcb_req = {
   5532         .count = 2,
   5533         .ext = 0,
   5534         .opcode = XCB_CLOSE_FONT,
   5535         .isvoid = 1
   5536     };
   5537 
   5538     struct iovec xcb_parts[4];
   5539     xcb_void_cookie_t xcb_ret;
   5540     xcb_close_font_request_t xcb_out;
   5541 
   5542     xcb_out.pad0 = 0;
   5543     xcb_out.font = font;
   5544 
   5545     xcb_parts[2].iov_base = (char *) &xcb_out;
   5546     xcb_parts[2].iov_len = sizeof(xcb_out);
   5547     xcb_parts[3].iov_base = 0;
   5548     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   5549 
   5550     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   5551     return xcb_ret;
   5552 }
   5553 
   5554 xcb_void_cookie_t
   5555 xcb_close_font (xcb_connection_t *c,
   5556                 xcb_font_t        font)
   5557 {
   5558     static const xcb_protocol_request_t xcb_req = {
   5559         .count = 2,
   5560         .ext = 0,
   5561         .opcode = XCB_CLOSE_FONT,
   5562         .isvoid = 1
   5563     };
   5564 
   5565     struct iovec xcb_parts[4];
   5566     xcb_void_cookie_t xcb_ret;
   5567     xcb_close_font_request_t xcb_out;
   5568 
   5569     xcb_out.pad0 = 0;
   5570     xcb_out.font = font;
   5571 
   5572     xcb_parts[2].iov_base = (char *) &xcb_out;
   5573     xcb_parts[2].iov_len = sizeof(xcb_out);
   5574     xcb_parts[3].iov_base = 0;
   5575     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   5576 
   5577     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   5578     return xcb_ret;
   5579 }
   5580 
   5581 void
   5582 xcb_fontprop_next (xcb_fontprop_iterator_t *i)
   5583 {
   5584     --i->rem;
   5585     ++i->data;
   5586     i->index += sizeof(xcb_fontprop_t);
   5587 }
   5588 
   5589 xcb_generic_iterator_t
   5590 xcb_fontprop_end (xcb_fontprop_iterator_t i)
   5591 {
   5592     xcb_generic_iterator_t ret;
   5593     ret.data = i.data + i.rem;
   5594     ret.index = i.index + ((char *) ret.data - (char *) i.data);
   5595     ret.rem = 0;
   5596     return ret;
   5597 }
   5598 
   5599 void
   5600 xcb_charinfo_next (xcb_charinfo_iterator_t *i)
   5601 {
   5602     --i->rem;
   5603     ++i->data;
   5604     i->index += sizeof(xcb_charinfo_t);
   5605 }
   5606 
   5607 xcb_generic_iterator_t
   5608 xcb_charinfo_end (xcb_charinfo_iterator_t i)
   5609 {
   5610     xcb_generic_iterator_t ret;
   5611     ret.data = i.data + i.rem;
   5612     ret.index = i.index + ((char *) ret.data - (char *) i.data);
   5613     ret.rem = 0;
   5614     return ret;
   5615 }
   5616 
   5617 int
   5618 xcb_query_font_sizeof (const void  *_buffer)
   5619 {
   5620     char *xcb_tmp = (char *)_buffer;
   5621     const xcb_query_font_reply_t *_aux = (xcb_query_font_reply_t *)_buffer;
   5622     unsigned int xcb_buffer_len = 0;
   5623     unsigned int xcb_block_len = 0;
   5624     unsigned int xcb_pad = 0;
   5625     unsigned int xcb_align_to = 0;
   5626 
   5627 
   5628     xcb_block_len += sizeof(xcb_query_font_reply_t);
   5629     xcb_tmp += xcb_block_len;
   5630     xcb_buffer_len += xcb_block_len;
   5631     xcb_block_len = 0;
   5632     /* properties */
   5633     xcb_block_len += _aux->properties_len * sizeof(xcb_fontprop_t);
   5634     xcb_tmp += xcb_block_len;
   5635     xcb_align_to = ALIGNOF(xcb_fontprop_t);
   5636     /* insert padding */
   5637     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   5638     xcb_buffer_len += xcb_block_len + xcb_pad;
   5639     if (0 != xcb_pad) {
   5640         xcb_tmp += xcb_pad;
   5641         xcb_pad = 0;
   5642     }
   5643     xcb_block_len = 0;
   5644     /* char_infos */
   5645     xcb_block_len += _aux->char_infos_len * sizeof(xcb_charinfo_t);
   5646     xcb_tmp += xcb_block_len;
   5647     xcb_align_to = ALIGNOF(xcb_charinfo_t);
   5648     /* insert padding */
   5649     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   5650     xcb_buffer_len += xcb_block_len + xcb_pad;
   5651     if (0 != xcb_pad) {
   5652         xcb_tmp += xcb_pad;
   5653         xcb_pad = 0;
   5654     }
   5655     xcb_block_len = 0;
   5656 
   5657     return xcb_buffer_len;
   5658 }
   5659 
   5660 xcb_query_font_cookie_t
   5661 xcb_query_font (xcb_connection_t *c,
   5662                 xcb_fontable_t    font)
   5663 {
   5664     static const xcb_protocol_request_t xcb_req = {
   5665         .count = 2,
   5666         .ext = 0,
   5667         .opcode = XCB_QUERY_FONT,
   5668         .isvoid = 0
   5669     };
   5670 
   5671     struct iovec xcb_parts[4];
   5672     xcb_query_font_cookie_t xcb_ret;
   5673     xcb_query_font_request_t xcb_out;
   5674 
   5675     xcb_out.pad0 = 0;
   5676     xcb_out.font = font;
   5677 
   5678     xcb_parts[2].iov_base = (char *) &xcb_out;
   5679     xcb_parts[2].iov_len = sizeof(xcb_out);
   5680     xcb_parts[3].iov_base = 0;
   5681     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   5682 
   5683     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   5684     return xcb_ret;
   5685 }
   5686 
   5687 xcb_query_font_cookie_t
   5688 xcb_query_font_unchecked (xcb_connection_t *c,
   5689                           xcb_fontable_t    font)
   5690 {
   5691     static const xcb_protocol_request_t xcb_req = {
   5692         .count = 2,
   5693         .ext = 0,
   5694         .opcode = XCB_QUERY_FONT,
   5695         .isvoid = 0
   5696     };
   5697 
   5698     struct iovec xcb_parts[4];
   5699     xcb_query_font_cookie_t xcb_ret;
   5700     xcb_query_font_request_t xcb_out;
   5701 
   5702     xcb_out.pad0 = 0;
   5703     xcb_out.font = font;
   5704 
   5705     xcb_parts[2].iov_base = (char *) &xcb_out;
   5706     xcb_parts[2].iov_len = sizeof(xcb_out);
   5707     xcb_parts[3].iov_base = 0;
   5708     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   5709 
   5710     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   5711     return xcb_ret;
   5712 }
   5713 
   5714 xcb_fontprop_t *
   5715 xcb_query_font_properties (const xcb_query_font_reply_t *R)
   5716 {
   5717     return (xcb_fontprop_t *) (R + 1);
   5718 }
   5719 
   5720 int
   5721 xcb_query_font_properties_length (const xcb_query_font_reply_t *R)
   5722 {
   5723     return R->properties_len;
   5724 }
   5725 
   5726 xcb_fontprop_iterator_t
   5727 xcb_query_font_properties_iterator (const xcb_query_font_reply_t *R)
   5728 {
   5729     xcb_fontprop_iterator_t i;
   5730     i.data = (xcb_fontprop_t *) (R + 1);
   5731     i.rem = R->properties_len;
   5732     i.index = (char *) i.data - (char *) R;
   5733     return i;
   5734 }
   5735 
   5736 xcb_charinfo_t *
   5737 xcb_query_font_char_infos (const xcb_query_font_reply_t *R)
   5738 {
   5739     xcb_generic_iterator_t prev = xcb_fontprop_end(xcb_query_font_properties_iterator(R));
   5740     return (xcb_charinfo_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_charinfo_t, prev.index) + 0);
   5741 }
   5742 
   5743 int
   5744 xcb_query_font_char_infos_length (const xcb_query_font_reply_t *R)
   5745 {
   5746     return R->char_infos_len;
   5747 }
   5748 
   5749 xcb_charinfo_iterator_t
   5750 xcb_query_font_char_infos_iterator (const xcb_query_font_reply_t *R)
   5751 {
   5752     xcb_charinfo_iterator_t i;
   5753     xcb_generic_iterator_t prev = xcb_fontprop_end(xcb_query_font_properties_iterator(R));
   5754     i.data = (xcb_charinfo_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_charinfo_t, prev.index));
   5755     i.rem = R->char_infos_len;
   5756     i.index = (char *) i.data - (char *) R;
   5757     return i;
   5758 }
   5759 
   5760 xcb_query_font_reply_t *
   5761 xcb_query_font_reply (xcb_connection_t         *c,
   5762                       xcb_query_font_cookie_t   cookie  /**< */,
   5763                       xcb_generic_error_t     **e)
   5764 {
   5765     return (xcb_query_font_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   5766 }
   5767 
   5768 int
   5769 xcb_query_text_extents_sizeof (const void  *_buffer,
   5770                                uint32_t     string_len)
   5771 {
   5772     char *xcb_tmp = (char *)_buffer;
   5773     unsigned int xcb_buffer_len = 0;
   5774     unsigned int xcb_block_len = 0;
   5775     unsigned int xcb_pad = 0;
   5776     unsigned int xcb_align_to = 0;
   5777 
   5778 
   5779     xcb_block_len += sizeof(xcb_query_text_extents_request_t);
   5780     xcb_tmp += xcb_block_len;
   5781     xcb_buffer_len += xcb_block_len;
   5782     xcb_block_len = 0;
   5783     /* string */
   5784     xcb_block_len += string_len * sizeof(xcb_char2b_t);
   5785     xcb_tmp += xcb_block_len;
   5786     xcb_align_to = ALIGNOF(xcb_char2b_t);
   5787     /* insert padding */
   5788     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   5789     xcb_buffer_len += xcb_block_len + xcb_pad;
   5790     if (0 != xcb_pad) {
   5791         xcb_tmp += xcb_pad;
   5792         xcb_pad = 0;
   5793     }
   5794     xcb_block_len = 0;
   5795 
   5796     return xcb_buffer_len;
   5797 }
   5798 
   5799 xcb_query_text_extents_cookie_t
   5800 xcb_query_text_extents (xcb_connection_t   *c,
   5801                         xcb_fontable_t      font,
   5802                         uint32_t            string_len,
   5803                         const xcb_char2b_t *string)
   5804 {
   5805     static const xcb_protocol_request_t xcb_req = {
   5806         .count = 4,
   5807         .ext = 0,
   5808         .opcode = XCB_QUERY_TEXT_EXTENTS,
   5809         .isvoid = 0
   5810     };
   5811 
   5812     struct iovec xcb_parts[6];
   5813     xcb_query_text_extents_cookie_t xcb_ret;
   5814     xcb_query_text_extents_request_t xcb_out;
   5815 
   5816     xcb_out.odd_length = (string_len & 1);
   5817     xcb_out.font = font;
   5818 
   5819     xcb_parts[2].iov_base = (char *) &xcb_out;
   5820     xcb_parts[2].iov_len = sizeof(xcb_out);
   5821     xcb_parts[3].iov_base = 0;
   5822     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   5823     /* xcb_char2b_t string */
   5824     xcb_parts[4].iov_base = (char *) string;
   5825     xcb_parts[4].iov_len = string_len * sizeof(xcb_char2b_t);
   5826     xcb_parts[5].iov_base = 0;
   5827     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   5828 
   5829     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   5830     return xcb_ret;
   5831 }
   5832 
   5833 xcb_query_text_extents_cookie_t
   5834 xcb_query_text_extents_unchecked (xcb_connection_t   *c,
   5835                                   xcb_fontable_t      font,
   5836                                   uint32_t            string_len,
   5837                                   const xcb_char2b_t *string)
   5838 {
   5839     static const xcb_protocol_request_t xcb_req = {
   5840         .count = 4,
   5841         .ext = 0,
   5842         .opcode = XCB_QUERY_TEXT_EXTENTS,
   5843         .isvoid = 0
   5844     };
   5845 
   5846     struct iovec xcb_parts[6];
   5847     xcb_query_text_extents_cookie_t xcb_ret;
   5848     xcb_query_text_extents_request_t xcb_out;
   5849 
   5850     xcb_out.odd_length = (string_len & 1);
   5851     xcb_out.font = font;
   5852 
   5853     xcb_parts[2].iov_base = (char *) &xcb_out;
   5854     xcb_parts[2].iov_len = sizeof(xcb_out);
   5855     xcb_parts[3].iov_base = 0;
   5856     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   5857     /* xcb_char2b_t string */
   5858     xcb_parts[4].iov_base = (char *) string;
   5859     xcb_parts[4].iov_len = string_len * sizeof(xcb_char2b_t);
   5860     xcb_parts[5].iov_base = 0;
   5861     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   5862 
   5863     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   5864     return xcb_ret;
   5865 }
   5866 
   5867 xcb_query_text_extents_reply_t *
   5868 xcb_query_text_extents_reply (xcb_connection_t                 *c,
   5869                               xcb_query_text_extents_cookie_t   cookie  /**< */,
   5870                               xcb_generic_error_t             **e)
   5871 {
   5872     return (xcb_query_text_extents_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   5873 }
   5874 
   5875 int
   5876 xcb_str_sizeof (const void  *_buffer)
   5877 {
   5878     char *xcb_tmp = (char *)_buffer;
   5879     const xcb_str_t *_aux = (xcb_str_t *)_buffer;
   5880     unsigned int xcb_buffer_len = 0;
   5881     unsigned int xcb_block_len = 0;
   5882     unsigned int xcb_pad = 0;
   5883     unsigned int xcb_align_to = 0;
   5884 
   5885 
   5886     xcb_block_len += sizeof(xcb_str_t);
   5887     xcb_tmp += xcb_block_len;
   5888     xcb_buffer_len += xcb_block_len;
   5889     xcb_block_len = 0;
   5890     /* name */
   5891     xcb_block_len += _aux->name_len * sizeof(char);
   5892     xcb_tmp += xcb_block_len;
   5893     xcb_align_to = ALIGNOF(char);
   5894     /* insert padding */
   5895     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   5896     xcb_buffer_len += xcb_block_len + xcb_pad;
   5897     if (0 != xcb_pad) {
   5898         xcb_tmp += xcb_pad;
   5899         xcb_pad = 0;
   5900     }
   5901     xcb_block_len = 0;
   5902 
   5903     return xcb_buffer_len;
   5904 }
   5905 
   5906 char *
   5907 xcb_str_name (const xcb_str_t *R)
   5908 {
   5909     return (char *) (R + 1);
   5910 }
   5911 
   5912 int
   5913 xcb_str_name_length (const xcb_str_t *R)
   5914 {
   5915     return R->name_len;
   5916 }
   5917 
   5918 xcb_generic_iterator_t
   5919 xcb_str_name_end (const xcb_str_t *R)
   5920 {
   5921     xcb_generic_iterator_t i;
   5922     i.data = ((char *) (R + 1)) + (R->name_len);
   5923     i.rem = 0;
   5924     i.index = (char *) i.data - (char *) R;
   5925     return i;
   5926 }
   5927 
   5928 void
   5929 xcb_str_next (xcb_str_iterator_t *i)
   5930 {
   5931     xcb_str_t *R = i->data;
   5932     xcb_generic_iterator_t child;
   5933     child.data = (xcb_str_t *)(((char *)R) + xcb_str_sizeof(R));
   5934     i->index = (char *) child.data - (char *) i->data;
   5935     --i->rem;
   5936     i->data = (xcb_str_t *) child.data;
   5937 }
   5938 
   5939 xcb_generic_iterator_t
   5940 xcb_str_end (xcb_str_iterator_t i)
   5941 {
   5942     xcb_generic_iterator_t ret;
   5943     while(i.rem > 0)
   5944         xcb_str_next(&i);
   5945     ret.data = i.data;
   5946     ret.rem = i.rem;
   5947     ret.index = i.index;
   5948     return ret;
   5949 }
   5950 
   5951 int
   5952 xcb_list_fonts_sizeof (const void  *_buffer)
   5953 {
   5954     char *xcb_tmp = (char *)_buffer;
   5955     const xcb_list_fonts_request_t *_aux = (xcb_list_fonts_request_t *)_buffer;
   5956     unsigned int xcb_buffer_len = 0;
   5957     unsigned int xcb_block_len = 0;
   5958     unsigned int xcb_pad = 0;
   5959     unsigned int xcb_align_to = 0;
   5960 
   5961 
   5962     xcb_block_len += sizeof(xcb_list_fonts_request_t);
   5963     xcb_tmp += xcb_block_len;
   5964     xcb_buffer_len += xcb_block_len;
   5965     xcb_block_len = 0;
   5966     /* pattern */
   5967     xcb_block_len += _aux->pattern_len * sizeof(char);
   5968     xcb_tmp += xcb_block_len;
   5969     xcb_align_to = ALIGNOF(char);
   5970     /* insert padding */
   5971     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   5972     xcb_buffer_len += xcb_block_len + xcb_pad;
   5973     if (0 != xcb_pad) {
   5974         xcb_tmp += xcb_pad;
   5975         xcb_pad = 0;
   5976     }
   5977     xcb_block_len = 0;
   5978 
   5979     return xcb_buffer_len;
   5980 }
   5981 
   5982 xcb_list_fonts_cookie_t
   5983 xcb_list_fonts (xcb_connection_t *c,
   5984                 uint16_t          max_names,
   5985                 uint16_t          pattern_len,
   5986                 const char       *pattern)
   5987 {
   5988     static const xcb_protocol_request_t xcb_req = {
   5989         .count = 4,
   5990         .ext = 0,
   5991         .opcode = XCB_LIST_FONTS,
   5992         .isvoid = 0
   5993     };
   5994 
   5995     struct iovec xcb_parts[6];
   5996     xcb_list_fonts_cookie_t xcb_ret;
   5997     xcb_list_fonts_request_t xcb_out;
   5998 
   5999     xcb_out.pad0 = 0;
   6000     xcb_out.max_names = max_names;
   6001     xcb_out.pattern_len = pattern_len;
   6002 
   6003     xcb_parts[2].iov_base = (char *) &xcb_out;
   6004     xcb_parts[2].iov_len = sizeof(xcb_out);
   6005     xcb_parts[3].iov_base = 0;
   6006     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   6007     /* char pattern */
   6008     xcb_parts[4].iov_base = (char *) pattern;
   6009     xcb_parts[4].iov_len = pattern_len * sizeof(char);
   6010     xcb_parts[5].iov_base = 0;
   6011     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   6012 
   6013     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   6014     return xcb_ret;
   6015 }
   6016 
   6017 xcb_list_fonts_cookie_t
   6018 xcb_list_fonts_unchecked (xcb_connection_t *c,
   6019                           uint16_t          max_names,
   6020                           uint16_t          pattern_len,
   6021                           const char       *pattern)
   6022 {
   6023     static const xcb_protocol_request_t xcb_req = {
   6024         .count = 4,
   6025         .ext = 0,
   6026         .opcode = XCB_LIST_FONTS,
   6027         .isvoid = 0
   6028     };
   6029 
   6030     struct iovec xcb_parts[6];
   6031     xcb_list_fonts_cookie_t xcb_ret;
   6032     xcb_list_fonts_request_t xcb_out;
   6033 
   6034     xcb_out.pad0 = 0;
   6035     xcb_out.max_names = max_names;
   6036     xcb_out.pattern_len = pattern_len;
   6037 
   6038     xcb_parts[2].iov_base = (char *) &xcb_out;
   6039     xcb_parts[2].iov_len = sizeof(xcb_out);
   6040     xcb_parts[3].iov_base = 0;
   6041     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   6042     /* char pattern */
   6043     xcb_parts[4].iov_base = (char *) pattern;
   6044     xcb_parts[4].iov_len = pattern_len * sizeof(char);
   6045     xcb_parts[5].iov_base = 0;
   6046     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   6047 
   6048     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   6049     return xcb_ret;
   6050 }
   6051 
   6052 int
   6053 xcb_list_fonts_names_length (const xcb_list_fonts_reply_t *R)
   6054 {
   6055     return R->names_len;
   6056 }
   6057 
   6058 xcb_str_iterator_t
   6059 xcb_list_fonts_names_iterator (const xcb_list_fonts_reply_t *R)
   6060 {
   6061     xcb_str_iterator_t i;
   6062     i.data = (xcb_str_t *) (R + 1);
   6063     i.rem = R->names_len;
   6064     i.index = (char *) i.data - (char *) R;
   6065     return i;
   6066 }
   6067 
   6068 xcb_list_fonts_reply_t *
   6069 xcb_list_fonts_reply (xcb_connection_t         *c,
   6070                       xcb_list_fonts_cookie_t   cookie  /**< */,
   6071                       xcb_generic_error_t     **e)
   6072 {
   6073     return (xcb_list_fonts_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   6074 }
   6075 
   6076 int
   6077 xcb_list_fonts_with_info_sizeof (const void  *_buffer)
   6078 {
   6079     char *xcb_tmp = (char *)_buffer;
   6080     const xcb_list_fonts_with_info_request_t *_aux = (xcb_list_fonts_with_info_request_t *)_buffer;
   6081     unsigned int xcb_buffer_len = 0;
   6082     unsigned int xcb_block_len = 0;
   6083     unsigned int xcb_pad = 0;
   6084     unsigned int xcb_align_to = 0;
   6085 
   6086 
   6087     xcb_block_len += sizeof(xcb_list_fonts_with_info_request_t);
   6088     xcb_tmp += xcb_block_len;
   6089     xcb_buffer_len += xcb_block_len;
   6090     xcb_block_len = 0;
   6091     /* pattern */
   6092     xcb_block_len += _aux->pattern_len * sizeof(char);
   6093     xcb_tmp += xcb_block_len;
   6094     xcb_align_to = ALIGNOF(char);
   6095     /* insert padding */
   6096     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   6097     xcb_buffer_len += xcb_block_len + xcb_pad;
   6098     if (0 != xcb_pad) {
   6099         xcb_tmp += xcb_pad;
   6100         xcb_pad = 0;
   6101     }
   6102     xcb_block_len = 0;
   6103 
   6104     return xcb_buffer_len;
   6105 }
   6106 
   6107 xcb_list_fonts_with_info_cookie_t
   6108 xcb_list_fonts_with_info (xcb_connection_t *c,
   6109                           uint16_t          max_names,
   6110                           uint16_t          pattern_len,
   6111                           const char       *pattern)
   6112 {
   6113     static const xcb_protocol_request_t xcb_req = {
   6114         .count = 4,
   6115         .ext = 0,
   6116         .opcode = XCB_LIST_FONTS_WITH_INFO,
   6117         .isvoid = 0
   6118     };
   6119 
   6120     struct iovec xcb_parts[6];
   6121     xcb_list_fonts_with_info_cookie_t xcb_ret;
   6122     xcb_list_fonts_with_info_request_t xcb_out;
   6123 
   6124     xcb_out.pad0 = 0;
   6125     xcb_out.max_names = max_names;
   6126     xcb_out.pattern_len = pattern_len;
   6127 
   6128     xcb_parts[2].iov_base = (char *) &xcb_out;
   6129     xcb_parts[2].iov_len = sizeof(xcb_out);
   6130     xcb_parts[3].iov_base = 0;
   6131     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   6132     /* char pattern */
   6133     xcb_parts[4].iov_base = (char *) pattern;
   6134     xcb_parts[4].iov_len = pattern_len * sizeof(char);
   6135     xcb_parts[5].iov_base = 0;
   6136     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   6137 
   6138     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   6139     return xcb_ret;
   6140 }
   6141 
   6142 xcb_list_fonts_with_info_cookie_t
   6143 xcb_list_fonts_with_info_unchecked (xcb_connection_t *c,
   6144                                     uint16_t          max_names,
   6145                                     uint16_t          pattern_len,
   6146                                     const char       *pattern)
   6147 {
   6148     static const xcb_protocol_request_t xcb_req = {
   6149         .count = 4,
   6150         .ext = 0,
   6151         .opcode = XCB_LIST_FONTS_WITH_INFO,
   6152         .isvoid = 0
   6153     };
   6154 
   6155     struct iovec xcb_parts[6];
   6156     xcb_list_fonts_with_info_cookie_t xcb_ret;
   6157     xcb_list_fonts_with_info_request_t xcb_out;
   6158 
   6159     xcb_out.pad0 = 0;
   6160     xcb_out.max_names = max_names;
   6161     xcb_out.pattern_len = pattern_len;
   6162 
   6163     xcb_parts[2].iov_base = (char *) &xcb_out;
   6164     xcb_parts[2].iov_len = sizeof(xcb_out);
   6165     xcb_parts[3].iov_base = 0;
   6166     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   6167     /* char pattern */
   6168     xcb_parts[4].iov_base = (char *) pattern;
   6169     xcb_parts[4].iov_len = pattern_len * sizeof(char);
   6170     xcb_parts[5].iov_base = 0;
   6171     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   6172 
   6173     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   6174     return xcb_ret;
   6175 }
   6176 
   6177 xcb_fontprop_t *
   6178 xcb_list_fonts_with_info_properties (const xcb_list_fonts_with_info_reply_t *R)
   6179 {
   6180     return (xcb_fontprop_t *) (R + 1);
   6181 }
   6182 
   6183 int
   6184 xcb_list_fonts_with_info_properties_length (const xcb_list_fonts_with_info_reply_t *R)
   6185 {
   6186     return R->properties_len;
   6187 }
   6188 
   6189 xcb_fontprop_iterator_t
   6190 xcb_list_fonts_with_info_properties_iterator (const xcb_list_fonts_with_info_reply_t *R)
   6191 {
   6192     xcb_fontprop_iterator_t i;
   6193     i.data = (xcb_fontprop_t *) (R + 1);
   6194     i.rem = R->properties_len;
   6195     i.index = (char *) i.data - (char *) R;
   6196     return i;
   6197 }
   6198 
   6199 char *
   6200 xcb_list_fonts_with_info_name (const xcb_list_fonts_with_info_reply_t *R)
   6201 {
   6202     xcb_generic_iterator_t prev = xcb_fontprop_end(xcb_list_fonts_with_info_properties_iterator(R));
   6203     return (char *) ((char *) prev.data + XCB_TYPE_PAD(char, prev.index) + 0);
   6204 }
   6205 
   6206 int
   6207 xcb_list_fonts_with_info_name_length (const xcb_list_fonts_with_info_reply_t *R)
   6208 {
   6209     return R->name_len;
   6210 }
   6211 
   6212 xcb_generic_iterator_t
   6213 xcb_list_fonts_with_info_name_end (const xcb_list_fonts_with_info_reply_t *R)
   6214 {
   6215     xcb_generic_iterator_t i;
   6216     xcb_generic_iterator_t prev = xcb_fontprop_end(xcb_list_fonts_with_info_properties_iterator(R));
   6217     i.data = ((char *) ((char*) prev.data + XCB_TYPE_PAD(char, prev.index))) + (R->name_len);
   6218     i.rem = 0;
   6219     i.index = (char *) i.data - (char *) R;
   6220     return i;
   6221 }
   6222 
   6223 xcb_list_fonts_with_info_reply_t *
   6224 xcb_list_fonts_with_info_reply (xcb_connection_t                   *c,
   6225                                 xcb_list_fonts_with_info_cookie_t   cookie  /**< */,
   6226                                 xcb_generic_error_t               **e)
   6227 {
   6228     return (xcb_list_fonts_with_info_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   6229 }
   6230 
   6231 int
   6232 xcb_set_font_path_sizeof (const void  *_buffer)
   6233 {
   6234     char *xcb_tmp = (char *)_buffer;
   6235     const xcb_set_font_path_request_t *_aux = (xcb_set_font_path_request_t *)_buffer;
   6236     unsigned int xcb_buffer_len = 0;
   6237     unsigned int xcb_block_len = 0;
   6238     unsigned int xcb_pad = 0;
   6239     unsigned int xcb_align_to = 0;
   6240 
   6241     unsigned int i;
   6242     unsigned int xcb_tmp_len;
   6243 
   6244     xcb_block_len += sizeof(xcb_set_font_path_request_t);
   6245     xcb_tmp += xcb_block_len;
   6246     xcb_buffer_len += xcb_block_len;
   6247     xcb_block_len = 0;
   6248     /* font */
   6249     for(i=0; i<_aux->font_qty; i++) {
   6250         xcb_tmp_len = xcb_str_sizeof(xcb_tmp);
   6251         xcb_block_len += xcb_tmp_len;
   6252         xcb_tmp += xcb_tmp_len;
   6253     }
   6254     xcb_align_to = ALIGNOF(xcb_str_t);
   6255     /* insert padding */
   6256     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   6257     xcb_buffer_len += xcb_block_len + xcb_pad;
   6258     if (0 != xcb_pad) {
   6259         xcb_tmp += xcb_pad;
   6260         xcb_pad = 0;
   6261     }
   6262     xcb_block_len = 0;
   6263 
   6264     return xcb_buffer_len;
   6265 }
   6266 
   6267 xcb_void_cookie_t
   6268 xcb_set_font_path_checked (xcb_connection_t *c,
   6269                            uint16_t          font_qty,
   6270                            const xcb_str_t  *font)
   6271 {
   6272     static const xcb_protocol_request_t xcb_req = {
   6273         .count = 4,
   6274         .ext = 0,
   6275         .opcode = XCB_SET_FONT_PATH,
   6276         .isvoid = 1
   6277     };
   6278 
   6279     struct iovec xcb_parts[6];
   6280     xcb_void_cookie_t xcb_ret;
   6281     xcb_set_font_path_request_t xcb_out;
   6282     unsigned int xcb_tmp_len;
   6283     char *xcb_tmp;
   6284     unsigned int i;
   6285 
   6286     xcb_out.pad0 = 0;
   6287     xcb_out.font_qty = font_qty;
   6288     memset(xcb_out.pad1, 0, 2);
   6289 
   6290     xcb_parts[2].iov_base = (char *) &xcb_out;
   6291     xcb_parts[2].iov_len = sizeof(xcb_out);
   6292     xcb_parts[3].iov_base = 0;
   6293     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   6294     /* xcb_str_t font */
   6295     xcb_parts[4].iov_base = (char *) font;
   6296     xcb_parts[4].iov_len = 0;
   6297     xcb_tmp = (char *)font;
   6298     for(i=0; i<font_qty; i++) {
   6299         xcb_tmp_len = xcb_str_sizeof(xcb_tmp);
   6300         xcb_parts[4].iov_len += xcb_tmp_len;
   6301         xcb_tmp += xcb_tmp_len;
   6302     }
   6303     xcb_parts[5].iov_base = 0;
   6304     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   6305 
   6306     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   6307     return xcb_ret;
   6308 }
   6309 
   6310 xcb_void_cookie_t
   6311 xcb_set_font_path (xcb_connection_t *c,
   6312                    uint16_t          font_qty,
   6313                    const xcb_str_t  *font)
   6314 {
   6315     static const xcb_protocol_request_t xcb_req = {
   6316         .count = 4,
   6317         .ext = 0,
   6318         .opcode = XCB_SET_FONT_PATH,
   6319         .isvoid = 1
   6320     };
   6321 
   6322     struct iovec xcb_parts[6];
   6323     xcb_void_cookie_t xcb_ret;
   6324     xcb_set_font_path_request_t xcb_out;
   6325     unsigned int xcb_tmp_len;
   6326     char *xcb_tmp;
   6327     unsigned int i;
   6328 
   6329     xcb_out.pad0 = 0;
   6330     xcb_out.font_qty = font_qty;
   6331     memset(xcb_out.pad1, 0, 2);
   6332 
   6333     xcb_parts[2].iov_base = (char *) &xcb_out;
   6334     xcb_parts[2].iov_len = sizeof(xcb_out);
   6335     xcb_parts[3].iov_base = 0;
   6336     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   6337     /* xcb_str_t font */
   6338     xcb_parts[4].iov_base = (char *) font;
   6339     xcb_parts[4].iov_len = 0;
   6340     xcb_tmp = (char *)font;
   6341     for(i=0; i<font_qty; i++) {
   6342         xcb_tmp_len = xcb_str_sizeof(xcb_tmp);
   6343         xcb_parts[4].iov_len += xcb_tmp_len;
   6344         xcb_tmp += xcb_tmp_len;
   6345     }
   6346     xcb_parts[5].iov_base = 0;
   6347     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   6348 
   6349     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   6350     return xcb_ret;
   6351 }
   6352 
   6353 int
   6354 xcb_set_font_path_font_length (const xcb_set_font_path_request_t *R)
   6355 {
   6356     return R->font_qty;
   6357 }
   6358 
   6359 xcb_str_iterator_t
   6360 xcb_set_font_path_font_iterator (const xcb_set_font_path_request_t *R)
   6361 {
   6362     xcb_str_iterator_t i;
   6363     i.data = (xcb_str_t *) (R + 1);
   6364     i.rem = R->font_qty;
   6365     i.index = (char *) i.data - (char *) R;
   6366     return i;
   6367 }
   6368 
   6369 int
   6370 xcb_get_font_path_sizeof (const void  *_buffer)
   6371 {
   6372     char *xcb_tmp = (char *)_buffer;
   6373     const xcb_get_font_path_reply_t *_aux = (xcb_get_font_path_reply_t *)_buffer;
   6374     unsigned int xcb_buffer_len = 0;
   6375     unsigned int xcb_block_len = 0;
   6376     unsigned int xcb_pad = 0;
   6377     unsigned int xcb_align_to = 0;
   6378 
   6379     unsigned int i;
   6380     unsigned int xcb_tmp_len;
   6381 
   6382     xcb_block_len += sizeof(xcb_get_font_path_reply_t);
   6383     xcb_tmp += xcb_block_len;
   6384     xcb_buffer_len += xcb_block_len;
   6385     xcb_block_len = 0;
   6386     /* path */
   6387     for(i=0; i<_aux->path_len; i++) {
   6388         xcb_tmp_len = xcb_str_sizeof(xcb_tmp);
   6389         xcb_block_len += xcb_tmp_len;
   6390         xcb_tmp += xcb_tmp_len;
   6391     }
   6392     xcb_align_to = ALIGNOF(xcb_str_t);
   6393     /* insert padding */
   6394     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   6395     xcb_buffer_len += xcb_block_len + xcb_pad;
   6396     if (0 != xcb_pad) {
   6397         xcb_tmp += xcb_pad;
   6398         xcb_pad = 0;
   6399     }
   6400     xcb_block_len = 0;
   6401 
   6402     return xcb_buffer_len;
   6403 }
   6404 
   6405 xcb_get_font_path_cookie_t
   6406 xcb_get_font_path (xcb_connection_t *c)
   6407 {
   6408     static const xcb_protocol_request_t xcb_req = {
   6409         .count = 2,
   6410         .ext = 0,
   6411         .opcode = XCB_GET_FONT_PATH,
   6412         .isvoid = 0
   6413     };
   6414 
   6415     struct iovec xcb_parts[4];
   6416     xcb_get_font_path_cookie_t xcb_ret;
   6417     xcb_get_font_path_request_t xcb_out;
   6418 
   6419     xcb_out.pad0 = 0;
   6420 
   6421     xcb_parts[2].iov_base = (char *) &xcb_out;
   6422     xcb_parts[2].iov_len = sizeof(xcb_out);
   6423     xcb_parts[3].iov_base = 0;
   6424     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   6425 
   6426     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   6427     return xcb_ret;
   6428 }
   6429 
   6430 xcb_get_font_path_cookie_t
   6431 xcb_get_font_path_unchecked (xcb_connection_t *c)
   6432 {
   6433     static const xcb_protocol_request_t xcb_req = {
   6434         .count = 2,
   6435         .ext = 0,
   6436         .opcode = XCB_GET_FONT_PATH,
   6437         .isvoid = 0
   6438     };
   6439 
   6440     struct iovec xcb_parts[4];
   6441     xcb_get_font_path_cookie_t xcb_ret;
   6442     xcb_get_font_path_request_t xcb_out;
   6443 
   6444     xcb_out.pad0 = 0;
   6445 
   6446     xcb_parts[2].iov_base = (char *) &xcb_out;
   6447     xcb_parts[2].iov_len = sizeof(xcb_out);
   6448     xcb_parts[3].iov_base = 0;
   6449     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   6450 
   6451     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   6452     return xcb_ret;
   6453 }
   6454 
   6455 int
   6456 xcb_get_font_path_path_length (const xcb_get_font_path_reply_t *R)
   6457 {
   6458     return R->path_len;
   6459 }
   6460 
   6461 xcb_str_iterator_t
   6462 xcb_get_font_path_path_iterator (const xcb_get_font_path_reply_t *R)
   6463 {
   6464     xcb_str_iterator_t i;
   6465     i.data = (xcb_str_t *) (R + 1);
   6466     i.rem = R->path_len;
   6467     i.index = (char *) i.data - (char *) R;
   6468     return i;
   6469 }
   6470 
   6471 xcb_get_font_path_reply_t *
   6472 xcb_get_font_path_reply (xcb_connection_t            *c,
   6473                          xcb_get_font_path_cookie_t   cookie  /**< */,
   6474                          xcb_generic_error_t        **e)
   6475 {
   6476     return (xcb_get_font_path_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   6477 }
   6478 
   6479 xcb_void_cookie_t
   6480 xcb_create_pixmap_checked (xcb_connection_t *c,
   6481                            uint8_t           depth,
   6482                            xcb_pixmap_t      pid,
   6483                            xcb_drawable_t    drawable,
   6484                            uint16_t          width,
   6485                            uint16_t          height)
   6486 {
   6487     static const xcb_protocol_request_t xcb_req = {
   6488         .count = 2,
   6489         .ext = 0,
   6490         .opcode = XCB_CREATE_PIXMAP,
   6491         .isvoid = 1
   6492     };
   6493 
   6494     struct iovec xcb_parts[4];
   6495     xcb_void_cookie_t xcb_ret;
   6496     xcb_create_pixmap_request_t xcb_out;
   6497 
   6498     xcb_out.depth = depth;
   6499     xcb_out.pid = pid;
   6500     xcb_out.drawable = drawable;
   6501     xcb_out.width = width;
   6502     xcb_out.height = height;
   6503 
   6504     xcb_parts[2].iov_base = (char *) &xcb_out;
   6505     xcb_parts[2].iov_len = sizeof(xcb_out);
   6506     xcb_parts[3].iov_base = 0;
   6507     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   6508 
   6509     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   6510     return xcb_ret;
   6511 }
   6512 
   6513 xcb_void_cookie_t
   6514 xcb_create_pixmap (xcb_connection_t *c,
   6515                    uint8_t           depth,
   6516                    xcb_pixmap_t      pid,
   6517                    xcb_drawable_t    drawable,
   6518                    uint16_t          width,
   6519                    uint16_t          height)
   6520 {
   6521     static const xcb_protocol_request_t xcb_req = {
   6522         .count = 2,
   6523         .ext = 0,
   6524         .opcode = XCB_CREATE_PIXMAP,
   6525         .isvoid = 1
   6526     };
   6527 
   6528     struct iovec xcb_parts[4];
   6529     xcb_void_cookie_t xcb_ret;
   6530     xcb_create_pixmap_request_t xcb_out;
   6531 
   6532     xcb_out.depth = depth;
   6533     xcb_out.pid = pid;
   6534     xcb_out.drawable = drawable;
   6535     xcb_out.width = width;
   6536     xcb_out.height = height;
   6537 
   6538     xcb_parts[2].iov_base = (char *) &xcb_out;
   6539     xcb_parts[2].iov_len = sizeof(xcb_out);
   6540     xcb_parts[3].iov_base = 0;
   6541     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   6542 
   6543     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   6544     return xcb_ret;
   6545 }
   6546 
   6547 xcb_void_cookie_t
   6548 xcb_free_pixmap_checked (xcb_connection_t *c,
   6549                          xcb_pixmap_t      pixmap)
   6550 {
   6551     static const xcb_protocol_request_t xcb_req = {
   6552         .count = 2,
   6553         .ext = 0,
   6554         .opcode = XCB_FREE_PIXMAP,
   6555         .isvoid = 1
   6556     };
   6557 
   6558     struct iovec xcb_parts[4];
   6559     xcb_void_cookie_t xcb_ret;
   6560     xcb_free_pixmap_request_t xcb_out;
   6561 
   6562     xcb_out.pad0 = 0;
   6563     xcb_out.pixmap = pixmap;
   6564 
   6565     xcb_parts[2].iov_base = (char *) &xcb_out;
   6566     xcb_parts[2].iov_len = sizeof(xcb_out);
   6567     xcb_parts[3].iov_base = 0;
   6568     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   6569 
   6570     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   6571     return xcb_ret;
   6572 }
   6573 
   6574 xcb_void_cookie_t
   6575 xcb_free_pixmap (xcb_connection_t *c,
   6576                  xcb_pixmap_t      pixmap)
   6577 {
   6578     static const xcb_protocol_request_t xcb_req = {
   6579         .count = 2,
   6580         .ext = 0,
   6581         .opcode = XCB_FREE_PIXMAP,
   6582         .isvoid = 1
   6583     };
   6584 
   6585     struct iovec xcb_parts[4];
   6586     xcb_void_cookie_t xcb_ret;
   6587     xcb_free_pixmap_request_t xcb_out;
   6588 
   6589     xcb_out.pad0 = 0;
   6590     xcb_out.pixmap = pixmap;
   6591 
   6592     xcb_parts[2].iov_base = (char *) &xcb_out;
   6593     xcb_parts[2].iov_len = sizeof(xcb_out);
   6594     xcb_parts[3].iov_base = 0;
   6595     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   6596 
   6597     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   6598     return xcb_ret;
   6599 }
   6600 
   6601 int
   6602 xcb_create_gc_value_list_serialize (void                             **_buffer,
   6603                                     uint32_t                           value_mask,
   6604                                     const xcb_create_gc_value_list_t  *_aux)
   6605 {
   6606     char *xcb_out = *_buffer;
   6607     unsigned int xcb_buffer_len = 0;
   6608     unsigned int xcb_align_to = 0;
   6609     unsigned int xcb_padding_offset = 0;
   6610 
   6611     unsigned int xcb_pad = 0;
   6612     char xcb_pad0[3] = {0, 0, 0};
   6613     struct iovec xcb_parts[24];
   6614     unsigned int xcb_parts_idx = 0;
   6615     unsigned int xcb_block_len = 0;
   6616     unsigned int i;
   6617     char *xcb_tmp;
   6618 
   6619     if(value_mask & XCB_GC_FUNCTION) {
   6620         /* xcb_create_gc_value_list_t.function */
   6621         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->function;
   6622         xcb_block_len += sizeof(uint32_t);
   6623         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   6624         xcb_parts_idx++;
   6625         xcb_align_to = ALIGNOF(uint32_t);
   6626     }
   6627     if(value_mask & XCB_GC_PLANE_MASK) {
   6628         /* xcb_create_gc_value_list_t.plane_mask */
   6629         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->plane_mask;
   6630         xcb_block_len += sizeof(uint32_t);
   6631         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   6632         xcb_parts_idx++;
   6633         xcb_align_to = ALIGNOF(uint32_t);
   6634     }
   6635     if(value_mask & XCB_GC_FOREGROUND) {
   6636         /* xcb_create_gc_value_list_t.foreground */
   6637         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->foreground;
   6638         xcb_block_len += sizeof(uint32_t);
   6639         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   6640         xcb_parts_idx++;
   6641         xcb_align_to = ALIGNOF(uint32_t);
   6642     }
   6643     if(value_mask & XCB_GC_BACKGROUND) {
   6644         /* xcb_create_gc_value_list_t.background */
   6645         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->background;
   6646         xcb_block_len += sizeof(uint32_t);
   6647         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   6648         xcb_parts_idx++;
   6649         xcb_align_to = ALIGNOF(uint32_t);
   6650     }
   6651     if(value_mask & XCB_GC_LINE_WIDTH) {
   6652         /* xcb_create_gc_value_list_t.line_width */
   6653         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->line_width;
   6654         xcb_block_len += sizeof(uint32_t);
   6655         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   6656         xcb_parts_idx++;
   6657         xcb_align_to = ALIGNOF(uint32_t);
   6658     }
   6659     if(value_mask & XCB_GC_LINE_STYLE) {
   6660         /* xcb_create_gc_value_list_t.line_style */
   6661         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->line_style;
   6662         xcb_block_len += sizeof(uint32_t);
   6663         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   6664         xcb_parts_idx++;
   6665         xcb_align_to = ALIGNOF(uint32_t);
   6666     }
   6667     if(value_mask & XCB_GC_CAP_STYLE) {
   6668         /* xcb_create_gc_value_list_t.cap_style */
   6669         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->cap_style;
   6670         xcb_block_len += sizeof(uint32_t);
   6671         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   6672         xcb_parts_idx++;
   6673         xcb_align_to = ALIGNOF(uint32_t);
   6674     }
   6675     if(value_mask & XCB_GC_JOIN_STYLE) {
   6676         /* xcb_create_gc_value_list_t.join_style */
   6677         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->join_style;
   6678         xcb_block_len += sizeof(uint32_t);
   6679         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   6680         xcb_parts_idx++;
   6681         xcb_align_to = ALIGNOF(uint32_t);
   6682     }
   6683     if(value_mask & XCB_GC_FILL_STYLE) {
   6684         /* xcb_create_gc_value_list_t.fill_style */
   6685         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->fill_style;
   6686         xcb_block_len += sizeof(uint32_t);
   6687         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   6688         xcb_parts_idx++;
   6689         xcb_align_to = ALIGNOF(uint32_t);
   6690     }
   6691     if(value_mask & XCB_GC_FILL_RULE) {
   6692         /* xcb_create_gc_value_list_t.fill_rule */
   6693         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->fill_rule;
   6694         xcb_block_len += sizeof(uint32_t);
   6695         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   6696         xcb_parts_idx++;
   6697         xcb_align_to = ALIGNOF(uint32_t);
   6698     }
   6699     if(value_mask & XCB_GC_TILE) {
   6700         /* xcb_create_gc_value_list_t.tile */
   6701         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->tile;
   6702         xcb_block_len += sizeof(xcb_pixmap_t);
   6703         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_pixmap_t);
   6704         xcb_parts_idx++;
   6705         xcb_align_to = ALIGNOF(xcb_pixmap_t);
   6706     }
   6707     if(value_mask & XCB_GC_STIPPLE) {
   6708         /* xcb_create_gc_value_list_t.stipple */
   6709         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->stipple;
   6710         xcb_block_len += sizeof(xcb_pixmap_t);
   6711         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_pixmap_t);
   6712         xcb_parts_idx++;
   6713         xcb_align_to = ALIGNOF(xcb_pixmap_t);
   6714     }
   6715     if(value_mask & XCB_GC_TILE_STIPPLE_ORIGIN_X) {
   6716         /* xcb_create_gc_value_list_t.tile_stipple_x_origin */
   6717         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->tile_stipple_x_origin;
   6718         xcb_block_len += sizeof(int32_t);
   6719         xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t);
   6720         xcb_parts_idx++;
   6721         xcb_align_to = ALIGNOF(int32_t);
   6722     }
   6723     if(value_mask & XCB_GC_TILE_STIPPLE_ORIGIN_Y) {
   6724         /* xcb_create_gc_value_list_t.tile_stipple_y_origin */
   6725         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->tile_stipple_y_origin;
   6726         xcb_block_len += sizeof(int32_t);
   6727         xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t);
   6728         xcb_parts_idx++;
   6729         xcb_align_to = ALIGNOF(int32_t);
   6730     }
   6731     if(value_mask & XCB_GC_FONT) {
   6732         /* xcb_create_gc_value_list_t.font */
   6733         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->font;
   6734         xcb_block_len += sizeof(xcb_font_t);
   6735         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_font_t);
   6736         xcb_parts_idx++;
   6737         xcb_align_to = ALIGNOF(xcb_font_t);
   6738     }
   6739     if(value_mask & XCB_GC_SUBWINDOW_MODE) {
   6740         /* xcb_create_gc_value_list_t.subwindow_mode */
   6741         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->subwindow_mode;
   6742         xcb_block_len += sizeof(uint32_t);
   6743         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   6744         xcb_parts_idx++;
   6745         xcb_align_to = ALIGNOF(uint32_t);
   6746     }
   6747     if(value_mask & XCB_GC_GRAPHICS_EXPOSURES) {
   6748         /* xcb_create_gc_value_list_t.graphics_exposures */
   6749         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->graphics_exposures;
   6750         xcb_block_len += sizeof(xcb_bool32_t);
   6751         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_bool32_t);
   6752         xcb_parts_idx++;
   6753         xcb_align_to = ALIGNOF(xcb_bool32_t);
   6754     }
   6755     if(value_mask & XCB_GC_CLIP_ORIGIN_X) {
   6756         /* xcb_create_gc_value_list_t.clip_x_origin */
   6757         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clip_x_origin;
   6758         xcb_block_len += sizeof(int32_t);
   6759         xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t);
   6760         xcb_parts_idx++;
   6761         xcb_align_to = ALIGNOF(int32_t);
   6762     }
   6763     if(value_mask & XCB_GC_CLIP_ORIGIN_Y) {
   6764         /* xcb_create_gc_value_list_t.clip_y_origin */
   6765         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clip_y_origin;
   6766         xcb_block_len += sizeof(int32_t);
   6767         xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t);
   6768         xcb_parts_idx++;
   6769         xcb_align_to = ALIGNOF(int32_t);
   6770     }
   6771     if(value_mask & XCB_GC_CLIP_MASK) {
   6772         /* xcb_create_gc_value_list_t.clip_mask */
   6773         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clip_mask;
   6774         xcb_block_len += sizeof(xcb_pixmap_t);
   6775         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_pixmap_t);
   6776         xcb_parts_idx++;
   6777         xcb_align_to = ALIGNOF(xcb_pixmap_t);
   6778     }
   6779     if(value_mask & XCB_GC_DASH_OFFSET) {
   6780         /* xcb_create_gc_value_list_t.dash_offset */
   6781         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->dash_offset;
   6782         xcb_block_len += sizeof(uint32_t);
   6783         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   6784         xcb_parts_idx++;
   6785         xcb_align_to = ALIGNOF(uint32_t);
   6786     }
   6787     if(value_mask & XCB_GC_DASH_LIST) {
   6788         /* xcb_create_gc_value_list_t.dashes */
   6789         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->dashes;
   6790         xcb_block_len += sizeof(uint32_t);
   6791         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   6792         xcb_parts_idx++;
   6793         xcb_align_to = ALIGNOF(uint32_t);
   6794     }
   6795     if(value_mask & XCB_GC_ARC_MODE) {
   6796         /* xcb_create_gc_value_list_t.arc_mode */
   6797         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->arc_mode;
   6798         xcb_block_len += sizeof(uint32_t);
   6799         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   6800         xcb_parts_idx++;
   6801         xcb_align_to = ALIGNOF(uint32_t);
   6802     }
   6803     /* insert padding */
   6804     xcb_pad = -(xcb_block_len + xcb_padding_offset) & (xcb_align_to - 1);
   6805     xcb_buffer_len += xcb_block_len + xcb_pad;
   6806     if (0 != xcb_pad) {
   6807         xcb_parts[xcb_parts_idx].iov_base = xcb_pad0;
   6808         xcb_parts[xcb_parts_idx].iov_len = xcb_pad;
   6809         xcb_parts_idx++;
   6810         xcb_pad = 0;
   6811     }
   6812     xcb_block_len = 0;
   6813     xcb_padding_offset = 0;
   6814 
   6815     if (NULL == xcb_out) {
   6816         /* allocate memory */
   6817         xcb_out = malloc(xcb_buffer_len);
   6818         *_buffer = xcb_out;
   6819     }
   6820 
   6821     xcb_tmp = xcb_out;
   6822     for(i=0; i<xcb_parts_idx; i++) {
   6823         if (0 != xcb_parts[i].iov_base && 0 != xcb_parts[i].iov_len)
   6824             memcpy(xcb_tmp, xcb_parts[i].iov_base, xcb_parts[i].iov_len);
   6825         if (0 != xcb_parts[i].iov_len)
   6826             xcb_tmp += xcb_parts[i].iov_len;
   6827     }
   6828 
   6829     return xcb_buffer_len;
   6830 }
   6831 
   6832 int
   6833 xcb_create_gc_value_list_unpack (const void                  *_buffer,
   6834                                  uint32_t                     value_mask,
   6835                                  xcb_create_gc_value_list_t  *_aux)
   6836 {
   6837     char *xcb_tmp = (char *)_buffer;
   6838     unsigned int xcb_buffer_len = 0;
   6839     unsigned int xcb_block_len = 0;
   6840     unsigned int xcb_pad = 0;
   6841     unsigned int xcb_align_to = 0;
   6842     unsigned int xcb_padding_offset = 0;
   6843 
   6844 
   6845     if(value_mask & XCB_GC_FUNCTION) {
   6846         /* xcb_create_gc_value_list_t.function */
   6847         _aux->function = *(uint32_t *)xcb_tmp;
   6848         xcb_block_len += sizeof(uint32_t);
   6849         xcb_tmp += sizeof(uint32_t);
   6850         xcb_align_to = ALIGNOF(uint32_t);
   6851     }
   6852     if(value_mask & XCB_GC_PLANE_MASK) {
   6853         /* xcb_create_gc_value_list_t.plane_mask */
   6854         _aux->plane_mask = *(uint32_t *)xcb_tmp;
   6855         xcb_block_len += sizeof(uint32_t);
   6856         xcb_tmp += sizeof(uint32_t);
   6857         xcb_align_to = ALIGNOF(uint32_t);
   6858     }
   6859     if(value_mask & XCB_GC_FOREGROUND) {
   6860         /* xcb_create_gc_value_list_t.foreground */
   6861         _aux->foreground = *(uint32_t *)xcb_tmp;
   6862         xcb_block_len += sizeof(uint32_t);
   6863         xcb_tmp += sizeof(uint32_t);
   6864         xcb_align_to = ALIGNOF(uint32_t);
   6865     }
   6866     if(value_mask & XCB_GC_BACKGROUND) {
   6867         /* xcb_create_gc_value_list_t.background */
   6868         _aux->background = *(uint32_t *)xcb_tmp;
   6869         xcb_block_len += sizeof(uint32_t);
   6870         xcb_tmp += sizeof(uint32_t);
   6871         xcb_align_to = ALIGNOF(uint32_t);
   6872     }
   6873     if(value_mask & XCB_GC_LINE_WIDTH) {
   6874         /* xcb_create_gc_value_list_t.line_width */
   6875         _aux->line_width = *(uint32_t *)xcb_tmp;
   6876         xcb_block_len += sizeof(uint32_t);
   6877         xcb_tmp += sizeof(uint32_t);
   6878         xcb_align_to = ALIGNOF(uint32_t);
   6879     }
   6880     if(value_mask & XCB_GC_LINE_STYLE) {
   6881         /* xcb_create_gc_value_list_t.line_style */
   6882         _aux->line_style = *(uint32_t *)xcb_tmp;
   6883         xcb_block_len += sizeof(uint32_t);
   6884         xcb_tmp += sizeof(uint32_t);
   6885         xcb_align_to = ALIGNOF(uint32_t);
   6886     }
   6887     if(value_mask & XCB_GC_CAP_STYLE) {
   6888         /* xcb_create_gc_value_list_t.cap_style */
   6889         _aux->cap_style = *(uint32_t *)xcb_tmp;
   6890         xcb_block_len += sizeof(uint32_t);
   6891         xcb_tmp += sizeof(uint32_t);
   6892         xcb_align_to = ALIGNOF(uint32_t);
   6893     }
   6894     if(value_mask & XCB_GC_JOIN_STYLE) {
   6895         /* xcb_create_gc_value_list_t.join_style */
   6896         _aux->join_style = *(uint32_t *)xcb_tmp;
   6897         xcb_block_len += sizeof(uint32_t);
   6898         xcb_tmp += sizeof(uint32_t);
   6899         xcb_align_to = ALIGNOF(uint32_t);
   6900     }
   6901     if(value_mask & XCB_GC_FILL_STYLE) {
   6902         /* xcb_create_gc_value_list_t.fill_style */
   6903         _aux->fill_style = *(uint32_t *)xcb_tmp;
   6904         xcb_block_len += sizeof(uint32_t);
   6905         xcb_tmp += sizeof(uint32_t);
   6906         xcb_align_to = ALIGNOF(uint32_t);
   6907     }
   6908     if(value_mask & XCB_GC_FILL_RULE) {
   6909         /* xcb_create_gc_value_list_t.fill_rule */
   6910         _aux->fill_rule = *(uint32_t *)xcb_tmp;
   6911         xcb_block_len += sizeof(uint32_t);
   6912         xcb_tmp += sizeof(uint32_t);
   6913         xcb_align_to = ALIGNOF(uint32_t);
   6914     }
   6915     if(value_mask & XCB_GC_TILE) {
   6916         /* xcb_create_gc_value_list_t.tile */
   6917         _aux->tile = *(xcb_pixmap_t *)xcb_tmp;
   6918         xcb_block_len += sizeof(xcb_pixmap_t);
   6919         xcb_tmp += sizeof(xcb_pixmap_t);
   6920         xcb_align_to = ALIGNOF(xcb_pixmap_t);
   6921     }
   6922     if(value_mask & XCB_GC_STIPPLE) {
   6923         /* xcb_create_gc_value_list_t.stipple */
   6924         _aux->stipple = *(xcb_pixmap_t *)xcb_tmp;
   6925         xcb_block_len += sizeof(xcb_pixmap_t);
   6926         xcb_tmp += sizeof(xcb_pixmap_t);
   6927         xcb_align_to = ALIGNOF(xcb_pixmap_t);
   6928     }
   6929     if(value_mask & XCB_GC_TILE_STIPPLE_ORIGIN_X) {
   6930         /* xcb_create_gc_value_list_t.tile_stipple_x_origin */
   6931         _aux->tile_stipple_x_origin = *(int32_t *)xcb_tmp;
   6932         xcb_block_len += sizeof(int32_t);
   6933         xcb_tmp += sizeof(int32_t);
   6934         xcb_align_to = ALIGNOF(int32_t);
   6935     }
   6936     if(value_mask & XCB_GC_TILE_STIPPLE_ORIGIN_Y) {
   6937         /* xcb_create_gc_value_list_t.tile_stipple_y_origin */
   6938         _aux->tile_stipple_y_origin = *(int32_t *)xcb_tmp;
   6939         xcb_block_len += sizeof(int32_t);
   6940         xcb_tmp += sizeof(int32_t);
   6941         xcb_align_to = ALIGNOF(int32_t);
   6942     }
   6943     if(value_mask & XCB_GC_FONT) {
   6944         /* xcb_create_gc_value_list_t.font */
   6945         _aux->font = *(xcb_font_t *)xcb_tmp;
   6946         xcb_block_len += sizeof(xcb_font_t);
   6947         xcb_tmp += sizeof(xcb_font_t);
   6948         xcb_align_to = ALIGNOF(xcb_font_t);
   6949     }
   6950     if(value_mask & XCB_GC_SUBWINDOW_MODE) {
   6951         /* xcb_create_gc_value_list_t.subwindow_mode */
   6952         _aux->subwindow_mode = *(uint32_t *)xcb_tmp;
   6953         xcb_block_len += sizeof(uint32_t);
   6954         xcb_tmp += sizeof(uint32_t);
   6955         xcb_align_to = ALIGNOF(uint32_t);
   6956     }
   6957     if(value_mask & XCB_GC_GRAPHICS_EXPOSURES) {
   6958         /* xcb_create_gc_value_list_t.graphics_exposures */
   6959         _aux->graphics_exposures = *(xcb_bool32_t *)xcb_tmp;
   6960         xcb_block_len += sizeof(xcb_bool32_t);
   6961         xcb_tmp += sizeof(xcb_bool32_t);
   6962         xcb_align_to = ALIGNOF(xcb_bool32_t);
   6963     }
   6964     if(value_mask & XCB_GC_CLIP_ORIGIN_X) {
   6965         /* xcb_create_gc_value_list_t.clip_x_origin */
   6966         _aux->clip_x_origin = *(int32_t *)xcb_tmp;
   6967         xcb_block_len += sizeof(int32_t);
   6968         xcb_tmp += sizeof(int32_t);
   6969         xcb_align_to = ALIGNOF(int32_t);
   6970     }
   6971     if(value_mask & XCB_GC_CLIP_ORIGIN_Y) {
   6972         /* xcb_create_gc_value_list_t.clip_y_origin */
   6973         _aux->clip_y_origin = *(int32_t *)xcb_tmp;
   6974         xcb_block_len += sizeof(int32_t);
   6975         xcb_tmp += sizeof(int32_t);
   6976         xcb_align_to = ALIGNOF(int32_t);
   6977     }
   6978     if(value_mask & XCB_GC_CLIP_MASK) {
   6979         /* xcb_create_gc_value_list_t.clip_mask */
   6980         _aux->clip_mask = *(xcb_pixmap_t *)xcb_tmp;
   6981         xcb_block_len += sizeof(xcb_pixmap_t);
   6982         xcb_tmp += sizeof(xcb_pixmap_t);
   6983         xcb_align_to = ALIGNOF(xcb_pixmap_t);
   6984     }
   6985     if(value_mask & XCB_GC_DASH_OFFSET) {
   6986         /* xcb_create_gc_value_list_t.dash_offset */
   6987         _aux->dash_offset = *(uint32_t *)xcb_tmp;
   6988         xcb_block_len += sizeof(uint32_t);
   6989         xcb_tmp += sizeof(uint32_t);
   6990         xcb_align_to = ALIGNOF(uint32_t);
   6991     }
   6992     if(value_mask & XCB_GC_DASH_LIST) {
   6993         /* xcb_create_gc_value_list_t.dashes */
   6994         _aux->dashes = *(uint32_t *)xcb_tmp;
   6995         xcb_block_len += sizeof(uint32_t);
   6996         xcb_tmp += sizeof(uint32_t);
   6997         xcb_align_to = ALIGNOF(uint32_t);
   6998     }
   6999     if(value_mask & XCB_GC_ARC_MODE) {
   7000         /* xcb_create_gc_value_list_t.arc_mode */
   7001         _aux->arc_mode = *(uint32_t *)xcb_tmp;
   7002         xcb_block_len += sizeof(uint32_t);
   7003         xcb_tmp += sizeof(uint32_t);
   7004         xcb_align_to = ALIGNOF(uint32_t);
   7005     }
   7006     /* insert padding */
   7007     xcb_pad = -(xcb_block_len + xcb_padding_offset) & (xcb_align_to - 1);
   7008     xcb_buffer_len += xcb_block_len + xcb_pad;
   7009     if (0 != xcb_pad) {
   7010         xcb_tmp += xcb_pad;
   7011         xcb_pad = 0;
   7012     }
   7013     xcb_block_len = 0;
   7014     xcb_padding_offset = 0;
   7015 
   7016     return xcb_buffer_len;
   7017 }
   7018 
   7019 int
   7020 xcb_create_gc_value_list_sizeof (const void  *_buffer,
   7021                                  uint32_t     value_mask)
   7022 {
   7023     xcb_create_gc_value_list_t _aux;
   7024     return xcb_create_gc_value_list_unpack(_buffer, value_mask, &_aux);
   7025 }
   7026 
   7027 int
   7028 xcb_create_gc_sizeof (const void  *_buffer)
   7029 {
   7030     char *xcb_tmp = (char *)_buffer;
   7031     const xcb_create_gc_request_t *_aux = (xcb_create_gc_request_t *)_buffer;
   7032     unsigned int xcb_buffer_len = 0;
   7033     unsigned int xcb_block_len = 0;
   7034     unsigned int xcb_pad = 0;
   7035     unsigned int xcb_align_to = 0;
   7036 
   7037 
   7038     xcb_block_len += sizeof(xcb_create_gc_request_t);
   7039     xcb_tmp += xcb_block_len;
   7040     xcb_buffer_len += xcb_block_len;
   7041     xcb_block_len = 0;
   7042     /* value_list */
   7043     xcb_block_len += xcb_create_gc_value_list_sizeof(xcb_tmp, _aux->value_mask);
   7044     xcb_tmp += xcb_block_len;
   7045     xcb_align_to = ALIGNOF(char);
   7046     /* insert padding */
   7047     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   7048     xcb_buffer_len += xcb_block_len + xcb_pad;
   7049     if (0 != xcb_pad) {
   7050         xcb_tmp += xcb_pad;
   7051         xcb_pad = 0;
   7052     }
   7053     xcb_block_len = 0;
   7054 
   7055     return xcb_buffer_len;
   7056 }
   7057 
   7058 xcb_void_cookie_t
   7059 xcb_create_gc_checked (xcb_connection_t *c,
   7060                        xcb_gcontext_t    cid,
   7061                        xcb_drawable_t    drawable,
   7062                        uint32_t          value_mask,
   7063                        const void       *value_list)
   7064 {
   7065     static const xcb_protocol_request_t xcb_req = {
   7066         .count = 3,
   7067         .ext = 0,
   7068         .opcode = XCB_CREATE_GC,
   7069         .isvoid = 1
   7070     };
   7071 
   7072     struct iovec xcb_parts[5];
   7073     xcb_void_cookie_t xcb_ret;
   7074     xcb_create_gc_request_t xcb_out;
   7075 
   7076     xcb_out.pad0 = 0;
   7077     xcb_out.cid = cid;
   7078     xcb_out.drawable = drawable;
   7079     xcb_out.value_mask = value_mask;
   7080 
   7081     xcb_parts[2].iov_base = (char *) &xcb_out;
   7082     xcb_parts[2].iov_len = sizeof(xcb_out);
   7083     xcb_parts[3].iov_base = 0;
   7084     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   7085     /* xcb_create_gc_value_list_t value_list */
   7086     xcb_parts[4].iov_base = (char *) value_list;
   7087     xcb_parts[4].iov_len =
   7088       xcb_create_gc_value_list_sizeof (value_list, value_mask);
   7089 
   7090     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   7091     return xcb_ret;
   7092 }
   7093 
   7094 xcb_void_cookie_t
   7095 xcb_create_gc (xcb_connection_t *c,
   7096                xcb_gcontext_t    cid,
   7097                xcb_drawable_t    drawable,
   7098                uint32_t          value_mask,
   7099                const void       *value_list)
   7100 {
   7101     static const xcb_protocol_request_t xcb_req = {
   7102         .count = 3,
   7103         .ext = 0,
   7104         .opcode = XCB_CREATE_GC,
   7105         .isvoid = 1
   7106     };
   7107 
   7108     struct iovec xcb_parts[5];
   7109     xcb_void_cookie_t xcb_ret;
   7110     xcb_create_gc_request_t xcb_out;
   7111 
   7112     xcb_out.pad0 = 0;
   7113     xcb_out.cid = cid;
   7114     xcb_out.drawable = drawable;
   7115     xcb_out.value_mask = value_mask;
   7116 
   7117     xcb_parts[2].iov_base = (char *) &xcb_out;
   7118     xcb_parts[2].iov_len = sizeof(xcb_out);
   7119     xcb_parts[3].iov_base = 0;
   7120     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   7121     /* xcb_create_gc_value_list_t value_list */
   7122     xcb_parts[4].iov_base = (char *) value_list;
   7123     xcb_parts[4].iov_len =
   7124       xcb_create_gc_value_list_sizeof (value_list, value_mask);
   7125 
   7126     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   7127     return xcb_ret;
   7128 }
   7129 
   7130 xcb_void_cookie_t
   7131 xcb_create_gc_aux_checked (xcb_connection_t                 *c,
   7132                            xcb_gcontext_t                    cid,
   7133                            xcb_drawable_t                    drawable,
   7134                            uint32_t                          value_mask,
   7135                            const xcb_create_gc_value_list_t *value_list)
   7136 {
   7137     static const xcb_protocol_request_t xcb_req = {
   7138         .count = 3,
   7139         .ext = 0,
   7140         .opcode = XCB_CREATE_GC,
   7141         .isvoid = 1
   7142     };
   7143 
   7144     struct iovec xcb_parts[5];
   7145     xcb_void_cookie_t xcb_ret;
   7146     xcb_create_gc_request_t xcb_out;
   7147     void *xcb_aux0 = 0;
   7148 
   7149     xcb_out.pad0 = 0;
   7150     xcb_out.cid = cid;
   7151     xcb_out.drawable = drawable;
   7152     xcb_out.value_mask = value_mask;
   7153 
   7154     xcb_parts[2].iov_base = (char *) &xcb_out;
   7155     xcb_parts[2].iov_len = sizeof(xcb_out);
   7156     xcb_parts[3].iov_base = 0;
   7157     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   7158     /* xcb_create_gc_value_list_t value_list */
   7159     xcb_parts[4].iov_len =
   7160       xcb_create_gc_value_list_serialize (&xcb_aux0, value_mask, value_list);
   7161     xcb_parts[4].iov_base = xcb_aux0;
   7162 
   7163     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   7164     free(xcb_aux0);
   7165     return xcb_ret;
   7166 }
   7167 
   7168 xcb_void_cookie_t
   7169 xcb_create_gc_aux (xcb_connection_t                 *c,
   7170                    xcb_gcontext_t                    cid,
   7171                    xcb_drawable_t                    drawable,
   7172                    uint32_t                          value_mask,
   7173                    const xcb_create_gc_value_list_t *value_list)
   7174 {
   7175     static const xcb_protocol_request_t xcb_req = {
   7176         .count = 3,
   7177         .ext = 0,
   7178         .opcode = XCB_CREATE_GC,
   7179         .isvoid = 1
   7180     };
   7181 
   7182     struct iovec xcb_parts[5];
   7183     xcb_void_cookie_t xcb_ret;
   7184     xcb_create_gc_request_t xcb_out;
   7185     void *xcb_aux0 = 0;
   7186 
   7187     xcb_out.pad0 = 0;
   7188     xcb_out.cid = cid;
   7189     xcb_out.drawable = drawable;
   7190     xcb_out.value_mask = value_mask;
   7191 
   7192     xcb_parts[2].iov_base = (char *) &xcb_out;
   7193     xcb_parts[2].iov_len = sizeof(xcb_out);
   7194     xcb_parts[3].iov_base = 0;
   7195     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   7196     /* xcb_create_gc_value_list_t value_list */
   7197     xcb_parts[4].iov_len =
   7198       xcb_create_gc_value_list_serialize (&xcb_aux0, value_mask, value_list);
   7199     xcb_parts[4].iov_base = xcb_aux0;
   7200 
   7201     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   7202     free(xcb_aux0);
   7203     return xcb_ret;
   7204 }
   7205 
   7206 void *
   7207 xcb_create_gc_value_list (const xcb_create_gc_request_t *R)
   7208 {
   7209     return (void *) (R + 1);
   7210 }
   7211 
   7212 int
   7213 xcb_change_gc_value_list_serialize (void                             **_buffer,
   7214                                     uint32_t                           value_mask,
   7215                                     const xcb_change_gc_value_list_t  *_aux)
   7216 {
   7217     char *xcb_out = *_buffer;
   7218     unsigned int xcb_buffer_len = 0;
   7219     unsigned int xcb_align_to = 0;
   7220     unsigned int xcb_padding_offset = 0;
   7221 
   7222     unsigned int xcb_pad = 0;
   7223     char xcb_pad0[3] = {0, 0, 0};
   7224     struct iovec xcb_parts[24];
   7225     unsigned int xcb_parts_idx = 0;
   7226     unsigned int xcb_block_len = 0;
   7227     unsigned int i;
   7228     char *xcb_tmp;
   7229 
   7230     if(value_mask & XCB_GC_FUNCTION) {
   7231         /* xcb_change_gc_value_list_t.function */
   7232         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->function;
   7233         xcb_block_len += sizeof(uint32_t);
   7234         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   7235         xcb_parts_idx++;
   7236         xcb_align_to = ALIGNOF(uint32_t);
   7237     }
   7238     if(value_mask & XCB_GC_PLANE_MASK) {
   7239         /* xcb_change_gc_value_list_t.plane_mask */
   7240         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->plane_mask;
   7241         xcb_block_len += sizeof(uint32_t);
   7242         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   7243         xcb_parts_idx++;
   7244         xcb_align_to = ALIGNOF(uint32_t);
   7245     }
   7246     if(value_mask & XCB_GC_FOREGROUND) {
   7247         /* xcb_change_gc_value_list_t.foreground */
   7248         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->foreground;
   7249         xcb_block_len += sizeof(uint32_t);
   7250         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   7251         xcb_parts_idx++;
   7252         xcb_align_to = ALIGNOF(uint32_t);
   7253     }
   7254     if(value_mask & XCB_GC_BACKGROUND) {
   7255         /* xcb_change_gc_value_list_t.background */
   7256         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->background;
   7257         xcb_block_len += sizeof(uint32_t);
   7258         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   7259         xcb_parts_idx++;
   7260         xcb_align_to = ALIGNOF(uint32_t);
   7261     }
   7262     if(value_mask & XCB_GC_LINE_WIDTH) {
   7263         /* xcb_change_gc_value_list_t.line_width */
   7264         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->line_width;
   7265         xcb_block_len += sizeof(uint32_t);
   7266         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   7267         xcb_parts_idx++;
   7268         xcb_align_to = ALIGNOF(uint32_t);
   7269     }
   7270     if(value_mask & XCB_GC_LINE_STYLE) {
   7271         /* xcb_change_gc_value_list_t.line_style */
   7272         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->line_style;
   7273         xcb_block_len += sizeof(uint32_t);
   7274         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   7275         xcb_parts_idx++;
   7276         xcb_align_to = ALIGNOF(uint32_t);
   7277     }
   7278     if(value_mask & XCB_GC_CAP_STYLE) {
   7279         /* xcb_change_gc_value_list_t.cap_style */
   7280         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->cap_style;
   7281         xcb_block_len += sizeof(uint32_t);
   7282         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   7283         xcb_parts_idx++;
   7284         xcb_align_to = ALIGNOF(uint32_t);
   7285     }
   7286     if(value_mask & XCB_GC_JOIN_STYLE) {
   7287         /* xcb_change_gc_value_list_t.join_style */
   7288         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->join_style;
   7289         xcb_block_len += sizeof(uint32_t);
   7290         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   7291         xcb_parts_idx++;
   7292         xcb_align_to = ALIGNOF(uint32_t);
   7293     }
   7294     if(value_mask & XCB_GC_FILL_STYLE) {
   7295         /* xcb_change_gc_value_list_t.fill_style */
   7296         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->fill_style;
   7297         xcb_block_len += sizeof(uint32_t);
   7298         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   7299         xcb_parts_idx++;
   7300         xcb_align_to = ALIGNOF(uint32_t);
   7301     }
   7302     if(value_mask & XCB_GC_FILL_RULE) {
   7303         /* xcb_change_gc_value_list_t.fill_rule */
   7304         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->fill_rule;
   7305         xcb_block_len += sizeof(uint32_t);
   7306         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   7307         xcb_parts_idx++;
   7308         xcb_align_to = ALIGNOF(uint32_t);
   7309     }
   7310     if(value_mask & XCB_GC_TILE) {
   7311         /* xcb_change_gc_value_list_t.tile */
   7312         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->tile;
   7313         xcb_block_len += sizeof(xcb_pixmap_t);
   7314         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_pixmap_t);
   7315         xcb_parts_idx++;
   7316         xcb_align_to = ALIGNOF(xcb_pixmap_t);
   7317     }
   7318     if(value_mask & XCB_GC_STIPPLE) {
   7319         /* xcb_change_gc_value_list_t.stipple */
   7320         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->stipple;
   7321         xcb_block_len += sizeof(xcb_pixmap_t);
   7322         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_pixmap_t);
   7323         xcb_parts_idx++;
   7324         xcb_align_to = ALIGNOF(xcb_pixmap_t);
   7325     }
   7326     if(value_mask & XCB_GC_TILE_STIPPLE_ORIGIN_X) {
   7327         /* xcb_change_gc_value_list_t.tile_stipple_x_origin */
   7328         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->tile_stipple_x_origin;
   7329         xcb_block_len += sizeof(int32_t);
   7330         xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t);
   7331         xcb_parts_idx++;
   7332         xcb_align_to = ALIGNOF(int32_t);
   7333     }
   7334     if(value_mask & XCB_GC_TILE_STIPPLE_ORIGIN_Y) {
   7335         /* xcb_change_gc_value_list_t.tile_stipple_y_origin */
   7336         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->tile_stipple_y_origin;
   7337         xcb_block_len += sizeof(int32_t);
   7338         xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t);
   7339         xcb_parts_idx++;
   7340         xcb_align_to = ALIGNOF(int32_t);
   7341     }
   7342     if(value_mask & XCB_GC_FONT) {
   7343         /* xcb_change_gc_value_list_t.font */
   7344         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->font;
   7345         xcb_block_len += sizeof(xcb_font_t);
   7346         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_font_t);
   7347         xcb_parts_idx++;
   7348         xcb_align_to = ALIGNOF(xcb_font_t);
   7349     }
   7350     if(value_mask & XCB_GC_SUBWINDOW_MODE) {
   7351         /* xcb_change_gc_value_list_t.subwindow_mode */
   7352         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->subwindow_mode;
   7353         xcb_block_len += sizeof(uint32_t);
   7354         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   7355         xcb_parts_idx++;
   7356         xcb_align_to = ALIGNOF(uint32_t);
   7357     }
   7358     if(value_mask & XCB_GC_GRAPHICS_EXPOSURES) {
   7359         /* xcb_change_gc_value_list_t.graphics_exposures */
   7360         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->graphics_exposures;
   7361         xcb_block_len += sizeof(xcb_bool32_t);
   7362         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_bool32_t);
   7363         xcb_parts_idx++;
   7364         xcb_align_to = ALIGNOF(xcb_bool32_t);
   7365     }
   7366     if(value_mask & XCB_GC_CLIP_ORIGIN_X) {
   7367         /* xcb_change_gc_value_list_t.clip_x_origin */
   7368         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clip_x_origin;
   7369         xcb_block_len += sizeof(int32_t);
   7370         xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t);
   7371         xcb_parts_idx++;
   7372         xcb_align_to = ALIGNOF(int32_t);
   7373     }
   7374     if(value_mask & XCB_GC_CLIP_ORIGIN_Y) {
   7375         /* xcb_change_gc_value_list_t.clip_y_origin */
   7376         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clip_y_origin;
   7377         xcb_block_len += sizeof(int32_t);
   7378         xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t);
   7379         xcb_parts_idx++;
   7380         xcb_align_to = ALIGNOF(int32_t);
   7381     }
   7382     if(value_mask & XCB_GC_CLIP_MASK) {
   7383         /* xcb_change_gc_value_list_t.clip_mask */
   7384         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->clip_mask;
   7385         xcb_block_len += sizeof(xcb_pixmap_t);
   7386         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_pixmap_t);
   7387         xcb_parts_idx++;
   7388         xcb_align_to = ALIGNOF(xcb_pixmap_t);
   7389     }
   7390     if(value_mask & XCB_GC_DASH_OFFSET) {
   7391         /* xcb_change_gc_value_list_t.dash_offset */
   7392         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->dash_offset;
   7393         xcb_block_len += sizeof(uint32_t);
   7394         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   7395         xcb_parts_idx++;
   7396         xcb_align_to = ALIGNOF(uint32_t);
   7397     }
   7398     if(value_mask & XCB_GC_DASH_LIST) {
   7399         /* xcb_change_gc_value_list_t.dashes */
   7400         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->dashes;
   7401         xcb_block_len += sizeof(uint32_t);
   7402         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   7403         xcb_parts_idx++;
   7404         xcb_align_to = ALIGNOF(uint32_t);
   7405     }
   7406     if(value_mask & XCB_GC_ARC_MODE) {
   7407         /* xcb_change_gc_value_list_t.arc_mode */
   7408         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->arc_mode;
   7409         xcb_block_len += sizeof(uint32_t);
   7410         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   7411         xcb_parts_idx++;
   7412         xcb_align_to = ALIGNOF(uint32_t);
   7413     }
   7414     /* insert padding */
   7415     xcb_pad = -(xcb_block_len + xcb_padding_offset) & (xcb_align_to - 1);
   7416     xcb_buffer_len += xcb_block_len + xcb_pad;
   7417     if (0 != xcb_pad) {
   7418         xcb_parts[xcb_parts_idx].iov_base = xcb_pad0;
   7419         xcb_parts[xcb_parts_idx].iov_len = xcb_pad;
   7420         xcb_parts_idx++;
   7421         xcb_pad = 0;
   7422     }
   7423     xcb_block_len = 0;
   7424     xcb_padding_offset = 0;
   7425 
   7426     if (NULL == xcb_out) {
   7427         /* allocate memory */
   7428         xcb_out = malloc(xcb_buffer_len);
   7429         *_buffer = xcb_out;
   7430     }
   7431 
   7432     xcb_tmp = xcb_out;
   7433     for(i=0; i<xcb_parts_idx; i++) {
   7434         if (0 != xcb_parts[i].iov_base && 0 != xcb_parts[i].iov_len)
   7435             memcpy(xcb_tmp, xcb_parts[i].iov_base, xcb_parts[i].iov_len);
   7436         if (0 != xcb_parts[i].iov_len)
   7437             xcb_tmp += xcb_parts[i].iov_len;
   7438     }
   7439 
   7440     return xcb_buffer_len;
   7441 }
   7442 
   7443 int
   7444 xcb_change_gc_value_list_unpack (const void                  *_buffer,
   7445                                  uint32_t                     value_mask,
   7446                                  xcb_change_gc_value_list_t  *_aux)
   7447 {
   7448     char *xcb_tmp = (char *)_buffer;
   7449     unsigned int xcb_buffer_len = 0;
   7450     unsigned int xcb_block_len = 0;
   7451     unsigned int xcb_pad = 0;
   7452     unsigned int xcb_align_to = 0;
   7453     unsigned int xcb_padding_offset = 0;
   7454 
   7455 
   7456     if(value_mask & XCB_GC_FUNCTION) {
   7457         /* xcb_change_gc_value_list_t.function */
   7458         _aux->function = *(uint32_t *)xcb_tmp;
   7459         xcb_block_len += sizeof(uint32_t);
   7460         xcb_tmp += sizeof(uint32_t);
   7461         xcb_align_to = ALIGNOF(uint32_t);
   7462     }
   7463     if(value_mask & XCB_GC_PLANE_MASK) {
   7464         /* xcb_change_gc_value_list_t.plane_mask */
   7465         _aux->plane_mask = *(uint32_t *)xcb_tmp;
   7466         xcb_block_len += sizeof(uint32_t);
   7467         xcb_tmp += sizeof(uint32_t);
   7468         xcb_align_to = ALIGNOF(uint32_t);
   7469     }
   7470     if(value_mask & XCB_GC_FOREGROUND) {
   7471         /* xcb_change_gc_value_list_t.foreground */
   7472         _aux->foreground = *(uint32_t *)xcb_tmp;
   7473         xcb_block_len += sizeof(uint32_t);
   7474         xcb_tmp += sizeof(uint32_t);
   7475         xcb_align_to = ALIGNOF(uint32_t);
   7476     }
   7477     if(value_mask & XCB_GC_BACKGROUND) {
   7478         /* xcb_change_gc_value_list_t.background */
   7479         _aux->background = *(uint32_t *)xcb_tmp;
   7480         xcb_block_len += sizeof(uint32_t);
   7481         xcb_tmp += sizeof(uint32_t);
   7482         xcb_align_to = ALIGNOF(uint32_t);
   7483     }
   7484     if(value_mask & XCB_GC_LINE_WIDTH) {
   7485         /* xcb_change_gc_value_list_t.line_width */
   7486         _aux->line_width = *(uint32_t *)xcb_tmp;
   7487         xcb_block_len += sizeof(uint32_t);
   7488         xcb_tmp += sizeof(uint32_t);
   7489         xcb_align_to = ALIGNOF(uint32_t);
   7490     }
   7491     if(value_mask & XCB_GC_LINE_STYLE) {
   7492         /* xcb_change_gc_value_list_t.line_style */
   7493         _aux->line_style = *(uint32_t *)xcb_tmp;
   7494         xcb_block_len += sizeof(uint32_t);
   7495         xcb_tmp += sizeof(uint32_t);
   7496         xcb_align_to = ALIGNOF(uint32_t);
   7497     }
   7498     if(value_mask & XCB_GC_CAP_STYLE) {
   7499         /* xcb_change_gc_value_list_t.cap_style */
   7500         _aux->cap_style = *(uint32_t *)xcb_tmp;
   7501         xcb_block_len += sizeof(uint32_t);
   7502         xcb_tmp += sizeof(uint32_t);
   7503         xcb_align_to = ALIGNOF(uint32_t);
   7504     }
   7505     if(value_mask & XCB_GC_JOIN_STYLE) {
   7506         /* xcb_change_gc_value_list_t.join_style */
   7507         _aux->join_style = *(uint32_t *)xcb_tmp;
   7508         xcb_block_len += sizeof(uint32_t);
   7509         xcb_tmp += sizeof(uint32_t);
   7510         xcb_align_to = ALIGNOF(uint32_t);
   7511     }
   7512     if(value_mask & XCB_GC_FILL_STYLE) {
   7513         /* xcb_change_gc_value_list_t.fill_style */
   7514         _aux->fill_style = *(uint32_t *)xcb_tmp;
   7515         xcb_block_len += sizeof(uint32_t);
   7516         xcb_tmp += sizeof(uint32_t);
   7517         xcb_align_to = ALIGNOF(uint32_t);
   7518     }
   7519     if(value_mask & XCB_GC_FILL_RULE) {
   7520         /* xcb_change_gc_value_list_t.fill_rule */
   7521         _aux->fill_rule = *(uint32_t *)xcb_tmp;
   7522         xcb_block_len += sizeof(uint32_t);
   7523         xcb_tmp += sizeof(uint32_t);
   7524         xcb_align_to = ALIGNOF(uint32_t);
   7525     }
   7526     if(value_mask & XCB_GC_TILE) {
   7527         /* xcb_change_gc_value_list_t.tile */
   7528         _aux->tile = *(xcb_pixmap_t *)xcb_tmp;
   7529         xcb_block_len += sizeof(xcb_pixmap_t);
   7530         xcb_tmp += sizeof(xcb_pixmap_t);
   7531         xcb_align_to = ALIGNOF(xcb_pixmap_t);
   7532     }
   7533     if(value_mask & XCB_GC_STIPPLE) {
   7534         /* xcb_change_gc_value_list_t.stipple */
   7535         _aux->stipple = *(xcb_pixmap_t *)xcb_tmp;
   7536         xcb_block_len += sizeof(xcb_pixmap_t);
   7537         xcb_tmp += sizeof(xcb_pixmap_t);
   7538         xcb_align_to = ALIGNOF(xcb_pixmap_t);
   7539     }
   7540     if(value_mask & XCB_GC_TILE_STIPPLE_ORIGIN_X) {
   7541         /* xcb_change_gc_value_list_t.tile_stipple_x_origin */
   7542         _aux->tile_stipple_x_origin = *(int32_t *)xcb_tmp;
   7543         xcb_block_len += sizeof(int32_t);
   7544         xcb_tmp += sizeof(int32_t);
   7545         xcb_align_to = ALIGNOF(int32_t);
   7546     }
   7547     if(value_mask & XCB_GC_TILE_STIPPLE_ORIGIN_Y) {
   7548         /* xcb_change_gc_value_list_t.tile_stipple_y_origin */
   7549         _aux->tile_stipple_y_origin = *(int32_t *)xcb_tmp;
   7550         xcb_block_len += sizeof(int32_t);
   7551         xcb_tmp += sizeof(int32_t);
   7552         xcb_align_to = ALIGNOF(int32_t);
   7553     }
   7554     if(value_mask & XCB_GC_FONT) {
   7555         /* xcb_change_gc_value_list_t.font */
   7556         _aux->font = *(xcb_font_t *)xcb_tmp;
   7557         xcb_block_len += sizeof(xcb_font_t);
   7558         xcb_tmp += sizeof(xcb_font_t);
   7559         xcb_align_to = ALIGNOF(xcb_font_t);
   7560     }
   7561     if(value_mask & XCB_GC_SUBWINDOW_MODE) {
   7562         /* xcb_change_gc_value_list_t.subwindow_mode */
   7563         _aux->subwindow_mode = *(uint32_t *)xcb_tmp;
   7564         xcb_block_len += sizeof(uint32_t);
   7565         xcb_tmp += sizeof(uint32_t);
   7566         xcb_align_to = ALIGNOF(uint32_t);
   7567     }
   7568     if(value_mask & XCB_GC_GRAPHICS_EXPOSURES) {
   7569         /* xcb_change_gc_value_list_t.graphics_exposures */
   7570         _aux->graphics_exposures = *(xcb_bool32_t *)xcb_tmp;
   7571         xcb_block_len += sizeof(xcb_bool32_t);
   7572         xcb_tmp += sizeof(xcb_bool32_t);
   7573         xcb_align_to = ALIGNOF(xcb_bool32_t);
   7574     }
   7575     if(value_mask & XCB_GC_CLIP_ORIGIN_X) {
   7576         /* xcb_change_gc_value_list_t.clip_x_origin */
   7577         _aux->clip_x_origin = *(int32_t *)xcb_tmp;
   7578         xcb_block_len += sizeof(int32_t);
   7579         xcb_tmp += sizeof(int32_t);
   7580         xcb_align_to = ALIGNOF(int32_t);
   7581     }
   7582     if(value_mask & XCB_GC_CLIP_ORIGIN_Y) {
   7583         /* xcb_change_gc_value_list_t.clip_y_origin */
   7584         _aux->clip_y_origin = *(int32_t *)xcb_tmp;
   7585         xcb_block_len += sizeof(int32_t);
   7586         xcb_tmp += sizeof(int32_t);
   7587         xcb_align_to = ALIGNOF(int32_t);
   7588     }
   7589     if(value_mask & XCB_GC_CLIP_MASK) {
   7590         /* xcb_change_gc_value_list_t.clip_mask */
   7591         _aux->clip_mask = *(xcb_pixmap_t *)xcb_tmp;
   7592         xcb_block_len += sizeof(xcb_pixmap_t);
   7593         xcb_tmp += sizeof(xcb_pixmap_t);
   7594         xcb_align_to = ALIGNOF(xcb_pixmap_t);
   7595     }
   7596     if(value_mask & XCB_GC_DASH_OFFSET) {
   7597         /* xcb_change_gc_value_list_t.dash_offset */
   7598         _aux->dash_offset = *(uint32_t *)xcb_tmp;
   7599         xcb_block_len += sizeof(uint32_t);
   7600         xcb_tmp += sizeof(uint32_t);
   7601         xcb_align_to = ALIGNOF(uint32_t);
   7602     }
   7603     if(value_mask & XCB_GC_DASH_LIST) {
   7604         /* xcb_change_gc_value_list_t.dashes */
   7605         _aux->dashes = *(uint32_t *)xcb_tmp;
   7606         xcb_block_len += sizeof(uint32_t);
   7607         xcb_tmp += sizeof(uint32_t);
   7608         xcb_align_to = ALIGNOF(uint32_t);
   7609     }
   7610     if(value_mask & XCB_GC_ARC_MODE) {
   7611         /* xcb_change_gc_value_list_t.arc_mode */
   7612         _aux->arc_mode = *(uint32_t *)xcb_tmp;
   7613         xcb_block_len += sizeof(uint32_t);
   7614         xcb_tmp += sizeof(uint32_t);
   7615         xcb_align_to = ALIGNOF(uint32_t);
   7616     }
   7617     /* insert padding */
   7618     xcb_pad = -(xcb_block_len + xcb_padding_offset) & (xcb_align_to - 1);
   7619     xcb_buffer_len += xcb_block_len + xcb_pad;
   7620     if (0 != xcb_pad) {
   7621         xcb_tmp += xcb_pad;
   7622         xcb_pad = 0;
   7623     }
   7624     xcb_block_len = 0;
   7625     xcb_padding_offset = 0;
   7626 
   7627     return xcb_buffer_len;
   7628 }
   7629 
   7630 int
   7631 xcb_change_gc_value_list_sizeof (const void  *_buffer,
   7632                                  uint32_t     value_mask)
   7633 {
   7634     xcb_change_gc_value_list_t _aux;
   7635     return xcb_change_gc_value_list_unpack(_buffer, value_mask, &_aux);
   7636 }
   7637 
   7638 int
   7639 xcb_change_gc_sizeof (const void  *_buffer)
   7640 {
   7641     char *xcb_tmp = (char *)_buffer;
   7642     const xcb_change_gc_request_t *_aux = (xcb_change_gc_request_t *)_buffer;
   7643     unsigned int xcb_buffer_len = 0;
   7644     unsigned int xcb_block_len = 0;
   7645     unsigned int xcb_pad = 0;
   7646     unsigned int xcb_align_to = 0;
   7647 
   7648 
   7649     xcb_block_len += sizeof(xcb_change_gc_request_t);
   7650     xcb_tmp += xcb_block_len;
   7651     xcb_buffer_len += xcb_block_len;
   7652     xcb_block_len = 0;
   7653     /* value_list */
   7654     xcb_block_len += xcb_change_gc_value_list_sizeof(xcb_tmp, _aux->value_mask);
   7655     xcb_tmp += xcb_block_len;
   7656     xcb_align_to = ALIGNOF(char);
   7657     /* insert padding */
   7658     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   7659     xcb_buffer_len += xcb_block_len + xcb_pad;
   7660     if (0 != xcb_pad) {
   7661         xcb_tmp += xcb_pad;
   7662         xcb_pad = 0;
   7663     }
   7664     xcb_block_len = 0;
   7665 
   7666     return xcb_buffer_len;
   7667 }
   7668 
   7669 xcb_void_cookie_t
   7670 xcb_change_gc_checked (xcb_connection_t *c,
   7671                        xcb_gcontext_t    gc,
   7672                        uint32_t          value_mask,
   7673                        const void       *value_list)
   7674 {
   7675     static const xcb_protocol_request_t xcb_req = {
   7676         .count = 3,
   7677         .ext = 0,
   7678         .opcode = XCB_CHANGE_GC,
   7679         .isvoid = 1
   7680     };
   7681 
   7682     struct iovec xcb_parts[5];
   7683     xcb_void_cookie_t xcb_ret;
   7684     xcb_change_gc_request_t xcb_out;
   7685 
   7686     xcb_out.pad0 = 0;
   7687     xcb_out.gc = gc;
   7688     xcb_out.value_mask = value_mask;
   7689 
   7690     xcb_parts[2].iov_base = (char *) &xcb_out;
   7691     xcb_parts[2].iov_len = sizeof(xcb_out);
   7692     xcb_parts[3].iov_base = 0;
   7693     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   7694     /* xcb_change_gc_value_list_t value_list */
   7695     xcb_parts[4].iov_base = (char *) value_list;
   7696     xcb_parts[4].iov_len =
   7697       xcb_change_gc_value_list_sizeof (value_list, value_mask);
   7698 
   7699     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   7700     return xcb_ret;
   7701 }
   7702 
   7703 xcb_void_cookie_t
   7704 xcb_change_gc (xcb_connection_t *c,
   7705                xcb_gcontext_t    gc,
   7706                uint32_t          value_mask,
   7707                const void       *value_list)
   7708 {
   7709     static const xcb_protocol_request_t xcb_req = {
   7710         .count = 3,
   7711         .ext = 0,
   7712         .opcode = XCB_CHANGE_GC,
   7713         .isvoid = 1
   7714     };
   7715 
   7716     struct iovec xcb_parts[5];
   7717     xcb_void_cookie_t xcb_ret;
   7718     xcb_change_gc_request_t xcb_out;
   7719 
   7720     xcb_out.pad0 = 0;
   7721     xcb_out.gc = gc;
   7722     xcb_out.value_mask = value_mask;
   7723 
   7724     xcb_parts[2].iov_base = (char *) &xcb_out;
   7725     xcb_parts[2].iov_len = sizeof(xcb_out);
   7726     xcb_parts[3].iov_base = 0;
   7727     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   7728     /* xcb_change_gc_value_list_t value_list */
   7729     xcb_parts[4].iov_base = (char *) value_list;
   7730     xcb_parts[4].iov_len =
   7731       xcb_change_gc_value_list_sizeof (value_list, value_mask);
   7732 
   7733     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   7734     return xcb_ret;
   7735 }
   7736 
   7737 xcb_void_cookie_t
   7738 xcb_change_gc_aux_checked (xcb_connection_t                 *c,
   7739                            xcb_gcontext_t                    gc,
   7740                            uint32_t                          value_mask,
   7741                            const xcb_change_gc_value_list_t *value_list)
   7742 {
   7743     static const xcb_protocol_request_t xcb_req = {
   7744         .count = 3,
   7745         .ext = 0,
   7746         .opcode = XCB_CHANGE_GC,
   7747         .isvoid = 1
   7748     };
   7749 
   7750     struct iovec xcb_parts[5];
   7751     xcb_void_cookie_t xcb_ret;
   7752     xcb_change_gc_request_t xcb_out;
   7753     void *xcb_aux0 = 0;
   7754 
   7755     xcb_out.pad0 = 0;
   7756     xcb_out.gc = gc;
   7757     xcb_out.value_mask = value_mask;
   7758 
   7759     xcb_parts[2].iov_base = (char *) &xcb_out;
   7760     xcb_parts[2].iov_len = sizeof(xcb_out);
   7761     xcb_parts[3].iov_base = 0;
   7762     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   7763     /* xcb_change_gc_value_list_t value_list */
   7764     xcb_parts[4].iov_len =
   7765       xcb_change_gc_value_list_serialize (&xcb_aux0, value_mask, value_list);
   7766     xcb_parts[4].iov_base = xcb_aux0;
   7767 
   7768     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   7769     free(xcb_aux0);
   7770     return xcb_ret;
   7771 }
   7772 
   7773 xcb_void_cookie_t
   7774 xcb_change_gc_aux (xcb_connection_t                 *c,
   7775                    xcb_gcontext_t                    gc,
   7776                    uint32_t                          value_mask,
   7777                    const xcb_change_gc_value_list_t *value_list)
   7778 {
   7779     static const xcb_protocol_request_t xcb_req = {
   7780         .count = 3,
   7781         .ext = 0,
   7782         .opcode = XCB_CHANGE_GC,
   7783         .isvoid = 1
   7784     };
   7785 
   7786     struct iovec xcb_parts[5];
   7787     xcb_void_cookie_t xcb_ret;
   7788     xcb_change_gc_request_t xcb_out;
   7789     void *xcb_aux0 = 0;
   7790 
   7791     xcb_out.pad0 = 0;
   7792     xcb_out.gc = gc;
   7793     xcb_out.value_mask = value_mask;
   7794 
   7795     xcb_parts[2].iov_base = (char *) &xcb_out;
   7796     xcb_parts[2].iov_len = sizeof(xcb_out);
   7797     xcb_parts[3].iov_base = 0;
   7798     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   7799     /* xcb_change_gc_value_list_t value_list */
   7800     xcb_parts[4].iov_len =
   7801       xcb_change_gc_value_list_serialize (&xcb_aux0, value_mask, value_list);
   7802     xcb_parts[4].iov_base = xcb_aux0;
   7803 
   7804     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   7805     free(xcb_aux0);
   7806     return xcb_ret;
   7807 }
   7808 
   7809 void *
   7810 xcb_change_gc_value_list (const xcb_change_gc_request_t *R)
   7811 {
   7812     return (void *) (R + 1);
   7813 }
   7814 
   7815 xcb_void_cookie_t
   7816 xcb_copy_gc_checked (xcb_connection_t *c,
   7817                      xcb_gcontext_t    src_gc,
   7818                      xcb_gcontext_t    dst_gc,
   7819                      uint32_t          value_mask)
   7820 {
   7821     static const xcb_protocol_request_t xcb_req = {
   7822         .count = 2,
   7823         .ext = 0,
   7824         .opcode = XCB_COPY_GC,
   7825         .isvoid = 1
   7826     };
   7827 
   7828     struct iovec xcb_parts[4];
   7829     xcb_void_cookie_t xcb_ret;
   7830     xcb_copy_gc_request_t xcb_out;
   7831 
   7832     xcb_out.pad0 = 0;
   7833     xcb_out.src_gc = src_gc;
   7834     xcb_out.dst_gc = dst_gc;
   7835     xcb_out.value_mask = value_mask;
   7836 
   7837     xcb_parts[2].iov_base = (char *) &xcb_out;
   7838     xcb_parts[2].iov_len = sizeof(xcb_out);
   7839     xcb_parts[3].iov_base = 0;
   7840     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   7841 
   7842     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   7843     return xcb_ret;
   7844 }
   7845 
   7846 xcb_void_cookie_t
   7847 xcb_copy_gc (xcb_connection_t *c,
   7848              xcb_gcontext_t    src_gc,
   7849              xcb_gcontext_t    dst_gc,
   7850              uint32_t          value_mask)
   7851 {
   7852     static const xcb_protocol_request_t xcb_req = {
   7853         .count = 2,
   7854         .ext = 0,
   7855         .opcode = XCB_COPY_GC,
   7856         .isvoid = 1
   7857     };
   7858 
   7859     struct iovec xcb_parts[4];
   7860     xcb_void_cookie_t xcb_ret;
   7861     xcb_copy_gc_request_t xcb_out;
   7862 
   7863     xcb_out.pad0 = 0;
   7864     xcb_out.src_gc = src_gc;
   7865     xcb_out.dst_gc = dst_gc;
   7866     xcb_out.value_mask = value_mask;
   7867 
   7868     xcb_parts[2].iov_base = (char *) &xcb_out;
   7869     xcb_parts[2].iov_len = sizeof(xcb_out);
   7870     xcb_parts[3].iov_base = 0;
   7871     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   7872 
   7873     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   7874     return xcb_ret;
   7875 }
   7876 
   7877 int
   7878 xcb_set_dashes_sizeof (const void  *_buffer)
   7879 {
   7880     char *xcb_tmp = (char *)_buffer;
   7881     const xcb_set_dashes_request_t *_aux = (xcb_set_dashes_request_t *)_buffer;
   7882     unsigned int xcb_buffer_len = 0;
   7883     unsigned int xcb_block_len = 0;
   7884     unsigned int xcb_pad = 0;
   7885     unsigned int xcb_align_to = 0;
   7886 
   7887 
   7888     xcb_block_len += sizeof(xcb_set_dashes_request_t);
   7889     xcb_tmp += xcb_block_len;
   7890     xcb_buffer_len += xcb_block_len;
   7891     xcb_block_len = 0;
   7892     /* dashes */
   7893     xcb_block_len += _aux->dashes_len * sizeof(uint8_t);
   7894     xcb_tmp += xcb_block_len;
   7895     xcb_align_to = ALIGNOF(uint8_t);
   7896     /* insert padding */
   7897     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   7898     xcb_buffer_len += xcb_block_len + xcb_pad;
   7899     if (0 != xcb_pad) {
   7900         xcb_tmp += xcb_pad;
   7901         xcb_pad = 0;
   7902     }
   7903     xcb_block_len = 0;
   7904 
   7905     return xcb_buffer_len;
   7906 }
   7907 
   7908 xcb_void_cookie_t
   7909 xcb_set_dashes_checked (xcb_connection_t *c,
   7910                         xcb_gcontext_t    gc,
   7911                         uint16_t          dash_offset,
   7912                         uint16_t          dashes_len,
   7913                         const uint8_t    *dashes)
   7914 {
   7915     static const xcb_protocol_request_t xcb_req = {
   7916         .count = 4,
   7917         .ext = 0,
   7918         .opcode = XCB_SET_DASHES,
   7919         .isvoid = 1
   7920     };
   7921 
   7922     struct iovec xcb_parts[6];
   7923     xcb_void_cookie_t xcb_ret;
   7924     xcb_set_dashes_request_t xcb_out;
   7925 
   7926     xcb_out.pad0 = 0;
   7927     xcb_out.gc = gc;
   7928     xcb_out.dash_offset = dash_offset;
   7929     xcb_out.dashes_len = dashes_len;
   7930 
   7931     xcb_parts[2].iov_base = (char *) &xcb_out;
   7932     xcb_parts[2].iov_len = sizeof(xcb_out);
   7933     xcb_parts[3].iov_base = 0;
   7934     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   7935     /* uint8_t dashes */
   7936     xcb_parts[4].iov_base = (char *) dashes;
   7937     xcb_parts[4].iov_len = dashes_len * sizeof(uint8_t);
   7938     xcb_parts[5].iov_base = 0;
   7939     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   7940 
   7941     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   7942     return xcb_ret;
   7943 }
   7944 
   7945 xcb_void_cookie_t
   7946 xcb_set_dashes (xcb_connection_t *c,
   7947                 xcb_gcontext_t    gc,
   7948                 uint16_t          dash_offset,
   7949                 uint16_t          dashes_len,
   7950                 const uint8_t    *dashes)
   7951 {
   7952     static const xcb_protocol_request_t xcb_req = {
   7953         .count = 4,
   7954         .ext = 0,
   7955         .opcode = XCB_SET_DASHES,
   7956         .isvoid = 1
   7957     };
   7958 
   7959     struct iovec xcb_parts[6];
   7960     xcb_void_cookie_t xcb_ret;
   7961     xcb_set_dashes_request_t xcb_out;
   7962 
   7963     xcb_out.pad0 = 0;
   7964     xcb_out.gc = gc;
   7965     xcb_out.dash_offset = dash_offset;
   7966     xcb_out.dashes_len = dashes_len;
   7967 
   7968     xcb_parts[2].iov_base = (char *) &xcb_out;
   7969     xcb_parts[2].iov_len = sizeof(xcb_out);
   7970     xcb_parts[3].iov_base = 0;
   7971     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   7972     /* uint8_t dashes */
   7973     xcb_parts[4].iov_base = (char *) dashes;
   7974     xcb_parts[4].iov_len = dashes_len * sizeof(uint8_t);
   7975     xcb_parts[5].iov_base = 0;
   7976     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   7977 
   7978     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   7979     return xcb_ret;
   7980 }
   7981 
   7982 uint8_t *
   7983 xcb_set_dashes_dashes (const xcb_set_dashes_request_t *R)
   7984 {
   7985     return (uint8_t *) (R + 1);
   7986 }
   7987 
   7988 int
   7989 xcb_set_dashes_dashes_length (const xcb_set_dashes_request_t *R)
   7990 {
   7991     return R->dashes_len;
   7992 }
   7993 
   7994 xcb_generic_iterator_t
   7995 xcb_set_dashes_dashes_end (const xcb_set_dashes_request_t *R)
   7996 {
   7997     xcb_generic_iterator_t i;
   7998     i.data = ((uint8_t *) (R + 1)) + (R->dashes_len);
   7999     i.rem = 0;
   8000     i.index = (char *) i.data - (char *) R;
   8001     return i;
   8002 }
   8003 
   8004 int
   8005 xcb_set_clip_rectangles_sizeof (const void  *_buffer,
   8006                                 uint32_t     rectangles_len)
   8007 {
   8008     char *xcb_tmp = (char *)_buffer;
   8009     unsigned int xcb_buffer_len = 0;
   8010     unsigned int xcb_block_len = 0;
   8011     unsigned int xcb_pad = 0;
   8012     unsigned int xcb_align_to = 0;
   8013 
   8014 
   8015     xcb_block_len += sizeof(xcb_set_clip_rectangles_request_t);
   8016     xcb_tmp += xcb_block_len;
   8017     xcb_buffer_len += xcb_block_len;
   8018     xcb_block_len = 0;
   8019     /* rectangles */
   8020     xcb_block_len += rectangles_len * sizeof(xcb_rectangle_t);
   8021     xcb_tmp += xcb_block_len;
   8022     xcb_align_to = ALIGNOF(xcb_rectangle_t);
   8023     /* insert padding */
   8024     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   8025     xcb_buffer_len += xcb_block_len + xcb_pad;
   8026     if (0 != xcb_pad) {
   8027         xcb_tmp += xcb_pad;
   8028         xcb_pad = 0;
   8029     }
   8030     xcb_block_len = 0;
   8031 
   8032     return xcb_buffer_len;
   8033 }
   8034 
   8035 xcb_void_cookie_t
   8036 xcb_set_clip_rectangles_checked (xcb_connection_t      *c,
   8037                                  uint8_t                ordering,
   8038                                  xcb_gcontext_t         gc,
   8039                                  int16_t                clip_x_origin,
   8040                                  int16_t                clip_y_origin,
   8041                                  uint32_t               rectangles_len,
   8042                                  const xcb_rectangle_t *rectangles)
   8043 {
   8044     static const xcb_protocol_request_t xcb_req = {
   8045         .count = 4,
   8046         .ext = 0,
   8047         .opcode = XCB_SET_CLIP_RECTANGLES,
   8048         .isvoid = 1
   8049     };
   8050 
   8051     struct iovec xcb_parts[6];
   8052     xcb_void_cookie_t xcb_ret;
   8053     xcb_set_clip_rectangles_request_t xcb_out;
   8054 
   8055     xcb_out.ordering = ordering;
   8056     xcb_out.gc = gc;
   8057     xcb_out.clip_x_origin = clip_x_origin;
   8058     xcb_out.clip_y_origin = clip_y_origin;
   8059 
   8060     xcb_parts[2].iov_base = (char *) &xcb_out;
   8061     xcb_parts[2].iov_len = sizeof(xcb_out);
   8062     xcb_parts[3].iov_base = 0;
   8063     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   8064     /* xcb_rectangle_t rectangles */
   8065     xcb_parts[4].iov_base = (char *) rectangles;
   8066     xcb_parts[4].iov_len = rectangles_len * sizeof(xcb_rectangle_t);
   8067     xcb_parts[5].iov_base = 0;
   8068     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   8069 
   8070     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   8071     return xcb_ret;
   8072 }
   8073 
   8074 xcb_void_cookie_t
   8075 xcb_set_clip_rectangles (xcb_connection_t      *c,
   8076                          uint8_t                ordering,
   8077                          xcb_gcontext_t         gc,
   8078                          int16_t                clip_x_origin,
   8079                          int16_t                clip_y_origin,
   8080                          uint32_t               rectangles_len,
   8081                          const xcb_rectangle_t *rectangles)
   8082 {
   8083     static const xcb_protocol_request_t xcb_req = {
   8084         .count = 4,
   8085         .ext = 0,
   8086         .opcode = XCB_SET_CLIP_RECTANGLES,
   8087         .isvoid = 1
   8088     };
   8089 
   8090     struct iovec xcb_parts[6];
   8091     xcb_void_cookie_t xcb_ret;
   8092     xcb_set_clip_rectangles_request_t xcb_out;
   8093 
   8094     xcb_out.ordering = ordering;
   8095     xcb_out.gc = gc;
   8096     xcb_out.clip_x_origin = clip_x_origin;
   8097     xcb_out.clip_y_origin = clip_y_origin;
   8098 
   8099     xcb_parts[2].iov_base = (char *) &xcb_out;
   8100     xcb_parts[2].iov_len = sizeof(xcb_out);
   8101     xcb_parts[3].iov_base = 0;
   8102     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   8103     /* xcb_rectangle_t rectangles */
   8104     xcb_parts[4].iov_base = (char *) rectangles;
   8105     xcb_parts[4].iov_len = rectangles_len * sizeof(xcb_rectangle_t);
   8106     xcb_parts[5].iov_base = 0;
   8107     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   8108 
   8109     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   8110     return xcb_ret;
   8111 }
   8112 
   8113 xcb_rectangle_t *
   8114 xcb_set_clip_rectangles_rectangles (const xcb_set_clip_rectangles_request_t *R)
   8115 {
   8116     return (xcb_rectangle_t *) (R + 1);
   8117 }
   8118 
   8119 int
   8120 xcb_set_clip_rectangles_rectangles_length (const xcb_set_clip_rectangles_request_t *R)
   8121 {
   8122     return (((R->length * 4) - sizeof(xcb_set_clip_rectangles_request_t))/sizeof(xcb_rectangle_t));
   8123 }
   8124 
   8125 xcb_rectangle_iterator_t
   8126 xcb_set_clip_rectangles_rectangles_iterator (const xcb_set_clip_rectangles_request_t *R)
   8127 {
   8128     xcb_rectangle_iterator_t i;
   8129     i.data = (xcb_rectangle_t *) (R + 1);
   8130     i.rem = (((R->length * 4) - sizeof(xcb_set_clip_rectangles_request_t))/sizeof(xcb_rectangle_t));
   8131     i.index = (char *) i.data - (char *) R;
   8132     return i;
   8133 }
   8134 
   8135 xcb_void_cookie_t
   8136 xcb_free_gc_checked (xcb_connection_t *c,
   8137                      xcb_gcontext_t    gc)
   8138 {
   8139     static const xcb_protocol_request_t xcb_req = {
   8140         .count = 2,
   8141         .ext = 0,
   8142         .opcode = XCB_FREE_GC,
   8143         .isvoid = 1
   8144     };
   8145 
   8146     struct iovec xcb_parts[4];
   8147     xcb_void_cookie_t xcb_ret;
   8148     xcb_free_gc_request_t xcb_out;
   8149 
   8150     xcb_out.pad0 = 0;
   8151     xcb_out.gc = gc;
   8152 
   8153     xcb_parts[2].iov_base = (char *) &xcb_out;
   8154     xcb_parts[2].iov_len = sizeof(xcb_out);
   8155     xcb_parts[3].iov_base = 0;
   8156     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   8157 
   8158     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   8159     return xcb_ret;
   8160 }
   8161 
   8162 xcb_void_cookie_t
   8163 xcb_free_gc (xcb_connection_t *c,
   8164              xcb_gcontext_t    gc)
   8165 {
   8166     static const xcb_protocol_request_t xcb_req = {
   8167         .count = 2,
   8168         .ext = 0,
   8169         .opcode = XCB_FREE_GC,
   8170         .isvoid = 1
   8171     };
   8172 
   8173     struct iovec xcb_parts[4];
   8174     xcb_void_cookie_t xcb_ret;
   8175     xcb_free_gc_request_t xcb_out;
   8176 
   8177     xcb_out.pad0 = 0;
   8178     xcb_out.gc = gc;
   8179 
   8180     xcb_parts[2].iov_base = (char *) &xcb_out;
   8181     xcb_parts[2].iov_len = sizeof(xcb_out);
   8182     xcb_parts[3].iov_base = 0;
   8183     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   8184 
   8185     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   8186     return xcb_ret;
   8187 }
   8188 
   8189 xcb_void_cookie_t
   8190 xcb_clear_area_checked (xcb_connection_t *c,
   8191                         uint8_t           exposures,
   8192                         xcb_window_t      window,
   8193                         int16_t           x,
   8194                         int16_t           y,
   8195                         uint16_t          width,
   8196                         uint16_t          height)
   8197 {
   8198     static const xcb_protocol_request_t xcb_req = {
   8199         .count = 2,
   8200         .ext = 0,
   8201         .opcode = XCB_CLEAR_AREA,
   8202         .isvoid = 1
   8203     };
   8204 
   8205     struct iovec xcb_parts[4];
   8206     xcb_void_cookie_t xcb_ret;
   8207     xcb_clear_area_request_t xcb_out;
   8208 
   8209     xcb_out.exposures = exposures;
   8210     xcb_out.window = window;
   8211     xcb_out.x = x;
   8212     xcb_out.y = y;
   8213     xcb_out.width = width;
   8214     xcb_out.height = height;
   8215 
   8216     xcb_parts[2].iov_base = (char *) &xcb_out;
   8217     xcb_parts[2].iov_len = sizeof(xcb_out);
   8218     xcb_parts[3].iov_base = 0;
   8219     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   8220 
   8221     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   8222     return xcb_ret;
   8223 }
   8224 
   8225 xcb_void_cookie_t
   8226 xcb_clear_area (xcb_connection_t *c,
   8227                 uint8_t           exposures,
   8228                 xcb_window_t      window,
   8229                 int16_t           x,
   8230                 int16_t           y,
   8231                 uint16_t          width,
   8232                 uint16_t          height)
   8233 {
   8234     static const xcb_protocol_request_t xcb_req = {
   8235         .count = 2,
   8236         .ext = 0,
   8237         .opcode = XCB_CLEAR_AREA,
   8238         .isvoid = 1
   8239     };
   8240 
   8241     struct iovec xcb_parts[4];
   8242     xcb_void_cookie_t xcb_ret;
   8243     xcb_clear_area_request_t xcb_out;
   8244 
   8245     xcb_out.exposures = exposures;
   8246     xcb_out.window = window;
   8247     xcb_out.x = x;
   8248     xcb_out.y = y;
   8249     xcb_out.width = width;
   8250     xcb_out.height = height;
   8251 
   8252     xcb_parts[2].iov_base = (char *) &xcb_out;
   8253     xcb_parts[2].iov_len = sizeof(xcb_out);
   8254     xcb_parts[3].iov_base = 0;
   8255     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   8256 
   8257     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   8258     return xcb_ret;
   8259 }
   8260 
   8261 xcb_void_cookie_t
   8262 xcb_copy_area_checked (xcb_connection_t *c,
   8263                        xcb_drawable_t    src_drawable,
   8264                        xcb_drawable_t    dst_drawable,
   8265                        xcb_gcontext_t    gc,
   8266                        int16_t           src_x,
   8267                        int16_t           src_y,
   8268                        int16_t           dst_x,
   8269                        int16_t           dst_y,
   8270                        uint16_t          width,
   8271                        uint16_t          height)
   8272 {
   8273     static const xcb_protocol_request_t xcb_req = {
   8274         .count = 2,
   8275         .ext = 0,
   8276         .opcode = XCB_COPY_AREA,
   8277         .isvoid = 1
   8278     };
   8279 
   8280     struct iovec xcb_parts[4];
   8281     xcb_void_cookie_t xcb_ret;
   8282     xcb_copy_area_request_t xcb_out;
   8283 
   8284     xcb_out.pad0 = 0;
   8285     xcb_out.src_drawable = src_drawable;
   8286     xcb_out.dst_drawable = dst_drawable;
   8287     xcb_out.gc = gc;
   8288     xcb_out.src_x = src_x;
   8289     xcb_out.src_y = src_y;
   8290     xcb_out.dst_x = dst_x;
   8291     xcb_out.dst_y = dst_y;
   8292     xcb_out.width = width;
   8293     xcb_out.height = height;
   8294 
   8295     xcb_parts[2].iov_base = (char *) &xcb_out;
   8296     xcb_parts[2].iov_len = sizeof(xcb_out);
   8297     xcb_parts[3].iov_base = 0;
   8298     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   8299 
   8300     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   8301     return xcb_ret;
   8302 }
   8303 
   8304 xcb_void_cookie_t
   8305 xcb_copy_area (xcb_connection_t *c,
   8306                xcb_drawable_t    src_drawable,
   8307                xcb_drawable_t    dst_drawable,
   8308                xcb_gcontext_t    gc,
   8309                int16_t           src_x,
   8310                int16_t           src_y,
   8311                int16_t           dst_x,
   8312                int16_t           dst_y,
   8313                uint16_t          width,
   8314                uint16_t          height)
   8315 {
   8316     static const xcb_protocol_request_t xcb_req = {
   8317         .count = 2,
   8318         .ext = 0,
   8319         .opcode = XCB_COPY_AREA,
   8320         .isvoid = 1
   8321     };
   8322 
   8323     struct iovec xcb_parts[4];
   8324     xcb_void_cookie_t xcb_ret;
   8325     xcb_copy_area_request_t xcb_out;
   8326 
   8327     xcb_out.pad0 = 0;
   8328     xcb_out.src_drawable = src_drawable;
   8329     xcb_out.dst_drawable = dst_drawable;
   8330     xcb_out.gc = gc;
   8331     xcb_out.src_x = src_x;
   8332     xcb_out.src_y = src_y;
   8333     xcb_out.dst_x = dst_x;
   8334     xcb_out.dst_y = dst_y;
   8335     xcb_out.width = width;
   8336     xcb_out.height = height;
   8337 
   8338     xcb_parts[2].iov_base = (char *) &xcb_out;
   8339     xcb_parts[2].iov_len = sizeof(xcb_out);
   8340     xcb_parts[3].iov_base = 0;
   8341     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   8342 
   8343     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   8344     return xcb_ret;
   8345 }
   8346 
   8347 xcb_void_cookie_t
   8348 xcb_copy_plane_checked (xcb_connection_t *c,
   8349                         xcb_drawable_t    src_drawable,
   8350                         xcb_drawable_t    dst_drawable,
   8351                         xcb_gcontext_t    gc,
   8352                         int16_t           src_x,
   8353                         int16_t           src_y,
   8354                         int16_t           dst_x,
   8355                         int16_t           dst_y,
   8356                         uint16_t          width,
   8357                         uint16_t          height,
   8358                         uint32_t          bit_plane)
   8359 {
   8360     static const xcb_protocol_request_t xcb_req = {
   8361         .count = 2,
   8362         .ext = 0,
   8363         .opcode = XCB_COPY_PLANE,
   8364         .isvoid = 1
   8365     };
   8366 
   8367     struct iovec xcb_parts[4];
   8368     xcb_void_cookie_t xcb_ret;
   8369     xcb_copy_plane_request_t xcb_out;
   8370 
   8371     xcb_out.pad0 = 0;
   8372     xcb_out.src_drawable = src_drawable;
   8373     xcb_out.dst_drawable = dst_drawable;
   8374     xcb_out.gc = gc;
   8375     xcb_out.src_x = src_x;
   8376     xcb_out.src_y = src_y;
   8377     xcb_out.dst_x = dst_x;
   8378     xcb_out.dst_y = dst_y;
   8379     xcb_out.width = width;
   8380     xcb_out.height = height;
   8381     xcb_out.bit_plane = bit_plane;
   8382 
   8383     xcb_parts[2].iov_base = (char *) &xcb_out;
   8384     xcb_parts[2].iov_len = sizeof(xcb_out);
   8385     xcb_parts[3].iov_base = 0;
   8386     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   8387 
   8388     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   8389     return xcb_ret;
   8390 }
   8391 
   8392 xcb_void_cookie_t
   8393 xcb_copy_plane (xcb_connection_t *c,
   8394                 xcb_drawable_t    src_drawable,
   8395                 xcb_drawable_t    dst_drawable,
   8396                 xcb_gcontext_t    gc,
   8397                 int16_t           src_x,
   8398                 int16_t           src_y,
   8399                 int16_t           dst_x,
   8400                 int16_t           dst_y,
   8401                 uint16_t          width,
   8402                 uint16_t          height,
   8403                 uint32_t          bit_plane)
   8404 {
   8405     static const xcb_protocol_request_t xcb_req = {
   8406         .count = 2,
   8407         .ext = 0,
   8408         .opcode = XCB_COPY_PLANE,
   8409         .isvoid = 1
   8410     };
   8411 
   8412     struct iovec xcb_parts[4];
   8413     xcb_void_cookie_t xcb_ret;
   8414     xcb_copy_plane_request_t xcb_out;
   8415 
   8416     xcb_out.pad0 = 0;
   8417     xcb_out.src_drawable = src_drawable;
   8418     xcb_out.dst_drawable = dst_drawable;
   8419     xcb_out.gc = gc;
   8420     xcb_out.src_x = src_x;
   8421     xcb_out.src_y = src_y;
   8422     xcb_out.dst_x = dst_x;
   8423     xcb_out.dst_y = dst_y;
   8424     xcb_out.width = width;
   8425     xcb_out.height = height;
   8426     xcb_out.bit_plane = bit_plane;
   8427 
   8428     xcb_parts[2].iov_base = (char *) &xcb_out;
   8429     xcb_parts[2].iov_len = sizeof(xcb_out);
   8430     xcb_parts[3].iov_base = 0;
   8431     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   8432 
   8433     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   8434     return xcb_ret;
   8435 }
   8436 
   8437 int
   8438 xcb_poly_point_sizeof (const void  *_buffer,
   8439                        uint32_t     points_len)
   8440 {
   8441     char *xcb_tmp = (char *)_buffer;
   8442     unsigned int xcb_buffer_len = 0;
   8443     unsigned int xcb_block_len = 0;
   8444     unsigned int xcb_pad = 0;
   8445     unsigned int xcb_align_to = 0;
   8446 
   8447 
   8448     xcb_block_len += sizeof(xcb_poly_point_request_t);
   8449     xcb_tmp += xcb_block_len;
   8450     xcb_buffer_len += xcb_block_len;
   8451     xcb_block_len = 0;
   8452     /* points */
   8453     xcb_block_len += points_len * sizeof(xcb_point_t);
   8454     xcb_tmp += xcb_block_len;
   8455     xcb_align_to = ALIGNOF(xcb_point_t);
   8456     /* insert padding */
   8457     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   8458     xcb_buffer_len += xcb_block_len + xcb_pad;
   8459     if (0 != xcb_pad) {
   8460         xcb_tmp += xcb_pad;
   8461         xcb_pad = 0;
   8462     }
   8463     xcb_block_len = 0;
   8464 
   8465     return xcb_buffer_len;
   8466 }
   8467 
   8468 xcb_void_cookie_t
   8469 xcb_poly_point_checked (xcb_connection_t  *c,
   8470                         uint8_t            coordinate_mode,
   8471                         xcb_drawable_t     drawable,
   8472                         xcb_gcontext_t     gc,
   8473                         uint32_t           points_len,
   8474                         const xcb_point_t *points)
   8475 {
   8476     static const xcb_protocol_request_t xcb_req = {
   8477         .count = 4,
   8478         .ext = 0,
   8479         .opcode = XCB_POLY_POINT,
   8480         .isvoid = 1
   8481     };
   8482 
   8483     struct iovec xcb_parts[6];
   8484     xcb_void_cookie_t xcb_ret;
   8485     xcb_poly_point_request_t xcb_out;
   8486 
   8487     xcb_out.coordinate_mode = coordinate_mode;
   8488     xcb_out.drawable = drawable;
   8489     xcb_out.gc = gc;
   8490 
   8491     xcb_parts[2].iov_base = (char *) &xcb_out;
   8492     xcb_parts[2].iov_len = sizeof(xcb_out);
   8493     xcb_parts[3].iov_base = 0;
   8494     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   8495     /* xcb_point_t points */
   8496     xcb_parts[4].iov_base = (char *) points;
   8497     xcb_parts[4].iov_len = points_len * sizeof(xcb_point_t);
   8498     xcb_parts[5].iov_base = 0;
   8499     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   8500 
   8501     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   8502     return xcb_ret;
   8503 }
   8504 
   8505 xcb_void_cookie_t
   8506 xcb_poly_point (xcb_connection_t  *c,
   8507                 uint8_t            coordinate_mode,
   8508                 xcb_drawable_t     drawable,
   8509                 xcb_gcontext_t     gc,
   8510                 uint32_t           points_len,
   8511                 const xcb_point_t *points)
   8512 {
   8513     static const xcb_protocol_request_t xcb_req = {
   8514         .count = 4,
   8515         .ext = 0,
   8516         .opcode = XCB_POLY_POINT,
   8517         .isvoid = 1
   8518     };
   8519 
   8520     struct iovec xcb_parts[6];
   8521     xcb_void_cookie_t xcb_ret;
   8522     xcb_poly_point_request_t xcb_out;
   8523 
   8524     xcb_out.coordinate_mode = coordinate_mode;
   8525     xcb_out.drawable = drawable;
   8526     xcb_out.gc = gc;
   8527 
   8528     xcb_parts[2].iov_base = (char *) &xcb_out;
   8529     xcb_parts[2].iov_len = sizeof(xcb_out);
   8530     xcb_parts[3].iov_base = 0;
   8531     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   8532     /* xcb_point_t points */
   8533     xcb_parts[4].iov_base = (char *) points;
   8534     xcb_parts[4].iov_len = points_len * sizeof(xcb_point_t);
   8535     xcb_parts[5].iov_base = 0;
   8536     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   8537 
   8538     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   8539     return xcb_ret;
   8540 }
   8541 
   8542 xcb_point_t *
   8543 xcb_poly_point_points (const xcb_poly_point_request_t *R)
   8544 {
   8545     return (xcb_point_t *) (R + 1);
   8546 }
   8547 
   8548 int
   8549 xcb_poly_point_points_length (const xcb_poly_point_request_t *R)
   8550 {
   8551     return (((R->length * 4) - sizeof(xcb_poly_point_request_t))/sizeof(xcb_point_t));
   8552 }
   8553 
   8554 xcb_point_iterator_t
   8555 xcb_poly_point_points_iterator (const xcb_poly_point_request_t *R)
   8556 {
   8557     xcb_point_iterator_t i;
   8558     i.data = (xcb_point_t *) (R + 1);
   8559     i.rem = (((R->length * 4) - sizeof(xcb_poly_point_request_t))/sizeof(xcb_point_t));
   8560     i.index = (char *) i.data - (char *) R;
   8561     return i;
   8562 }
   8563 
   8564 int
   8565 xcb_poly_line_sizeof (const void  *_buffer,
   8566                       uint32_t     points_len)
   8567 {
   8568     char *xcb_tmp = (char *)_buffer;
   8569     unsigned int xcb_buffer_len = 0;
   8570     unsigned int xcb_block_len = 0;
   8571     unsigned int xcb_pad = 0;
   8572     unsigned int xcb_align_to = 0;
   8573 
   8574 
   8575     xcb_block_len += sizeof(xcb_poly_line_request_t);
   8576     xcb_tmp += xcb_block_len;
   8577     xcb_buffer_len += xcb_block_len;
   8578     xcb_block_len = 0;
   8579     /* points */
   8580     xcb_block_len += points_len * sizeof(xcb_point_t);
   8581     xcb_tmp += xcb_block_len;
   8582     xcb_align_to = ALIGNOF(xcb_point_t);
   8583     /* insert padding */
   8584     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   8585     xcb_buffer_len += xcb_block_len + xcb_pad;
   8586     if (0 != xcb_pad) {
   8587         xcb_tmp += xcb_pad;
   8588         xcb_pad = 0;
   8589     }
   8590     xcb_block_len = 0;
   8591 
   8592     return xcb_buffer_len;
   8593 }
   8594 
   8595 xcb_void_cookie_t
   8596 xcb_poly_line_checked (xcb_connection_t  *c,
   8597                        uint8_t            coordinate_mode,
   8598                        xcb_drawable_t     drawable,
   8599                        xcb_gcontext_t     gc,
   8600                        uint32_t           points_len,
   8601                        const xcb_point_t *points)
   8602 {
   8603     static const xcb_protocol_request_t xcb_req = {
   8604         .count = 4,
   8605         .ext = 0,
   8606         .opcode = XCB_POLY_LINE,
   8607         .isvoid = 1
   8608     };
   8609 
   8610     struct iovec xcb_parts[6];
   8611     xcb_void_cookie_t xcb_ret;
   8612     xcb_poly_line_request_t xcb_out;
   8613 
   8614     xcb_out.coordinate_mode = coordinate_mode;
   8615     xcb_out.drawable = drawable;
   8616     xcb_out.gc = gc;
   8617 
   8618     xcb_parts[2].iov_base = (char *) &xcb_out;
   8619     xcb_parts[2].iov_len = sizeof(xcb_out);
   8620     xcb_parts[3].iov_base = 0;
   8621     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   8622     /* xcb_point_t points */
   8623     xcb_parts[4].iov_base = (char *) points;
   8624     xcb_parts[4].iov_len = points_len * sizeof(xcb_point_t);
   8625     xcb_parts[5].iov_base = 0;
   8626     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   8627 
   8628     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   8629     return xcb_ret;
   8630 }
   8631 
   8632 xcb_void_cookie_t
   8633 xcb_poly_line (xcb_connection_t  *c,
   8634                uint8_t            coordinate_mode,
   8635                xcb_drawable_t     drawable,
   8636                xcb_gcontext_t     gc,
   8637                uint32_t           points_len,
   8638                const xcb_point_t *points)
   8639 {
   8640     static const xcb_protocol_request_t xcb_req = {
   8641         .count = 4,
   8642         .ext = 0,
   8643         .opcode = XCB_POLY_LINE,
   8644         .isvoid = 1
   8645     };
   8646 
   8647     struct iovec xcb_parts[6];
   8648     xcb_void_cookie_t xcb_ret;
   8649     xcb_poly_line_request_t xcb_out;
   8650 
   8651     xcb_out.coordinate_mode = coordinate_mode;
   8652     xcb_out.drawable = drawable;
   8653     xcb_out.gc = gc;
   8654 
   8655     xcb_parts[2].iov_base = (char *) &xcb_out;
   8656     xcb_parts[2].iov_len = sizeof(xcb_out);
   8657     xcb_parts[3].iov_base = 0;
   8658     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   8659     /* xcb_point_t points */
   8660     xcb_parts[4].iov_base = (char *) points;
   8661     xcb_parts[4].iov_len = points_len * sizeof(xcb_point_t);
   8662     xcb_parts[5].iov_base = 0;
   8663     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   8664 
   8665     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   8666     return xcb_ret;
   8667 }
   8668 
   8669 xcb_point_t *
   8670 xcb_poly_line_points (const xcb_poly_line_request_t *R)
   8671 {
   8672     return (xcb_point_t *) (R + 1);
   8673 }
   8674 
   8675 int
   8676 xcb_poly_line_points_length (const xcb_poly_line_request_t *R)
   8677 {
   8678     return (((R->length * 4) - sizeof(xcb_poly_line_request_t))/sizeof(xcb_point_t));
   8679 }
   8680 
   8681 xcb_point_iterator_t
   8682 xcb_poly_line_points_iterator (const xcb_poly_line_request_t *R)
   8683 {
   8684     xcb_point_iterator_t i;
   8685     i.data = (xcb_point_t *) (R + 1);
   8686     i.rem = (((R->length * 4) - sizeof(xcb_poly_line_request_t))/sizeof(xcb_point_t));
   8687     i.index = (char *) i.data - (char *) R;
   8688     return i;
   8689 }
   8690 
   8691 void
   8692 xcb_segment_next (xcb_segment_iterator_t *i)
   8693 {
   8694     --i->rem;
   8695     ++i->data;
   8696     i->index += sizeof(xcb_segment_t);
   8697 }
   8698 
   8699 xcb_generic_iterator_t
   8700 xcb_segment_end (xcb_segment_iterator_t i)
   8701 {
   8702     xcb_generic_iterator_t ret;
   8703     ret.data = i.data + i.rem;
   8704     ret.index = i.index + ((char *) ret.data - (char *) i.data);
   8705     ret.rem = 0;
   8706     return ret;
   8707 }
   8708 
   8709 int
   8710 xcb_poly_segment_sizeof (const void  *_buffer,
   8711                          uint32_t     segments_len)
   8712 {
   8713     char *xcb_tmp = (char *)_buffer;
   8714     unsigned int xcb_buffer_len = 0;
   8715     unsigned int xcb_block_len = 0;
   8716     unsigned int xcb_pad = 0;
   8717     unsigned int xcb_align_to = 0;
   8718 
   8719 
   8720     xcb_block_len += sizeof(xcb_poly_segment_request_t);
   8721     xcb_tmp += xcb_block_len;
   8722     xcb_buffer_len += xcb_block_len;
   8723     xcb_block_len = 0;
   8724     /* segments */
   8725     xcb_block_len += segments_len * sizeof(xcb_segment_t);
   8726     xcb_tmp += xcb_block_len;
   8727     xcb_align_to = ALIGNOF(xcb_segment_t);
   8728     /* insert padding */
   8729     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   8730     xcb_buffer_len += xcb_block_len + xcb_pad;
   8731     if (0 != xcb_pad) {
   8732         xcb_tmp += xcb_pad;
   8733         xcb_pad = 0;
   8734     }
   8735     xcb_block_len = 0;
   8736 
   8737     return xcb_buffer_len;
   8738 }
   8739 
   8740 xcb_void_cookie_t
   8741 xcb_poly_segment_checked (xcb_connection_t    *c,
   8742                           xcb_drawable_t       drawable,
   8743                           xcb_gcontext_t       gc,
   8744                           uint32_t             segments_len,
   8745                           const xcb_segment_t *segments)
   8746 {
   8747     static const xcb_protocol_request_t xcb_req = {
   8748         .count = 4,
   8749         .ext = 0,
   8750         .opcode = XCB_POLY_SEGMENT,
   8751         .isvoid = 1
   8752     };
   8753 
   8754     struct iovec xcb_parts[6];
   8755     xcb_void_cookie_t xcb_ret;
   8756     xcb_poly_segment_request_t xcb_out;
   8757 
   8758     xcb_out.pad0 = 0;
   8759     xcb_out.drawable = drawable;
   8760     xcb_out.gc = gc;
   8761 
   8762     xcb_parts[2].iov_base = (char *) &xcb_out;
   8763     xcb_parts[2].iov_len = sizeof(xcb_out);
   8764     xcb_parts[3].iov_base = 0;
   8765     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   8766     /* xcb_segment_t segments */
   8767     xcb_parts[4].iov_base = (char *) segments;
   8768     xcb_parts[4].iov_len = segments_len * sizeof(xcb_segment_t);
   8769     xcb_parts[5].iov_base = 0;
   8770     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   8771 
   8772     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   8773     return xcb_ret;
   8774 }
   8775 
   8776 xcb_void_cookie_t
   8777 xcb_poly_segment (xcb_connection_t    *c,
   8778                   xcb_drawable_t       drawable,
   8779                   xcb_gcontext_t       gc,
   8780                   uint32_t             segments_len,
   8781                   const xcb_segment_t *segments)
   8782 {
   8783     static const xcb_protocol_request_t xcb_req = {
   8784         .count = 4,
   8785         .ext = 0,
   8786         .opcode = XCB_POLY_SEGMENT,
   8787         .isvoid = 1
   8788     };
   8789 
   8790     struct iovec xcb_parts[6];
   8791     xcb_void_cookie_t xcb_ret;
   8792     xcb_poly_segment_request_t xcb_out;
   8793 
   8794     xcb_out.pad0 = 0;
   8795     xcb_out.drawable = drawable;
   8796     xcb_out.gc = gc;
   8797 
   8798     xcb_parts[2].iov_base = (char *) &xcb_out;
   8799     xcb_parts[2].iov_len = sizeof(xcb_out);
   8800     xcb_parts[3].iov_base = 0;
   8801     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   8802     /* xcb_segment_t segments */
   8803     xcb_parts[4].iov_base = (char *) segments;
   8804     xcb_parts[4].iov_len = segments_len * sizeof(xcb_segment_t);
   8805     xcb_parts[5].iov_base = 0;
   8806     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   8807 
   8808     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   8809     return xcb_ret;
   8810 }
   8811 
   8812 xcb_segment_t *
   8813 xcb_poly_segment_segments (const xcb_poly_segment_request_t *R)
   8814 {
   8815     return (xcb_segment_t *) (R + 1);
   8816 }
   8817 
   8818 int
   8819 xcb_poly_segment_segments_length (const xcb_poly_segment_request_t *R)
   8820 {
   8821     return (((R->length * 4) - sizeof(xcb_poly_segment_request_t))/sizeof(xcb_segment_t));
   8822 }
   8823 
   8824 xcb_segment_iterator_t
   8825 xcb_poly_segment_segments_iterator (const xcb_poly_segment_request_t *R)
   8826 {
   8827     xcb_segment_iterator_t i;
   8828     i.data = (xcb_segment_t *) (R + 1);
   8829     i.rem = (((R->length * 4) - sizeof(xcb_poly_segment_request_t))/sizeof(xcb_segment_t));
   8830     i.index = (char *) i.data - (char *) R;
   8831     return i;
   8832 }
   8833 
   8834 int
   8835 xcb_poly_rectangle_sizeof (const void  *_buffer,
   8836                            uint32_t     rectangles_len)
   8837 {
   8838     char *xcb_tmp = (char *)_buffer;
   8839     unsigned int xcb_buffer_len = 0;
   8840     unsigned int xcb_block_len = 0;
   8841     unsigned int xcb_pad = 0;
   8842     unsigned int xcb_align_to = 0;
   8843 
   8844 
   8845     xcb_block_len += sizeof(xcb_poly_rectangle_request_t);
   8846     xcb_tmp += xcb_block_len;
   8847     xcb_buffer_len += xcb_block_len;
   8848     xcb_block_len = 0;
   8849     /* rectangles */
   8850     xcb_block_len += rectangles_len * sizeof(xcb_rectangle_t);
   8851     xcb_tmp += xcb_block_len;
   8852     xcb_align_to = ALIGNOF(xcb_rectangle_t);
   8853     /* insert padding */
   8854     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   8855     xcb_buffer_len += xcb_block_len + xcb_pad;
   8856     if (0 != xcb_pad) {
   8857         xcb_tmp += xcb_pad;
   8858         xcb_pad = 0;
   8859     }
   8860     xcb_block_len = 0;
   8861 
   8862     return xcb_buffer_len;
   8863 }
   8864 
   8865 xcb_void_cookie_t
   8866 xcb_poly_rectangle_checked (xcb_connection_t      *c,
   8867                             xcb_drawable_t         drawable,
   8868                             xcb_gcontext_t         gc,
   8869                             uint32_t               rectangles_len,
   8870                             const xcb_rectangle_t *rectangles)
   8871 {
   8872     static const xcb_protocol_request_t xcb_req = {
   8873         .count = 4,
   8874         .ext = 0,
   8875         .opcode = XCB_POLY_RECTANGLE,
   8876         .isvoid = 1
   8877     };
   8878 
   8879     struct iovec xcb_parts[6];
   8880     xcb_void_cookie_t xcb_ret;
   8881     xcb_poly_rectangle_request_t xcb_out;
   8882 
   8883     xcb_out.pad0 = 0;
   8884     xcb_out.drawable = drawable;
   8885     xcb_out.gc = gc;
   8886 
   8887     xcb_parts[2].iov_base = (char *) &xcb_out;
   8888     xcb_parts[2].iov_len = sizeof(xcb_out);
   8889     xcb_parts[3].iov_base = 0;
   8890     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   8891     /* xcb_rectangle_t rectangles */
   8892     xcb_parts[4].iov_base = (char *) rectangles;
   8893     xcb_parts[4].iov_len = rectangles_len * sizeof(xcb_rectangle_t);
   8894     xcb_parts[5].iov_base = 0;
   8895     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   8896 
   8897     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   8898     return xcb_ret;
   8899 }
   8900 
   8901 xcb_void_cookie_t
   8902 xcb_poly_rectangle (xcb_connection_t      *c,
   8903                     xcb_drawable_t         drawable,
   8904                     xcb_gcontext_t         gc,
   8905                     uint32_t               rectangles_len,
   8906                     const xcb_rectangle_t *rectangles)
   8907 {
   8908     static const xcb_protocol_request_t xcb_req = {
   8909         .count = 4,
   8910         .ext = 0,
   8911         .opcode = XCB_POLY_RECTANGLE,
   8912         .isvoid = 1
   8913     };
   8914 
   8915     struct iovec xcb_parts[6];
   8916     xcb_void_cookie_t xcb_ret;
   8917     xcb_poly_rectangle_request_t xcb_out;
   8918 
   8919     xcb_out.pad0 = 0;
   8920     xcb_out.drawable = drawable;
   8921     xcb_out.gc = gc;
   8922 
   8923     xcb_parts[2].iov_base = (char *) &xcb_out;
   8924     xcb_parts[2].iov_len = sizeof(xcb_out);
   8925     xcb_parts[3].iov_base = 0;
   8926     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   8927     /* xcb_rectangle_t rectangles */
   8928     xcb_parts[4].iov_base = (char *) rectangles;
   8929     xcb_parts[4].iov_len = rectangles_len * sizeof(xcb_rectangle_t);
   8930     xcb_parts[5].iov_base = 0;
   8931     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   8932 
   8933     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   8934     return xcb_ret;
   8935 }
   8936 
   8937 xcb_rectangle_t *
   8938 xcb_poly_rectangle_rectangles (const xcb_poly_rectangle_request_t *R)
   8939 {
   8940     return (xcb_rectangle_t *) (R + 1);
   8941 }
   8942 
   8943 int
   8944 xcb_poly_rectangle_rectangles_length (const xcb_poly_rectangle_request_t *R)
   8945 {
   8946     return (((R->length * 4) - sizeof(xcb_poly_rectangle_request_t))/sizeof(xcb_rectangle_t));
   8947 }
   8948 
   8949 xcb_rectangle_iterator_t
   8950 xcb_poly_rectangle_rectangles_iterator (const xcb_poly_rectangle_request_t *R)
   8951 {
   8952     xcb_rectangle_iterator_t i;
   8953     i.data = (xcb_rectangle_t *) (R + 1);
   8954     i.rem = (((R->length * 4) - sizeof(xcb_poly_rectangle_request_t))/sizeof(xcb_rectangle_t));
   8955     i.index = (char *) i.data - (char *) R;
   8956     return i;
   8957 }
   8958 
   8959 int
   8960 xcb_poly_arc_sizeof (const void  *_buffer,
   8961                      uint32_t     arcs_len)
   8962 {
   8963     char *xcb_tmp = (char *)_buffer;
   8964     unsigned int xcb_buffer_len = 0;
   8965     unsigned int xcb_block_len = 0;
   8966     unsigned int xcb_pad = 0;
   8967     unsigned int xcb_align_to = 0;
   8968 
   8969 
   8970     xcb_block_len += sizeof(xcb_poly_arc_request_t);
   8971     xcb_tmp += xcb_block_len;
   8972     xcb_buffer_len += xcb_block_len;
   8973     xcb_block_len = 0;
   8974     /* arcs */
   8975     xcb_block_len += arcs_len * sizeof(xcb_arc_t);
   8976     xcb_tmp += xcb_block_len;
   8977     xcb_align_to = ALIGNOF(xcb_arc_t);
   8978     /* insert padding */
   8979     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   8980     xcb_buffer_len += xcb_block_len + xcb_pad;
   8981     if (0 != xcb_pad) {
   8982         xcb_tmp += xcb_pad;
   8983         xcb_pad = 0;
   8984     }
   8985     xcb_block_len = 0;
   8986 
   8987     return xcb_buffer_len;
   8988 }
   8989 
   8990 xcb_void_cookie_t
   8991 xcb_poly_arc_checked (xcb_connection_t *c,
   8992                       xcb_drawable_t    drawable,
   8993                       xcb_gcontext_t    gc,
   8994                       uint32_t          arcs_len,
   8995                       const xcb_arc_t  *arcs)
   8996 {
   8997     static const xcb_protocol_request_t xcb_req = {
   8998         .count = 4,
   8999         .ext = 0,
   9000         .opcode = XCB_POLY_ARC,
   9001         .isvoid = 1
   9002     };
   9003 
   9004     struct iovec xcb_parts[6];
   9005     xcb_void_cookie_t xcb_ret;
   9006     xcb_poly_arc_request_t xcb_out;
   9007 
   9008     xcb_out.pad0 = 0;
   9009     xcb_out.drawable = drawable;
   9010     xcb_out.gc = gc;
   9011 
   9012     xcb_parts[2].iov_base = (char *) &xcb_out;
   9013     xcb_parts[2].iov_len = sizeof(xcb_out);
   9014     xcb_parts[3].iov_base = 0;
   9015     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   9016     /* xcb_arc_t arcs */
   9017     xcb_parts[4].iov_base = (char *) arcs;
   9018     xcb_parts[4].iov_len = arcs_len * sizeof(xcb_arc_t);
   9019     xcb_parts[5].iov_base = 0;
   9020     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   9021 
   9022     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   9023     return xcb_ret;
   9024 }
   9025 
   9026 xcb_void_cookie_t
   9027 xcb_poly_arc (xcb_connection_t *c,
   9028               xcb_drawable_t    drawable,
   9029               xcb_gcontext_t    gc,
   9030               uint32_t          arcs_len,
   9031               const xcb_arc_t  *arcs)
   9032 {
   9033     static const xcb_protocol_request_t xcb_req = {
   9034         .count = 4,
   9035         .ext = 0,
   9036         .opcode = XCB_POLY_ARC,
   9037         .isvoid = 1
   9038     };
   9039 
   9040     struct iovec xcb_parts[6];
   9041     xcb_void_cookie_t xcb_ret;
   9042     xcb_poly_arc_request_t xcb_out;
   9043 
   9044     xcb_out.pad0 = 0;
   9045     xcb_out.drawable = drawable;
   9046     xcb_out.gc = gc;
   9047 
   9048     xcb_parts[2].iov_base = (char *) &xcb_out;
   9049     xcb_parts[2].iov_len = sizeof(xcb_out);
   9050     xcb_parts[3].iov_base = 0;
   9051     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   9052     /* xcb_arc_t arcs */
   9053     xcb_parts[4].iov_base = (char *) arcs;
   9054     xcb_parts[4].iov_len = arcs_len * sizeof(xcb_arc_t);
   9055     xcb_parts[5].iov_base = 0;
   9056     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   9057 
   9058     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   9059     return xcb_ret;
   9060 }
   9061 
   9062 xcb_arc_t *
   9063 xcb_poly_arc_arcs (const xcb_poly_arc_request_t *R)
   9064 {
   9065     return (xcb_arc_t *) (R + 1);
   9066 }
   9067 
   9068 int
   9069 xcb_poly_arc_arcs_length (const xcb_poly_arc_request_t *R)
   9070 {
   9071     return (((R->length * 4) - sizeof(xcb_poly_arc_request_t))/sizeof(xcb_arc_t));
   9072 }
   9073 
   9074 xcb_arc_iterator_t
   9075 xcb_poly_arc_arcs_iterator (const xcb_poly_arc_request_t *R)
   9076 {
   9077     xcb_arc_iterator_t i;
   9078     i.data = (xcb_arc_t *) (R + 1);
   9079     i.rem = (((R->length * 4) - sizeof(xcb_poly_arc_request_t))/sizeof(xcb_arc_t));
   9080     i.index = (char *) i.data - (char *) R;
   9081     return i;
   9082 }
   9083 
   9084 int
   9085 xcb_fill_poly_sizeof (const void  *_buffer,
   9086                       uint32_t     points_len)
   9087 {
   9088     char *xcb_tmp = (char *)_buffer;
   9089     unsigned int xcb_buffer_len = 0;
   9090     unsigned int xcb_block_len = 0;
   9091     unsigned int xcb_pad = 0;
   9092     unsigned int xcb_align_to = 0;
   9093 
   9094 
   9095     xcb_block_len += sizeof(xcb_fill_poly_request_t);
   9096     xcb_tmp += xcb_block_len;
   9097     xcb_buffer_len += xcb_block_len;
   9098     xcb_block_len = 0;
   9099     /* points */
   9100     xcb_block_len += points_len * sizeof(xcb_point_t);
   9101     xcb_tmp += xcb_block_len;
   9102     xcb_align_to = ALIGNOF(xcb_point_t);
   9103     /* insert padding */
   9104     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   9105     xcb_buffer_len += xcb_block_len + xcb_pad;
   9106     if (0 != xcb_pad) {
   9107         xcb_tmp += xcb_pad;
   9108         xcb_pad = 0;
   9109     }
   9110     xcb_block_len = 0;
   9111 
   9112     return xcb_buffer_len;
   9113 }
   9114 
   9115 xcb_void_cookie_t
   9116 xcb_fill_poly_checked (xcb_connection_t  *c,
   9117                        xcb_drawable_t     drawable,
   9118                        xcb_gcontext_t     gc,
   9119                        uint8_t            shape,
   9120                        uint8_t            coordinate_mode,
   9121                        uint32_t           points_len,
   9122                        const xcb_point_t *points)
   9123 {
   9124     static const xcb_protocol_request_t xcb_req = {
   9125         .count = 4,
   9126         .ext = 0,
   9127         .opcode = XCB_FILL_POLY,
   9128         .isvoid = 1
   9129     };
   9130 
   9131     struct iovec xcb_parts[6];
   9132     xcb_void_cookie_t xcb_ret;
   9133     xcb_fill_poly_request_t xcb_out;
   9134 
   9135     xcb_out.pad0 = 0;
   9136     xcb_out.drawable = drawable;
   9137     xcb_out.gc = gc;
   9138     xcb_out.shape = shape;
   9139     xcb_out.coordinate_mode = coordinate_mode;
   9140     memset(xcb_out.pad1, 0, 2);
   9141 
   9142     xcb_parts[2].iov_base = (char *) &xcb_out;
   9143     xcb_parts[2].iov_len = sizeof(xcb_out);
   9144     xcb_parts[3].iov_base = 0;
   9145     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   9146     /* xcb_point_t points */
   9147     xcb_parts[4].iov_base = (char *) points;
   9148     xcb_parts[4].iov_len = points_len * sizeof(xcb_point_t);
   9149     xcb_parts[5].iov_base = 0;
   9150     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   9151 
   9152     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   9153     return xcb_ret;
   9154 }
   9155 
   9156 xcb_void_cookie_t
   9157 xcb_fill_poly (xcb_connection_t  *c,
   9158                xcb_drawable_t     drawable,
   9159                xcb_gcontext_t     gc,
   9160                uint8_t            shape,
   9161                uint8_t            coordinate_mode,
   9162                uint32_t           points_len,
   9163                const xcb_point_t *points)
   9164 {
   9165     static const xcb_protocol_request_t xcb_req = {
   9166         .count = 4,
   9167         .ext = 0,
   9168         .opcode = XCB_FILL_POLY,
   9169         .isvoid = 1
   9170     };
   9171 
   9172     struct iovec xcb_parts[6];
   9173     xcb_void_cookie_t xcb_ret;
   9174     xcb_fill_poly_request_t xcb_out;
   9175 
   9176     xcb_out.pad0 = 0;
   9177     xcb_out.drawable = drawable;
   9178     xcb_out.gc = gc;
   9179     xcb_out.shape = shape;
   9180     xcb_out.coordinate_mode = coordinate_mode;
   9181     memset(xcb_out.pad1, 0, 2);
   9182 
   9183     xcb_parts[2].iov_base = (char *) &xcb_out;
   9184     xcb_parts[2].iov_len = sizeof(xcb_out);
   9185     xcb_parts[3].iov_base = 0;
   9186     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   9187     /* xcb_point_t points */
   9188     xcb_parts[4].iov_base = (char *) points;
   9189     xcb_parts[4].iov_len = points_len * sizeof(xcb_point_t);
   9190     xcb_parts[5].iov_base = 0;
   9191     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   9192 
   9193     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   9194     return xcb_ret;
   9195 }
   9196 
   9197 xcb_point_t *
   9198 xcb_fill_poly_points (const xcb_fill_poly_request_t *R)
   9199 {
   9200     return (xcb_point_t *) (R + 1);
   9201 }
   9202 
   9203 int
   9204 xcb_fill_poly_points_length (const xcb_fill_poly_request_t *R)
   9205 {
   9206     return (((R->length * 4) - sizeof(xcb_fill_poly_request_t))/sizeof(xcb_point_t));
   9207 }
   9208 
   9209 xcb_point_iterator_t
   9210 xcb_fill_poly_points_iterator (const xcb_fill_poly_request_t *R)
   9211 {
   9212     xcb_point_iterator_t i;
   9213     i.data = (xcb_point_t *) (R + 1);
   9214     i.rem = (((R->length * 4) - sizeof(xcb_fill_poly_request_t))/sizeof(xcb_point_t));
   9215     i.index = (char *) i.data - (char *) R;
   9216     return i;
   9217 }
   9218 
   9219 int
   9220 xcb_poly_fill_rectangle_sizeof (const void  *_buffer,
   9221                                 uint32_t     rectangles_len)
   9222 {
   9223     char *xcb_tmp = (char *)_buffer;
   9224     unsigned int xcb_buffer_len = 0;
   9225     unsigned int xcb_block_len = 0;
   9226     unsigned int xcb_pad = 0;
   9227     unsigned int xcb_align_to = 0;
   9228 
   9229 
   9230     xcb_block_len += sizeof(xcb_poly_fill_rectangle_request_t);
   9231     xcb_tmp += xcb_block_len;
   9232     xcb_buffer_len += xcb_block_len;
   9233     xcb_block_len = 0;
   9234     /* rectangles */
   9235     xcb_block_len += rectangles_len * sizeof(xcb_rectangle_t);
   9236     xcb_tmp += xcb_block_len;
   9237     xcb_align_to = ALIGNOF(xcb_rectangle_t);
   9238     /* insert padding */
   9239     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   9240     xcb_buffer_len += xcb_block_len + xcb_pad;
   9241     if (0 != xcb_pad) {
   9242         xcb_tmp += xcb_pad;
   9243         xcb_pad = 0;
   9244     }
   9245     xcb_block_len = 0;
   9246 
   9247     return xcb_buffer_len;
   9248 }
   9249 
   9250 xcb_void_cookie_t
   9251 xcb_poly_fill_rectangle_checked (xcb_connection_t      *c,
   9252                                  xcb_drawable_t         drawable,
   9253                                  xcb_gcontext_t         gc,
   9254                                  uint32_t               rectangles_len,
   9255                                  const xcb_rectangle_t *rectangles)
   9256 {
   9257     static const xcb_protocol_request_t xcb_req = {
   9258         .count = 4,
   9259         .ext = 0,
   9260         .opcode = XCB_POLY_FILL_RECTANGLE,
   9261         .isvoid = 1
   9262     };
   9263 
   9264     struct iovec xcb_parts[6];
   9265     xcb_void_cookie_t xcb_ret;
   9266     xcb_poly_fill_rectangle_request_t xcb_out;
   9267 
   9268     xcb_out.pad0 = 0;
   9269     xcb_out.drawable = drawable;
   9270     xcb_out.gc = gc;
   9271 
   9272     xcb_parts[2].iov_base = (char *) &xcb_out;
   9273     xcb_parts[2].iov_len = sizeof(xcb_out);
   9274     xcb_parts[3].iov_base = 0;
   9275     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   9276     /* xcb_rectangle_t rectangles */
   9277     xcb_parts[4].iov_base = (char *) rectangles;
   9278     xcb_parts[4].iov_len = rectangles_len * sizeof(xcb_rectangle_t);
   9279     xcb_parts[5].iov_base = 0;
   9280     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   9281 
   9282     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   9283     return xcb_ret;
   9284 }
   9285 
   9286 xcb_void_cookie_t
   9287 xcb_poly_fill_rectangle (xcb_connection_t      *c,
   9288                          xcb_drawable_t         drawable,
   9289                          xcb_gcontext_t         gc,
   9290                          uint32_t               rectangles_len,
   9291                          const xcb_rectangle_t *rectangles)
   9292 {
   9293     static const xcb_protocol_request_t xcb_req = {
   9294         .count = 4,
   9295         .ext = 0,
   9296         .opcode = XCB_POLY_FILL_RECTANGLE,
   9297         .isvoid = 1
   9298     };
   9299 
   9300     struct iovec xcb_parts[6];
   9301     xcb_void_cookie_t xcb_ret;
   9302     xcb_poly_fill_rectangle_request_t xcb_out;
   9303 
   9304     xcb_out.pad0 = 0;
   9305     xcb_out.drawable = drawable;
   9306     xcb_out.gc = gc;
   9307 
   9308     xcb_parts[2].iov_base = (char *) &xcb_out;
   9309     xcb_parts[2].iov_len = sizeof(xcb_out);
   9310     xcb_parts[3].iov_base = 0;
   9311     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   9312     /* xcb_rectangle_t rectangles */
   9313     xcb_parts[4].iov_base = (char *) rectangles;
   9314     xcb_parts[4].iov_len = rectangles_len * sizeof(xcb_rectangle_t);
   9315     xcb_parts[5].iov_base = 0;
   9316     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   9317 
   9318     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   9319     return xcb_ret;
   9320 }
   9321 
   9322 xcb_rectangle_t *
   9323 xcb_poly_fill_rectangle_rectangles (const xcb_poly_fill_rectangle_request_t *R)
   9324 {
   9325     return (xcb_rectangle_t *) (R + 1);
   9326 }
   9327 
   9328 int
   9329 xcb_poly_fill_rectangle_rectangles_length (const xcb_poly_fill_rectangle_request_t *R)
   9330 {
   9331     return (((R->length * 4) - sizeof(xcb_poly_fill_rectangle_request_t))/sizeof(xcb_rectangle_t));
   9332 }
   9333 
   9334 xcb_rectangle_iterator_t
   9335 xcb_poly_fill_rectangle_rectangles_iterator (const xcb_poly_fill_rectangle_request_t *R)
   9336 {
   9337     xcb_rectangle_iterator_t i;
   9338     i.data = (xcb_rectangle_t *) (R + 1);
   9339     i.rem = (((R->length * 4) - sizeof(xcb_poly_fill_rectangle_request_t))/sizeof(xcb_rectangle_t));
   9340     i.index = (char *) i.data - (char *) R;
   9341     return i;
   9342 }
   9343 
   9344 int
   9345 xcb_poly_fill_arc_sizeof (const void  *_buffer,
   9346                           uint32_t     arcs_len)
   9347 {
   9348     char *xcb_tmp = (char *)_buffer;
   9349     unsigned int xcb_buffer_len = 0;
   9350     unsigned int xcb_block_len = 0;
   9351     unsigned int xcb_pad = 0;
   9352     unsigned int xcb_align_to = 0;
   9353 
   9354 
   9355     xcb_block_len += sizeof(xcb_poly_fill_arc_request_t);
   9356     xcb_tmp += xcb_block_len;
   9357     xcb_buffer_len += xcb_block_len;
   9358     xcb_block_len = 0;
   9359     /* arcs */
   9360     xcb_block_len += arcs_len * sizeof(xcb_arc_t);
   9361     xcb_tmp += xcb_block_len;
   9362     xcb_align_to = ALIGNOF(xcb_arc_t);
   9363     /* insert padding */
   9364     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   9365     xcb_buffer_len += xcb_block_len + xcb_pad;
   9366     if (0 != xcb_pad) {
   9367         xcb_tmp += xcb_pad;
   9368         xcb_pad = 0;
   9369     }
   9370     xcb_block_len = 0;
   9371 
   9372     return xcb_buffer_len;
   9373 }
   9374 
   9375 xcb_void_cookie_t
   9376 xcb_poly_fill_arc_checked (xcb_connection_t *c,
   9377                            xcb_drawable_t    drawable,
   9378                            xcb_gcontext_t    gc,
   9379                            uint32_t          arcs_len,
   9380                            const xcb_arc_t  *arcs)
   9381 {
   9382     static const xcb_protocol_request_t xcb_req = {
   9383         .count = 4,
   9384         .ext = 0,
   9385         .opcode = XCB_POLY_FILL_ARC,
   9386         .isvoid = 1
   9387     };
   9388 
   9389     struct iovec xcb_parts[6];
   9390     xcb_void_cookie_t xcb_ret;
   9391     xcb_poly_fill_arc_request_t xcb_out;
   9392 
   9393     xcb_out.pad0 = 0;
   9394     xcb_out.drawable = drawable;
   9395     xcb_out.gc = gc;
   9396 
   9397     xcb_parts[2].iov_base = (char *) &xcb_out;
   9398     xcb_parts[2].iov_len = sizeof(xcb_out);
   9399     xcb_parts[3].iov_base = 0;
   9400     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   9401     /* xcb_arc_t arcs */
   9402     xcb_parts[4].iov_base = (char *) arcs;
   9403     xcb_parts[4].iov_len = arcs_len * sizeof(xcb_arc_t);
   9404     xcb_parts[5].iov_base = 0;
   9405     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   9406 
   9407     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   9408     return xcb_ret;
   9409 }
   9410 
   9411 xcb_void_cookie_t
   9412 xcb_poly_fill_arc (xcb_connection_t *c,
   9413                    xcb_drawable_t    drawable,
   9414                    xcb_gcontext_t    gc,
   9415                    uint32_t          arcs_len,
   9416                    const xcb_arc_t  *arcs)
   9417 {
   9418     static const xcb_protocol_request_t xcb_req = {
   9419         .count = 4,
   9420         .ext = 0,
   9421         .opcode = XCB_POLY_FILL_ARC,
   9422         .isvoid = 1
   9423     };
   9424 
   9425     struct iovec xcb_parts[6];
   9426     xcb_void_cookie_t xcb_ret;
   9427     xcb_poly_fill_arc_request_t xcb_out;
   9428 
   9429     xcb_out.pad0 = 0;
   9430     xcb_out.drawable = drawable;
   9431     xcb_out.gc = gc;
   9432 
   9433     xcb_parts[2].iov_base = (char *) &xcb_out;
   9434     xcb_parts[2].iov_len = sizeof(xcb_out);
   9435     xcb_parts[3].iov_base = 0;
   9436     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   9437     /* xcb_arc_t arcs */
   9438     xcb_parts[4].iov_base = (char *) arcs;
   9439     xcb_parts[4].iov_len = arcs_len * sizeof(xcb_arc_t);
   9440     xcb_parts[5].iov_base = 0;
   9441     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   9442 
   9443     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   9444     return xcb_ret;
   9445 }
   9446 
   9447 xcb_arc_t *
   9448 xcb_poly_fill_arc_arcs (const xcb_poly_fill_arc_request_t *R)
   9449 {
   9450     return (xcb_arc_t *) (R + 1);
   9451 }
   9452 
   9453 int
   9454 xcb_poly_fill_arc_arcs_length (const xcb_poly_fill_arc_request_t *R)
   9455 {
   9456     return (((R->length * 4) - sizeof(xcb_poly_fill_arc_request_t))/sizeof(xcb_arc_t));
   9457 }
   9458 
   9459 xcb_arc_iterator_t
   9460 xcb_poly_fill_arc_arcs_iterator (const xcb_poly_fill_arc_request_t *R)
   9461 {
   9462     xcb_arc_iterator_t i;
   9463     i.data = (xcb_arc_t *) (R + 1);
   9464     i.rem = (((R->length * 4) - sizeof(xcb_poly_fill_arc_request_t))/sizeof(xcb_arc_t));
   9465     i.index = (char *) i.data - (char *) R;
   9466     return i;
   9467 }
   9468 
   9469 int
   9470 xcb_put_image_sizeof (const void  *_buffer,
   9471                       uint32_t     data_len)
   9472 {
   9473     char *xcb_tmp = (char *)_buffer;
   9474     unsigned int xcb_buffer_len = 0;
   9475     unsigned int xcb_block_len = 0;
   9476     unsigned int xcb_pad = 0;
   9477     unsigned int xcb_align_to = 0;
   9478 
   9479 
   9480     xcb_block_len += sizeof(xcb_put_image_request_t);
   9481     xcb_tmp += xcb_block_len;
   9482     xcb_buffer_len += xcb_block_len;
   9483     xcb_block_len = 0;
   9484     /* data */
   9485     xcb_block_len += data_len * sizeof(uint8_t);
   9486     xcb_tmp += xcb_block_len;
   9487     xcb_align_to = ALIGNOF(uint8_t);
   9488     /* insert padding */
   9489     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   9490     xcb_buffer_len += xcb_block_len + xcb_pad;
   9491     if (0 != xcb_pad) {
   9492         xcb_tmp += xcb_pad;
   9493         xcb_pad = 0;
   9494     }
   9495     xcb_block_len = 0;
   9496 
   9497     return xcb_buffer_len;
   9498 }
   9499 
   9500 xcb_void_cookie_t
   9501 xcb_put_image_checked (xcb_connection_t *c,
   9502                        uint8_t           format,
   9503                        xcb_drawable_t    drawable,
   9504                        xcb_gcontext_t    gc,
   9505                        uint16_t          width,
   9506                        uint16_t          height,
   9507                        int16_t           dst_x,
   9508                        int16_t           dst_y,
   9509                        uint8_t           left_pad,
   9510                        uint8_t           depth,
   9511                        uint32_t          data_len,
   9512                        const uint8_t    *data)
   9513 {
   9514     static const xcb_protocol_request_t xcb_req = {
   9515         .count = 4,
   9516         .ext = 0,
   9517         .opcode = XCB_PUT_IMAGE,
   9518         .isvoid = 1
   9519     };
   9520 
   9521     struct iovec xcb_parts[6];
   9522     xcb_void_cookie_t xcb_ret;
   9523     xcb_put_image_request_t xcb_out;
   9524 
   9525     xcb_out.format = format;
   9526     xcb_out.drawable = drawable;
   9527     xcb_out.gc = gc;
   9528     xcb_out.width = width;
   9529     xcb_out.height = height;
   9530     xcb_out.dst_x = dst_x;
   9531     xcb_out.dst_y = dst_y;
   9532     xcb_out.left_pad = left_pad;
   9533     xcb_out.depth = depth;
   9534     memset(xcb_out.pad0, 0, 2);
   9535 
   9536     xcb_parts[2].iov_base = (char *) &xcb_out;
   9537     xcb_parts[2].iov_len = sizeof(xcb_out);
   9538     xcb_parts[3].iov_base = 0;
   9539     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   9540     /* uint8_t data */
   9541     xcb_parts[4].iov_base = (char *) data;
   9542     xcb_parts[4].iov_len = data_len * sizeof(uint8_t);
   9543     xcb_parts[5].iov_base = 0;
   9544     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   9545 
   9546     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   9547     return xcb_ret;
   9548 }
   9549 
   9550 xcb_void_cookie_t
   9551 xcb_put_image (xcb_connection_t *c,
   9552                uint8_t           format,
   9553                xcb_drawable_t    drawable,
   9554                xcb_gcontext_t    gc,
   9555                uint16_t          width,
   9556                uint16_t          height,
   9557                int16_t           dst_x,
   9558                int16_t           dst_y,
   9559                uint8_t           left_pad,
   9560                uint8_t           depth,
   9561                uint32_t          data_len,
   9562                const uint8_t    *data)
   9563 {
   9564     static const xcb_protocol_request_t xcb_req = {
   9565         .count = 4,
   9566         .ext = 0,
   9567         .opcode = XCB_PUT_IMAGE,
   9568         .isvoid = 1
   9569     };
   9570 
   9571     struct iovec xcb_parts[6];
   9572     xcb_void_cookie_t xcb_ret;
   9573     xcb_put_image_request_t xcb_out;
   9574 
   9575     xcb_out.format = format;
   9576     xcb_out.drawable = drawable;
   9577     xcb_out.gc = gc;
   9578     xcb_out.width = width;
   9579     xcb_out.height = height;
   9580     xcb_out.dst_x = dst_x;
   9581     xcb_out.dst_y = dst_y;
   9582     xcb_out.left_pad = left_pad;
   9583     xcb_out.depth = depth;
   9584     memset(xcb_out.pad0, 0, 2);
   9585 
   9586     xcb_parts[2].iov_base = (char *) &xcb_out;
   9587     xcb_parts[2].iov_len = sizeof(xcb_out);
   9588     xcb_parts[3].iov_base = 0;
   9589     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   9590     /* uint8_t data */
   9591     xcb_parts[4].iov_base = (char *) data;
   9592     xcb_parts[4].iov_len = data_len * sizeof(uint8_t);
   9593     xcb_parts[5].iov_base = 0;
   9594     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   9595 
   9596     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   9597     return xcb_ret;
   9598 }
   9599 
   9600 uint8_t *
   9601 xcb_put_image_data (const xcb_put_image_request_t *R)
   9602 {
   9603     return (uint8_t *) (R + 1);
   9604 }
   9605 
   9606 int
   9607 xcb_put_image_data_length (const xcb_put_image_request_t *R)
   9608 {
   9609     return (((R->length * 4) - sizeof(xcb_put_image_request_t))/sizeof(uint8_t));
   9610 }
   9611 
   9612 xcb_generic_iterator_t
   9613 xcb_put_image_data_end (const xcb_put_image_request_t *R)
   9614 {
   9615     xcb_generic_iterator_t i;
   9616     i.data = ((uint8_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_put_image_request_t))/sizeof(uint8_t)));
   9617     i.rem = 0;
   9618     i.index = (char *) i.data - (char *) R;
   9619     return i;
   9620 }
   9621 
   9622 int
   9623 xcb_get_image_sizeof (const void  *_buffer)
   9624 {
   9625     char *xcb_tmp = (char *)_buffer;
   9626     const xcb_get_image_reply_t *_aux = (xcb_get_image_reply_t *)_buffer;
   9627     unsigned int xcb_buffer_len = 0;
   9628     unsigned int xcb_block_len = 0;
   9629     unsigned int xcb_pad = 0;
   9630     unsigned int xcb_align_to = 0;
   9631 
   9632 
   9633     xcb_block_len += sizeof(xcb_get_image_reply_t);
   9634     xcb_tmp += xcb_block_len;
   9635     xcb_buffer_len += xcb_block_len;
   9636     xcb_block_len = 0;
   9637     /* data */
   9638     xcb_block_len += (_aux->length * 4) * sizeof(uint8_t);
   9639     xcb_tmp += xcb_block_len;
   9640     xcb_align_to = ALIGNOF(uint8_t);
   9641     /* insert padding */
   9642     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   9643     xcb_buffer_len += xcb_block_len + xcb_pad;
   9644     if (0 != xcb_pad) {
   9645         xcb_tmp += xcb_pad;
   9646         xcb_pad = 0;
   9647     }
   9648     xcb_block_len = 0;
   9649 
   9650     return xcb_buffer_len;
   9651 }
   9652 
   9653 xcb_get_image_cookie_t
   9654 xcb_get_image (xcb_connection_t *c,
   9655                uint8_t           format,
   9656                xcb_drawable_t    drawable,
   9657                int16_t           x,
   9658                int16_t           y,
   9659                uint16_t          width,
   9660                uint16_t          height,
   9661                uint32_t          plane_mask)
   9662 {
   9663     static const xcb_protocol_request_t xcb_req = {
   9664         .count = 2,
   9665         .ext = 0,
   9666         .opcode = XCB_GET_IMAGE,
   9667         .isvoid = 0
   9668     };
   9669 
   9670     struct iovec xcb_parts[4];
   9671     xcb_get_image_cookie_t xcb_ret;
   9672     xcb_get_image_request_t xcb_out;
   9673 
   9674     xcb_out.format = format;
   9675     xcb_out.drawable = drawable;
   9676     xcb_out.x = x;
   9677     xcb_out.y = y;
   9678     xcb_out.width = width;
   9679     xcb_out.height = height;
   9680     xcb_out.plane_mask = plane_mask;
   9681 
   9682     xcb_parts[2].iov_base = (char *) &xcb_out;
   9683     xcb_parts[2].iov_len = sizeof(xcb_out);
   9684     xcb_parts[3].iov_base = 0;
   9685     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   9686 
   9687     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   9688     return xcb_ret;
   9689 }
   9690 
   9691 xcb_get_image_cookie_t
   9692 xcb_get_image_unchecked (xcb_connection_t *c,
   9693                          uint8_t           format,
   9694                          xcb_drawable_t    drawable,
   9695                          int16_t           x,
   9696                          int16_t           y,
   9697                          uint16_t          width,
   9698                          uint16_t          height,
   9699                          uint32_t          plane_mask)
   9700 {
   9701     static const xcb_protocol_request_t xcb_req = {
   9702         .count = 2,
   9703         .ext = 0,
   9704         .opcode = XCB_GET_IMAGE,
   9705         .isvoid = 0
   9706     };
   9707 
   9708     struct iovec xcb_parts[4];
   9709     xcb_get_image_cookie_t xcb_ret;
   9710     xcb_get_image_request_t xcb_out;
   9711 
   9712     xcb_out.format = format;
   9713     xcb_out.drawable = drawable;
   9714     xcb_out.x = x;
   9715     xcb_out.y = y;
   9716     xcb_out.width = width;
   9717     xcb_out.height = height;
   9718     xcb_out.plane_mask = plane_mask;
   9719 
   9720     xcb_parts[2].iov_base = (char *) &xcb_out;
   9721     xcb_parts[2].iov_len = sizeof(xcb_out);
   9722     xcb_parts[3].iov_base = 0;
   9723     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   9724 
   9725     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   9726     return xcb_ret;
   9727 }
   9728 
   9729 uint8_t *
   9730 xcb_get_image_data (const xcb_get_image_reply_t *R)
   9731 {
   9732     return (uint8_t *) (R + 1);
   9733 }
   9734 
   9735 int
   9736 xcb_get_image_data_length (const xcb_get_image_reply_t *R)
   9737 {
   9738     return (R->length * 4);
   9739 }
   9740 
   9741 xcb_generic_iterator_t
   9742 xcb_get_image_data_end (const xcb_get_image_reply_t *R)
   9743 {
   9744     xcb_generic_iterator_t i;
   9745     i.data = ((uint8_t *) (R + 1)) + ((R->length * 4));
   9746     i.rem = 0;
   9747     i.index = (char *) i.data - (char *) R;
   9748     return i;
   9749 }
   9750 
   9751 xcb_get_image_reply_t *
   9752 xcb_get_image_reply (xcb_connection_t        *c,
   9753                      xcb_get_image_cookie_t   cookie  /**< */,
   9754                      xcb_generic_error_t    **e)
   9755 {
   9756     return (xcb_get_image_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   9757 }
   9758 
   9759 int
   9760 xcb_poly_text_8_sizeof (const void  *_buffer,
   9761                         uint32_t     items_len)
   9762 {
   9763     char *xcb_tmp = (char *)_buffer;
   9764     unsigned int xcb_buffer_len = 0;
   9765     unsigned int xcb_block_len = 0;
   9766     unsigned int xcb_pad = 0;
   9767     unsigned int xcb_align_to = 0;
   9768 
   9769 
   9770     xcb_block_len += sizeof(xcb_poly_text_8_request_t);
   9771     xcb_tmp += xcb_block_len;
   9772     xcb_buffer_len += xcb_block_len;
   9773     xcb_block_len = 0;
   9774     /* items */
   9775     xcb_block_len += items_len * sizeof(uint8_t);
   9776     xcb_tmp += xcb_block_len;
   9777     xcb_align_to = ALIGNOF(uint8_t);
   9778     /* insert padding */
   9779     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   9780     xcb_buffer_len += xcb_block_len + xcb_pad;
   9781     if (0 != xcb_pad) {
   9782         xcb_tmp += xcb_pad;
   9783         xcb_pad = 0;
   9784     }
   9785     xcb_block_len = 0;
   9786 
   9787     return xcb_buffer_len;
   9788 }
   9789 
   9790 xcb_void_cookie_t
   9791 xcb_poly_text_8_checked (xcb_connection_t *c,
   9792                          xcb_drawable_t    drawable,
   9793                          xcb_gcontext_t    gc,
   9794                          int16_t           x,
   9795                          int16_t           y,
   9796                          uint32_t          items_len,
   9797                          const uint8_t    *items)
   9798 {
   9799     static const xcb_protocol_request_t xcb_req = {
   9800         .count = 4,
   9801         .ext = 0,
   9802         .opcode = XCB_POLY_TEXT_8,
   9803         .isvoid = 1
   9804     };
   9805 
   9806     struct iovec xcb_parts[6];
   9807     xcb_void_cookie_t xcb_ret;
   9808     xcb_poly_text_8_request_t xcb_out;
   9809 
   9810     xcb_out.pad0 = 0;
   9811     xcb_out.drawable = drawable;
   9812     xcb_out.gc = gc;
   9813     xcb_out.x = x;
   9814     xcb_out.y = y;
   9815 
   9816     xcb_parts[2].iov_base = (char *) &xcb_out;
   9817     xcb_parts[2].iov_len = sizeof(xcb_out);
   9818     xcb_parts[3].iov_base = 0;
   9819     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   9820     /* uint8_t items */
   9821     xcb_parts[4].iov_base = (char *) items;
   9822     xcb_parts[4].iov_len = items_len * sizeof(uint8_t);
   9823     xcb_parts[5].iov_base = 0;
   9824     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   9825 
   9826     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   9827     return xcb_ret;
   9828 }
   9829 
   9830 xcb_void_cookie_t
   9831 xcb_poly_text_8 (xcb_connection_t *c,
   9832                  xcb_drawable_t    drawable,
   9833                  xcb_gcontext_t    gc,
   9834                  int16_t           x,
   9835                  int16_t           y,
   9836                  uint32_t          items_len,
   9837                  const uint8_t    *items)
   9838 {
   9839     static const xcb_protocol_request_t xcb_req = {
   9840         .count = 4,
   9841         .ext = 0,
   9842         .opcode = XCB_POLY_TEXT_8,
   9843         .isvoid = 1
   9844     };
   9845 
   9846     struct iovec xcb_parts[6];
   9847     xcb_void_cookie_t xcb_ret;
   9848     xcb_poly_text_8_request_t xcb_out;
   9849 
   9850     xcb_out.pad0 = 0;
   9851     xcb_out.drawable = drawable;
   9852     xcb_out.gc = gc;
   9853     xcb_out.x = x;
   9854     xcb_out.y = y;
   9855 
   9856     xcb_parts[2].iov_base = (char *) &xcb_out;
   9857     xcb_parts[2].iov_len = sizeof(xcb_out);
   9858     xcb_parts[3].iov_base = 0;
   9859     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   9860     /* uint8_t items */
   9861     xcb_parts[4].iov_base = (char *) items;
   9862     xcb_parts[4].iov_len = items_len * sizeof(uint8_t);
   9863     xcb_parts[5].iov_base = 0;
   9864     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   9865 
   9866     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   9867     return xcb_ret;
   9868 }
   9869 
   9870 uint8_t *
   9871 xcb_poly_text_8_items (const xcb_poly_text_8_request_t *R)
   9872 {
   9873     return (uint8_t *) (R + 1);
   9874 }
   9875 
   9876 int
   9877 xcb_poly_text_8_items_length (const xcb_poly_text_8_request_t *R)
   9878 {
   9879     return (((R->length * 4) - sizeof(xcb_poly_text_8_request_t))/sizeof(uint8_t));
   9880 }
   9881 
   9882 xcb_generic_iterator_t
   9883 xcb_poly_text_8_items_end (const xcb_poly_text_8_request_t *R)
   9884 {
   9885     xcb_generic_iterator_t i;
   9886     i.data = ((uint8_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_poly_text_8_request_t))/sizeof(uint8_t)));
   9887     i.rem = 0;
   9888     i.index = (char *) i.data - (char *) R;
   9889     return i;
   9890 }
   9891 
   9892 int
   9893 xcb_poly_text_16_sizeof (const void  *_buffer,
   9894                          uint32_t     items_len)
   9895 {
   9896     char *xcb_tmp = (char *)_buffer;
   9897     unsigned int xcb_buffer_len = 0;
   9898     unsigned int xcb_block_len = 0;
   9899     unsigned int xcb_pad = 0;
   9900     unsigned int xcb_align_to = 0;
   9901 
   9902 
   9903     xcb_block_len += sizeof(xcb_poly_text_16_request_t);
   9904     xcb_tmp += xcb_block_len;
   9905     xcb_buffer_len += xcb_block_len;
   9906     xcb_block_len = 0;
   9907     /* items */
   9908     xcb_block_len += items_len * sizeof(uint8_t);
   9909     xcb_tmp += xcb_block_len;
   9910     xcb_align_to = ALIGNOF(uint8_t);
   9911     /* insert padding */
   9912     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   9913     xcb_buffer_len += xcb_block_len + xcb_pad;
   9914     if (0 != xcb_pad) {
   9915         xcb_tmp += xcb_pad;
   9916         xcb_pad = 0;
   9917     }
   9918     xcb_block_len = 0;
   9919 
   9920     return xcb_buffer_len;
   9921 }
   9922 
   9923 xcb_void_cookie_t
   9924 xcb_poly_text_16_checked (xcb_connection_t *c,
   9925                           xcb_drawable_t    drawable,
   9926                           xcb_gcontext_t    gc,
   9927                           int16_t           x,
   9928                           int16_t           y,
   9929                           uint32_t          items_len,
   9930                           const uint8_t    *items)
   9931 {
   9932     static const xcb_protocol_request_t xcb_req = {
   9933         .count = 4,
   9934         .ext = 0,
   9935         .opcode = XCB_POLY_TEXT_16,
   9936         .isvoid = 1
   9937     };
   9938 
   9939     struct iovec xcb_parts[6];
   9940     xcb_void_cookie_t xcb_ret;
   9941     xcb_poly_text_16_request_t xcb_out;
   9942 
   9943     xcb_out.pad0 = 0;
   9944     xcb_out.drawable = drawable;
   9945     xcb_out.gc = gc;
   9946     xcb_out.x = x;
   9947     xcb_out.y = y;
   9948 
   9949     xcb_parts[2].iov_base = (char *) &xcb_out;
   9950     xcb_parts[2].iov_len = sizeof(xcb_out);
   9951     xcb_parts[3].iov_base = 0;
   9952     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   9953     /* uint8_t items */
   9954     xcb_parts[4].iov_base = (char *) items;
   9955     xcb_parts[4].iov_len = items_len * sizeof(uint8_t);
   9956     xcb_parts[5].iov_base = 0;
   9957     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   9958 
   9959     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   9960     return xcb_ret;
   9961 }
   9962 
   9963 xcb_void_cookie_t
   9964 xcb_poly_text_16 (xcb_connection_t *c,
   9965                   xcb_drawable_t    drawable,
   9966                   xcb_gcontext_t    gc,
   9967                   int16_t           x,
   9968                   int16_t           y,
   9969                   uint32_t          items_len,
   9970                   const uint8_t    *items)
   9971 {
   9972     static const xcb_protocol_request_t xcb_req = {
   9973         .count = 4,
   9974         .ext = 0,
   9975         .opcode = XCB_POLY_TEXT_16,
   9976         .isvoid = 1
   9977     };
   9978 
   9979     struct iovec xcb_parts[6];
   9980     xcb_void_cookie_t xcb_ret;
   9981     xcb_poly_text_16_request_t xcb_out;
   9982 
   9983     xcb_out.pad0 = 0;
   9984     xcb_out.drawable = drawable;
   9985     xcb_out.gc = gc;
   9986     xcb_out.x = x;
   9987     xcb_out.y = y;
   9988 
   9989     xcb_parts[2].iov_base = (char *) &xcb_out;
   9990     xcb_parts[2].iov_len = sizeof(xcb_out);
   9991     xcb_parts[3].iov_base = 0;
   9992     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   9993     /* uint8_t items */
   9994     xcb_parts[4].iov_base = (char *) items;
   9995     xcb_parts[4].iov_len = items_len * sizeof(uint8_t);
   9996     xcb_parts[5].iov_base = 0;
   9997     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   9998 
   9999     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   10000     return xcb_ret;
   10001 }
   10002 
   10003 uint8_t *
   10004 xcb_poly_text_16_items (const xcb_poly_text_16_request_t *R)
   10005 {
   10006     return (uint8_t *) (R + 1);
   10007 }
   10008 
   10009 int
   10010 xcb_poly_text_16_items_length (const xcb_poly_text_16_request_t *R)
   10011 {
   10012     return (((R->length * 4) - sizeof(xcb_poly_text_16_request_t))/sizeof(uint8_t));
   10013 }
   10014 
   10015 xcb_generic_iterator_t
   10016 xcb_poly_text_16_items_end (const xcb_poly_text_16_request_t *R)
   10017 {
   10018     xcb_generic_iterator_t i;
   10019     i.data = ((uint8_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_poly_text_16_request_t))/sizeof(uint8_t)));
   10020     i.rem = 0;
   10021     i.index = (char *) i.data - (char *) R;
   10022     return i;
   10023 }
   10024 
   10025 int
   10026 xcb_image_text_8_sizeof (const void  *_buffer)
   10027 {
   10028     char *xcb_tmp = (char *)_buffer;
   10029     const xcb_image_text_8_request_t *_aux = (xcb_image_text_8_request_t *)_buffer;
   10030     unsigned int xcb_buffer_len = 0;
   10031     unsigned int xcb_block_len = 0;
   10032     unsigned int xcb_pad = 0;
   10033     unsigned int xcb_align_to = 0;
   10034 
   10035 
   10036     xcb_block_len += sizeof(xcb_image_text_8_request_t);
   10037     xcb_tmp += xcb_block_len;
   10038     xcb_buffer_len += xcb_block_len;
   10039     xcb_block_len = 0;
   10040     /* string */
   10041     xcb_block_len += _aux->string_len * sizeof(char);
   10042     xcb_tmp += xcb_block_len;
   10043     xcb_align_to = ALIGNOF(char);
   10044     /* insert padding */
   10045     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   10046     xcb_buffer_len += xcb_block_len + xcb_pad;
   10047     if (0 != xcb_pad) {
   10048         xcb_tmp += xcb_pad;
   10049         xcb_pad = 0;
   10050     }
   10051     xcb_block_len = 0;
   10052 
   10053     return xcb_buffer_len;
   10054 }
   10055 
   10056 xcb_void_cookie_t
   10057 xcb_image_text_8_checked (xcb_connection_t *c,
   10058                           uint8_t           string_len,
   10059                           xcb_drawable_t    drawable,
   10060                           xcb_gcontext_t    gc,
   10061                           int16_t           x,
   10062                           int16_t           y,
   10063                           const char       *string)
   10064 {
   10065     static const xcb_protocol_request_t xcb_req = {
   10066         .count = 4,
   10067         .ext = 0,
   10068         .opcode = XCB_IMAGE_TEXT_8,
   10069         .isvoid = 1
   10070     };
   10071 
   10072     struct iovec xcb_parts[6];
   10073     xcb_void_cookie_t xcb_ret;
   10074     xcb_image_text_8_request_t xcb_out;
   10075 
   10076     xcb_out.string_len = string_len;
   10077     xcb_out.drawable = drawable;
   10078     xcb_out.gc = gc;
   10079     xcb_out.x = x;
   10080     xcb_out.y = y;
   10081 
   10082     xcb_parts[2].iov_base = (char *) &xcb_out;
   10083     xcb_parts[2].iov_len = sizeof(xcb_out);
   10084     xcb_parts[3].iov_base = 0;
   10085     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   10086     /* char string */
   10087     xcb_parts[4].iov_base = (char *) string;
   10088     xcb_parts[4].iov_len = string_len * sizeof(char);
   10089     xcb_parts[5].iov_base = 0;
   10090     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   10091 
   10092     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   10093     return xcb_ret;
   10094 }
   10095 
   10096 xcb_void_cookie_t
   10097 xcb_image_text_8 (xcb_connection_t *c,
   10098                   uint8_t           string_len,
   10099                   xcb_drawable_t    drawable,
   10100                   xcb_gcontext_t    gc,
   10101                   int16_t           x,
   10102                   int16_t           y,
   10103                   const char       *string)
   10104 {
   10105     static const xcb_protocol_request_t xcb_req = {
   10106         .count = 4,
   10107         .ext = 0,
   10108         .opcode = XCB_IMAGE_TEXT_8,
   10109         .isvoid = 1
   10110     };
   10111 
   10112     struct iovec xcb_parts[6];
   10113     xcb_void_cookie_t xcb_ret;
   10114     xcb_image_text_8_request_t xcb_out;
   10115 
   10116     xcb_out.string_len = string_len;
   10117     xcb_out.drawable = drawable;
   10118     xcb_out.gc = gc;
   10119     xcb_out.x = x;
   10120     xcb_out.y = y;
   10121 
   10122     xcb_parts[2].iov_base = (char *) &xcb_out;
   10123     xcb_parts[2].iov_len = sizeof(xcb_out);
   10124     xcb_parts[3].iov_base = 0;
   10125     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   10126     /* char string */
   10127     xcb_parts[4].iov_base = (char *) string;
   10128     xcb_parts[4].iov_len = string_len * sizeof(char);
   10129     xcb_parts[5].iov_base = 0;
   10130     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   10131 
   10132     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   10133     return xcb_ret;
   10134 }
   10135 
   10136 char *
   10137 xcb_image_text_8_string (const xcb_image_text_8_request_t *R)
   10138 {
   10139     return (char *) (R + 1);
   10140 }
   10141 
   10142 int
   10143 xcb_image_text_8_string_length (const xcb_image_text_8_request_t *R)
   10144 {
   10145     return R->string_len;
   10146 }
   10147 
   10148 xcb_generic_iterator_t
   10149 xcb_image_text_8_string_end (const xcb_image_text_8_request_t *R)
   10150 {
   10151     xcb_generic_iterator_t i;
   10152     i.data = ((char *) (R + 1)) + (R->string_len);
   10153     i.rem = 0;
   10154     i.index = (char *) i.data - (char *) R;
   10155     return i;
   10156 }
   10157 
   10158 int
   10159 xcb_image_text_16_sizeof (const void  *_buffer)
   10160 {
   10161     char *xcb_tmp = (char *)_buffer;
   10162     const xcb_image_text_16_request_t *_aux = (xcb_image_text_16_request_t *)_buffer;
   10163     unsigned int xcb_buffer_len = 0;
   10164     unsigned int xcb_block_len = 0;
   10165     unsigned int xcb_pad = 0;
   10166     unsigned int xcb_align_to = 0;
   10167 
   10168 
   10169     xcb_block_len += sizeof(xcb_image_text_16_request_t);
   10170     xcb_tmp += xcb_block_len;
   10171     xcb_buffer_len += xcb_block_len;
   10172     xcb_block_len = 0;
   10173     /* string */
   10174     xcb_block_len += _aux->string_len * sizeof(xcb_char2b_t);
   10175     xcb_tmp += xcb_block_len;
   10176     xcb_align_to = ALIGNOF(xcb_char2b_t);
   10177     /* insert padding */
   10178     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   10179     xcb_buffer_len += xcb_block_len + xcb_pad;
   10180     if (0 != xcb_pad) {
   10181         xcb_tmp += xcb_pad;
   10182         xcb_pad = 0;
   10183     }
   10184     xcb_block_len = 0;
   10185 
   10186     return xcb_buffer_len;
   10187 }
   10188 
   10189 xcb_void_cookie_t
   10190 xcb_image_text_16_checked (xcb_connection_t   *c,
   10191                            uint8_t             string_len,
   10192                            xcb_drawable_t      drawable,
   10193                            xcb_gcontext_t      gc,
   10194                            int16_t             x,
   10195                            int16_t             y,
   10196                            const xcb_char2b_t *string)
   10197 {
   10198     static const xcb_protocol_request_t xcb_req = {
   10199         .count = 4,
   10200         .ext = 0,
   10201         .opcode = XCB_IMAGE_TEXT_16,
   10202         .isvoid = 1
   10203     };
   10204 
   10205     struct iovec xcb_parts[6];
   10206     xcb_void_cookie_t xcb_ret;
   10207     xcb_image_text_16_request_t xcb_out;
   10208 
   10209     xcb_out.string_len = string_len;
   10210     xcb_out.drawable = drawable;
   10211     xcb_out.gc = gc;
   10212     xcb_out.x = x;
   10213     xcb_out.y = y;
   10214 
   10215     xcb_parts[2].iov_base = (char *) &xcb_out;
   10216     xcb_parts[2].iov_len = sizeof(xcb_out);
   10217     xcb_parts[3].iov_base = 0;
   10218     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   10219     /* xcb_char2b_t string */
   10220     xcb_parts[4].iov_base = (char *) string;
   10221     xcb_parts[4].iov_len = string_len * sizeof(xcb_char2b_t);
   10222     xcb_parts[5].iov_base = 0;
   10223     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   10224 
   10225     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   10226     return xcb_ret;
   10227 }
   10228 
   10229 xcb_void_cookie_t
   10230 xcb_image_text_16 (xcb_connection_t   *c,
   10231                    uint8_t             string_len,
   10232                    xcb_drawable_t      drawable,
   10233                    xcb_gcontext_t      gc,
   10234                    int16_t             x,
   10235                    int16_t             y,
   10236                    const xcb_char2b_t *string)
   10237 {
   10238     static const xcb_protocol_request_t xcb_req = {
   10239         .count = 4,
   10240         .ext = 0,
   10241         .opcode = XCB_IMAGE_TEXT_16,
   10242         .isvoid = 1
   10243     };
   10244 
   10245     struct iovec xcb_parts[6];
   10246     xcb_void_cookie_t xcb_ret;
   10247     xcb_image_text_16_request_t xcb_out;
   10248 
   10249     xcb_out.string_len = string_len;
   10250     xcb_out.drawable = drawable;
   10251     xcb_out.gc = gc;
   10252     xcb_out.x = x;
   10253     xcb_out.y = y;
   10254 
   10255     xcb_parts[2].iov_base = (char *) &xcb_out;
   10256     xcb_parts[2].iov_len = sizeof(xcb_out);
   10257     xcb_parts[3].iov_base = 0;
   10258     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   10259     /* xcb_char2b_t string */
   10260     xcb_parts[4].iov_base = (char *) string;
   10261     xcb_parts[4].iov_len = string_len * sizeof(xcb_char2b_t);
   10262     xcb_parts[5].iov_base = 0;
   10263     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   10264 
   10265     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   10266     return xcb_ret;
   10267 }
   10268 
   10269 xcb_char2b_t *
   10270 xcb_image_text_16_string (const xcb_image_text_16_request_t *R)
   10271 {
   10272     return (xcb_char2b_t *) (R + 1);
   10273 }
   10274 
   10275 int
   10276 xcb_image_text_16_string_length (const xcb_image_text_16_request_t *R)
   10277 {
   10278     return R->string_len;
   10279 }
   10280 
   10281 xcb_char2b_iterator_t
   10282 xcb_image_text_16_string_iterator (const xcb_image_text_16_request_t *R)
   10283 {
   10284     xcb_char2b_iterator_t i;
   10285     i.data = (xcb_char2b_t *) (R + 1);
   10286     i.rem = R->string_len;
   10287     i.index = (char *) i.data - (char *) R;
   10288     return i;
   10289 }
   10290 
   10291 xcb_void_cookie_t
   10292 xcb_create_colormap_checked (xcb_connection_t *c,
   10293                              uint8_t           alloc,
   10294                              xcb_colormap_t    mid,
   10295                              xcb_window_t      window,
   10296                              xcb_visualid_t    visual)
   10297 {
   10298     static const xcb_protocol_request_t xcb_req = {
   10299         .count = 2,
   10300         .ext = 0,
   10301         .opcode = XCB_CREATE_COLORMAP,
   10302         .isvoid = 1
   10303     };
   10304 
   10305     struct iovec xcb_parts[4];
   10306     xcb_void_cookie_t xcb_ret;
   10307     xcb_create_colormap_request_t xcb_out;
   10308 
   10309     xcb_out.alloc = alloc;
   10310     xcb_out.mid = mid;
   10311     xcb_out.window = window;
   10312     xcb_out.visual = visual;
   10313 
   10314     xcb_parts[2].iov_base = (char *) &xcb_out;
   10315     xcb_parts[2].iov_len = sizeof(xcb_out);
   10316     xcb_parts[3].iov_base = 0;
   10317     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   10318 
   10319     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   10320     return xcb_ret;
   10321 }
   10322 
   10323 xcb_void_cookie_t
   10324 xcb_create_colormap (xcb_connection_t *c,
   10325                      uint8_t           alloc,
   10326                      xcb_colormap_t    mid,
   10327                      xcb_window_t      window,
   10328                      xcb_visualid_t    visual)
   10329 {
   10330     static const xcb_protocol_request_t xcb_req = {
   10331         .count = 2,
   10332         .ext = 0,
   10333         .opcode = XCB_CREATE_COLORMAP,
   10334         .isvoid = 1
   10335     };
   10336 
   10337     struct iovec xcb_parts[4];
   10338     xcb_void_cookie_t xcb_ret;
   10339     xcb_create_colormap_request_t xcb_out;
   10340 
   10341     xcb_out.alloc = alloc;
   10342     xcb_out.mid = mid;
   10343     xcb_out.window = window;
   10344     xcb_out.visual = visual;
   10345 
   10346     xcb_parts[2].iov_base = (char *) &xcb_out;
   10347     xcb_parts[2].iov_len = sizeof(xcb_out);
   10348     xcb_parts[3].iov_base = 0;
   10349     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   10350 
   10351     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   10352     return xcb_ret;
   10353 }
   10354 
   10355 xcb_void_cookie_t
   10356 xcb_free_colormap_checked (xcb_connection_t *c,
   10357                            xcb_colormap_t    cmap)
   10358 {
   10359     static const xcb_protocol_request_t xcb_req = {
   10360         .count = 2,
   10361         .ext = 0,
   10362         .opcode = XCB_FREE_COLORMAP,
   10363         .isvoid = 1
   10364     };
   10365 
   10366     struct iovec xcb_parts[4];
   10367     xcb_void_cookie_t xcb_ret;
   10368     xcb_free_colormap_request_t xcb_out;
   10369 
   10370     xcb_out.pad0 = 0;
   10371     xcb_out.cmap = cmap;
   10372 
   10373     xcb_parts[2].iov_base = (char *) &xcb_out;
   10374     xcb_parts[2].iov_len = sizeof(xcb_out);
   10375     xcb_parts[3].iov_base = 0;
   10376     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   10377 
   10378     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   10379     return xcb_ret;
   10380 }
   10381 
   10382 xcb_void_cookie_t
   10383 xcb_free_colormap (xcb_connection_t *c,
   10384                    xcb_colormap_t    cmap)
   10385 {
   10386     static const xcb_protocol_request_t xcb_req = {
   10387         .count = 2,
   10388         .ext = 0,
   10389         .opcode = XCB_FREE_COLORMAP,
   10390         .isvoid = 1
   10391     };
   10392 
   10393     struct iovec xcb_parts[4];
   10394     xcb_void_cookie_t xcb_ret;
   10395     xcb_free_colormap_request_t xcb_out;
   10396 
   10397     xcb_out.pad0 = 0;
   10398     xcb_out.cmap = cmap;
   10399 
   10400     xcb_parts[2].iov_base = (char *) &xcb_out;
   10401     xcb_parts[2].iov_len = sizeof(xcb_out);
   10402     xcb_parts[3].iov_base = 0;
   10403     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   10404 
   10405     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   10406     return xcb_ret;
   10407 }
   10408 
   10409 xcb_void_cookie_t
   10410 xcb_copy_colormap_and_free_checked (xcb_connection_t *c,
   10411                                     xcb_colormap_t    mid,
   10412                                     xcb_colormap_t    src_cmap)
   10413 {
   10414     static const xcb_protocol_request_t xcb_req = {
   10415         .count = 2,
   10416         .ext = 0,
   10417         .opcode = XCB_COPY_COLORMAP_AND_FREE,
   10418         .isvoid = 1
   10419     };
   10420 
   10421     struct iovec xcb_parts[4];
   10422     xcb_void_cookie_t xcb_ret;
   10423     xcb_copy_colormap_and_free_request_t xcb_out;
   10424 
   10425     xcb_out.pad0 = 0;
   10426     xcb_out.mid = mid;
   10427     xcb_out.src_cmap = src_cmap;
   10428 
   10429     xcb_parts[2].iov_base = (char *) &xcb_out;
   10430     xcb_parts[2].iov_len = sizeof(xcb_out);
   10431     xcb_parts[3].iov_base = 0;
   10432     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   10433 
   10434     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   10435     return xcb_ret;
   10436 }
   10437 
   10438 xcb_void_cookie_t
   10439 xcb_copy_colormap_and_free (xcb_connection_t *c,
   10440                             xcb_colormap_t    mid,
   10441                             xcb_colormap_t    src_cmap)
   10442 {
   10443     static const xcb_protocol_request_t xcb_req = {
   10444         .count = 2,
   10445         .ext = 0,
   10446         .opcode = XCB_COPY_COLORMAP_AND_FREE,
   10447         .isvoid = 1
   10448     };
   10449 
   10450     struct iovec xcb_parts[4];
   10451     xcb_void_cookie_t xcb_ret;
   10452     xcb_copy_colormap_and_free_request_t xcb_out;
   10453 
   10454     xcb_out.pad0 = 0;
   10455     xcb_out.mid = mid;
   10456     xcb_out.src_cmap = src_cmap;
   10457 
   10458     xcb_parts[2].iov_base = (char *) &xcb_out;
   10459     xcb_parts[2].iov_len = sizeof(xcb_out);
   10460     xcb_parts[3].iov_base = 0;
   10461     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   10462 
   10463     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   10464     return xcb_ret;
   10465 }
   10466 
   10467 xcb_void_cookie_t
   10468 xcb_install_colormap_checked (xcb_connection_t *c,
   10469                               xcb_colormap_t    cmap)
   10470 {
   10471     static const xcb_protocol_request_t xcb_req = {
   10472         .count = 2,
   10473         .ext = 0,
   10474         .opcode = XCB_INSTALL_COLORMAP,
   10475         .isvoid = 1
   10476     };
   10477 
   10478     struct iovec xcb_parts[4];
   10479     xcb_void_cookie_t xcb_ret;
   10480     xcb_install_colormap_request_t xcb_out;
   10481 
   10482     xcb_out.pad0 = 0;
   10483     xcb_out.cmap = cmap;
   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_void_cookie_t
   10495 xcb_install_colormap (xcb_connection_t *c,
   10496                       xcb_colormap_t    cmap)
   10497 {
   10498     static const xcb_protocol_request_t xcb_req = {
   10499         .count = 2,
   10500         .ext = 0,
   10501         .opcode = XCB_INSTALL_COLORMAP,
   10502         .isvoid = 1
   10503     };
   10504 
   10505     struct iovec xcb_parts[4];
   10506     xcb_void_cookie_t xcb_ret;
   10507     xcb_install_colormap_request_t xcb_out;
   10508 
   10509     xcb_out.pad0 = 0;
   10510     xcb_out.cmap = cmap;
   10511 
   10512     xcb_parts[2].iov_base = (char *) &xcb_out;
   10513     xcb_parts[2].iov_len = sizeof(xcb_out);
   10514     xcb_parts[3].iov_base = 0;
   10515     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   10516 
   10517     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   10518     return xcb_ret;
   10519 }
   10520 
   10521 xcb_void_cookie_t
   10522 xcb_uninstall_colormap_checked (xcb_connection_t *c,
   10523                                 xcb_colormap_t    cmap)
   10524 {
   10525     static const xcb_protocol_request_t xcb_req = {
   10526         .count = 2,
   10527         .ext = 0,
   10528         .opcode = XCB_UNINSTALL_COLORMAP,
   10529         .isvoid = 1
   10530     };
   10531 
   10532     struct iovec xcb_parts[4];
   10533     xcb_void_cookie_t xcb_ret;
   10534     xcb_uninstall_colormap_request_t xcb_out;
   10535 
   10536     xcb_out.pad0 = 0;
   10537     xcb_out.cmap = cmap;
   10538 
   10539     xcb_parts[2].iov_base = (char *) &xcb_out;
   10540     xcb_parts[2].iov_len = sizeof(xcb_out);
   10541     xcb_parts[3].iov_base = 0;
   10542     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   10543 
   10544     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   10545     return xcb_ret;
   10546 }
   10547 
   10548 xcb_void_cookie_t
   10549 xcb_uninstall_colormap (xcb_connection_t *c,
   10550                         xcb_colormap_t    cmap)
   10551 {
   10552     static const xcb_protocol_request_t xcb_req = {
   10553         .count = 2,
   10554         .ext = 0,
   10555         .opcode = XCB_UNINSTALL_COLORMAP,
   10556         .isvoid = 1
   10557     };
   10558 
   10559     struct iovec xcb_parts[4];
   10560     xcb_void_cookie_t xcb_ret;
   10561     xcb_uninstall_colormap_request_t xcb_out;
   10562 
   10563     xcb_out.pad0 = 0;
   10564     xcb_out.cmap = cmap;
   10565 
   10566     xcb_parts[2].iov_base = (char *) &xcb_out;
   10567     xcb_parts[2].iov_len = sizeof(xcb_out);
   10568     xcb_parts[3].iov_base = 0;
   10569     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   10570 
   10571     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   10572     return xcb_ret;
   10573 }
   10574 
   10575 int
   10576 xcb_list_installed_colormaps_sizeof (const void  *_buffer)
   10577 {
   10578     char *xcb_tmp = (char *)_buffer;
   10579     const xcb_list_installed_colormaps_reply_t *_aux = (xcb_list_installed_colormaps_reply_t *)_buffer;
   10580     unsigned int xcb_buffer_len = 0;
   10581     unsigned int xcb_block_len = 0;
   10582     unsigned int xcb_pad = 0;
   10583     unsigned int xcb_align_to = 0;
   10584 
   10585 
   10586     xcb_block_len += sizeof(xcb_list_installed_colormaps_reply_t);
   10587     xcb_tmp += xcb_block_len;
   10588     xcb_buffer_len += xcb_block_len;
   10589     xcb_block_len = 0;
   10590     /* cmaps */
   10591     xcb_block_len += _aux->cmaps_len * sizeof(xcb_colormap_t);
   10592     xcb_tmp += xcb_block_len;
   10593     xcb_align_to = ALIGNOF(xcb_colormap_t);
   10594     /* insert padding */
   10595     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   10596     xcb_buffer_len += xcb_block_len + xcb_pad;
   10597     if (0 != xcb_pad) {
   10598         xcb_tmp += xcb_pad;
   10599         xcb_pad = 0;
   10600     }
   10601     xcb_block_len = 0;
   10602 
   10603     return xcb_buffer_len;
   10604 }
   10605 
   10606 xcb_list_installed_colormaps_cookie_t
   10607 xcb_list_installed_colormaps (xcb_connection_t *c,
   10608                               xcb_window_t      window)
   10609 {
   10610     static const xcb_protocol_request_t xcb_req = {
   10611         .count = 2,
   10612         .ext = 0,
   10613         .opcode = XCB_LIST_INSTALLED_COLORMAPS,
   10614         .isvoid = 0
   10615     };
   10616 
   10617     struct iovec xcb_parts[4];
   10618     xcb_list_installed_colormaps_cookie_t xcb_ret;
   10619     xcb_list_installed_colormaps_request_t xcb_out;
   10620 
   10621     xcb_out.pad0 = 0;
   10622     xcb_out.window = window;
   10623 
   10624     xcb_parts[2].iov_base = (char *) &xcb_out;
   10625     xcb_parts[2].iov_len = sizeof(xcb_out);
   10626     xcb_parts[3].iov_base = 0;
   10627     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   10628 
   10629     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   10630     return xcb_ret;
   10631 }
   10632 
   10633 xcb_list_installed_colormaps_cookie_t
   10634 xcb_list_installed_colormaps_unchecked (xcb_connection_t *c,
   10635                                         xcb_window_t      window)
   10636 {
   10637     static const xcb_protocol_request_t xcb_req = {
   10638         .count = 2,
   10639         .ext = 0,
   10640         .opcode = XCB_LIST_INSTALLED_COLORMAPS,
   10641         .isvoid = 0
   10642     };
   10643 
   10644     struct iovec xcb_parts[4];
   10645     xcb_list_installed_colormaps_cookie_t xcb_ret;
   10646     xcb_list_installed_colormaps_request_t xcb_out;
   10647 
   10648     xcb_out.pad0 = 0;
   10649     xcb_out.window = window;
   10650 
   10651     xcb_parts[2].iov_base = (char *) &xcb_out;
   10652     xcb_parts[2].iov_len = sizeof(xcb_out);
   10653     xcb_parts[3].iov_base = 0;
   10654     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   10655 
   10656     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   10657     return xcb_ret;
   10658 }
   10659 
   10660 xcb_colormap_t *
   10661 xcb_list_installed_colormaps_cmaps (const xcb_list_installed_colormaps_reply_t *R)
   10662 {
   10663     return (xcb_colormap_t *) (R + 1);
   10664 }
   10665 
   10666 int
   10667 xcb_list_installed_colormaps_cmaps_length (const xcb_list_installed_colormaps_reply_t *R)
   10668 {
   10669     return R->cmaps_len;
   10670 }
   10671 
   10672 xcb_generic_iterator_t
   10673 xcb_list_installed_colormaps_cmaps_end (const xcb_list_installed_colormaps_reply_t *R)
   10674 {
   10675     xcb_generic_iterator_t i;
   10676     i.data = ((xcb_colormap_t *) (R + 1)) + (R->cmaps_len);
   10677     i.rem = 0;
   10678     i.index = (char *) i.data - (char *) R;
   10679     return i;
   10680 }
   10681 
   10682 xcb_list_installed_colormaps_reply_t *
   10683 xcb_list_installed_colormaps_reply (xcb_connection_t                       *c,
   10684                                     xcb_list_installed_colormaps_cookie_t   cookie  /**< */,
   10685                                     xcb_generic_error_t                   **e)
   10686 {
   10687     return (xcb_list_installed_colormaps_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   10688 }
   10689 
   10690 xcb_alloc_color_cookie_t
   10691 xcb_alloc_color (xcb_connection_t *c,
   10692                  xcb_colormap_t    cmap,
   10693                  uint16_t          red,
   10694                  uint16_t          green,
   10695                  uint16_t          blue)
   10696 {
   10697     static const xcb_protocol_request_t xcb_req = {
   10698         .count = 2,
   10699         .ext = 0,
   10700         .opcode = XCB_ALLOC_COLOR,
   10701         .isvoid = 0
   10702     };
   10703 
   10704     struct iovec xcb_parts[4];
   10705     xcb_alloc_color_cookie_t xcb_ret;
   10706     xcb_alloc_color_request_t xcb_out;
   10707 
   10708     xcb_out.pad0 = 0;
   10709     xcb_out.cmap = cmap;
   10710     xcb_out.red = red;
   10711     xcb_out.green = green;
   10712     xcb_out.blue = blue;
   10713     memset(xcb_out.pad1, 0, 2);
   10714 
   10715     xcb_parts[2].iov_base = (char *) &xcb_out;
   10716     xcb_parts[2].iov_len = sizeof(xcb_out);
   10717     xcb_parts[3].iov_base = 0;
   10718     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   10719 
   10720     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   10721     return xcb_ret;
   10722 }
   10723 
   10724 xcb_alloc_color_cookie_t
   10725 xcb_alloc_color_unchecked (xcb_connection_t *c,
   10726                            xcb_colormap_t    cmap,
   10727                            uint16_t          red,
   10728                            uint16_t          green,
   10729                            uint16_t          blue)
   10730 {
   10731     static const xcb_protocol_request_t xcb_req = {
   10732         .count = 2,
   10733         .ext = 0,
   10734         .opcode = XCB_ALLOC_COLOR,
   10735         .isvoid = 0
   10736     };
   10737 
   10738     struct iovec xcb_parts[4];
   10739     xcb_alloc_color_cookie_t xcb_ret;
   10740     xcb_alloc_color_request_t xcb_out;
   10741 
   10742     xcb_out.pad0 = 0;
   10743     xcb_out.cmap = cmap;
   10744     xcb_out.red = red;
   10745     xcb_out.green = green;
   10746     xcb_out.blue = blue;
   10747     memset(xcb_out.pad1, 0, 2);
   10748 
   10749     xcb_parts[2].iov_base = (char *) &xcb_out;
   10750     xcb_parts[2].iov_len = sizeof(xcb_out);
   10751     xcb_parts[3].iov_base = 0;
   10752     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   10753 
   10754     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   10755     return xcb_ret;
   10756 }
   10757 
   10758 xcb_alloc_color_reply_t *
   10759 xcb_alloc_color_reply (xcb_connection_t          *c,
   10760                        xcb_alloc_color_cookie_t   cookie  /**< */,
   10761                        xcb_generic_error_t      **e)
   10762 {
   10763     return (xcb_alloc_color_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   10764 }
   10765 
   10766 int
   10767 xcb_alloc_named_color_sizeof (const void  *_buffer)
   10768 {
   10769     char *xcb_tmp = (char *)_buffer;
   10770     const xcb_alloc_named_color_request_t *_aux = (xcb_alloc_named_color_request_t *)_buffer;
   10771     unsigned int xcb_buffer_len = 0;
   10772     unsigned int xcb_block_len = 0;
   10773     unsigned int xcb_pad = 0;
   10774     unsigned int xcb_align_to = 0;
   10775 
   10776 
   10777     xcb_block_len += sizeof(xcb_alloc_named_color_request_t);
   10778     xcb_tmp += xcb_block_len;
   10779     xcb_buffer_len += xcb_block_len;
   10780     xcb_block_len = 0;
   10781     /* name */
   10782     xcb_block_len += _aux->name_len * sizeof(char);
   10783     xcb_tmp += xcb_block_len;
   10784     xcb_align_to = ALIGNOF(char);
   10785     /* insert padding */
   10786     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   10787     xcb_buffer_len += xcb_block_len + xcb_pad;
   10788     if (0 != xcb_pad) {
   10789         xcb_tmp += xcb_pad;
   10790         xcb_pad = 0;
   10791     }
   10792     xcb_block_len = 0;
   10793 
   10794     return xcb_buffer_len;
   10795 }
   10796 
   10797 xcb_alloc_named_color_cookie_t
   10798 xcb_alloc_named_color (xcb_connection_t *c,
   10799                        xcb_colormap_t    cmap,
   10800                        uint16_t          name_len,
   10801                        const char       *name)
   10802 {
   10803     static const xcb_protocol_request_t xcb_req = {
   10804         .count = 4,
   10805         .ext = 0,
   10806         .opcode = XCB_ALLOC_NAMED_COLOR,
   10807         .isvoid = 0
   10808     };
   10809 
   10810     struct iovec xcb_parts[6];
   10811     xcb_alloc_named_color_cookie_t xcb_ret;
   10812     xcb_alloc_named_color_request_t xcb_out;
   10813 
   10814     xcb_out.pad0 = 0;
   10815     xcb_out.cmap = cmap;
   10816     xcb_out.name_len = name_len;
   10817     memset(xcb_out.pad1, 0, 2);
   10818 
   10819     xcb_parts[2].iov_base = (char *) &xcb_out;
   10820     xcb_parts[2].iov_len = sizeof(xcb_out);
   10821     xcb_parts[3].iov_base = 0;
   10822     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   10823     /* char name */
   10824     xcb_parts[4].iov_base = (char *) name;
   10825     xcb_parts[4].iov_len = name_len * sizeof(char);
   10826     xcb_parts[5].iov_base = 0;
   10827     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   10828 
   10829     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   10830     return xcb_ret;
   10831 }
   10832 
   10833 xcb_alloc_named_color_cookie_t
   10834 xcb_alloc_named_color_unchecked (xcb_connection_t *c,
   10835                                  xcb_colormap_t    cmap,
   10836                                  uint16_t          name_len,
   10837                                  const char       *name)
   10838 {
   10839     static const xcb_protocol_request_t xcb_req = {
   10840         .count = 4,
   10841         .ext = 0,
   10842         .opcode = XCB_ALLOC_NAMED_COLOR,
   10843         .isvoid = 0
   10844     };
   10845 
   10846     struct iovec xcb_parts[6];
   10847     xcb_alloc_named_color_cookie_t xcb_ret;
   10848     xcb_alloc_named_color_request_t xcb_out;
   10849 
   10850     xcb_out.pad0 = 0;
   10851     xcb_out.cmap = cmap;
   10852     xcb_out.name_len = name_len;
   10853     memset(xcb_out.pad1, 0, 2);
   10854 
   10855     xcb_parts[2].iov_base = (char *) &xcb_out;
   10856     xcb_parts[2].iov_len = sizeof(xcb_out);
   10857     xcb_parts[3].iov_base = 0;
   10858     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   10859     /* char name */
   10860     xcb_parts[4].iov_base = (char *) name;
   10861     xcb_parts[4].iov_len = name_len * sizeof(char);
   10862     xcb_parts[5].iov_base = 0;
   10863     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   10864 
   10865     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   10866     return xcb_ret;
   10867 }
   10868 
   10869 xcb_alloc_named_color_reply_t *
   10870 xcb_alloc_named_color_reply (xcb_connection_t                *c,
   10871                              xcb_alloc_named_color_cookie_t   cookie  /**< */,
   10872                              xcb_generic_error_t            **e)
   10873 {
   10874     return (xcb_alloc_named_color_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   10875 }
   10876 
   10877 int
   10878 xcb_alloc_color_cells_sizeof (const void  *_buffer)
   10879 {
   10880     char *xcb_tmp = (char *)_buffer;
   10881     const xcb_alloc_color_cells_reply_t *_aux = (xcb_alloc_color_cells_reply_t *)_buffer;
   10882     unsigned int xcb_buffer_len = 0;
   10883     unsigned int xcb_block_len = 0;
   10884     unsigned int xcb_pad = 0;
   10885     unsigned int xcb_align_to = 0;
   10886 
   10887 
   10888     xcb_block_len += sizeof(xcb_alloc_color_cells_reply_t);
   10889     xcb_tmp += xcb_block_len;
   10890     xcb_buffer_len += xcb_block_len;
   10891     xcb_block_len = 0;
   10892     /* pixels */
   10893     xcb_block_len += _aux->pixels_len * sizeof(uint32_t);
   10894     xcb_tmp += xcb_block_len;
   10895     xcb_align_to = ALIGNOF(uint32_t);
   10896     /* insert padding */
   10897     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   10898     xcb_buffer_len += xcb_block_len + xcb_pad;
   10899     if (0 != xcb_pad) {
   10900         xcb_tmp += xcb_pad;
   10901         xcb_pad = 0;
   10902     }
   10903     xcb_block_len = 0;
   10904     /* masks */
   10905     xcb_block_len += _aux->masks_len * sizeof(uint32_t);
   10906     xcb_tmp += xcb_block_len;
   10907     xcb_align_to = ALIGNOF(uint32_t);
   10908     /* insert padding */
   10909     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   10910     xcb_buffer_len += xcb_block_len + xcb_pad;
   10911     if (0 != xcb_pad) {
   10912         xcb_tmp += xcb_pad;
   10913         xcb_pad = 0;
   10914     }
   10915     xcb_block_len = 0;
   10916 
   10917     return xcb_buffer_len;
   10918 }
   10919 
   10920 xcb_alloc_color_cells_cookie_t
   10921 xcb_alloc_color_cells (xcb_connection_t *c,
   10922                        uint8_t           contiguous,
   10923                        xcb_colormap_t    cmap,
   10924                        uint16_t          colors,
   10925                        uint16_t          planes)
   10926 {
   10927     static const xcb_protocol_request_t xcb_req = {
   10928         .count = 2,
   10929         .ext = 0,
   10930         .opcode = XCB_ALLOC_COLOR_CELLS,
   10931         .isvoid = 0
   10932     };
   10933 
   10934     struct iovec xcb_parts[4];
   10935     xcb_alloc_color_cells_cookie_t xcb_ret;
   10936     xcb_alloc_color_cells_request_t xcb_out;
   10937 
   10938     xcb_out.contiguous = contiguous;
   10939     xcb_out.cmap = cmap;
   10940     xcb_out.colors = colors;
   10941     xcb_out.planes = planes;
   10942 
   10943     xcb_parts[2].iov_base = (char *) &xcb_out;
   10944     xcb_parts[2].iov_len = sizeof(xcb_out);
   10945     xcb_parts[3].iov_base = 0;
   10946     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   10947 
   10948     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   10949     return xcb_ret;
   10950 }
   10951 
   10952 xcb_alloc_color_cells_cookie_t
   10953 xcb_alloc_color_cells_unchecked (xcb_connection_t *c,
   10954                                  uint8_t           contiguous,
   10955                                  xcb_colormap_t    cmap,
   10956                                  uint16_t          colors,
   10957                                  uint16_t          planes)
   10958 {
   10959     static const xcb_protocol_request_t xcb_req = {
   10960         .count = 2,
   10961         .ext = 0,
   10962         .opcode = XCB_ALLOC_COLOR_CELLS,
   10963         .isvoid = 0
   10964     };
   10965 
   10966     struct iovec xcb_parts[4];
   10967     xcb_alloc_color_cells_cookie_t xcb_ret;
   10968     xcb_alloc_color_cells_request_t xcb_out;
   10969 
   10970     xcb_out.contiguous = contiguous;
   10971     xcb_out.cmap = cmap;
   10972     xcb_out.colors = colors;
   10973     xcb_out.planes = planes;
   10974 
   10975     xcb_parts[2].iov_base = (char *) &xcb_out;
   10976     xcb_parts[2].iov_len = sizeof(xcb_out);
   10977     xcb_parts[3].iov_base = 0;
   10978     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   10979 
   10980     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   10981     return xcb_ret;
   10982 }
   10983 
   10984 uint32_t *
   10985 xcb_alloc_color_cells_pixels (const xcb_alloc_color_cells_reply_t *R)
   10986 {
   10987     return (uint32_t *) (R + 1);
   10988 }
   10989 
   10990 int
   10991 xcb_alloc_color_cells_pixels_length (const xcb_alloc_color_cells_reply_t *R)
   10992 {
   10993     return R->pixels_len;
   10994 }
   10995 
   10996 xcb_generic_iterator_t
   10997 xcb_alloc_color_cells_pixels_end (const xcb_alloc_color_cells_reply_t *R)
   10998 {
   10999     xcb_generic_iterator_t i;
   11000     i.data = ((uint32_t *) (R + 1)) + (R->pixels_len);
   11001     i.rem = 0;
   11002     i.index = (char *) i.data - (char *) R;
   11003     return i;
   11004 }
   11005 
   11006 uint32_t *
   11007 xcb_alloc_color_cells_masks (const xcb_alloc_color_cells_reply_t *R)
   11008 {
   11009     xcb_generic_iterator_t prev = xcb_alloc_color_cells_pixels_end(R);
   11010     return (uint32_t *) ((char *) prev.data + XCB_TYPE_PAD(uint32_t, prev.index) + 0);
   11011 }
   11012 
   11013 int
   11014 xcb_alloc_color_cells_masks_length (const xcb_alloc_color_cells_reply_t *R)
   11015 {
   11016     return R->masks_len;
   11017 }
   11018 
   11019 xcb_generic_iterator_t
   11020 xcb_alloc_color_cells_masks_end (const xcb_alloc_color_cells_reply_t *R)
   11021 {
   11022     xcb_generic_iterator_t i;
   11023     xcb_generic_iterator_t prev = xcb_alloc_color_cells_pixels_end(R);
   11024     i.data = ((uint32_t *) ((char*) prev.data + XCB_TYPE_PAD(uint32_t, prev.index))) + (R->masks_len);
   11025     i.rem = 0;
   11026     i.index = (char *) i.data - (char *) R;
   11027     return i;
   11028 }
   11029 
   11030 xcb_alloc_color_cells_reply_t *
   11031 xcb_alloc_color_cells_reply (xcb_connection_t                *c,
   11032                              xcb_alloc_color_cells_cookie_t   cookie  /**< */,
   11033                              xcb_generic_error_t            **e)
   11034 {
   11035     return (xcb_alloc_color_cells_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   11036 }
   11037 
   11038 int
   11039 xcb_alloc_color_planes_sizeof (const void  *_buffer)
   11040 {
   11041     char *xcb_tmp = (char *)_buffer;
   11042     const xcb_alloc_color_planes_reply_t *_aux = (xcb_alloc_color_planes_reply_t *)_buffer;
   11043     unsigned int xcb_buffer_len = 0;
   11044     unsigned int xcb_block_len = 0;
   11045     unsigned int xcb_pad = 0;
   11046     unsigned int xcb_align_to = 0;
   11047 
   11048 
   11049     xcb_block_len += sizeof(xcb_alloc_color_planes_reply_t);
   11050     xcb_tmp += xcb_block_len;
   11051     xcb_buffer_len += xcb_block_len;
   11052     xcb_block_len = 0;
   11053     /* pixels */
   11054     xcb_block_len += _aux->pixels_len * sizeof(uint32_t);
   11055     xcb_tmp += xcb_block_len;
   11056     xcb_align_to = ALIGNOF(uint32_t);
   11057     /* insert padding */
   11058     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   11059     xcb_buffer_len += xcb_block_len + xcb_pad;
   11060     if (0 != xcb_pad) {
   11061         xcb_tmp += xcb_pad;
   11062         xcb_pad = 0;
   11063     }
   11064     xcb_block_len = 0;
   11065 
   11066     return xcb_buffer_len;
   11067 }
   11068 
   11069 xcb_alloc_color_planes_cookie_t
   11070 xcb_alloc_color_planes (xcb_connection_t *c,
   11071                         uint8_t           contiguous,
   11072                         xcb_colormap_t    cmap,
   11073                         uint16_t          colors,
   11074                         uint16_t          reds,
   11075                         uint16_t          greens,
   11076                         uint16_t          blues)
   11077 {
   11078     static const xcb_protocol_request_t xcb_req = {
   11079         .count = 2,
   11080         .ext = 0,
   11081         .opcode = XCB_ALLOC_COLOR_PLANES,
   11082         .isvoid = 0
   11083     };
   11084 
   11085     struct iovec xcb_parts[4];
   11086     xcb_alloc_color_planes_cookie_t xcb_ret;
   11087     xcb_alloc_color_planes_request_t xcb_out;
   11088 
   11089     xcb_out.contiguous = contiguous;
   11090     xcb_out.cmap = cmap;
   11091     xcb_out.colors = colors;
   11092     xcb_out.reds = reds;
   11093     xcb_out.greens = greens;
   11094     xcb_out.blues = blues;
   11095 
   11096     xcb_parts[2].iov_base = (char *) &xcb_out;
   11097     xcb_parts[2].iov_len = sizeof(xcb_out);
   11098     xcb_parts[3].iov_base = 0;
   11099     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   11100 
   11101     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   11102     return xcb_ret;
   11103 }
   11104 
   11105 xcb_alloc_color_planes_cookie_t
   11106 xcb_alloc_color_planes_unchecked (xcb_connection_t *c,
   11107                                   uint8_t           contiguous,
   11108                                   xcb_colormap_t    cmap,
   11109                                   uint16_t          colors,
   11110                                   uint16_t          reds,
   11111                                   uint16_t          greens,
   11112                                   uint16_t          blues)
   11113 {
   11114     static const xcb_protocol_request_t xcb_req = {
   11115         .count = 2,
   11116         .ext = 0,
   11117         .opcode = XCB_ALLOC_COLOR_PLANES,
   11118         .isvoid = 0
   11119     };
   11120 
   11121     struct iovec xcb_parts[4];
   11122     xcb_alloc_color_planes_cookie_t xcb_ret;
   11123     xcb_alloc_color_planes_request_t xcb_out;
   11124 
   11125     xcb_out.contiguous = contiguous;
   11126     xcb_out.cmap = cmap;
   11127     xcb_out.colors = colors;
   11128     xcb_out.reds = reds;
   11129     xcb_out.greens = greens;
   11130     xcb_out.blues = blues;
   11131 
   11132     xcb_parts[2].iov_base = (char *) &xcb_out;
   11133     xcb_parts[2].iov_len = sizeof(xcb_out);
   11134     xcb_parts[3].iov_base = 0;
   11135     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   11136 
   11137     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   11138     return xcb_ret;
   11139 }
   11140 
   11141 uint32_t *
   11142 xcb_alloc_color_planes_pixels (const xcb_alloc_color_planes_reply_t *R)
   11143 {
   11144     return (uint32_t *) (R + 1);
   11145 }
   11146 
   11147 int
   11148 xcb_alloc_color_planes_pixels_length (const xcb_alloc_color_planes_reply_t *R)
   11149 {
   11150     return R->pixels_len;
   11151 }
   11152 
   11153 xcb_generic_iterator_t
   11154 xcb_alloc_color_planes_pixels_end (const xcb_alloc_color_planes_reply_t *R)
   11155 {
   11156     xcb_generic_iterator_t i;
   11157     i.data = ((uint32_t *) (R + 1)) + (R->pixels_len);
   11158     i.rem = 0;
   11159     i.index = (char *) i.data - (char *) R;
   11160     return i;
   11161 }
   11162 
   11163 xcb_alloc_color_planes_reply_t *
   11164 xcb_alloc_color_planes_reply (xcb_connection_t                 *c,
   11165                               xcb_alloc_color_planes_cookie_t   cookie  /**< */,
   11166                               xcb_generic_error_t             **e)
   11167 {
   11168     return (xcb_alloc_color_planes_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   11169 }
   11170 
   11171 int
   11172 xcb_free_colors_sizeof (const void  *_buffer,
   11173                         uint32_t     pixels_len)
   11174 {
   11175     char *xcb_tmp = (char *)_buffer;
   11176     unsigned int xcb_buffer_len = 0;
   11177     unsigned int xcb_block_len = 0;
   11178     unsigned int xcb_pad = 0;
   11179     unsigned int xcb_align_to = 0;
   11180 
   11181 
   11182     xcb_block_len += sizeof(xcb_free_colors_request_t);
   11183     xcb_tmp += xcb_block_len;
   11184     xcb_buffer_len += xcb_block_len;
   11185     xcb_block_len = 0;
   11186     /* pixels */
   11187     xcb_block_len += pixels_len * sizeof(uint32_t);
   11188     xcb_tmp += xcb_block_len;
   11189     xcb_align_to = ALIGNOF(uint32_t);
   11190     /* insert padding */
   11191     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   11192     xcb_buffer_len += xcb_block_len + xcb_pad;
   11193     if (0 != xcb_pad) {
   11194         xcb_tmp += xcb_pad;
   11195         xcb_pad = 0;
   11196     }
   11197     xcb_block_len = 0;
   11198 
   11199     return xcb_buffer_len;
   11200 }
   11201 
   11202 xcb_void_cookie_t
   11203 xcb_free_colors_checked (xcb_connection_t *c,
   11204                          xcb_colormap_t    cmap,
   11205                          uint32_t          plane_mask,
   11206                          uint32_t          pixels_len,
   11207                          const uint32_t   *pixels)
   11208 {
   11209     static const xcb_protocol_request_t xcb_req = {
   11210         .count = 4,
   11211         .ext = 0,
   11212         .opcode = XCB_FREE_COLORS,
   11213         .isvoid = 1
   11214     };
   11215 
   11216     struct iovec xcb_parts[6];
   11217     xcb_void_cookie_t xcb_ret;
   11218     xcb_free_colors_request_t xcb_out;
   11219 
   11220     xcb_out.pad0 = 0;
   11221     xcb_out.cmap = cmap;
   11222     xcb_out.plane_mask = plane_mask;
   11223 
   11224     xcb_parts[2].iov_base = (char *) &xcb_out;
   11225     xcb_parts[2].iov_len = sizeof(xcb_out);
   11226     xcb_parts[3].iov_base = 0;
   11227     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   11228     /* uint32_t pixels */
   11229     xcb_parts[4].iov_base = (char *) pixels;
   11230     xcb_parts[4].iov_len = pixels_len * sizeof(uint32_t);
   11231     xcb_parts[5].iov_base = 0;
   11232     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   11233 
   11234     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   11235     return xcb_ret;
   11236 }
   11237 
   11238 xcb_void_cookie_t
   11239 xcb_free_colors (xcb_connection_t *c,
   11240                  xcb_colormap_t    cmap,
   11241                  uint32_t          plane_mask,
   11242                  uint32_t          pixels_len,
   11243                  const uint32_t   *pixels)
   11244 {
   11245     static const xcb_protocol_request_t xcb_req = {
   11246         .count = 4,
   11247         .ext = 0,
   11248         .opcode = XCB_FREE_COLORS,
   11249         .isvoid = 1
   11250     };
   11251 
   11252     struct iovec xcb_parts[6];
   11253     xcb_void_cookie_t xcb_ret;
   11254     xcb_free_colors_request_t xcb_out;
   11255 
   11256     xcb_out.pad0 = 0;
   11257     xcb_out.cmap = cmap;
   11258     xcb_out.plane_mask = plane_mask;
   11259 
   11260     xcb_parts[2].iov_base = (char *) &xcb_out;
   11261     xcb_parts[2].iov_len = sizeof(xcb_out);
   11262     xcb_parts[3].iov_base = 0;
   11263     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   11264     /* uint32_t pixels */
   11265     xcb_parts[4].iov_base = (char *) pixels;
   11266     xcb_parts[4].iov_len = pixels_len * sizeof(uint32_t);
   11267     xcb_parts[5].iov_base = 0;
   11268     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   11269 
   11270     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   11271     return xcb_ret;
   11272 }
   11273 
   11274 uint32_t *
   11275 xcb_free_colors_pixels (const xcb_free_colors_request_t *R)
   11276 {
   11277     return (uint32_t *) (R + 1);
   11278 }
   11279 
   11280 int
   11281 xcb_free_colors_pixels_length (const xcb_free_colors_request_t *R)
   11282 {
   11283     return (((R->length * 4) - sizeof(xcb_free_colors_request_t))/sizeof(uint32_t));
   11284 }
   11285 
   11286 xcb_generic_iterator_t
   11287 xcb_free_colors_pixels_end (const xcb_free_colors_request_t *R)
   11288 {
   11289     xcb_generic_iterator_t i;
   11290     i.data = ((uint32_t *) (R + 1)) + ((((R->length * 4) - sizeof(xcb_free_colors_request_t))/sizeof(uint32_t)));
   11291     i.rem = 0;
   11292     i.index = (char *) i.data - (char *) R;
   11293     return i;
   11294 }
   11295 
   11296 void
   11297 xcb_coloritem_next (xcb_coloritem_iterator_t *i)
   11298 {
   11299     --i->rem;
   11300     ++i->data;
   11301     i->index += sizeof(xcb_coloritem_t);
   11302 }
   11303 
   11304 xcb_generic_iterator_t
   11305 xcb_coloritem_end (xcb_coloritem_iterator_t i)
   11306 {
   11307     xcb_generic_iterator_t ret;
   11308     ret.data = i.data + i.rem;
   11309     ret.index = i.index + ((char *) ret.data - (char *) i.data);
   11310     ret.rem = 0;
   11311     return ret;
   11312 }
   11313 
   11314 int
   11315 xcb_store_colors_sizeof (const void  *_buffer,
   11316                          uint32_t     items_len)
   11317 {
   11318     char *xcb_tmp = (char *)_buffer;
   11319     unsigned int xcb_buffer_len = 0;
   11320     unsigned int xcb_block_len = 0;
   11321     unsigned int xcb_pad = 0;
   11322     unsigned int xcb_align_to = 0;
   11323 
   11324 
   11325     xcb_block_len += sizeof(xcb_store_colors_request_t);
   11326     xcb_tmp += xcb_block_len;
   11327     xcb_buffer_len += xcb_block_len;
   11328     xcb_block_len = 0;
   11329     /* items */
   11330     xcb_block_len += items_len * sizeof(xcb_coloritem_t);
   11331     xcb_tmp += xcb_block_len;
   11332     xcb_align_to = ALIGNOF(xcb_coloritem_t);
   11333     /* insert padding */
   11334     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   11335     xcb_buffer_len += xcb_block_len + xcb_pad;
   11336     if (0 != xcb_pad) {
   11337         xcb_tmp += xcb_pad;
   11338         xcb_pad = 0;
   11339     }
   11340     xcb_block_len = 0;
   11341 
   11342     return xcb_buffer_len;
   11343 }
   11344 
   11345 xcb_void_cookie_t
   11346 xcb_store_colors_checked (xcb_connection_t      *c,
   11347                           xcb_colormap_t         cmap,
   11348                           uint32_t               items_len,
   11349                           const xcb_coloritem_t *items)
   11350 {
   11351     static const xcb_protocol_request_t xcb_req = {
   11352         .count = 4,
   11353         .ext = 0,
   11354         .opcode = XCB_STORE_COLORS,
   11355         .isvoid = 1
   11356     };
   11357 
   11358     struct iovec xcb_parts[6];
   11359     xcb_void_cookie_t xcb_ret;
   11360     xcb_store_colors_request_t xcb_out;
   11361 
   11362     xcb_out.pad0 = 0;
   11363     xcb_out.cmap = cmap;
   11364 
   11365     xcb_parts[2].iov_base = (char *) &xcb_out;
   11366     xcb_parts[2].iov_len = sizeof(xcb_out);
   11367     xcb_parts[3].iov_base = 0;
   11368     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   11369     /* xcb_coloritem_t items */
   11370     xcb_parts[4].iov_base = (char *) items;
   11371     xcb_parts[4].iov_len = items_len * sizeof(xcb_coloritem_t);
   11372     xcb_parts[5].iov_base = 0;
   11373     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   11374 
   11375     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   11376     return xcb_ret;
   11377 }
   11378 
   11379 xcb_void_cookie_t
   11380 xcb_store_colors (xcb_connection_t      *c,
   11381                   xcb_colormap_t         cmap,
   11382                   uint32_t               items_len,
   11383                   const xcb_coloritem_t *items)
   11384 {
   11385     static const xcb_protocol_request_t xcb_req = {
   11386         .count = 4,
   11387         .ext = 0,
   11388         .opcode = XCB_STORE_COLORS,
   11389         .isvoid = 1
   11390     };
   11391 
   11392     struct iovec xcb_parts[6];
   11393     xcb_void_cookie_t xcb_ret;
   11394     xcb_store_colors_request_t xcb_out;
   11395 
   11396     xcb_out.pad0 = 0;
   11397     xcb_out.cmap = cmap;
   11398 
   11399     xcb_parts[2].iov_base = (char *) &xcb_out;
   11400     xcb_parts[2].iov_len = sizeof(xcb_out);
   11401     xcb_parts[3].iov_base = 0;
   11402     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   11403     /* xcb_coloritem_t items */
   11404     xcb_parts[4].iov_base = (char *) items;
   11405     xcb_parts[4].iov_len = items_len * sizeof(xcb_coloritem_t);
   11406     xcb_parts[5].iov_base = 0;
   11407     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   11408 
   11409     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   11410     return xcb_ret;
   11411 }
   11412 
   11413 xcb_coloritem_t *
   11414 xcb_store_colors_items (const xcb_store_colors_request_t *R)
   11415 {
   11416     return (xcb_coloritem_t *) (R + 1);
   11417 }
   11418 
   11419 int
   11420 xcb_store_colors_items_length (const xcb_store_colors_request_t *R)
   11421 {
   11422     return (((R->length * 4) - sizeof(xcb_store_colors_request_t))/sizeof(xcb_coloritem_t));
   11423 }
   11424 
   11425 xcb_coloritem_iterator_t
   11426 xcb_store_colors_items_iterator (const xcb_store_colors_request_t *R)
   11427 {
   11428     xcb_coloritem_iterator_t i;
   11429     i.data = (xcb_coloritem_t *) (R + 1);
   11430     i.rem = (((R->length * 4) - sizeof(xcb_store_colors_request_t))/sizeof(xcb_coloritem_t));
   11431     i.index = (char *) i.data - (char *) R;
   11432     return i;
   11433 }
   11434 
   11435 int
   11436 xcb_store_named_color_sizeof (const void  *_buffer)
   11437 {
   11438     char *xcb_tmp = (char *)_buffer;
   11439     const xcb_store_named_color_request_t *_aux = (xcb_store_named_color_request_t *)_buffer;
   11440     unsigned int xcb_buffer_len = 0;
   11441     unsigned int xcb_block_len = 0;
   11442     unsigned int xcb_pad = 0;
   11443     unsigned int xcb_align_to = 0;
   11444 
   11445 
   11446     xcb_block_len += sizeof(xcb_store_named_color_request_t);
   11447     xcb_tmp += xcb_block_len;
   11448     xcb_buffer_len += xcb_block_len;
   11449     xcb_block_len = 0;
   11450     /* name */
   11451     xcb_block_len += _aux->name_len * sizeof(char);
   11452     xcb_tmp += xcb_block_len;
   11453     xcb_align_to = ALIGNOF(char);
   11454     /* insert padding */
   11455     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   11456     xcb_buffer_len += xcb_block_len + xcb_pad;
   11457     if (0 != xcb_pad) {
   11458         xcb_tmp += xcb_pad;
   11459         xcb_pad = 0;
   11460     }
   11461     xcb_block_len = 0;
   11462 
   11463     return xcb_buffer_len;
   11464 }
   11465 
   11466 xcb_void_cookie_t
   11467 xcb_store_named_color_checked (xcb_connection_t *c,
   11468                                uint8_t           flags,
   11469                                xcb_colormap_t    cmap,
   11470                                uint32_t          pixel,
   11471                                uint16_t          name_len,
   11472                                const char       *name)
   11473 {
   11474     static const xcb_protocol_request_t xcb_req = {
   11475         .count = 4,
   11476         .ext = 0,
   11477         .opcode = XCB_STORE_NAMED_COLOR,
   11478         .isvoid = 1
   11479     };
   11480 
   11481     struct iovec xcb_parts[6];
   11482     xcb_void_cookie_t xcb_ret;
   11483     xcb_store_named_color_request_t xcb_out;
   11484 
   11485     xcb_out.flags = flags;
   11486     xcb_out.cmap = cmap;
   11487     xcb_out.pixel = pixel;
   11488     xcb_out.name_len = name_len;
   11489     memset(xcb_out.pad0, 0, 2);
   11490 
   11491     xcb_parts[2].iov_base = (char *) &xcb_out;
   11492     xcb_parts[2].iov_len = sizeof(xcb_out);
   11493     xcb_parts[3].iov_base = 0;
   11494     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   11495     /* char name */
   11496     xcb_parts[4].iov_base = (char *) name;
   11497     xcb_parts[4].iov_len = name_len * sizeof(char);
   11498     xcb_parts[5].iov_base = 0;
   11499     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   11500 
   11501     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   11502     return xcb_ret;
   11503 }
   11504 
   11505 xcb_void_cookie_t
   11506 xcb_store_named_color (xcb_connection_t *c,
   11507                        uint8_t           flags,
   11508                        xcb_colormap_t    cmap,
   11509                        uint32_t          pixel,
   11510                        uint16_t          name_len,
   11511                        const char       *name)
   11512 {
   11513     static const xcb_protocol_request_t xcb_req = {
   11514         .count = 4,
   11515         .ext = 0,
   11516         .opcode = XCB_STORE_NAMED_COLOR,
   11517         .isvoid = 1
   11518     };
   11519 
   11520     struct iovec xcb_parts[6];
   11521     xcb_void_cookie_t xcb_ret;
   11522     xcb_store_named_color_request_t xcb_out;
   11523 
   11524     xcb_out.flags = flags;
   11525     xcb_out.cmap = cmap;
   11526     xcb_out.pixel = pixel;
   11527     xcb_out.name_len = name_len;
   11528     memset(xcb_out.pad0, 0, 2);
   11529 
   11530     xcb_parts[2].iov_base = (char *) &xcb_out;
   11531     xcb_parts[2].iov_len = sizeof(xcb_out);
   11532     xcb_parts[3].iov_base = 0;
   11533     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   11534     /* char name */
   11535     xcb_parts[4].iov_base = (char *) name;
   11536     xcb_parts[4].iov_len = name_len * sizeof(char);
   11537     xcb_parts[5].iov_base = 0;
   11538     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   11539 
   11540     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   11541     return xcb_ret;
   11542 }
   11543 
   11544 char *
   11545 xcb_store_named_color_name (const xcb_store_named_color_request_t *R)
   11546 {
   11547     return (char *) (R + 1);
   11548 }
   11549 
   11550 int
   11551 xcb_store_named_color_name_length (const xcb_store_named_color_request_t *R)
   11552 {
   11553     return R->name_len;
   11554 }
   11555 
   11556 xcb_generic_iterator_t
   11557 xcb_store_named_color_name_end (const xcb_store_named_color_request_t *R)
   11558 {
   11559     xcb_generic_iterator_t i;
   11560     i.data = ((char *) (R + 1)) + (R->name_len);
   11561     i.rem = 0;
   11562     i.index = (char *) i.data - (char *) R;
   11563     return i;
   11564 }
   11565 
   11566 void
   11567 xcb_rgb_next (xcb_rgb_iterator_t *i)
   11568 {
   11569     --i->rem;
   11570     ++i->data;
   11571     i->index += sizeof(xcb_rgb_t);
   11572 }
   11573 
   11574 xcb_generic_iterator_t
   11575 xcb_rgb_end (xcb_rgb_iterator_t i)
   11576 {
   11577     xcb_generic_iterator_t ret;
   11578     ret.data = i.data + i.rem;
   11579     ret.index = i.index + ((char *) ret.data - (char *) i.data);
   11580     ret.rem = 0;
   11581     return ret;
   11582 }
   11583 
   11584 int
   11585 xcb_query_colors_sizeof (const void  *_buffer,
   11586                          uint32_t     pixels_len)
   11587 {
   11588     char *xcb_tmp = (char *)_buffer;
   11589     unsigned int xcb_buffer_len = 0;
   11590     unsigned int xcb_block_len = 0;
   11591     unsigned int xcb_pad = 0;
   11592     unsigned int xcb_align_to = 0;
   11593 
   11594 
   11595     xcb_block_len += sizeof(xcb_query_colors_request_t);
   11596     xcb_tmp += xcb_block_len;
   11597     xcb_buffer_len += xcb_block_len;
   11598     xcb_block_len = 0;
   11599     /* pixels */
   11600     xcb_block_len += pixels_len * sizeof(uint32_t);
   11601     xcb_tmp += xcb_block_len;
   11602     xcb_align_to = ALIGNOF(uint32_t);
   11603     /* insert padding */
   11604     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   11605     xcb_buffer_len += xcb_block_len + xcb_pad;
   11606     if (0 != xcb_pad) {
   11607         xcb_tmp += xcb_pad;
   11608         xcb_pad = 0;
   11609     }
   11610     xcb_block_len = 0;
   11611 
   11612     return xcb_buffer_len;
   11613 }
   11614 
   11615 xcb_query_colors_cookie_t
   11616 xcb_query_colors (xcb_connection_t *c,
   11617                   xcb_colormap_t    cmap,
   11618                   uint32_t          pixels_len,
   11619                   const uint32_t   *pixels)
   11620 {
   11621     static const xcb_protocol_request_t xcb_req = {
   11622         .count = 4,
   11623         .ext = 0,
   11624         .opcode = XCB_QUERY_COLORS,
   11625         .isvoid = 0
   11626     };
   11627 
   11628     struct iovec xcb_parts[6];
   11629     xcb_query_colors_cookie_t xcb_ret;
   11630     xcb_query_colors_request_t xcb_out;
   11631 
   11632     xcb_out.pad0 = 0;
   11633     xcb_out.cmap = cmap;
   11634 
   11635     xcb_parts[2].iov_base = (char *) &xcb_out;
   11636     xcb_parts[2].iov_len = sizeof(xcb_out);
   11637     xcb_parts[3].iov_base = 0;
   11638     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   11639     /* uint32_t pixels */
   11640     xcb_parts[4].iov_base = (char *) pixels;
   11641     xcb_parts[4].iov_len = pixels_len * sizeof(uint32_t);
   11642     xcb_parts[5].iov_base = 0;
   11643     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   11644 
   11645     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   11646     return xcb_ret;
   11647 }
   11648 
   11649 xcb_query_colors_cookie_t
   11650 xcb_query_colors_unchecked (xcb_connection_t *c,
   11651                             xcb_colormap_t    cmap,
   11652                             uint32_t          pixels_len,
   11653                             const uint32_t   *pixels)
   11654 {
   11655     static const xcb_protocol_request_t xcb_req = {
   11656         .count = 4,
   11657         .ext = 0,
   11658         .opcode = XCB_QUERY_COLORS,
   11659         .isvoid = 0
   11660     };
   11661 
   11662     struct iovec xcb_parts[6];
   11663     xcb_query_colors_cookie_t xcb_ret;
   11664     xcb_query_colors_request_t xcb_out;
   11665 
   11666     xcb_out.pad0 = 0;
   11667     xcb_out.cmap = cmap;
   11668 
   11669     xcb_parts[2].iov_base = (char *) &xcb_out;
   11670     xcb_parts[2].iov_len = sizeof(xcb_out);
   11671     xcb_parts[3].iov_base = 0;
   11672     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   11673     /* uint32_t pixels */
   11674     xcb_parts[4].iov_base = (char *) pixels;
   11675     xcb_parts[4].iov_len = pixels_len * sizeof(uint32_t);
   11676     xcb_parts[5].iov_base = 0;
   11677     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   11678 
   11679     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   11680     return xcb_ret;
   11681 }
   11682 
   11683 xcb_rgb_t *
   11684 xcb_query_colors_colors (const xcb_query_colors_reply_t *R)
   11685 {
   11686     return (xcb_rgb_t *) (R + 1);
   11687 }
   11688 
   11689 int
   11690 xcb_query_colors_colors_length (const xcb_query_colors_reply_t *R)
   11691 {
   11692     return R->colors_len;
   11693 }
   11694 
   11695 xcb_rgb_iterator_t
   11696 xcb_query_colors_colors_iterator (const xcb_query_colors_reply_t *R)
   11697 {
   11698     xcb_rgb_iterator_t i;
   11699     i.data = (xcb_rgb_t *) (R + 1);
   11700     i.rem = R->colors_len;
   11701     i.index = (char *) i.data - (char *) R;
   11702     return i;
   11703 }
   11704 
   11705 xcb_query_colors_reply_t *
   11706 xcb_query_colors_reply (xcb_connection_t           *c,
   11707                         xcb_query_colors_cookie_t   cookie  /**< */,
   11708                         xcb_generic_error_t       **e)
   11709 {
   11710     return (xcb_query_colors_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   11711 }
   11712 
   11713 int
   11714 xcb_lookup_color_sizeof (const void  *_buffer)
   11715 {
   11716     char *xcb_tmp = (char *)_buffer;
   11717     const xcb_lookup_color_request_t *_aux = (xcb_lookup_color_request_t *)_buffer;
   11718     unsigned int xcb_buffer_len = 0;
   11719     unsigned int xcb_block_len = 0;
   11720     unsigned int xcb_pad = 0;
   11721     unsigned int xcb_align_to = 0;
   11722 
   11723 
   11724     xcb_block_len += sizeof(xcb_lookup_color_request_t);
   11725     xcb_tmp += xcb_block_len;
   11726     xcb_buffer_len += xcb_block_len;
   11727     xcb_block_len = 0;
   11728     /* name */
   11729     xcb_block_len += _aux->name_len * sizeof(char);
   11730     xcb_tmp += xcb_block_len;
   11731     xcb_align_to = ALIGNOF(char);
   11732     /* insert padding */
   11733     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   11734     xcb_buffer_len += xcb_block_len + xcb_pad;
   11735     if (0 != xcb_pad) {
   11736         xcb_tmp += xcb_pad;
   11737         xcb_pad = 0;
   11738     }
   11739     xcb_block_len = 0;
   11740 
   11741     return xcb_buffer_len;
   11742 }
   11743 
   11744 xcb_lookup_color_cookie_t
   11745 xcb_lookup_color (xcb_connection_t *c,
   11746                   xcb_colormap_t    cmap,
   11747                   uint16_t          name_len,
   11748                   const char       *name)
   11749 {
   11750     static const xcb_protocol_request_t xcb_req = {
   11751         .count = 4,
   11752         .ext = 0,
   11753         .opcode = XCB_LOOKUP_COLOR,
   11754         .isvoid = 0
   11755     };
   11756 
   11757     struct iovec xcb_parts[6];
   11758     xcb_lookup_color_cookie_t xcb_ret;
   11759     xcb_lookup_color_request_t xcb_out;
   11760 
   11761     xcb_out.pad0 = 0;
   11762     xcb_out.cmap = cmap;
   11763     xcb_out.name_len = name_len;
   11764     memset(xcb_out.pad1, 0, 2);
   11765 
   11766     xcb_parts[2].iov_base = (char *) &xcb_out;
   11767     xcb_parts[2].iov_len = sizeof(xcb_out);
   11768     xcb_parts[3].iov_base = 0;
   11769     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   11770     /* char name */
   11771     xcb_parts[4].iov_base = (char *) name;
   11772     xcb_parts[4].iov_len = name_len * sizeof(char);
   11773     xcb_parts[5].iov_base = 0;
   11774     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   11775 
   11776     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   11777     return xcb_ret;
   11778 }
   11779 
   11780 xcb_lookup_color_cookie_t
   11781 xcb_lookup_color_unchecked (xcb_connection_t *c,
   11782                             xcb_colormap_t    cmap,
   11783                             uint16_t          name_len,
   11784                             const char       *name)
   11785 {
   11786     static const xcb_protocol_request_t xcb_req = {
   11787         .count = 4,
   11788         .ext = 0,
   11789         .opcode = XCB_LOOKUP_COLOR,
   11790         .isvoid = 0
   11791     };
   11792 
   11793     struct iovec xcb_parts[6];
   11794     xcb_lookup_color_cookie_t xcb_ret;
   11795     xcb_lookup_color_request_t xcb_out;
   11796 
   11797     xcb_out.pad0 = 0;
   11798     xcb_out.cmap = cmap;
   11799     xcb_out.name_len = name_len;
   11800     memset(xcb_out.pad1, 0, 2);
   11801 
   11802     xcb_parts[2].iov_base = (char *) &xcb_out;
   11803     xcb_parts[2].iov_len = sizeof(xcb_out);
   11804     xcb_parts[3].iov_base = 0;
   11805     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   11806     /* char name */
   11807     xcb_parts[4].iov_base = (char *) name;
   11808     xcb_parts[4].iov_len = name_len * sizeof(char);
   11809     xcb_parts[5].iov_base = 0;
   11810     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   11811 
   11812     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   11813     return xcb_ret;
   11814 }
   11815 
   11816 xcb_lookup_color_reply_t *
   11817 xcb_lookup_color_reply (xcb_connection_t           *c,
   11818                         xcb_lookup_color_cookie_t   cookie  /**< */,
   11819                         xcb_generic_error_t       **e)
   11820 {
   11821     return (xcb_lookup_color_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   11822 }
   11823 
   11824 xcb_void_cookie_t
   11825 xcb_create_cursor_checked (xcb_connection_t *c,
   11826                            xcb_cursor_t      cid,
   11827                            xcb_pixmap_t      source,
   11828                            xcb_pixmap_t      mask,
   11829                            uint16_t          fore_red,
   11830                            uint16_t          fore_green,
   11831                            uint16_t          fore_blue,
   11832                            uint16_t          back_red,
   11833                            uint16_t          back_green,
   11834                            uint16_t          back_blue,
   11835                            uint16_t          x,
   11836                            uint16_t          y)
   11837 {
   11838     static const xcb_protocol_request_t xcb_req = {
   11839         .count = 2,
   11840         .ext = 0,
   11841         .opcode = XCB_CREATE_CURSOR,
   11842         .isvoid = 1
   11843     };
   11844 
   11845     struct iovec xcb_parts[4];
   11846     xcb_void_cookie_t xcb_ret;
   11847     xcb_create_cursor_request_t xcb_out;
   11848 
   11849     xcb_out.pad0 = 0;
   11850     xcb_out.cid = cid;
   11851     xcb_out.source = source;
   11852     xcb_out.mask = mask;
   11853     xcb_out.fore_red = fore_red;
   11854     xcb_out.fore_green = fore_green;
   11855     xcb_out.fore_blue = fore_blue;
   11856     xcb_out.back_red = back_red;
   11857     xcb_out.back_green = back_green;
   11858     xcb_out.back_blue = back_blue;
   11859     xcb_out.x = x;
   11860     xcb_out.y = y;
   11861 
   11862     xcb_parts[2].iov_base = (char *) &xcb_out;
   11863     xcb_parts[2].iov_len = sizeof(xcb_out);
   11864     xcb_parts[3].iov_base = 0;
   11865     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   11866 
   11867     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   11868     return xcb_ret;
   11869 }
   11870 
   11871 xcb_void_cookie_t
   11872 xcb_create_cursor (xcb_connection_t *c,
   11873                    xcb_cursor_t      cid,
   11874                    xcb_pixmap_t      source,
   11875                    xcb_pixmap_t      mask,
   11876                    uint16_t          fore_red,
   11877                    uint16_t          fore_green,
   11878                    uint16_t          fore_blue,
   11879                    uint16_t          back_red,
   11880                    uint16_t          back_green,
   11881                    uint16_t          back_blue,
   11882                    uint16_t          x,
   11883                    uint16_t          y)
   11884 {
   11885     static const xcb_protocol_request_t xcb_req = {
   11886         .count = 2,
   11887         .ext = 0,
   11888         .opcode = XCB_CREATE_CURSOR,
   11889         .isvoid = 1
   11890     };
   11891 
   11892     struct iovec xcb_parts[4];
   11893     xcb_void_cookie_t xcb_ret;
   11894     xcb_create_cursor_request_t xcb_out;
   11895 
   11896     xcb_out.pad0 = 0;
   11897     xcb_out.cid = cid;
   11898     xcb_out.source = source;
   11899     xcb_out.mask = mask;
   11900     xcb_out.fore_red = fore_red;
   11901     xcb_out.fore_green = fore_green;
   11902     xcb_out.fore_blue = fore_blue;
   11903     xcb_out.back_red = back_red;
   11904     xcb_out.back_green = back_green;
   11905     xcb_out.back_blue = back_blue;
   11906     xcb_out.x = x;
   11907     xcb_out.y = y;
   11908 
   11909     xcb_parts[2].iov_base = (char *) &xcb_out;
   11910     xcb_parts[2].iov_len = sizeof(xcb_out);
   11911     xcb_parts[3].iov_base = 0;
   11912     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   11913 
   11914     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   11915     return xcb_ret;
   11916 }
   11917 
   11918 xcb_void_cookie_t
   11919 xcb_create_glyph_cursor_checked (xcb_connection_t *c,
   11920                                  xcb_cursor_t      cid,
   11921                                  xcb_font_t        source_font,
   11922                                  xcb_font_t        mask_font,
   11923                                  uint16_t          source_char,
   11924                                  uint16_t          mask_char,
   11925                                  uint16_t          fore_red,
   11926                                  uint16_t          fore_green,
   11927                                  uint16_t          fore_blue,
   11928                                  uint16_t          back_red,
   11929                                  uint16_t          back_green,
   11930                                  uint16_t          back_blue)
   11931 {
   11932     static const xcb_protocol_request_t xcb_req = {
   11933         .count = 2,
   11934         .ext = 0,
   11935         .opcode = XCB_CREATE_GLYPH_CURSOR,
   11936         .isvoid = 1
   11937     };
   11938 
   11939     struct iovec xcb_parts[4];
   11940     xcb_void_cookie_t xcb_ret;
   11941     xcb_create_glyph_cursor_request_t xcb_out;
   11942 
   11943     xcb_out.pad0 = 0;
   11944     xcb_out.cid = cid;
   11945     xcb_out.source_font = source_font;
   11946     xcb_out.mask_font = mask_font;
   11947     xcb_out.source_char = source_char;
   11948     xcb_out.mask_char = mask_char;
   11949     xcb_out.fore_red = fore_red;
   11950     xcb_out.fore_green = fore_green;
   11951     xcb_out.fore_blue = fore_blue;
   11952     xcb_out.back_red = back_red;
   11953     xcb_out.back_green = back_green;
   11954     xcb_out.back_blue = back_blue;
   11955 
   11956     xcb_parts[2].iov_base = (char *) &xcb_out;
   11957     xcb_parts[2].iov_len = sizeof(xcb_out);
   11958     xcb_parts[3].iov_base = 0;
   11959     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   11960 
   11961     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   11962     return xcb_ret;
   11963 }
   11964 
   11965 xcb_void_cookie_t
   11966 xcb_create_glyph_cursor (xcb_connection_t *c,
   11967                          xcb_cursor_t      cid,
   11968                          xcb_font_t        source_font,
   11969                          xcb_font_t        mask_font,
   11970                          uint16_t          source_char,
   11971                          uint16_t          mask_char,
   11972                          uint16_t          fore_red,
   11973                          uint16_t          fore_green,
   11974                          uint16_t          fore_blue,
   11975                          uint16_t          back_red,
   11976                          uint16_t          back_green,
   11977                          uint16_t          back_blue)
   11978 {
   11979     static const xcb_protocol_request_t xcb_req = {
   11980         .count = 2,
   11981         .ext = 0,
   11982         .opcode = XCB_CREATE_GLYPH_CURSOR,
   11983         .isvoid = 1
   11984     };
   11985 
   11986     struct iovec xcb_parts[4];
   11987     xcb_void_cookie_t xcb_ret;
   11988     xcb_create_glyph_cursor_request_t xcb_out;
   11989 
   11990     xcb_out.pad0 = 0;
   11991     xcb_out.cid = cid;
   11992     xcb_out.source_font = source_font;
   11993     xcb_out.mask_font = mask_font;
   11994     xcb_out.source_char = source_char;
   11995     xcb_out.mask_char = mask_char;
   11996     xcb_out.fore_red = fore_red;
   11997     xcb_out.fore_green = fore_green;
   11998     xcb_out.fore_blue = fore_blue;
   11999     xcb_out.back_red = back_red;
   12000     xcb_out.back_green = back_green;
   12001     xcb_out.back_blue = back_blue;
   12002 
   12003     xcb_parts[2].iov_base = (char *) &xcb_out;
   12004     xcb_parts[2].iov_len = sizeof(xcb_out);
   12005     xcb_parts[3].iov_base = 0;
   12006     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   12007 
   12008     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   12009     return xcb_ret;
   12010 }
   12011 
   12012 xcb_void_cookie_t
   12013 xcb_free_cursor_checked (xcb_connection_t *c,
   12014                          xcb_cursor_t      cursor)
   12015 {
   12016     static const xcb_protocol_request_t xcb_req = {
   12017         .count = 2,
   12018         .ext = 0,
   12019         .opcode = XCB_FREE_CURSOR,
   12020         .isvoid = 1
   12021     };
   12022 
   12023     struct iovec xcb_parts[4];
   12024     xcb_void_cookie_t xcb_ret;
   12025     xcb_free_cursor_request_t xcb_out;
   12026 
   12027     xcb_out.pad0 = 0;
   12028     xcb_out.cursor = cursor;
   12029 
   12030     xcb_parts[2].iov_base = (char *) &xcb_out;
   12031     xcb_parts[2].iov_len = sizeof(xcb_out);
   12032     xcb_parts[3].iov_base = 0;
   12033     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   12034 
   12035     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   12036     return xcb_ret;
   12037 }
   12038 
   12039 xcb_void_cookie_t
   12040 xcb_free_cursor (xcb_connection_t *c,
   12041                  xcb_cursor_t      cursor)
   12042 {
   12043     static const xcb_protocol_request_t xcb_req = {
   12044         .count = 2,
   12045         .ext = 0,
   12046         .opcode = XCB_FREE_CURSOR,
   12047         .isvoid = 1
   12048     };
   12049 
   12050     struct iovec xcb_parts[4];
   12051     xcb_void_cookie_t xcb_ret;
   12052     xcb_free_cursor_request_t xcb_out;
   12053 
   12054     xcb_out.pad0 = 0;
   12055     xcb_out.cursor = cursor;
   12056 
   12057     xcb_parts[2].iov_base = (char *) &xcb_out;
   12058     xcb_parts[2].iov_len = sizeof(xcb_out);
   12059     xcb_parts[3].iov_base = 0;
   12060     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   12061 
   12062     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   12063     return xcb_ret;
   12064 }
   12065 
   12066 xcb_void_cookie_t
   12067 xcb_recolor_cursor_checked (xcb_connection_t *c,
   12068                             xcb_cursor_t      cursor,
   12069                             uint16_t          fore_red,
   12070                             uint16_t          fore_green,
   12071                             uint16_t          fore_blue,
   12072                             uint16_t          back_red,
   12073                             uint16_t          back_green,
   12074                             uint16_t          back_blue)
   12075 {
   12076     static const xcb_protocol_request_t xcb_req = {
   12077         .count = 2,
   12078         .ext = 0,
   12079         .opcode = XCB_RECOLOR_CURSOR,
   12080         .isvoid = 1
   12081     };
   12082 
   12083     struct iovec xcb_parts[4];
   12084     xcb_void_cookie_t xcb_ret;
   12085     xcb_recolor_cursor_request_t xcb_out;
   12086 
   12087     xcb_out.pad0 = 0;
   12088     xcb_out.cursor = cursor;
   12089     xcb_out.fore_red = fore_red;
   12090     xcb_out.fore_green = fore_green;
   12091     xcb_out.fore_blue = fore_blue;
   12092     xcb_out.back_red = back_red;
   12093     xcb_out.back_green = back_green;
   12094     xcb_out.back_blue = back_blue;
   12095 
   12096     xcb_parts[2].iov_base = (char *) &xcb_out;
   12097     xcb_parts[2].iov_len = sizeof(xcb_out);
   12098     xcb_parts[3].iov_base = 0;
   12099     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   12100 
   12101     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   12102     return xcb_ret;
   12103 }
   12104 
   12105 xcb_void_cookie_t
   12106 xcb_recolor_cursor (xcb_connection_t *c,
   12107                     xcb_cursor_t      cursor,
   12108                     uint16_t          fore_red,
   12109                     uint16_t          fore_green,
   12110                     uint16_t          fore_blue,
   12111                     uint16_t          back_red,
   12112                     uint16_t          back_green,
   12113                     uint16_t          back_blue)
   12114 {
   12115     static const xcb_protocol_request_t xcb_req = {
   12116         .count = 2,
   12117         .ext = 0,
   12118         .opcode = XCB_RECOLOR_CURSOR,
   12119         .isvoid = 1
   12120     };
   12121 
   12122     struct iovec xcb_parts[4];
   12123     xcb_void_cookie_t xcb_ret;
   12124     xcb_recolor_cursor_request_t xcb_out;
   12125 
   12126     xcb_out.pad0 = 0;
   12127     xcb_out.cursor = cursor;
   12128     xcb_out.fore_red = fore_red;
   12129     xcb_out.fore_green = fore_green;
   12130     xcb_out.fore_blue = fore_blue;
   12131     xcb_out.back_red = back_red;
   12132     xcb_out.back_green = back_green;
   12133     xcb_out.back_blue = back_blue;
   12134 
   12135     xcb_parts[2].iov_base = (char *) &xcb_out;
   12136     xcb_parts[2].iov_len = sizeof(xcb_out);
   12137     xcb_parts[3].iov_base = 0;
   12138     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   12139 
   12140     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   12141     return xcb_ret;
   12142 }
   12143 
   12144 xcb_query_best_size_cookie_t
   12145 xcb_query_best_size (xcb_connection_t *c,
   12146                      uint8_t           _class,
   12147                      xcb_drawable_t    drawable,
   12148                      uint16_t          width,
   12149                      uint16_t          height)
   12150 {
   12151     static const xcb_protocol_request_t xcb_req = {
   12152         .count = 2,
   12153         .ext = 0,
   12154         .opcode = XCB_QUERY_BEST_SIZE,
   12155         .isvoid = 0
   12156     };
   12157 
   12158     struct iovec xcb_parts[4];
   12159     xcb_query_best_size_cookie_t xcb_ret;
   12160     xcb_query_best_size_request_t xcb_out;
   12161 
   12162     xcb_out._class = _class;
   12163     xcb_out.drawable = drawable;
   12164     xcb_out.width = width;
   12165     xcb_out.height = height;
   12166 
   12167     xcb_parts[2].iov_base = (char *) &xcb_out;
   12168     xcb_parts[2].iov_len = sizeof(xcb_out);
   12169     xcb_parts[3].iov_base = 0;
   12170     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   12171 
   12172     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   12173     return xcb_ret;
   12174 }
   12175 
   12176 xcb_query_best_size_cookie_t
   12177 xcb_query_best_size_unchecked (xcb_connection_t *c,
   12178                                uint8_t           _class,
   12179                                xcb_drawable_t    drawable,
   12180                                uint16_t          width,
   12181                                uint16_t          height)
   12182 {
   12183     static const xcb_protocol_request_t xcb_req = {
   12184         .count = 2,
   12185         .ext = 0,
   12186         .opcode = XCB_QUERY_BEST_SIZE,
   12187         .isvoid = 0
   12188     };
   12189 
   12190     struct iovec xcb_parts[4];
   12191     xcb_query_best_size_cookie_t xcb_ret;
   12192     xcb_query_best_size_request_t xcb_out;
   12193 
   12194     xcb_out._class = _class;
   12195     xcb_out.drawable = drawable;
   12196     xcb_out.width = width;
   12197     xcb_out.height = height;
   12198 
   12199     xcb_parts[2].iov_base = (char *) &xcb_out;
   12200     xcb_parts[2].iov_len = sizeof(xcb_out);
   12201     xcb_parts[3].iov_base = 0;
   12202     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   12203 
   12204     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   12205     return xcb_ret;
   12206 }
   12207 
   12208 xcb_query_best_size_reply_t *
   12209 xcb_query_best_size_reply (xcb_connection_t              *c,
   12210                            xcb_query_best_size_cookie_t   cookie  /**< */,
   12211                            xcb_generic_error_t          **e)
   12212 {
   12213     return (xcb_query_best_size_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   12214 }
   12215 
   12216 int
   12217 xcb_query_extension_sizeof (const void  *_buffer)
   12218 {
   12219     char *xcb_tmp = (char *)_buffer;
   12220     const xcb_query_extension_request_t *_aux = (xcb_query_extension_request_t *)_buffer;
   12221     unsigned int xcb_buffer_len = 0;
   12222     unsigned int xcb_block_len = 0;
   12223     unsigned int xcb_pad = 0;
   12224     unsigned int xcb_align_to = 0;
   12225 
   12226 
   12227     xcb_block_len += sizeof(xcb_query_extension_request_t);
   12228     xcb_tmp += xcb_block_len;
   12229     xcb_buffer_len += xcb_block_len;
   12230     xcb_block_len = 0;
   12231     /* name */
   12232     xcb_block_len += _aux->name_len * sizeof(char);
   12233     xcb_tmp += xcb_block_len;
   12234     xcb_align_to = ALIGNOF(char);
   12235     /* insert padding */
   12236     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   12237     xcb_buffer_len += xcb_block_len + xcb_pad;
   12238     if (0 != xcb_pad) {
   12239         xcb_tmp += xcb_pad;
   12240         xcb_pad = 0;
   12241     }
   12242     xcb_block_len = 0;
   12243 
   12244     return xcb_buffer_len;
   12245 }
   12246 
   12247 xcb_query_extension_cookie_t
   12248 xcb_query_extension (xcb_connection_t *c,
   12249                      uint16_t          name_len,
   12250                      const char       *name)
   12251 {
   12252     static const xcb_protocol_request_t xcb_req = {
   12253         .count = 4,
   12254         .ext = 0,
   12255         .opcode = XCB_QUERY_EXTENSION,
   12256         .isvoid = 0
   12257     };
   12258 
   12259     struct iovec xcb_parts[6];
   12260     xcb_query_extension_cookie_t xcb_ret;
   12261     xcb_query_extension_request_t xcb_out;
   12262 
   12263     xcb_out.pad0 = 0;
   12264     xcb_out.name_len = name_len;
   12265     memset(xcb_out.pad1, 0, 2);
   12266 
   12267     xcb_parts[2].iov_base = (char *) &xcb_out;
   12268     xcb_parts[2].iov_len = sizeof(xcb_out);
   12269     xcb_parts[3].iov_base = 0;
   12270     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   12271     /* char name */
   12272     xcb_parts[4].iov_base = (char *) name;
   12273     xcb_parts[4].iov_len = name_len * sizeof(char);
   12274     xcb_parts[5].iov_base = 0;
   12275     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   12276 
   12277     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   12278     return xcb_ret;
   12279 }
   12280 
   12281 xcb_query_extension_cookie_t
   12282 xcb_query_extension_unchecked (xcb_connection_t *c,
   12283                                uint16_t          name_len,
   12284                                const char       *name)
   12285 {
   12286     static const xcb_protocol_request_t xcb_req = {
   12287         .count = 4,
   12288         .ext = 0,
   12289         .opcode = XCB_QUERY_EXTENSION,
   12290         .isvoid = 0
   12291     };
   12292 
   12293     struct iovec xcb_parts[6];
   12294     xcb_query_extension_cookie_t xcb_ret;
   12295     xcb_query_extension_request_t xcb_out;
   12296 
   12297     xcb_out.pad0 = 0;
   12298     xcb_out.name_len = name_len;
   12299     memset(xcb_out.pad1, 0, 2);
   12300 
   12301     xcb_parts[2].iov_base = (char *) &xcb_out;
   12302     xcb_parts[2].iov_len = sizeof(xcb_out);
   12303     xcb_parts[3].iov_base = 0;
   12304     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   12305     /* char name */
   12306     xcb_parts[4].iov_base = (char *) name;
   12307     xcb_parts[4].iov_len = name_len * sizeof(char);
   12308     xcb_parts[5].iov_base = 0;
   12309     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   12310 
   12311     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   12312     return xcb_ret;
   12313 }
   12314 
   12315 xcb_query_extension_reply_t *
   12316 xcb_query_extension_reply (xcb_connection_t              *c,
   12317                            xcb_query_extension_cookie_t   cookie  /**< */,
   12318                            xcb_generic_error_t          **e)
   12319 {
   12320     return (xcb_query_extension_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   12321 }
   12322 
   12323 int
   12324 xcb_list_extensions_sizeof (const void  *_buffer)
   12325 {
   12326     char *xcb_tmp = (char *)_buffer;
   12327     const xcb_list_extensions_reply_t *_aux = (xcb_list_extensions_reply_t *)_buffer;
   12328     unsigned int xcb_buffer_len = 0;
   12329     unsigned int xcb_block_len = 0;
   12330     unsigned int xcb_pad = 0;
   12331     unsigned int xcb_align_to = 0;
   12332 
   12333     unsigned int i;
   12334     unsigned int xcb_tmp_len;
   12335 
   12336     xcb_block_len += sizeof(xcb_list_extensions_reply_t);
   12337     xcb_tmp += xcb_block_len;
   12338     xcb_buffer_len += xcb_block_len;
   12339     xcb_block_len = 0;
   12340     /* names */
   12341     for(i=0; i<_aux->names_len; i++) {
   12342         xcb_tmp_len = xcb_str_sizeof(xcb_tmp);
   12343         xcb_block_len += xcb_tmp_len;
   12344         xcb_tmp += xcb_tmp_len;
   12345     }
   12346     xcb_align_to = ALIGNOF(xcb_str_t);
   12347     /* insert padding */
   12348     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   12349     xcb_buffer_len += xcb_block_len + xcb_pad;
   12350     if (0 != xcb_pad) {
   12351         xcb_tmp += xcb_pad;
   12352         xcb_pad = 0;
   12353     }
   12354     xcb_block_len = 0;
   12355 
   12356     return xcb_buffer_len;
   12357 }
   12358 
   12359 xcb_list_extensions_cookie_t
   12360 xcb_list_extensions (xcb_connection_t *c)
   12361 {
   12362     static const xcb_protocol_request_t xcb_req = {
   12363         .count = 2,
   12364         .ext = 0,
   12365         .opcode = XCB_LIST_EXTENSIONS,
   12366         .isvoid = 0
   12367     };
   12368 
   12369     struct iovec xcb_parts[4];
   12370     xcb_list_extensions_cookie_t xcb_ret;
   12371     xcb_list_extensions_request_t xcb_out;
   12372 
   12373     xcb_out.pad0 = 0;
   12374 
   12375     xcb_parts[2].iov_base = (char *) &xcb_out;
   12376     xcb_parts[2].iov_len = sizeof(xcb_out);
   12377     xcb_parts[3].iov_base = 0;
   12378     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   12379 
   12380     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   12381     return xcb_ret;
   12382 }
   12383 
   12384 xcb_list_extensions_cookie_t
   12385 xcb_list_extensions_unchecked (xcb_connection_t *c)
   12386 {
   12387     static const xcb_protocol_request_t xcb_req = {
   12388         .count = 2,
   12389         .ext = 0,
   12390         .opcode = XCB_LIST_EXTENSIONS,
   12391         .isvoid = 0
   12392     };
   12393 
   12394     struct iovec xcb_parts[4];
   12395     xcb_list_extensions_cookie_t xcb_ret;
   12396     xcb_list_extensions_request_t xcb_out;
   12397 
   12398     xcb_out.pad0 = 0;
   12399 
   12400     xcb_parts[2].iov_base = (char *) &xcb_out;
   12401     xcb_parts[2].iov_len = sizeof(xcb_out);
   12402     xcb_parts[3].iov_base = 0;
   12403     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   12404 
   12405     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   12406     return xcb_ret;
   12407 }
   12408 
   12409 int
   12410 xcb_list_extensions_names_length (const xcb_list_extensions_reply_t *R)
   12411 {
   12412     return R->names_len;
   12413 }
   12414 
   12415 xcb_str_iterator_t
   12416 xcb_list_extensions_names_iterator (const xcb_list_extensions_reply_t *R)
   12417 {
   12418     xcb_str_iterator_t i;
   12419     i.data = (xcb_str_t *) (R + 1);
   12420     i.rem = R->names_len;
   12421     i.index = (char *) i.data - (char *) R;
   12422     return i;
   12423 }
   12424 
   12425 xcb_list_extensions_reply_t *
   12426 xcb_list_extensions_reply (xcb_connection_t              *c,
   12427                            xcb_list_extensions_cookie_t   cookie  /**< */,
   12428                            xcb_generic_error_t          **e)
   12429 {
   12430     return (xcb_list_extensions_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   12431 }
   12432 
   12433 int
   12434 xcb_change_keyboard_mapping_sizeof (const void  *_buffer)
   12435 {
   12436     char *xcb_tmp = (char *)_buffer;
   12437     const xcb_change_keyboard_mapping_request_t *_aux = (xcb_change_keyboard_mapping_request_t *)_buffer;
   12438     unsigned int xcb_buffer_len = 0;
   12439     unsigned int xcb_block_len = 0;
   12440     unsigned int xcb_pad = 0;
   12441     unsigned int xcb_align_to = 0;
   12442 
   12443 
   12444     xcb_block_len += sizeof(xcb_change_keyboard_mapping_request_t);
   12445     xcb_tmp += xcb_block_len;
   12446     xcb_buffer_len += xcb_block_len;
   12447     xcb_block_len = 0;
   12448     /* keysyms */
   12449     xcb_block_len += (_aux->keycode_count * _aux->keysyms_per_keycode) * sizeof(xcb_keysym_t);
   12450     xcb_tmp += xcb_block_len;
   12451     xcb_align_to = ALIGNOF(xcb_keysym_t);
   12452     /* insert padding */
   12453     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   12454     xcb_buffer_len += xcb_block_len + xcb_pad;
   12455     if (0 != xcb_pad) {
   12456         xcb_tmp += xcb_pad;
   12457         xcb_pad = 0;
   12458     }
   12459     xcb_block_len = 0;
   12460 
   12461     return xcb_buffer_len;
   12462 }
   12463 
   12464 xcb_void_cookie_t
   12465 xcb_change_keyboard_mapping_checked (xcb_connection_t   *c,
   12466                                      uint8_t             keycode_count,
   12467                                      xcb_keycode_t       first_keycode,
   12468                                      uint8_t             keysyms_per_keycode,
   12469                                      const xcb_keysym_t *keysyms)
   12470 {
   12471     static const xcb_protocol_request_t xcb_req = {
   12472         .count = 4,
   12473         .ext = 0,
   12474         .opcode = XCB_CHANGE_KEYBOARD_MAPPING,
   12475         .isvoid = 1
   12476     };
   12477 
   12478     struct iovec xcb_parts[6];
   12479     xcb_void_cookie_t xcb_ret;
   12480     xcb_change_keyboard_mapping_request_t xcb_out;
   12481 
   12482     xcb_out.keycode_count = keycode_count;
   12483     xcb_out.first_keycode = first_keycode;
   12484     xcb_out.keysyms_per_keycode = keysyms_per_keycode;
   12485     memset(xcb_out.pad0, 0, 2);
   12486 
   12487     xcb_parts[2].iov_base = (char *) &xcb_out;
   12488     xcb_parts[2].iov_len = sizeof(xcb_out);
   12489     xcb_parts[3].iov_base = 0;
   12490     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   12491     /* xcb_keysym_t keysyms */
   12492     xcb_parts[4].iov_base = (char *) keysyms;
   12493     xcb_parts[4].iov_len = (keycode_count * keysyms_per_keycode) * sizeof(xcb_keysym_t);
   12494     xcb_parts[5].iov_base = 0;
   12495     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   12496 
   12497     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   12498     return xcb_ret;
   12499 }
   12500 
   12501 xcb_void_cookie_t
   12502 xcb_change_keyboard_mapping (xcb_connection_t   *c,
   12503                              uint8_t             keycode_count,
   12504                              xcb_keycode_t       first_keycode,
   12505                              uint8_t             keysyms_per_keycode,
   12506                              const xcb_keysym_t *keysyms)
   12507 {
   12508     static const xcb_protocol_request_t xcb_req = {
   12509         .count = 4,
   12510         .ext = 0,
   12511         .opcode = XCB_CHANGE_KEYBOARD_MAPPING,
   12512         .isvoid = 1
   12513     };
   12514 
   12515     struct iovec xcb_parts[6];
   12516     xcb_void_cookie_t xcb_ret;
   12517     xcb_change_keyboard_mapping_request_t xcb_out;
   12518 
   12519     xcb_out.keycode_count = keycode_count;
   12520     xcb_out.first_keycode = first_keycode;
   12521     xcb_out.keysyms_per_keycode = keysyms_per_keycode;
   12522     memset(xcb_out.pad0, 0, 2);
   12523 
   12524     xcb_parts[2].iov_base = (char *) &xcb_out;
   12525     xcb_parts[2].iov_len = sizeof(xcb_out);
   12526     xcb_parts[3].iov_base = 0;
   12527     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   12528     /* xcb_keysym_t keysyms */
   12529     xcb_parts[4].iov_base = (char *) keysyms;
   12530     xcb_parts[4].iov_len = (keycode_count * keysyms_per_keycode) * sizeof(xcb_keysym_t);
   12531     xcb_parts[5].iov_base = 0;
   12532     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   12533 
   12534     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   12535     return xcb_ret;
   12536 }
   12537 
   12538 xcb_keysym_t *
   12539 xcb_change_keyboard_mapping_keysyms (const xcb_change_keyboard_mapping_request_t *R)
   12540 {
   12541     return (xcb_keysym_t *) (R + 1);
   12542 }
   12543 
   12544 int
   12545 xcb_change_keyboard_mapping_keysyms_length (const xcb_change_keyboard_mapping_request_t *R)
   12546 {
   12547     return (R->keycode_count * R->keysyms_per_keycode);
   12548 }
   12549 
   12550 xcb_generic_iterator_t
   12551 xcb_change_keyboard_mapping_keysyms_end (const xcb_change_keyboard_mapping_request_t *R)
   12552 {
   12553     xcb_generic_iterator_t i;
   12554     i.data = ((xcb_keysym_t *) (R + 1)) + ((R->keycode_count * R->keysyms_per_keycode));
   12555     i.rem = 0;
   12556     i.index = (char *) i.data - (char *) R;
   12557     return i;
   12558 }
   12559 
   12560 int
   12561 xcb_get_keyboard_mapping_sizeof (const void  *_buffer)
   12562 {
   12563     char *xcb_tmp = (char *)_buffer;
   12564     const xcb_get_keyboard_mapping_reply_t *_aux = (xcb_get_keyboard_mapping_reply_t *)_buffer;
   12565     unsigned int xcb_buffer_len = 0;
   12566     unsigned int xcb_block_len = 0;
   12567     unsigned int xcb_pad = 0;
   12568     unsigned int xcb_align_to = 0;
   12569 
   12570 
   12571     xcb_block_len += sizeof(xcb_get_keyboard_mapping_reply_t);
   12572     xcb_tmp += xcb_block_len;
   12573     xcb_buffer_len += xcb_block_len;
   12574     xcb_block_len = 0;
   12575     /* keysyms */
   12576     xcb_block_len += _aux->length * sizeof(xcb_keysym_t);
   12577     xcb_tmp += xcb_block_len;
   12578     xcb_align_to = ALIGNOF(xcb_keysym_t);
   12579     /* insert padding */
   12580     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   12581     xcb_buffer_len += xcb_block_len + xcb_pad;
   12582     if (0 != xcb_pad) {
   12583         xcb_tmp += xcb_pad;
   12584         xcb_pad = 0;
   12585     }
   12586     xcb_block_len = 0;
   12587 
   12588     return xcb_buffer_len;
   12589 }
   12590 
   12591 xcb_get_keyboard_mapping_cookie_t
   12592 xcb_get_keyboard_mapping (xcb_connection_t *c,
   12593                           xcb_keycode_t     first_keycode,
   12594                           uint8_t           count)
   12595 {
   12596     static const xcb_protocol_request_t xcb_req = {
   12597         .count = 2,
   12598         .ext = 0,
   12599         .opcode = XCB_GET_KEYBOARD_MAPPING,
   12600         .isvoid = 0
   12601     };
   12602 
   12603     struct iovec xcb_parts[4];
   12604     xcb_get_keyboard_mapping_cookie_t xcb_ret;
   12605     xcb_get_keyboard_mapping_request_t xcb_out;
   12606 
   12607     xcb_out.pad0 = 0;
   12608     xcb_out.first_keycode = first_keycode;
   12609     xcb_out.count = count;
   12610 
   12611     xcb_parts[2].iov_base = (char *) &xcb_out;
   12612     xcb_parts[2].iov_len = sizeof(xcb_out);
   12613     xcb_parts[3].iov_base = 0;
   12614     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   12615 
   12616     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   12617     return xcb_ret;
   12618 }
   12619 
   12620 xcb_get_keyboard_mapping_cookie_t
   12621 xcb_get_keyboard_mapping_unchecked (xcb_connection_t *c,
   12622                                     xcb_keycode_t     first_keycode,
   12623                                     uint8_t           count)
   12624 {
   12625     static const xcb_protocol_request_t xcb_req = {
   12626         .count = 2,
   12627         .ext = 0,
   12628         .opcode = XCB_GET_KEYBOARD_MAPPING,
   12629         .isvoid = 0
   12630     };
   12631 
   12632     struct iovec xcb_parts[4];
   12633     xcb_get_keyboard_mapping_cookie_t xcb_ret;
   12634     xcb_get_keyboard_mapping_request_t xcb_out;
   12635 
   12636     xcb_out.pad0 = 0;
   12637     xcb_out.first_keycode = first_keycode;
   12638     xcb_out.count = count;
   12639 
   12640     xcb_parts[2].iov_base = (char *) &xcb_out;
   12641     xcb_parts[2].iov_len = sizeof(xcb_out);
   12642     xcb_parts[3].iov_base = 0;
   12643     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   12644 
   12645     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   12646     return xcb_ret;
   12647 }
   12648 
   12649 xcb_keysym_t *
   12650 xcb_get_keyboard_mapping_keysyms (const xcb_get_keyboard_mapping_reply_t *R)
   12651 {
   12652     return (xcb_keysym_t *) (R + 1);
   12653 }
   12654 
   12655 int
   12656 xcb_get_keyboard_mapping_keysyms_length (const xcb_get_keyboard_mapping_reply_t *R)
   12657 {
   12658     return R->length;
   12659 }
   12660 
   12661 xcb_generic_iterator_t
   12662 xcb_get_keyboard_mapping_keysyms_end (const xcb_get_keyboard_mapping_reply_t *R)
   12663 {
   12664     xcb_generic_iterator_t i;
   12665     i.data = ((xcb_keysym_t *) (R + 1)) + (R->length);
   12666     i.rem = 0;
   12667     i.index = (char *) i.data - (char *) R;
   12668     return i;
   12669 }
   12670 
   12671 xcb_get_keyboard_mapping_reply_t *
   12672 xcb_get_keyboard_mapping_reply (xcb_connection_t                   *c,
   12673                                 xcb_get_keyboard_mapping_cookie_t   cookie  /**< */,
   12674                                 xcb_generic_error_t               **e)
   12675 {
   12676     return (xcb_get_keyboard_mapping_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   12677 }
   12678 
   12679 int
   12680 xcb_change_keyboard_control_value_list_serialize (void                                           **_buffer,
   12681                                                   uint32_t                                         value_mask,
   12682                                                   const xcb_change_keyboard_control_value_list_t  *_aux)
   12683 {
   12684     char *xcb_out = *_buffer;
   12685     unsigned int xcb_buffer_len = 0;
   12686     unsigned int xcb_align_to = 0;
   12687     unsigned int xcb_padding_offset = 0;
   12688 
   12689     unsigned int xcb_pad = 0;
   12690     char xcb_pad0[3] = {0, 0, 0};
   12691     struct iovec xcb_parts[9];
   12692     unsigned int xcb_parts_idx = 0;
   12693     unsigned int xcb_block_len = 0;
   12694     unsigned int i;
   12695     char *xcb_tmp;
   12696 
   12697     if(value_mask & XCB_KB_KEY_CLICK_PERCENT) {
   12698         /* xcb_change_keyboard_control_value_list_t.key_click_percent */
   12699         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key_click_percent;
   12700         xcb_block_len += sizeof(int32_t);
   12701         xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t);
   12702         xcb_parts_idx++;
   12703         xcb_align_to = ALIGNOF(int32_t);
   12704     }
   12705     if(value_mask & XCB_KB_BELL_PERCENT) {
   12706         /* xcb_change_keyboard_control_value_list_t.bell_percent */
   12707         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->bell_percent;
   12708         xcb_block_len += sizeof(int32_t);
   12709         xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t);
   12710         xcb_parts_idx++;
   12711         xcb_align_to = ALIGNOF(int32_t);
   12712     }
   12713     if(value_mask & XCB_KB_BELL_PITCH) {
   12714         /* xcb_change_keyboard_control_value_list_t.bell_pitch */
   12715         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->bell_pitch;
   12716         xcb_block_len += sizeof(int32_t);
   12717         xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t);
   12718         xcb_parts_idx++;
   12719         xcb_align_to = ALIGNOF(int32_t);
   12720     }
   12721     if(value_mask & XCB_KB_BELL_DURATION) {
   12722         /* xcb_change_keyboard_control_value_list_t.bell_duration */
   12723         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->bell_duration;
   12724         xcb_block_len += sizeof(int32_t);
   12725         xcb_parts[xcb_parts_idx].iov_len = sizeof(int32_t);
   12726         xcb_parts_idx++;
   12727         xcb_align_to = ALIGNOF(int32_t);
   12728     }
   12729     if(value_mask & XCB_KB_LED) {
   12730         /* xcb_change_keyboard_control_value_list_t.led */
   12731         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->led;
   12732         xcb_block_len += sizeof(uint32_t);
   12733         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   12734         xcb_parts_idx++;
   12735         xcb_align_to = ALIGNOF(uint32_t);
   12736     }
   12737     if(value_mask & XCB_KB_LED_MODE) {
   12738         /* xcb_change_keyboard_control_value_list_t.led_mode */
   12739         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->led_mode;
   12740         xcb_block_len += sizeof(uint32_t);
   12741         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   12742         xcb_parts_idx++;
   12743         xcb_align_to = ALIGNOF(uint32_t);
   12744     }
   12745     if(value_mask & XCB_KB_KEY) {
   12746         /* xcb_change_keyboard_control_value_list_t.key */
   12747         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->key;
   12748         xcb_block_len += sizeof(xcb_keycode32_t);
   12749         xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_keycode32_t);
   12750         xcb_parts_idx++;
   12751         xcb_align_to = ALIGNOF(xcb_keycode32_t);
   12752     }
   12753     if(value_mask & XCB_KB_AUTO_REPEAT_MODE) {
   12754         /* xcb_change_keyboard_control_value_list_t.auto_repeat_mode */
   12755         xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->auto_repeat_mode;
   12756         xcb_block_len += sizeof(uint32_t);
   12757         xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
   12758         xcb_parts_idx++;
   12759         xcb_align_to = ALIGNOF(uint32_t);
   12760     }
   12761     /* insert padding */
   12762     xcb_pad = -(xcb_block_len + xcb_padding_offset) & (xcb_align_to - 1);
   12763     xcb_buffer_len += xcb_block_len + xcb_pad;
   12764     if (0 != xcb_pad) {
   12765         xcb_parts[xcb_parts_idx].iov_base = xcb_pad0;
   12766         xcb_parts[xcb_parts_idx].iov_len = xcb_pad;
   12767         xcb_parts_idx++;
   12768         xcb_pad = 0;
   12769     }
   12770     xcb_block_len = 0;
   12771     xcb_padding_offset = 0;
   12772 
   12773     if (NULL == xcb_out) {
   12774         /* allocate memory */
   12775         xcb_out = malloc(xcb_buffer_len);
   12776         *_buffer = xcb_out;
   12777     }
   12778 
   12779     xcb_tmp = xcb_out;
   12780     for(i=0; i<xcb_parts_idx; i++) {
   12781         if (0 != xcb_parts[i].iov_base && 0 != xcb_parts[i].iov_len)
   12782             memcpy(xcb_tmp, xcb_parts[i].iov_base, xcb_parts[i].iov_len);
   12783         if (0 != xcb_parts[i].iov_len)
   12784             xcb_tmp += xcb_parts[i].iov_len;
   12785     }
   12786 
   12787     return xcb_buffer_len;
   12788 }
   12789 
   12790 int
   12791 xcb_change_keyboard_control_value_list_unpack (const void                                *_buffer,
   12792                                                uint32_t                                   value_mask,
   12793                                                xcb_change_keyboard_control_value_list_t  *_aux)
   12794 {
   12795     char *xcb_tmp = (char *)_buffer;
   12796     unsigned int xcb_buffer_len = 0;
   12797     unsigned int xcb_block_len = 0;
   12798     unsigned int xcb_pad = 0;
   12799     unsigned int xcb_align_to = 0;
   12800     unsigned int xcb_padding_offset = 0;
   12801 
   12802 
   12803     if(value_mask & XCB_KB_KEY_CLICK_PERCENT) {
   12804         /* xcb_change_keyboard_control_value_list_t.key_click_percent */
   12805         _aux->key_click_percent = *(int32_t *)xcb_tmp;
   12806         xcb_block_len += sizeof(int32_t);
   12807         xcb_tmp += sizeof(int32_t);
   12808         xcb_align_to = ALIGNOF(int32_t);
   12809     }
   12810     if(value_mask & XCB_KB_BELL_PERCENT) {
   12811         /* xcb_change_keyboard_control_value_list_t.bell_percent */
   12812         _aux->bell_percent = *(int32_t *)xcb_tmp;
   12813         xcb_block_len += sizeof(int32_t);
   12814         xcb_tmp += sizeof(int32_t);
   12815         xcb_align_to = ALIGNOF(int32_t);
   12816     }
   12817     if(value_mask & XCB_KB_BELL_PITCH) {
   12818         /* xcb_change_keyboard_control_value_list_t.bell_pitch */
   12819         _aux->bell_pitch = *(int32_t *)xcb_tmp;
   12820         xcb_block_len += sizeof(int32_t);
   12821         xcb_tmp += sizeof(int32_t);
   12822         xcb_align_to = ALIGNOF(int32_t);
   12823     }
   12824     if(value_mask & XCB_KB_BELL_DURATION) {
   12825         /* xcb_change_keyboard_control_value_list_t.bell_duration */
   12826         _aux->bell_duration = *(int32_t *)xcb_tmp;
   12827         xcb_block_len += sizeof(int32_t);
   12828         xcb_tmp += sizeof(int32_t);
   12829         xcb_align_to = ALIGNOF(int32_t);
   12830     }
   12831     if(value_mask & XCB_KB_LED) {
   12832         /* xcb_change_keyboard_control_value_list_t.led */
   12833         _aux->led = *(uint32_t *)xcb_tmp;
   12834         xcb_block_len += sizeof(uint32_t);
   12835         xcb_tmp += sizeof(uint32_t);
   12836         xcb_align_to = ALIGNOF(uint32_t);
   12837     }
   12838     if(value_mask & XCB_KB_LED_MODE) {
   12839         /* xcb_change_keyboard_control_value_list_t.led_mode */
   12840         _aux->led_mode = *(uint32_t *)xcb_tmp;
   12841         xcb_block_len += sizeof(uint32_t);
   12842         xcb_tmp += sizeof(uint32_t);
   12843         xcb_align_to = ALIGNOF(uint32_t);
   12844     }
   12845     if(value_mask & XCB_KB_KEY) {
   12846         /* xcb_change_keyboard_control_value_list_t.key */
   12847         _aux->key = *(xcb_keycode32_t *)xcb_tmp;
   12848         xcb_block_len += sizeof(xcb_keycode32_t);
   12849         xcb_tmp += sizeof(xcb_keycode32_t);
   12850         xcb_align_to = ALIGNOF(xcb_keycode32_t);
   12851     }
   12852     if(value_mask & XCB_KB_AUTO_REPEAT_MODE) {
   12853         /* xcb_change_keyboard_control_value_list_t.auto_repeat_mode */
   12854         _aux->auto_repeat_mode = *(uint32_t *)xcb_tmp;
   12855         xcb_block_len += sizeof(uint32_t);
   12856         xcb_tmp += sizeof(uint32_t);
   12857         xcb_align_to = ALIGNOF(uint32_t);
   12858     }
   12859     /* insert padding */
   12860     xcb_pad = -(xcb_block_len + xcb_padding_offset) & (xcb_align_to - 1);
   12861     xcb_buffer_len += xcb_block_len + xcb_pad;
   12862     if (0 != xcb_pad) {
   12863         xcb_tmp += xcb_pad;
   12864         xcb_pad = 0;
   12865     }
   12866     xcb_block_len = 0;
   12867     xcb_padding_offset = 0;
   12868 
   12869     return xcb_buffer_len;
   12870 }
   12871 
   12872 int
   12873 xcb_change_keyboard_control_value_list_sizeof (const void  *_buffer,
   12874                                                uint32_t     value_mask)
   12875 {
   12876     xcb_change_keyboard_control_value_list_t _aux;
   12877     return xcb_change_keyboard_control_value_list_unpack(_buffer, value_mask, &_aux);
   12878 }
   12879 
   12880 int
   12881 xcb_change_keyboard_control_sizeof (const void  *_buffer)
   12882 {
   12883     char *xcb_tmp = (char *)_buffer;
   12884     const xcb_change_keyboard_control_request_t *_aux = (xcb_change_keyboard_control_request_t *)_buffer;
   12885     unsigned int xcb_buffer_len = 0;
   12886     unsigned int xcb_block_len = 0;
   12887     unsigned int xcb_pad = 0;
   12888     unsigned int xcb_align_to = 0;
   12889 
   12890 
   12891     xcb_block_len += sizeof(xcb_change_keyboard_control_request_t);
   12892     xcb_tmp += xcb_block_len;
   12893     xcb_buffer_len += xcb_block_len;
   12894     xcb_block_len = 0;
   12895     /* value_list */
   12896     xcb_block_len += xcb_change_keyboard_control_value_list_sizeof(xcb_tmp, _aux->value_mask);
   12897     xcb_tmp += xcb_block_len;
   12898     xcb_align_to = ALIGNOF(char);
   12899     /* insert padding */
   12900     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   12901     xcb_buffer_len += xcb_block_len + xcb_pad;
   12902     if (0 != xcb_pad) {
   12903         xcb_tmp += xcb_pad;
   12904         xcb_pad = 0;
   12905     }
   12906     xcb_block_len = 0;
   12907 
   12908     return xcb_buffer_len;
   12909 }
   12910 
   12911 xcb_void_cookie_t
   12912 xcb_change_keyboard_control_checked (xcb_connection_t *c,
   12913                                      uint32_t          value_mask,
   12914                                      const void       *value_list)
   12915 {
   12916     static const xcb_protocol_request_t xcb_req = {
   12917         .count = 3,
   12918         .ext = 0,
   12919         .opcode = XCB_CHANGE_KEYBOARD_CONTROL,
   12920         .isvoid = 1
   12921     };
   12922 
   12923     struct iovec xcb_parts[5];
   12924     xcb_void_cookie_t xcb_ret;
   12925     xcb_change_keyboard_control_request_t xcb_out;
   12926 
   12927     xcb_out.pad0 = 0;
   12928     xcb_out.value_mask = value_mask;
   12929 
   12930     xcb_parts[2].iov_base = (char *) &xcb_out;
   12931     xcb_parts[2].iov_len = sizeof(xcb_out);
   12932     xcb_parts[3].iov_base = 0;
   12933     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   12934     /* xcb_change_keyboard_control_value_list_t value_list */
   12935     xcb_parts[4].iov_base = (char *) value_list;
   12936     xcb_parts[4].iov_len =
   12937       xcb_change_keyboard_control_value_list_sizeof (value_list, value_mask);
   12938 
   12939     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   12940     return xcb_ret;
   12941 }
   12942 
   12943 xcb_void_cookie_t
   12944 xcb_change_keyboard_control (xcb_connection_t *c,
   12945                              uint32_t          value_mask,
   12946                              const void       *value_list)
   12947 {
   12948     static const xcb_protocol_request_t xcb_req = {
   12949         .count = 3,
   12950         .ext = 0,
   12951         .opcode = XCB_CHANGE_KEYBOARD_CONTROL,
   12952         .isvoid = 1
   12953     };
   12954 
   12955     struct iovec xcb_parts[5];
   12956     xcb_void_cookie_t xcb_ret;
   12957     xcb_change_keyboard_control_request_t xcb_out;
   12958 
   12959     xcb_out.pad0 = 0;
   12960     xcb_out.value_mask = value_mask;
   12961 
   12962     xcb_parts[2].iov_base = (char *) &xcb_out;
   12963     xcb_parts[2].iov_len = sizeof(xcb_out);
   12964     xcb_parts[3].iov_base = 0;
   12965     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   12966     /* xcb_change_keyboard_control_value_list_t value_list */
   12967     xcb_parts[4].iov_base = (char *) value_list;
   12968     xcb_parts[4].iov_len =
   12969       xcb_change_keyboard_control_value_list_sizeof (value_list, value_mask);
   12970 
   12971     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   12972     return xcb_ret;
   12973 }
   12974 
   12975 xcb_void_cookie_t
   12976 xcb_change_keyboard_control_aux_checked (xcb_connection_t                               *c,
   12977                                          uint32_t                                        value_mask,
   12978                                          const xcb_change_keyboard_control_value_list_t *value_list)
   12979 {
   12980     static const xcb_protocol_request_t xcb_req = {
   12981         .count = 3,
   12982         .ext = 0,
   12983         .opcode = XCB_CHANGE_KEYBOARD_CONTROL,
   12984         .isvoid = 1
   12985     };
   12986 
   12987     struct iovec xcb_parts[5];
   12988     xcb_void_cookie_t xcb_ret;
   12989     xcb_change_keyboard_control_request_t xcb_out;
   12990     void *xcb_aux0 = 0;
   12991 
   12992     xcb_out.pad0 = 0;
   12993     xcb_out.value_mask = value_mask;
   12994 
   12995     xcb_parts[2].iov_base = (char *) &xcb_out;
   12996     xcb_parts[2].iov_len = sizeof(xcb_out);
   12997     xcb_parts[3].iov_base = 0;
   12998     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   12999     /* xcb_change_keyboard_control_value_list_t value_list */
   13000     xcb_parts[4].iov_len =
   13001       xcb_change_keyboard_control_value_list_serialize (&xcb_aux0, value_mask, value_list);
   13002     xcb_parts[4].iov_base = xcb_aux0;
   13003 
   13004     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   13005     free(xcb_aux0);
   13006     return xcb_ret;
   13007 }
   13008 
   13009 xcb_void_cookie_t
   13010 xcb_change_keyboard_control_aux (xcb_connection_t                               *c,
   13011                                  uint32_t                                        value_mask,
   13012                                  const xcb_change_keyboard_control_value_list_t *value_list)
   13013 {
   13014     static const xcb_protocol_request_t xcb_req = {
   13015         .count = 3,
   13016         .ext = 0,
   13017         .opcode = XCB_CHANGE_KEYBOARD_CONTROL,
   13018         .isvoid = 1
   13019     };
   13020 
   13021     struct iovec xcb_parts[5];
   13022     xcb_void_cookie_t xcb_ret;
   13023     xcb_change_keyboard_control_request_t xcb_out;
   13024     void *xcb_aux0 = 0;
   13025 
   13026     xcb_out.pad0 = 0;
   13027     xcb_out.value_mask = value_mask;
   13028 
   13029     xcb_parts[2].iov_base = (char *) &xcb_out;
   13030     xcb_parts[2].iov_len = sizeof(xcb_out);
   13031     xcb_parts[3].iov_base = 0;
   13032     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13033     /* xcb_change_keyboard_control_value_list_t value_list */
   13034     xcb_parts[4].iov_len =
   13035       xcb_change_keyboard_control_value_list_serialize (&xcb_aux0, value_mask, value_list);
   13036     xcb_parts[4].iov_base = xcb_aux0;
   13037 
   13038     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   13039     free(xcb_aux0);
   13040     return xcb_ret;
   13041 }
   13042 
   13043 void *
   13044 xcb_change_keyboard_control_value_list (const xcb_change_keyboard_control_request_t *R)
   13045 {
   13046     return (void *) (R + 1);
   13047 }
   13048 
   13049 xcb_get_keyboard_control_cookie_t
   13050 xcb_get_keyboard_control (xcb_connection_t *c)
   13051 {
   13052     static const xcb_protocol_request_t xcb_req = {
   13053         .count = 2,
   13054         .ext = 0,
   13055         .opcode = XCB_GET_KEYBOARD_CONTROL,
   13056         .isvoid = 0
   13057     };
   13058 
   13059     struct iovec xcb_parts[4];
   13060     xcb_get_keyboard_control_cookie_t xcb_ret;
   13061     xcb_get_keyboard_control_request_t xcb_out;
   13062 
   13063     xcb_out.pad0 = 0;
   13064 
   13065     xcb_parts[2].iov_base = (char *) &xcb_out;
   13066     xcb_parts[2].iov_len = sizeof(xcb_out);
   13067     xcb_parts[3].iov_base = 0;
   13068     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13069 
   13070     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   13071     return xcb_ret;
   13072 }
   13073 
   13074 xcb_get_keyboard_control_cookie_t
   13075 xcb_get_keyboard_control_unchecked (xcb_connection_t *c)
   13076 {
   13077     static const xcb_protocol_request_t xcb_req = {
   13078         .count = 2,
   13079         .ext = 0,
   13080         .opcode = XCB_GET_KEYBOARD_CONTROL,
   13081         .isvoid = 0
   13082     };
   13083 
   13084     struct iovec xcb_parts[4];
   13085     xcb_get_keyboard_control_cookie_t xcb_ret;
   13086     xcb_get_keyboard_control_request_t xcb_out;
   13087 
   13088     xcb_out.pad0 = 0;
   13089 
   13090     xcb_parts[2].iov_base = (char *) &xcb_out;
   13091     xcb_parts[2].iov_len = sizeof(xcb_out);
   13092     xcb_parts[3].iov_base = 0;
   13093     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13094 
   13095     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   13096     return xcb_ret;
   13097 }
   13098 
   13099 xcb_get_keyboard_control_reply_t *
   13100 xcb_get_keyboard_control_reply (xcb_connection_t                   *c,
   13101                                 xcb_get_keyboard_control_cookie_t   cookie  /**< */,
   13102                                 xcb_generic_error_t               **e)
   13103 {
   13104     return (xcb_get_keyboard_control_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   13105 }
   13106 
   13107 xcb_void_cookie_t
   13108 xcb_bell_checked (xcb_connection_t *c,
   13109                   int8_t            percent)
   13110 {
   13111     static const xcb_protocol_request_t xcb_req = {
   13112         .count = 2,
   13113         .ext = 0,
   13114         .opcode = XCB_BELL,
   13115         .isvoid = 1
   13116     };
   13117 
   13118     struct iovec xcb_parts[4];
   13119     xcb_void_cookie_t xcb_ret;
   13120     xcb_bell_request_t xcb_out;
   13121 
   13122     xcb_out.percent = percent;
   13123 
   13124     xcb_parts[2].iov_base = (char *) &xcb_out;
   13125     xcb_parts[2].iov_len = sizeof(xcb_out);
   13126     xcb_parts[3].iov_base = 0;
   13127     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13128 
   13129     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   13130     return xcb_ret;
   13131 }
   13132 
   13133 xcb_void_cookie_t
   13134 xcb_bell (xcb_connection_t *c,
   13135           int8_t            percent)
   13136 {
   13137     static const xcb_protocol_request_t xcb_req = {
   13138         .count = 2,
   13139         .ext = 0,
   13140         .opcode = XCB_BELL,
   13141         .isvoid = 1
   13142     };
   13143 
   13144     struct iovec xcb_parts[4];
   13145     xcb_void_cookie_t xcb_ret;
   13146     xcb_bell_request_t xcb_out;
   13147 
   13148     xcb_out.percent = percent;
   13149 
   13150     xcb_parts[2].iov_base = (char *) &xcb_out;
   13151     xcb_parts[2].iov_len = sizeof(xcb_out);
   13152     xcb_parts[3].iov_base = 0;
   13153     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13154 
   13155     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   13156     return xcb_ret;
   13157 }
   13158 
   13159 xcb_void_cookie_t
   13160 xcb_change_pointer_control_checked (xcb_connection_t *c,
   13161                                     int16_t           acceleration_numerator,
   13162                                     int16_t           acceleration_denominator,
   13163                                     int16_t           threshold,
   13164                                     uint8_t           do_acceleration,
   13165                                     uint8_t           do_threshold)
   13166 {
   13167     static const xcb_protocol_request_t xcb_req = {
   13168         .count = 2,
   13169         .ext = 0,
   13170         .opcode = XCB_CHANGE_POINTER_CONTROL,
   13171         .isvoid = 1
   13172     };
   13173 
   13174     struct iovec xcb_parts[4];
   13175     xcb_void_cookie_t xcb_ret;
   13176     xcb_change_pointer_control_request_t xcb_out;
   13177 
   13178     xcb_out.pad0 = 0;
   13179     xcb_out.acceleration_numerator = acceleration_numerator;
   13180     xcb_out.acceleration_denominator = acceleration_denominator;
   13181     xcb_out.threshold = threshold;
   13182     xcb_out.do_acceleration = do_acceleration;
   13183     xcb_out.do_threshold = do_threshold;
   13184 
   13185     xcb_parts[2].iov_base = (char *) &xcb_out;
   13186     xcb_parts[2].iov_len = sizeof(xcb_out);
   13187     xcb_parts[3].iov_base = 0;
   13188     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13189 
   13190     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   13191     return xcb_ret;
   13192 }
   13193 
   13194 xcb_void_cookie_t
   13195 xcb_change_pointer_control (xcb_connection_t *c,
   13196                             int16_t           acceleration_numerator,
   13197                             int16_t           acceleration_denominator,
   13198                             int16_t           threshold,
   13199                             uint8_t           do_acceleration,
   13200                             uint8_t           do_threshold)
   13201 {
   13202     static const xcb_protocol_request_t xcb_req = {
   13203         .count = 2,
   13204         .ext = 0,
   13205         .opcode = XCB_CHANGE_POINTER_CONTROL,
   13206         .isvoid = 1
   13207     };
   13208 
   13209     struct iovec xcb_parts[4];
   13210     xcb_void_cookie_t xcb_ret;
   13211     xcb_change_pointer_control_request_t xcb_out;
   13212 
   13213     xcb_out.pad0 = 0;
   13214     xcb_out.acceleration_numerator = acceleration_numerator;
   13215     xcb_out.acceleration_denominator = acceleration_denominator;
   13216     xcb_out.threshold = threshold;
   13217     xcb_out.do_acceleration = do_acceleration;
   13218     xcb_out.do_threshold = do_threshold;
   13219 
   13220     xcb_parts[2].iov_base = (char *) &xcb_out;
   13221     xcb_parts[2].iov_len = sizeof(xcb_out);
   13222     xcb_parts[3].iov_base = 0;
   13223     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13224 
   13225     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   13226     return xcb_ret;
   13227 }
   13228 
   13229 xcb_get_pointer_control_cookie_t
   13230 xcb_get_pointer_control (xcb_connection_t *c)
   13231 {
   13232     static const xcb_protocol_request_t xcb_req = {
   13233         .count = 2,
   13234         .ext = 0,
   13235         .opcode = XCB_GET_POINTER_CONTROL,
   13236         .isvoid = 0
   13237     };
   13238 
   13239     struct iovec xcb_parts[4];
   13240     xcb_get_pointer_control_cookie_t xcb_ret;
   13241     xcb_get_pointer_control_request_t xcb_out;
   13242 
   13243     xcb_out.pad0 = 0;
   13244 
   13245     xcb_parts[2].iov_base = (char *) &xcb_out;
   13246     xcb_parts[2].iov_len = sizeof(xcb_out);
   13247     xcb_parts[3].iov_base = 0;
   13248     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13249 
   13250     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   13251     return xcb_ret;
   13252 }
   13253 
   13254 xcb_get_pointer_control_cookie_t
   13255 xcb_get_pointer_control_unchecked (xcb_connection_t *c)
   13256 {
   13257     static const xcb_protocol_request_t xcb_req = {
   13258         .count = 2,
   13259         .ext = 0,
   13260         .opcode = XCB_GET_POINTER_CONTROL,
   13261         .isvoid = 0
   13262     };
   13263 
   13264     struct iovec xcb_parts[4];
   13265     xcb_get_pointer_control_cookie_t xcb_ret;
   13266     xcb_get_pointer_control_request_t xcb_out;
   13267 
   13268     xcb_out.pad0 = 0;
   13269 
   13270     xcb_parts[2].iov_base = (char *) &xcb_out;
   13271     xcb_parts[2].iov_len = sizeof(xcb_out);
   13272     xcb_parts[3].iov_base = 0;
   13273     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13274 
   13275     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   13276     return xcb_ret;
   13277 }
   13278 
   13279 xcb_get_pointer_control_reply_t *
   13280 xcb_get_pointer_control_reply (xcb_connection_t                  *c,
   13281                                xcb_get_pointer_control_cookie_t   cookie  /**< */,
   13282                                xcb_generic_error_t              **e)
   13283 {
   13284     return (xcb_get_pointer_control_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   13285 }
   13286 
   13287 xcb_void_cookie_t
   13288 xcb_set_screen_saver_checked (xcb_connection_t *c,
   13289                               int16_t           timeout,
   13290                               int16_t           interval,
   13291                               uint8_t           prefer_blanking,
   13292                               uint8_t           allow_exposures)
   13293 {
   13294     static const xcb_protocol_request_t xcb_req = {
   13295         .count = 2,
   13296         .ext = 0,
   13297         .opcode = XCB_SET_SCREEN_SAVER,
   13298         .isvoid = 1
   13299     };
   13300 
   13301     struct iovec xcb_parts[4];
   13302     xcb_void_cookie_t xcb_ret;
   13303     xcb_set_screen_saver_request_t xcb_out;
   13304 
   13305     xcb_out.pad0 = 0;
   13306     xcb_out.timeout = timeout;
   13307     xcb_out.interval = interval;
   13308     xcb_out.prefer_blanking = prefer_blanking;
   13309     xcb_out.allow_exposures = allow_exposures;
   13310 
   13311     xcb_parts[2].iov_base = (char *) &xcb_out;
   13312     xcb_parts[2].iov_len = sizeof(xcb_out);
   13313     xcb_parts[3].iov_base = 0;
   13314     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13315 
   13316     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   13317     return xcb_ret;
   13318 }
   13319 
   13320 xcb_void_cookie_t
   13321 xcb_set_screen_saver (xcb_connection_t *c,
   13322                       int16_t           timeout,
   13323                       int16_t           interval,
   13324                       uint8_t           prefer_blanking,
   13325                       uint8_t           allow_exposures)
   13326 {
   13327     static const xcb_protocol_request_t xcb_req = {
   13328         .count = 2,
   13329         .ext = 0,
   13330         .opcode = XCB_SET_SCREEN_SAVER,
   13331         .isvoid = 1
   13332     };
   13333 
   13334     struct iovec xcb_parts[4];
   13335     xcb_void_cookie_t xcb_ret;
   13336     xcb_set_screen_saver_request_t xcb_out;
   13337 
   13338     xcb_out.pad0 = 0;
   13339     xcb_out.timeout = timeout;
   13340     xcb_out.interval = interval;
   13341     xcb_out.prefer_blanking = prefer_blanking;
   13342     xcb_out.allow_exposures = allow_exposures;
   13343 
   13344     xcb_parts[2].iov_base = (char *) &xcb_out;
   13345     xcb_parts[2].iov_len = sizeof(xcb_out);
   13346     xcb_parts[3].iov_base = 0;
   13347     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13348 
   13349     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   13350     return xcb_ret;
   13351 }
   13352 
   13353 xcb_get_screen_saver_cookie_t
   13354 xcb_get_screen_saver (xcb_connection_t *c)
   13355 {
   13356     static const xcb_protocol_request_t xcb_req = {
   13357         .count = 2,
   13358         .ext = 0,
   13359         .opcode = XCB_GET_SCREEN_SAVER,
   13360         .isvoid = 0
   13361     };
   13362 
   13363     struct iovec xcb_parts[4];
   13364     xcb_get_screen_saver_cookie_t xcb_ret;
   13365     xcb_get_screen_saver_request_t xcb_out;
   13366 
   13367     xcb_out.pad0 = 0;
   13368 
   13369     xcb_parts[2].iov_base = (char *) &xcb_out;
   13370     xcb_parts[2].iov_len = sizeof(xcb_out);
   13371     xcb_parts[3].iov_base = 0;
   13372     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13373 
   13374     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   13375     return xcb_ret;
   13376 }
   13377 
   13378 xcb_get_screen_saver_cookie_t
   13379 xcb_get_screen_saver_unchecked (xcb_connection_t *c)
   13380 {
   13381     static const xcb_protocol_request_t xcb_req = {
   13382         .count = 2,
   13383         .ext = 0,
   13384         .opcode = XCB_GET_SCREEN_SAVER,
   13385         .isvoid = 0
   13386     };
   13387 
   13388     struct iovec xcb_parts[4];
   13389     xcb_get_screen_saver_cookie_t xcb_ret;
   13390     xcb_get_screen_saver_request_t xcb_out;
   13391 
   13392     xcb_out.pad0 = 0;
   13393 
   13394     xcb_parts[2].iov_base = (char *) &xcb_out;
   13395     xcb_parts[2].iov_len = sizeof(xcb_out);
   13396     xcb_parts[3].iov_base = 0;
   13397     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13398 
   13399     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   13400     return xcb_ret;
   13401 }
   13402 
   13403 xcb_get_screen_saver_reply_t *
   13404 xcb_get_screen_saver_reply (xcb_connection_t               *c,
   13405                             xcb_get_screen_saver_cookie_t   cookie  /**< */,
   13406                             xcb_generic_error_t           **e)
   13407 {
   13408     return (xcb_get_screen_saver_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   13409 }
   13410 
   13411 int
   13412 xcb_change_hosts_sizeof (const void  *_buffer)
   13413 {
   13414     char *xcb_tmp = (char *)_buffer;
   13415     const xcb_change_hosts_request_t *_aux = (xcb_change_hosts_request_t *)_buffer;
   13416     unsigned int xcb_buffer_len = 0;
   13417     unsigned int xcb_block_len = 0;
   13418     unsigned int xcb_pad = 0;
   13419     unsigned int xcb_align_to = 0;
   13420 
   13421 
   13422     xcb_block_len += sizeof(xcb_change_hosts_request_t);
   13423     xcb_tmp += xcb_block_len;
   13424     xcb_buffer_len += xcb_block_len;
   13425     xcb_block_len = 0;
   13426     /* address */
   13427     xcb_block_len += _aux->address_len * sizeof(uint8_t);
   13428     xcb_tmp += xcb_block_len;
   13429     xcb_align_to = ALIGNOF(uint8_t);
   13430     /* insert padding */
   13431     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   13432     xcb_buffer_len += xcb_block_len + xcb_pad;
   13433     if (0 != xcb_pad) {
   13434         xcb_tmp += xcb_pad;
   13435         xcb_pad = 0;
   13436     }
   13437     xcb_block_len = 0;
   13438 
   13439     return xcb_buffer_len;
   13440 }
   13441 
   13442 xcb_void_cookie_t
   13443 xcb_change_hosts_checked (xcb_connection_t *c,
   13444                           uint8_t           mode,
   13445                           uint8_t           family,
   13446                           uint16_t          address_len,
   13447                           const uint8_t    *address)
   13448 {
   13449     static const xcb_protocol_request_t xcb_req = {
   13450         .count = 4,
   13451         .ext = 0,
   13452         .opcode = XCB_CHANGE_HOSTS,
   13453         .isvoid = 1
   13454     };
   13455 
   13456     struct iovec xcb_parts[6];
   13457     xcb_void_cookie_t xcb_ret;
   13458     xcb_change_hosts_request_t xcb_out;
   13459 
   13460     xcb_out.mode = mode;
   13461     xcb_out.family = family;
   13462     xcb_out.pad0 = 0;
   13463     xcb_out.address_len = address_len;
   13464 
   13465     xcb_parts[2].iov_base = (char *) &xcb_out;
   13466     xcb_parts[2].iov_len = sizeof(xcb_out);
   13467     xcb_parts[3].iov_base = 0;
   13468     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13469     /* uint8_t address */
   13470     xcb_parts[4].iov_base = (char *) address;
   13471     xcb_parts[4].iov_len = address_len * sizeof(uint8_t);
   13472     xcb_parts[5].iov_base = 0;
   13473     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   13474 
   13475     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   13476     return xcb_ret;
   13477 }
   13478 
   13479 xcb_void_cookie_t
   13480 xcb_change_hosts (xcb_connection_t *c,
   13481                   uint8_t           mode,
   13482                   uint8_t           family,
   13483                   uint16_t          address_len,
   13484                   const uint8_t    *address)
   13485 {
   13486     static const xcb_protocol_request_t xcb_req = {
   13487         .count = 4,
   13488         .ext = 0,
   13489         .opcode = XCB_CHANGE_HOSTS,
   13490         .isvoid = 1
   13491     };
   13492 
   13493     struct iovec xcb_parts[6];
   13494     xcb_void_cookie_t xcb_ret;
   13495     xcb_change_hosts_request_t xcb_out;
   13496 
   13497     xcb_out.mode = mode;
   13498     xcb_out.family = family;
   13499     xcb_out.pad0 = 0;
   13500     xcb_out.address_len = address_len;
   13501 
   13502     xcb_parts[2].iov_base = (char *) &xcb_out;
   13503     xcb_parts[2].iov_len = sizeof(xcb_out);
   13504     xcb_parts[3].iov_base = 0;
   13505     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13506     /* uint8_t address */
   13507     xcb_parts[4].iov_base = (char *) address;
   13508     xcb_parts[4].iov_len = address_len * sizeof(uint8_t);
   13509     xcb_parts[5].iov_base = 0;
   13510     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   13511 
   13512     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   13513     return xcb_ret;
   13514 }
   13515 
   13516 uint8_t *
   13517 xcb_change_hosts_address (const xcb_change_hosts_request_t *R)
   13518 {
   13519     return (uint8_t *) (R + 1);
   13520 }
   13521 
   13522 int
   13523 xcb_change_hosts_address_length (const xcb_change_hosts_request_t *R)
   13524 {
   13525     return R->address_len;
   13526 }
   13527 
   13528 xcb_generic_iterator_t
   13529 xcb_change_hosts_address_end (const xcb_change_hosts_request_t *R)
   13530 {
   13531     xcb_generic_iterator_t i;
   13532     i.data = ((uint8_t *) (R + 1)) + (R->address_len);
   13533     i.rem = 0;
   13534     i.index = (char *) i.data - (char *) R;
   13535     return i;
   13536 }
   13537 
   13538 int
   13539 xcb_host_sizeof (const void  *_buffer)
   13540 {
   13541     char *xcb_tmp = (char *)_buffer;
   13542     const xcb_host_t *_aux = (xcb_host_t *)_buffer;
   13543     unsigned int xcb_buffer_len = 0;
   13544     unsigned int xcb_block_len = 0;
   13545     unsigned int xcb_pad = 0;
   13546     unsigned int xcb_align_to = 0;
   13547 
   13548 
   13549     xcb_block_len += sizeof(xcb_host_t);
   13550     xcb_tmp += xcb_block_len;
   13551     xcb_buffer_len += xcb_block_len;
   13552     xcb_block_len = 0;
   13553     /* address */
   13554     xcb_block_len += _aux->address_len * sizeof(uint8_t);
   13555     xcb_tmp += xcb_block_len;
   13556     xcb_align_to = ALIGNOF(uint8_t);
   13557     xcb_align_to = 4;
   13558     /* insert padding */
   13559     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   13560     xcb_buffer_len += xcb_block_len + xcb_pad;
   13561     if (0 != xcb_pad) {
   13562         xcb_tmp += xcb_pad;
   13563         xcb_pad = 0;
   13564     }
   13565     xcb_block_len = 0;
   13566     /* insert padding */
   13567     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   13568     xcb_buffer_len += xcb_block_len + xcb_pad;
   13569     if (0 != xcb_pad) {
   13570         xcb_tmp += xcb_pad;
   13571         xcb_pad = 0;
   13572     }
   13573     xcb_block_len = 0;
   13574 
   13575     return xcb_buffer_len;
   13576 }
   13577 
   13578 uint8_t *
   13579 xcb_host_address (const xcb_host_t *R)
   13580 {
   13581     return (uint8_t *) (R + 1);
   13582 }
   13583 
   13584 int
   13585 xcb_host_address_length (const xcb_host_t *R)
   13586 {
   13587     return R->address_len;
   13588 }
   13589 
   13590 xcb_generic_iterator_t
   13591 xcb_host_address_end (const xcb_host_t *R)
   13592 {
   13593     xcb_generic_iterator_t i;
   13594     i.data = ((uint8_t *) (R + 1)) + (R->address_len);
   13595     i.rem = 0;
   13596     i.index = (char *) i.data - (char *) R;
   13597     return i;
   13598 }
   13599 
   13600 void
   13601 xcb_host_next (xcb_host_iterator_t *i)
   13602 {
   13603     xcb_host_t *R = i->data;
   13604     xcb_generic_iterator_t child;
   13605     child.data = (xcb_host_t *)(((char *)R) + xcb_host_sizeof(R));
   13606     i->index = (char *) child.data - (char *) i->data;
   13607     --i->rem;
   13608     i->data = (xcb_host_t *) child.data;
   13609 }
   13610 
   13611 xcb_generic_iterator_t
   13612 xcb_host_end (xcb_host_iterator_t i)
   13613 {
   13614     xcb_generic_iterator_t ret;
   13615     while(i.rem > 0)
   13616         xcb_host_next(&i);
   13617     ret.data = i.data;
   13618     ret.rem = i.rem;
   13619     ret.index = i.index;
   13620     return ret;
   13621 }
   13622 
   13623 int
   13624 xcb_list_hosts_sizeof (const void  *_buffer)
   13625 {
   13626     char *xcb_tmp = (char *)_buffer;
   13627     const xcb_list_hosts_reply_t *_aux = (xcb_list_hosts_reply_t *)_buffer;
   13628     unsigned int xcb_buffer_len = 0;
   13629     unsigned int xcb_block_len = 0;
   13630     unsigned int xcb_pad = 0;
   13631     unsigned int xcb_align_to = 0;
   13632 
   13633     unsigned int i;
   13634     unsigned int xcb_tmp_len;
   13635 
   13636     xcb_block_len += sizeof(xcb_list_hosts_reply_t);
   13637     xcb_tmp += xcb_block_len;
   13638     xcb_buffer_len += xcb_block_len;
   13639     xcb_block_len = 0;
   13640     /* hosts */
   13641     for(i=0; i<_aux->hosts_len; i++) {
   13642         xcb_tmp_len = xcb_host_sizeof(xcb_tmp);
   13643         xcb_block_len += xcb_tmp_len;
   13644         xcb_tmp += xcb_tmp_len;
   13645     }
   13646     xcb_align_to = ALIGNOF(xcb_host_t);
   13647     /* insert padding */
   13648     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   13649     xcb_buffer_len += xcb_block_len + xcb_pad;
   13650     if (0 != xcb_pad) {
   13651         xcb_tmp += xcb_pad;
   13652         xcb_pad = 0;
   13653     }
   13654     xcb_block_len = 0;
   13655 
   13656     return xcb_buffer_len;
   13657 }
   13658 
   13659 xcb_list_hosts_cookie_t
   13660 xcb_list_hosts (xcb_connection_t *c)
   13661 {
   13662     static const xcb_protocol_request_t xcb_req = {
   13663         .count = 2,
   13664         .ext = 0,
   13665         .opcode = XCB_LIST_HOSTS,
   13666         .isvoid = 0
   13667     };
   13668 
   13669     struct iovec xcb_parts[4];
   13670     xcb_list_hosts_cookie_t xcb_ret;
   13671     xcb_list_hosts_request_t xcb_out;
   13672 
   13673     xcb_out.pad0 = 0;
   13674 
   13675     xcb_parts[2].iov_base = (char *) &xcb_out;
   13676     xcb_parts[2].iov_len = sizeof(xcb_out);
   13677     xcb_parts[3].iov_base = 0;
   13678     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13679 
   13680     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   13681     return xcb_ret;
   13682 }
   13683 
   13684 xcb_list_hosts_cookie_t
   13685 xcb_list_hosts_unchecked (xcb_connection_t *c)
   13686 {
   13687     static const xcb_protocol_request_t xcb_req = {
   13688         .count = 2,
   13689         .ext = 0,
   13690         .opcode = XCB_LIST_HOSTS,
   13691         .isvoid = 0
   13692     };
   13693 
   13694     struct iovec xcb_parts[4];
   13695     xcb_list_hosts_cookie_t xcb_ret;
   13696     xcb_list_hosts_request_t xcb_out;
   13697 
   13698     xcb_out.pad0 = 0;
   13699 
   13700     xcb_parts[2].iov_base = (char *) &xcb_out;
   13701     xcb_parts[2].iov_len = sizeof(xcb_out);
   13702     xcb_parts[3].iov_base = 0;
   13703     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13704 
   13705     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   13706     return xcb_ret;
   13707 }
   13708 
   13709 int
   13710 xcb_list_hosts_hosts_length (const xcb_list_hosts_reply_t *R)
   13711 {
   13712     return R->hosts_len;
   13713 }
   13714 
   13715 xcb_host_iterator_t
   13716 xcb_list_hosts_hosts_iterator (const xcb_list_hosts_reply_t *R)
   13717 {
   13718     xcb_host_iterator_t i;
   13719     i.data = (xcb_host_t *) (R + 1);
   13720     i.rem = R->hosts_len;
   13721     i.index = (char *) i.data - (char *) R;
   13722     return i;
   13723 }
   13724 
   13725 xcb_list_hosts_reply_t *
   13726 xcb_list_hosts_reply (xcb_connection_t         *c,
   13727                       xcb_list_hosts_cookie_t   cookie  /**< */,
   13728                       xcb_generic_error_t     **e)
   13729 {
   13730     return (xcb_list_hosts_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   13731 }
   13732 
   13733 xcb_void_cookie_t
   13734 xcb_set_access_control_checked (xcb_connection_t *c,
   13735                                 uint8_t           mode)
   13736 {
   13737     static const xcb_protocol_request_t xcb_req = {
   13738         .count = 2,
   13739         .ext = 0,
   13740         .opcode = XCB_SET_ACCESS_CONTROL,
   13741         .isvoid = 1
   13742     };
   13743 
   13744     struct iovec xcb_parts[4];
   13745     xcb_void_cookie_t xcb_ret;
   13746     xcb_set_access_control_request_t xcb_out;
   13747 
   13748     xcb_out.mode = mode;
   13749 
   13750     xcb_parts[2].iov_base = (char *) &xcb_out;
   13751     xcb_parts[2].iov_len = sizeof(xcb_out);
   13752     xcb_parts[3].iov_base = 0;
   13753     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13754 
   13755     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   13756     return xcb_ret;
   13757 }
   13758 
   13759 xcb_void_cookie_t
   13760 xcb_set_access_control (xcb_connection_t *c,
   13761                         uint8_t           mode)
   13762 {
   13763     static const xcb_protocol_request_t xcb_req = {
   13764         .count = 2,
   13765         .ext = 0,
   13766         .opcode = XCB_SET_ACCESS_CONTROL,
   13767         .isvoid = 1
   13768     };
   13769 
   13770     struct iovec xcb_parts[4];
   13771     xcb_void_cookie_t xcb_ret;
   13772     xcb_set_access_control_request_t xcb_out;
   13773 
   13774     xcb_out.mode = mode;
   13775 
   13776     xcb_parts[2].iov_base = (char *) &xcb_out;
   13777     xcb_parts[2].iov_len = sizeof(xcb_out);
   13778     xcb_parts[3].iov_base = 0;
   13779     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13780 
   13781     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   13782     return xcb_ret;
   13783 }
   13784 
   13785 xcb_void_cookie_t
   13786 xcb_set_close_down_mode_checked (xcb_connection_t *c,
   13787                                  uint8_t           mode)
   13788 {
   13789     static const xcb_protocol_request_t xcb_req = {
   13790         .count = 2,
   13791         .ext = 0,
   13792         .opcode = XCB_SET_CLOSE_DOWN_MODE,
   13793         .isvoid = 1
   13794     };
   13795 
   13796     struct iovec xcb_parts[4];
   13797     xcb_void_cookie_t xcb_ret;
   13798     xcb_set_close_down_mode_request_t xcb_out;
   13799 
   13800     xcb_out.mode = mode;
   13801 
   13802     xcb_parts[2].iov_base = (char *) &xcb_out;
   13803     xcb_parts[2].iov_len = sizeof(xcb_out);
   13804     xcb_parts[3].iov_base = 0;
   13805     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13806 
   13807     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   13808     return xcb_ret;
   13809 }
   13810 
   13811 xcb_void_cookie_t
   13812 xcb_set_close_down_mode (xcb_connection_t *c,
   13813                          uint8_t           mode)
   13814 {
   13815     static const xcb_protocol_request_t xcb_req = {
   13816         .count = 2,
   13817         .ext = 0,
   13818         .opcode = XCB_SET_CLOSE_DOWN_MODE,
   13819         .isvoid = 1
   13820     };
   13821 
   13822     struct iovec xcb_parts[4];
   13823     xcb_void_cookie_t xcb_ret;
   13824     xcb_set_close_down_mode_request_t xcb_out;
   13825 
   13826     xcb_out.mode = mode;
   13827 
   13828     xcb_parts[2].iov_base = (char *) &xcb_out;
   13829     xcb_parts[2].iov_len = sizeof(xcb_out);
   13830     xcb_parts[3].iov_base = 0;
   13831     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13832 
   13833     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   13834     return xcb_ret;
   13835 }
   13836 
   13837 xcb_void_cookie_t
   13838 xcb_kill_client_checked (xcb_connection_t *c,
   13839                          uint32_t          resource)
   13840 {
   13841     static const xcb_protocol_request_t xcb_req = {
   13842         .count = 2,
   13843         .ext = 0,
   13844         .opcode = XCB_KILL_CLIENT,
   13845         .isvoid = 1
   13846     };
   13847 
   13848     struct iovec xcb_parts[4];
   13849     xcb_void_cookie_t xcb_ret;
   13850     xcb_kill_client_request_t xcb_out;
   13851 
   13852     xcb_out.pad0 = 0;
   13853     xcb_out.resource = resource;
   13854 
   13855     xcb_parts[2].iov_base = (char *) &xcb_out;
   13856     xcb_parts[2].iov_len = sizeof(xcb_out);
   13857     xcb_parts[3].iov_base = 0;
   13858     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13859 
   13860     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   13861     return xcb_ret;
   13862 }
   13863 
   13864 xcb_void_cookie_t
   13865 xcb_kill_client (xcb_connection_t *c,
   13866                  uint32_t          resource)
   13867 {
   13868     static const xcb_protocol_request_t xcb_req = {
   13869         .count = 2,
   13870         .ext = 0,
   13871         .opcode = XCB_KILL_CLIENT,
   13872         .isvoid = 1
   13873     };
   13874 
   13875     struct iovec xcb_parts[4];
   13876     xcb_void_cookie_t xcb_ret;
   13877     xcb_kill_client_request_t xcb_out;
   13878 
   13879     xcb_out.pad0 = 0;
   13880     xcb_out.resource = resource;
   13881 
   13882     xcb_parts[2].iov_base = (char *) &xcb_out;
   13883     xcb_parts[2].iov_len = sizeof(xcb_out);
   13884     xcb_parts[3].iov_base = 0;
   13885     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13886 
   13887     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   13888     return xcb_ret;
   13889 }
   13890 
   13891 int
   13892 xcb_rotate_properties_sizeof (const void  *_buffer)
   13893 {
   13894     char *xcb_tmp = (char *)_buffer;
   13895     const xcb_rotate_properties_request_t *_aux = (xcb_rotate_properties_request_t *)_buffer;
   13896     unsigned int xcb_buffer_len = 0;
   13897     unsigned int xcb_block_len = 0;
   13898     unsigned int xcb_pad = 0;
   13899     unsigned int xcb_align_to = 0;
   13900 
   13901 
   13902     xcb_block_len += sizeof(xcb_rotate_properties_request_t);
   13903     xcb_tmp += xcb_block_len;
   13904     xcb_buffer_len += xcb_block_len;
   13905     xcb_block_len = 0;
   13906     /* atoms */
   13907     xcb_block_len += _aux->atoms_len * sizeof(xcb_atom_t);
   13908     xcb_tmp += xcb_block_len;
   13909     xcb_align_to = ALIGNOF(xcb_atom_t);
   13910     /* insert padding */
   13911     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   13912     xcb_buffer_len += xcb_block_len + xcb_pad;
   13913     if (0 != xcb_pad) {
   13914         xcb_tmp += xcb_pad;
   13915         xcb_pad = 0;
   13916     }
   13917     xcb_block_len = 0;
   13918 
   13919     return xcb_buffer_len;
   13920 }
   13921 
   13922 xcb_void_cookie_t
   13923 xcb_rotate_properties_checked (xcb_connection_t *c,
   13924                                xcb_window_t      window,
   13925                                uint16_t          atoms_len,
   13926                                int16_t           delta,
   13927                                const xcb_atom_t *atoms)
   13928 {
   13929     static const xcb_protocol_request_t xcb_req = {
   13930         .count = 4,
   13931         .ext = 0,
   13932         .opcode = XCB_ROTATE_PROPERTIES,
   13933         .isvoid = 1
   13934     };
   13935 
   13936     struct iovec xcb_parts[6];
   13937     xcb_void_cookie_t xcb_ret;
   13938     xcb_rotate_properties_request_t xcb_out;
   13939 
   13940     xcb_out.pad0 = 0;
   13941     xcb_out.window = window;
   13942     xcb_out.atoms_len = atoms_len;
   13943     xcb_out.delta = delta;
   13944 
   13945     xcb_parts[2].iov_base = (char *) &xcb_out;
   13946     xcb_parts[2].iov_len = sizeof(xcb_out);
   13947     xcb_parts[3].iov_base = 0;
   13948     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13949     /* xcb_atom_t atoms */
   13950     xcb_parts[4].iov_base = (char *) atoms;
   13951     xcb_parts[4].iov_len = atoms_len * sizeof(xcb_atom_t);
   13952     xcb_parts[5].iov_base = 0;
   13953     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   13954 
   13955     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   13956     return xcb_ret;
   13957 }
   13958 
   13959 xcb_void_cookie_t
   13960 xcb_rotate_properties (xcb_connection_t *c,
   13961                        xcb_window_t      window,
   13962                        uint16_t          atoms_len,
   13963                        int16_t           delta,
   13964                        const xcb_atom_t *atoms)
   13965 {
   13966     static const xcb_protocol_request_t xcb_req = {
   13967         .count = 4,
   13968         .ext = 0,
   13969         .opcode = XCB_ROTATE_PROPERTIES,
   13970         .isvoid = 1
   13971     };
   13972 
   13973     struct iovec xcb_parts[6];
   13974     xcb_void_cookie_t xcb_ret;
   13975     xcb_rotate_properties_request_t xcb_out;
   13976 
   13977     xcb_out.pad0 = 0;
   13978     xcb_out.window = window;
   13979     xcb_out.atoms_len = atoms_len;
   13980     xcb_out.delta = delta;
   13981 
   13982     xcb_parts[2].iov_base = (char *) &xcb_out;
   13983     xcb_parts[2].iov_len = sizeof(xcb_out);
   13984     xcb_parts[3].iov_base = 0;
   13985     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   13986     /* xcb_atom_t atoms */
   13987     xcb_parts[4].iov_base = (char *) atoms;
   13988     xcb_parts[4].iov_len = atoms_len * sizeof(xcb_atom_t);
   13989     xcb_parts[5].iov_base = 0;
   13990     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   13991 
   13992     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   13993     return xcb_ret;
   13994 }
   13995 
   13996 xcb_atom_t *
   13997 xcb_rotate_properties_atoms (const xcb_rotate_properties_request_t *R)
   13998 {
   13999     return (xcb_atom_t *) (R + 1);
   14000 }
   14001 
   14002 int
   14003 xcb_rotate_properties_atoms_length (const xcb_rotate_properties_request_t *R)
   14004 {
   14005     return R->atoms_len;
   14006 }
   14007 
   14008 xcb_generic_iterator_t
   14009 xcb_rotate_properties_atoms_end (const xcb_rotate_properties_request_t *R)
   14010 {
   14011     xcb_generic_iterator_t i;
   14012     i.data = ((xcb_atom_t *) (R + 1)) + (R->atoms_len);
   14013     i.rem = 0;
   14014     i.index = (char *) i.data - (char *) R;
   14015     return i;
   14016 }
   14017 
   14018 xcb_void_cookie_t
   14019 xcb_force_screen_saver_checked (xcb_connection_t *c,
   14020                                 uint8_t           mode)
   14021 {
   14022     static const xcb_protocol_request_t xcb_req = {
   14023         .count = 2,
   14024         .ext = 0,
   14025         .opcode = XCB_FORCE_SCREEN_SAVER,
   14026         .isvoid = 1
   14027     };
   14028 
   14029     struct iovec xcb_parts[4];
   14030     xcb_void_cookie_t xcb_ret;
   14031     xcb_force_screen_saver_request_t xcb_out;
   14032 
   14033     xcb_out.mode = mode;
   14034 
   14035     xcb_parts[2].iov_base = (char *) &xcb_out;
   14036     xcb_parts[2].iov_len = sizeof(xcb_out);
   14037     xcb_parts[3].iov_base = 0;
   14038     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   14039 
   14040     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   14041     return xcb_ret;
   14042 }
   14043 
   14044 xcb_void_cookie_t
   14045 xcb_force_screen_saver (xcb_connection_t *c,
   14046                         uint8_t           mode)
   14047 {
   14048     static const xcb_protocol_request_t xcb_req = {
   14049         .count = 2,
   14050         .ext = 0,
   14051         .opcode = XCB_FORCE_SCREEN_SAVER,
   14052         .isvoid = 1
   14053     };
   14054 
   14055     struct iovec xcb_parts[4];
   14056     xcb_void_cookie_t xcb_ret;
   14057     xcb_force_screen_saver_request_t xcb_out;
   14058 
   14059     xcb_out.mode = mode;
   14060 
   14061     xcb_parts[2].iov_base = (char *) &xcb_out;
   14062     xcb_parts[2].iov_len = sizeof(xcb_out);
   14063     xcb_parts[3].iov_base = 0;
   14064     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   14065 
   14066     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   14067     return xcb_ret;
   14068 }
   14069 
   14070 int
   14071 xcb_set_pointer_mapping_sizeof (const void  *_buffer)
   14072 {
   14073     char *xcb_tmp = (char *)_buffer;
   14074     const xcb_set_pointer_mapping_request_t *_aux = (xcb_set_pointer_mapping_request_t *)_buffer;
   14075     unsigned int xcb_buffer_len = 0;
   14076     unsigned int xcb_block_len = 0;
   14077     unsigned int xcb_pad = 0;
   14078     unsigned int xcb_align_to = 0;
   14079 
   14080 
   14081     xcb_block_len += sizeof(xcb_set_pointer_mapping_request_t);
   14082     xcb_tmp += xcb_block_len;
   14083     xcb_buffer_len += xcb_block_len;
   14084     xcb_block_len = 0;
   14085     /* map */
   14086     xcb_block_len += _aux->map_len * sizeof(uint8_t);
   14087     xcb_tmp += xcb_block_len;
   14088     xcb_align_to = ALIGNOF(uint8_t);
   14089     /* insert padding */
   14090     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   14091     xcb_buffer_len += xcb_block_len + xcb_pad;
   14092     if (0 != xcb_pad) {
   14093         xcb_tmp += xcb_pad;
   14094         xcb_pad = 0;
   14095     }
   14096     xcb_block_len = 0;
   14097 
   14098     return xcb_buffer_len;
   14099 }
   14100 
   14101 xcb_set_pointer_mapping_cookie_t
   14102 xcb_set_pointer_mapping (xcb_connection_t *c,
   14103                          uint8_t           map_len,
   14104                          const uint8_t    *map)
   14105 {
   14106     static const xcb_protocol_request_t xcb_req = {
   14107         .count = 4,
   14108         .ext = 0,
   14109         .opcode = XCB_SET_POINTER_MAPPING,
   14110         .isvoid = 0
   14111     };
   14112 
   14113     struct iovec xcb_parts[6];
   14114     xcb_set_pointer_mapping_cookie_t xcb_ret;
   14115     xcb_set_pointer_mapping_request_t xcb_out;
   14116 
   14117     xcb_out.map_len = map_len;
   14118 
   14119     xcb_parts[2].iov_base = (char *) &xcb_out;
   14120     xcb_parts[2].iov_len = sizeof(xcb_out);
   14121     xcb_parts[3].iov_base = 0;
   14122     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   14123     /* uint8_t map */
   14124     xcb_parts[4].iov_base = (char *) map;
   14125     xcb_parts[4].iov_len = map_len * sizeof(uint8_t);
   14126     xcb_parts[5].iov_base = 0;
   14127     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   14128 
   14129     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   14130     return xcb_ret;
   14131 }
   14132 
   14133 xcb_set_pointer_mapping_cookie_t
   14134 xcb_set_pointer_mapping_unchecked (xcb_connection_t *c,
   14135                                    uint8_t           map_len,
   14136                                    const uint8_t    *map)
   14137 {
   14138     static const xcb_protocol_request_t xcb_req = {
   14139         .count = 4,
   14140         .ext = 0,
   14141         .opcode = XCB_SET_POINTER_MAPPING,
   14142         .isvoid = 0
   14143     };
   14144 
   14145     struct iovec xcb_parts[6];
   14146     xcb_set_pointer_mapping_cookie_t xcb_ret;
   14147     xcb_set_pointer_mapping_request_t xcb_out;
   14148 
   14149     xcb_out.map_len = map_len;
   14150 
   14151     xcb_parts[2].iov_base = (char *) &xcb_out;
   14152     xcb_parts[2].iov_len = sizeof(xcb_out);
   14153     xcb_parts[3].iov_base = 0;
   14154     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   14155     /* uint8_t map */
   14156     xcb_parts[4].iov_base = (char *) map;
   14157     xcb_parts[4].iov_len = map_len * sizeof(uint8_t);
   14158     xcb_parts[5].iov_base = 0;
   14159     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   14160 
   14161     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   14162     return xcb_ret;
   14163 }
   14164 
   14165 xcb_set_pointer_mapping_reply_t *
   14166 xcb_set_pointer_mapping_reply (xcb_connection_t                  *c,
   14167                                xcb_set_pointer_mapping_cookie_t   cookie  /**< */,
   14168                                xcb_generic_error_t              **e)
   14169 {
   14170     return (xcb_set_pointer_mapping_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   14171 }
   14172 
   14173 int
   14174 xcb_get_pointer_mapping_sizeof (const void  *_buffer)
   14175 {
   14176     char *xcb_tmp = (char *)_buffer;
   14177     const xcb_get_pointer_mapping_reply_t *_aux = (xcb_get_pointer_mapping_reply_t *)_buffer;
   14178     unsigned int xcb_buffer_len = 0;
   14179     unsigned int xcb_block_len = 0;
   14180     unsigned int xcb_pad = 0;
   14181     unsigned int xcb_align_to = 0;
   14182 
   14183 
   14184     xcb_block_len += sizeof(xcb_get_pointer_mapping_reply_t);
   14185     xcb_tmp += xcb_block_len;
   14186     xcb_buffer_len += xcb_block_len;
   14187     xcb_block_len = 0;
   14188     /* map */
   14189     xcb_block_len += _aux->map_len * sizeof(uint8_t);
   14190     xcb_tmp += xcb_block_len;
   14191     xcb_align_to = ALIGNOF(uint8_t);
   14192     /* insert padding */
   14193     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   14194     xcb_buffer_len += xcb_block_len + xcb_pad;
   14195     if (0 != xcb_pad) {
   14196         xcb_tmp += xcb_pad;
   14197         xcb_pad = 0;
   14198     }
   14199     xcb_block_len = 0;
   14200 
   14201     return xcb_buffer_len;
   14202 }
   14203 
   14204 xcb_get_pointer_mapping_cookie_t
   14205 xcb_get_pointer_mapping (xcb_connection_t *c)
   14206 {
   14207     static const xcb_protocol_request_t xcb_req = {
   14208         .count = 2,
   14209         .ext = 0,
   14210         .opcode = XCB_GET_POINTER_MAPPING,
   14211         .isvoid = 0
   14212     };
   14213 
   14214     struct iovec xcb_parts[4];
   14215     xcb_get_pointer_mapping_cookie_t xcb_ret;
   14216     xcb_get_pointer_mapping_request_t xcb_out;
   14217 
   14218     xcb_out.pad0 = 0;
   14219 
   14220     xcb_parts[2].iov_base = (char *) &xcb_out;
   14221     xcb_parts[2].iov_len = sizeof(xcb_out);
   14222     xcb_parts[3].iov_base = 0;
   14223     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   14224 
   14225     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   14226     return xcb_ret;
   14227 }
   14228 
   14229 xcb_get_pointer_mapping_cookie_t
   14230 xcb_get_pointer_mapping_unchecked (xcb_connection_t *c)
   14231 {
   14232     static const xcb_protocol_request_t xcb_req = {
   14233         .count = 2,
   14234         .ext = 0,
   14235         .opcode = XCB_GET_POINTER_MAPPING,
   14236         .isvoid = 0
   14237     };
   14238 
   14239     struct iovec xcb_parts[4];
   14240     xcb_get_pointer_mapping_cookie_t xcb_ret;
   14241     xcb_get_pointer_mapping_request_t xcb_out;
   14242 
   14243     xcb_out.pad0 = 0;
   14244 
   14245     xcb_parts[2].iov_base = (char *) &xcb_out;
   14246     xcb_parts[2].iov_len = sizeof(xcb_out);
   14247     xcb_parts[3].iov_base = 0;
   14248     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   14249 
   14250     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   14251     return xcb_ret;
   14252 }
   14253 
   14254 uint8_t *
   14255 xcb_get_pointer_mapping_map (const xcb_get_pointer_mapping_reply_t *R)
   14256 {
   14257     return (uint8_t *) (R + 1);
   14258 }
   14259 
   14260 int
   14261 xcb_get_pointer_mapping_map_length (const xcb_get_pointer_mapping_reply_t *R)
   14262 {
   14263     return R->map_len;
   14264 }
   14265 
   14266 xcb_generic_iterator_t
   14267 xcb_get_pointer_mapping_map_end (const xcb_get_pointer_mapping_reply_t *R)
   14268 {
   14269     xcb_generic_iterator_t i;
   14270     i.data = ((uint8_t *) (R + 1)) + (R->map_len);
   14271     i.rem = 0;
   14272     i.index = (char *) i.data - (char *) R;
   14273     return i;
   14274 }
   14275 
   14276 xcb_get_pointer_mapping_reply_t *
   14277 xcb_get_pointer_mapping_reply (xcb_connection_t                  *c,
   14278                                xcb_get_pointer_mapping_cookie_t   cookie  /**< */,
   14279                                xcb_generic_error_t              **e)
   14280 {
   14281     return (xcb_get_pointer_mapping_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   14282 }
   14283 
   14284 int
   14285 xcb_set_modifier_mapping_sizeof (const void  *_buffer)
   14286 {
   14287     char *xcb_tmp = (char *)_buffer;
   14288     const xcb_set_modifier_mapping_request_t *_aux = (xcb_set_modifier_mapping_request_t *)_buffer;
   14289     unsigned int xcb_buffer_len = 0;
   14290     unsigned int xcb_block_len = 0;
   14291     unsigned int xcb_pad = 0;
   14292     unsigned int xcb_align_to = 0;
   14293 
   14294 
   14295     xcb_block_len += sizeof(xcb_set_modifier_mapping_request_t);
   14296     xcb_tmp += xcb_block_len;
   14297     xcb_buffer_len += xcb_block_len;
   14298     xcb_block_len = 0;
   14299     /* keycodes */
   14300     xcb_block_len += (_aux->keycodes_per_modifier * 8) * sizeof(xcb_keycode_t);
   14301     xcb_tmp += xcb_block_len;
   14302     xcb_align_to = ALIGNOF(xcb_keycode_t);
   14303     /* insert padding */
   14304     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   14305     xcb_buffer_len += xcb_block_len + xcb_pad;
   14306     if (0 != xcb_pad) {
   14307         xcb_tmp += xcb_pad;
   14308         xcb_pad = 0;
   14309     }
   14310     xcb_block_len = 0;
   14311 
   14312     return xcb_buffer_len;
   14313 }
   14314 
   14315 xcb_set_modifier_mapping_cookie_t
   14316 xcb_set_modifier_mapping (xcb_connection_t    *c,
   14317                           uint8_t              keycodes_per_modifier,
   14318                           const xcb_keycode_t *keycodes)
   14319 {
   14320     static const xcb_protocol_request_t xcb_req = {
   14321         .count = 4,
   14322         .ext = 0,
   14323         .opcode = XCB_SET_MODIFIER_MAPPING,
   14324         .isvoid = 0
   14325     };
   14326 
   14327     struct iovec xcb_parts[6];
   14328     xcb_set_modifier_mapping_cookie_t xcb_ret;
   14329     xcb_set_modifier_mapping_request_t xcb_out;
   14330 
   14331     xcb_out.keycodes_per_modifier = keycodes_per_modifier;
   14332 
   14333     xcb_parts[2].iov_base = (char *) &xcb_out;
   14334     xcb_parts[2].iov_len = sizeof(xcb_out);
   14335     xcb_parts[3].iov_base = 0;
   14336     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   14337     /* xcb_keycode_t keycodes */
   14338     xcb_parts[4].iov_base = (char *) keycodes;
   14339     xcb_parts[4].iov_len = (keycodes_per_modifier * 8) * sizeof(uint8_t);
   14340     xcb_parts[5].iov_base = 0;
   14341     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   14342 
   14343     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   14344     return xcb_ret;
   14345 }
   14346 
   14347 xcb_set_modifier_mapping_cookie_t
   14348 xcb_set_modifier_mapping_unchecked (xcb_connection_t    *c,
   14349                                     uint8_t              keycodes_per_modifier,
   14350                                     const xcb_keycode_t *keycodes)
   14351 {
   14352     static const xcb_protocol_request_t xcb_req = {
   14353         .count = 4,
   14354         .ext = 0,
   14355         .opcode = XCB_SET_MODIFIER_MAPPING,
   14356         .isvoid = 0
   14357     };
   14358 
   14359     struct iovec xcb_parts[6];
   14360     xcb_set_modifier_mapping_cookie_t xcb_ret;
   14361     xcb_set_modifier_mapping_request_t xcb_out;
   14362 
   14363     xcb_out.keycodes_per_modifier = keycodes_per_modifier;
   14364 
   14365     xcb_parts[2].iov_base = (char *) &xcb_out;
   14366     xcb_parts[2].iov_len = sizeof(xcb_out);
   14367     xcb_parts[3].iov_base = 0;
   14368     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   14369     /* xcb_keycode_t keycodes */
   14370     xcb_parts[4].iov_base = (char *) keycodes;
   14371     xcb_parts[4].iov_len = (keycodes_per_modifier * 8) * sizeof(uint8_t);
   14372     xcb_parts[5].iov_base = 0;
   14373     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
   14374 
   14375     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   14376     return xcb_ret;
   14377 }
   14378 
   14379 xcb_set_modifier_mapping_reply_t *
   14380 xcb_set_modifier_mapping_reply (xcb_connection_t                   *c,
   14381                                 xcb_set_modifier_mapping_cookie_t   cookie  /**< */,
   14382                                 xcb_generic_error_t               **e)
   14383 {
   14384     return (xcb_set_modifier_mapping_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   14385 }
   14386 
   14387 int
   14388 xcb_get_modifier_mapping_sizeof (const void  *_buffer)
   14389 {
   14390     char *xcb_tmp = (char *)_buffer;
   14391     const xcb_get_modifier_mapping_reply_t *_aux = (xcb_get_modifier_mapping_reply_t *)_buffer;
   14392     unsigned int xcb_buffer_len = 0;
   14393     unsigned int xcb_block_len = 0;
   14394     unsigned int xcb_pad = 0;
   14395     unsigned int xcb_align_to = 0;
   14396 
   14397 
   14398     xcb_block_len += sizeof(xcb_get_modifier_mapping_reply_t);
   14399     xcb_tmp += xcb_block_len;
   14400     xcb_buffer_len += xcb_block_len;
   14401     xcb_block_len = 0;
   14402     /* keycodes */
   14403     xcb_block_len += (_aux->keycodes_per_modifier * 8) * sizeof(xcb_keycode_t);
   14404     xcb_tmp += xcb_block_len;
   14405     xcb_align_to = ALIGNOF(xcb_keycode_t);
   14406     /* insert padding */
   14407     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
   14408     xcb_buffer_len += xcb_block_len + xcb_pad;
   14409     if (0 != xcb_pad) {
   14410         xcb_tmp += xcb_pad;
   14411         xcb_pad = 0;
   14412     }
   14413     xcb_block_len = 0;
   14414 
   14415     return xcb_buffer_len;
   14416 }
   14417 
   14418 xcb_get_modifier_mapping_cookie_t
   14419 xcb_get_modifier_mapping (xcb_connection_t *c)
   14420 {
   14421     static const xcb_protocol_request_t xcb_req = {
   14422         .count = 2,
   14423         .ext = 0,
   14424         .opcode = XCB_GET_MODIFIER_MAPPING,
   14425         .isvoid = 0
   14426     };
   14427 
   14428     struct iovec xcb_parts[4];
   14429     xcb_get_modifier_mapping_cookie_t xcb_ret;
   14430     xcb_get_modifier_mapping_request_t xcb_out;
   14431 
   14432     xcb_out.pad0 = 0;
   14433 
   14434     xcb_parts[2].iov_base = (char *) &xcb_out;
   14435     xcb_parts[2].iov_len = sizeof(xcb_out);
   14436     xcb_parts[3].iov_base = 0;
   14437     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   14438 
   14439     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   14440     return xcb_ret;
   14441 }
   14442 
   14443 xcb_get_modifier_mapping_cookie_t
   14444 xcb_get_modifier_mapping_unchecked (xcb_connection_t *c)
   14445 {
   14446     static const xcb_protocol_request_t xcb_req = {
   14447         .count = 2,
   14448         .ext = 0,
   14449         .opcode = XCB_GET_MODIFIER_MAPPING,
   14450         .isvoid = 0
   14451     };
   14452 
   14453     struct iovec xcb_parts[4];
   14454     xcb_get_modifier_mapping_cookie_t xcb_ret;
   14455     xcb_get_modifier_mapping_request_t xcb_out;
   14456 
   14457     xcb_out.pad0 = 0;
   14458 
   14459     xcb_parts[2].iov_base = (char *) &xcb_out;
   14460     xcb_parts[2].iov_len = sizeof(xcb_out);
   14461     xcb_parts[3].iov_base = 0;
   14462     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   14463 
   14464     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   14465     return xcb_ret;
   14466 }
   14467 
   14468 xcb_keycode_t *
   14469 xcb_get_modifier_mapping_keycodes (const xcb_get_modifier_mapping_reply_t *R)
   14470 {
   14471     return (xcb_keycode_t *) (R + 1);
   14472 }
   14473 
   14474 int
   14475 xcb_get_modifier_mapping_keycodes_length (const xcb_get_modifier_mapping_reply_t *R)
   14476 {
   14477     return (R->keycodes_per_modifier * 8);
   14478 }
   14479 
   14480 xcb_generic_iterator_t
   14481 xcb_get_modifier_mapping_keycodes_end (const xcb_get_modifier_mapping_reply_t *R)
   14482 {
   14483     xcb_generic_iterator_t i;
   14484     i.data = ((xcb_keycode_t *) (R + 1)) + ((R->keycodes_per_modifier * 8));
   14485     i.rem = 0;
   14486     i.index = (char *) i.data - (char *) R;
   14487     return i;
   14488 }
   14489 
   14490 xcb_get_modifier_mapping_reply_t *
   14491 xcb_get_modifier_mapping_reply (xcb_connection_t                   *c,
   14492                                 xcb_get_modifier_mapping_cookie_t   cookie  /**< */,
   14493                                 xcb_generic_error_t               **e)
   14494 {
   14495     return (xcb_get_modifier_mapping_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   14496 }
   14497 
   14498 xcb_void_cookie_t
   14499 xcb_no_operation_checked (xcb_connection_t *c)
   14500 {
   14501     static const xcb_protocol_request_t xcb_req = {
   14502         .count = 2,
   14503         .ext = 0,
   14504         .opcode = XCB_NO_OPERATION,
   14505         .isvoid = 1
   14506     };
   14507 
   14508     struct iovec xcb_parts[4];
   14509     xcb_void_cookie_t xcb_ret;
   14510     xcb_no_operation_request_t xcb_out;
   14511 
   14512     xcb_out.pad0 = 0;
   14513 
   14514     xcb_parts[2].iov_base = (char *) &xcb_out;
   14515     xcb_parts[2].iov_len = sizeof(xcb_out);
   14516     xcb_parts[3].iov_base = 0;
   14517     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   14518 
   14519     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
   14520     return xcb_ret;
   14521 }
   14522 
   14523 xcb_void_cookie_t
   14524 xcb_no_operation (xcb_connection_t *c)
   14525 {
   14526     static const xcb_protocol_request_t xcb_req = {
   14527         .count = 2,
   14528         .ext = 0,
   14529         .opcode = XCB_NO_OPERATION,
   14530         .isvoid = 1
   14531     };
   14532 
   14533     struct iovec xcb_parts[4];
   14534     xcb_void_cookie_t xcb_ret;
   14535     xcb_no_operation_request_t xcb_out;
   14536 
   14537     xcb_out.pad0 = 0;
   14538 
   14539     xcb_parts[2].iov_base = (char *) &xcb_out;
   14540     xcb_parts[2].iov_len = sizeof(xcb_out);
   14541     xcb_parts[3].iov_base = 0;
   14542     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
   14543 
   14544     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
   14545     return xcb_ret;
   14546 }
   14547 
   14548