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