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