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