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