1 /* 2 * This file generated automatically from shape.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 "shape.h" 15 16 #define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) 17 #include "xproto.h" 18 19 xcb_extension_t xcb_shape_id = { "SHAPE", 0 }; 20 21 void 22 xcb_shape_op_next (xcb_shape_op_iterator_t *i) 23 { 24 --i->rem; 25 ++i->data; 26 i->index += sizeof(xcb_shape_op_t); 27 } 28 29 xcb_generic_iterator_t 30 xcb_shape_op_end (xcb_shape_op_iterator_t i) 31 { 32 xcb_generic_iterator_t ret; 33 ret.data = i.data + i.rem; 34 ret.index = i.index + ((char *) ret.data - (char *) i.data); 35 ret.rem = 0; 36 return ret; 37 } 38 39 void 40 xcb_shape_kind_next (xcb_shape_kind_iterator_t *i) 41 { 42 --i->rem; 43 ++i->data; 44 i->index += sizeof(xcb_shape_kind_t); 45 } 46 47 xcb_generic_iterator_t 48 xcb_shape_kind_end (xcb_shape_kind_iterator_t i) 49 { 50 xcb_generic_iterator_t ret; 51 ret.data = i.data + i.rem; 52 ret.index = i.index + ((char *) ret.data - (char *) i.data); 53 ret.rem = 0; 54 return ret; 55 } 56 57 xcb_shape_query_version_cookie_t 58 xcb_shape_query_version (xcb_connection_t *c) 59 { 60 static const xcb_protocol_request_t xcb_req = { 61 .count = 2, 62 .ext = &xcb_shape_id, 63 .opcode = XCB_SHAPE_QUERY_VERSION, 64 .isvoid = 0 65 }; 66 67 struct iovec xcb_parts[4]; 68 xcb_shape_query_version_cookie_t xcb_ret; 69 xcb_shape_query_version_request_t xcb_out; 70 71 72 xcb_parts[2].iov_base = (char *) &xcb_out; 73 xcb_parts[2].iov_len = sizeof(xcb_out); 74 xcb_parts[3].iov_base = 0; 75 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 76 77 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 78 return xcb_ret; 79 } 80 81 xcb_shape_query_version_cookie_t 82 xcb_shape_query_version_unchecked (xcb_connection_t *c) 83 { 84 static const xcb_protocol_request_t xcb_req = { 85 .count = 2, 86 .ext = &xcb_shape_id, 87 .opcode = XCB_SHAPE_QUERY_VERSION, 88 .isvoid = 0 89 }; 90 91 struct iovec xcb_parts[4]; 92 xcb_shape_query_version_cookie_t xcb_ret; 93 xcb_shape_query_version_request_t xcb_out; 94 95 96 xcb_parts[2].iov_base = (char *) &xcb_out; 97 xcb_parts[2].iov_len = sizeof(xcb_out); 98 xcb_parts[3].iov_base = 0; 99 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 100 101 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 102 return xcb_ret; 103 } 104 105 xcb_shape_query_version_reply_t * 106 xcb_shape_query_version_reply (xcb_connection_t *c, 107 xcb_shape_query_version_cookie_t cookie /**< */, 108 xcb_generic_error_t **e) 109 { 110 return (xcb_shape_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 111 } 112 113 int 114 xcb_shape_rectangles_sizeof (const void *_buffer, 115 uint32_t rectangles_len) 116 { 117 char *xcb_tmp = (char *)_buffer; 118 unsigned int xcb_buffer_len = 0; 119 unsigned int xcb_block_len = 0; 120 unsigned int xcb_pad = 0; 121 unsigned int xcb_align_to = 0; 122 123 124 xcb_block_len += sizeof(xcb_shape_rectangles_request_t); 125 xcb_tmp += xcb_block_len; 126 xcb_buffer_len += xcb_block_len; 127 xcb_block_len = 0; 128 /* rectangles */ 129 xcb_block_len += rectangles_len * sizeof(xcb_rectangle_t); 130 xcb_tmp += xcb_block_len; 131 xcb_align_to = ALIGNOF(xcb_rectangle_t); 132 /* insert padding */ 133 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 134 xcb_buffer_len += xcb_block_len + xcb_pad; 135 if (0 != xcb_pad) { 136 xcb_tmp += xcb_pad; 137 xcb_pad = 0; 138 } 139 xcb_block_len = 0; 140 141 return xcb_buffer_len; 142 } 143 144 xcb_void_cookie_t 145 xcb_shape_rectangles_checked (xcb_connection_t *c, 146 xcb_shape_op_t operation, 147 xcb_shape_kind_t destination_kind, 148 uint8_t ordering, 149 xcb_window_t destination_window, 150 int16_t x_offset, 151 int16_t y_offset, 152 uint32_t rectangles_len, 153 const xcb_rectangle_t *rectangles) 154 { 155 static const xcb_protocol_request_t xcb_req = { 156 .count = 4, 157 .ext = &xcb_shape_id, 158 .opcode = XCB_SHAPE_RECTANGLES, 159 .isvoid = 1 160 }; 161 162 struct iovec xcb_parts[6]; 163 xcb_void_cookie_t xcb_ret; 164 xcb_shape_rectangles_request_t xcb_out; 165 166 xcb_out.operation = operation; 167 xcb_out.destination_kind = destination_kind; 168 xcb_out.ordering = ordering; 169 xcb_out.pad0 = 0; 170 xcb_out.destination_window = destination_window; 171 xcb_out.x_offset = x_offset; 172 xcb_out.y_offset = y_offset; 173 174 xcb_parts[2].iov_base = (char *) &xcb_out; 175 xcb_parts[2].iov_len = sizeof(xcb_out); 176 xcb_parts[3].iov_base = 0; 177 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 178 /* xcb_rectangle_t rectangles */ 179 xcb_parts[4].iov_base = (char *) rectangles; 180 xcb_parts[4].iov_len = rectangles_len * sizeof(xcb_rectangle_t); 181 xcb_parts[5].iov_base = 0; 182 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 183 184 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 185 return xcb_ret; 186 } 187 188 xcb_void_cookie_t 189 xcb_shape_rectangles (xcb_connection_t *c, 190 xcb_shape_op_t operation, 191 xcb_shape_kind_t destination_kind, 192 uint8_t ordering, 193 xcb_window_t destination_window, 194 int16_t x_offset, 195 int16_t y_offset, 196 uint32_t rectangles_len, 197 const xcb_rectangle_t *rectangles) 198 { 199 static const xcb_protocol_request_t xcb_req = { 200 .count = 4, 201 .ext = &xcb_shape_id, 202 .opcode = XCB_SHAPE_RECTANGLES, 203 .isvoid = 1 204 }; 205 206 struct iovec xcb_parts[6]; 207 xcb_void_cookie_t xcb_ret; 208 xcb_shape_rectangles_request_t xcb_out; 209 210 xcb_out.operation = operation; 211 xcb_out.destination_kind = destination_kind; 212 xcb_out.ordering = ordering; 213 xcb_out.pad0 = 0; 214 xcb_out.destination_window = destination_window; 215 xcb_out.x_offset = x_offset; 216 xcb_out.y_offset = y_offset; 217 218 xcb_parts[2].iov_base = (char *) &xcb_out; 219 xcb_parts[2].iov_len = sizeof(xcb_out); 220 xcb_parts[3].iov_base = 0; 221 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 222 /* xcb_rectangle_t rectangles */ 223 xcb_parts[4].iov_base = (char *) rectangles; 224 xcb_parts[4].iov_len = rectangles_len * sizeof(xcb_rectangle_t); 225 xcb_parts[5].iov_base = 0; 226 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; 227 228 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 229 return xcb_ret; 230 } 231 232 xcb_rectangle_t * 233 xcb_shape_rectangles_rectangles (const xcb_shape_rectangles_request_t *R) 234 { 235 return (xcb_rectangle_t *) (R + 1); 236 } 237 238 int 239 xcb_shape_rectangles_rectangles_length (const xcb_shape_rectangles_request_t *R) 240 { 241 return (((R->length * 4) - sizeof(xcb_shape_rectangles_request_t))/sizeof(xcb_rectangle_t)); 242 } 243 244 xcb_rectangle_iterator_t 245 xcb_shape_rectangles_rectangles_iterator (const xcb_shape_rectangles_request_t *R) 246 { 247 xcb_rectangle_iterator_t i; 248 i.data = (xcb_rectangle_t *) (R + 1); 249 i.rem = (((R->length * 4) - sizeof(xcb_shape_rectangles_request_t))/sizeof(xcb_rectangle_t)); 250 i.index = (char *) i.data - (char *) R; 251 return i; 252 } 253 254 xcb_void_cookie_t 255 xcb_shape_mask_checked (xcb_connection_t *c, 256 xcb_shape_op_t operation, 257 xcb_shape_kind_t destination_kind, 258 xcb_window_t destination_window, 259 int16_t x_offset, 260 int16_t y_offset, 261 xcb_pixmap_t source_bitmap) 262 { 263 static const xcb_protocol_request_t xcb_req = { 264 .count = 2, 265 .ext = &xcb_shape_id, 266 .opcode = XCB_SHAPE_MASK, 267 .isvoid = 1 268 }; 269 270 struct iovec xcb_parts[4]; 271 xcb_void_cookie_t xcb_ret; 272 xcb_shape_mask_request_t xcb_out; 273 274 xcb_out.operation = operation; 275 xcb_out.destination_kind = destination_kind; 276 memset(xcb_out.pad0, 0, 2); 277 xcb_out.destination_window = destination_window; 278 xcb_out.x_offset = x_offset; 279 xcb_out.y_offset = y_offset; 280 xcb_out.source_bitmap = source_bitmap; 281 282 xcb_parts[2].iov_base = (char *) &xcb_out; 283 xcb_parts[2].iov_len = sizeof(xcb_out); 284 xcb_parts[3].iov_base = 0; 285 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 286 287 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 288 return xcb_ret; 289 } 290 291 xcb_void_cookie_t 292 xcb_shape_mask (xcb_connection_t *c, 293 xcb_shape_op_t operation, 294 xcb_shape_kind_t destination_kind, 295 xcb_window_t destination_window, 296 int16_t x_offset, 297 int16_t y_offset, 298 xcb_pixmap_t source_bitmap) 299 { 300 static const xcb_protocol_request_t xcb_req = { 301 .count = 2, 302 .ext = &xcb_shape_id, 303 .opcode = XCB_SHAPE_MASK, 304 .isvoid = 1 305 }; 306 307 struct iovec xcb_parts[4]; 308 xcb_void_cookie_t xcb_ret; 309 xcb_shape_mask_request_t xcb_out; 310 311 xcb_out.operation = operation; 312 xcb_out.destination_kind = destination_kind; 313 memset(xcb_out.pad0, 0, 2); 314 xcb_out.destination_window = destination_window; 315 xcb_out.x_offset = x_offset; 316 xcb_out.y_offset = y_offset; 317 xcb_out.source_bitmap = source_bitmap; 318 319 xcb_parts[2].iov_base = (char *) &xcb_out; 320 xcb_parts[2].iov_len = sizeof(xcb_out); 321 xcb_parts[3].iov_base = 0; 322 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 323 324 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 325 return xcb_ret; 326 } 327 328 xcb_void_cookie_t 329 xcb_shape_combine_checked (xcb_connection_t *c, 330 xcb_shape_op_t operation, 331 xcb_shape_kind_t destination_kind, 332 xcb_shape_kind_t source_kind, 333 xcb_window_t destination_window, 334 int16_t x_offset, 335 int16_t y_offset, 336 xcb_window_t source_window) 337 { 338 static const xcb_protocol_request_t xcb_req = { 339 .count = 2, 340 .ext = &xcb_shape_id, 341 .opcode = XCB_SHAPE_COMBINE, 342 .isvoid = 1 343 }; 344 345 struct iovec xcb_parts[4]; 346 xcb_void_cookie_t xcb_ret; 347 xcb_shape_combine_request_t xcb_out; 348 349 xcb_out.operation = operation; 350 xcb_out.destination_kind = destination_kind; 351 xcb_out.source_kind = source_kind; 352 xcb_out.pad0 = 0; 353 xcb_out.destination_window = destination_window; 354 xcb_out.x_offset = x_offset; 355 xcb_out.y_offset = y_offset; 356 xcb_out.source_window = source_window; 357 358 xcb_parts[2].iov_base = (char *) &xcb_out; 359 xcb_parts[2].iov_len = sizeof(xcb_out); 360 xcb_parts[3].iov_base = 0; 361 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 362 363 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 364 return xcb_ret; 365 } 366 367 xcb_void_cookie_t 368 xcb_shape_combine (xcb_connection_t *c, 369 xcb_shape_op_t operation, 370 xcb_shape_kind_t destination_kind, 371 xcb_shape_kind_t source_kind, 372 xcb_window_t destination_window, 373 int16_t x_offset, 374 int16_t y_offset, 375 xcb_window_t source_window) 376 { 377 static const xcb_protocol_request_t xcb_req = { 378 .count = 2, 379 .ext = &xcb_shape_id, 380 .opcode = XCB_SHAPE_COMBINE, 381 .isvoid = 1 382 }; 383 384 struct iovec xcb_parts[4]; 385 xcb_void_cookie_t xcb_ret; 386 xcb_shape_combine_request_t xcb_out; 387 388 xcb_out.operation = operation; 389 xcb_out.destination_kind = destination_kind; 390 xcb_out.source_kind = source_kind; 391 xcb_out.pad0 = 0; 392 xcb_out.destination_window = destination_window; 393 xcb_out.x_offset = x_offset; 394 xcb_out.y_offset = y_offset; 395 xcb_out.source_window = source_window; 396 397 xcb_parts[2].iov_base = (char *) &xcb_out; 398 xcb_parts[2].iov_len = sizeof(xcb_out); 399 xcb_parts[3].iov_base = 0; 400 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 401 402 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 403 return xcb_ret; 404 } 405 406 xcb_void_cookie_t 407 xcb_shape_offset_checked (xcb_connection_t *c, 408 xcb_shape_kind_t destination_kind, 409 xcb_window_t destination_window, 410 int16_t x_offset, 411 int16_t y_offset) 412 { 413 static const xcb_protocol_request_t xcb_req = { 414 .count = 2, 415 .ext = &xcb_shape_id, 416 .opcode = XCB_SHAPE_OFFSET, 417 .isvoid = 1 418 }; 419 420 struct iovec xcb_parts[4]; 421 xcb_void_cookie_t xcb_ret; 422 xcb_shape_offset_request_t xcb_out; 423 424 xcb_out.destination_kind = destination_kind; 425 memset(xcb_out.pad0, 0, 3); 426 xcb_out.destination_window = destination_window; 427 xcb_out.x_offset = x_offset; 428 xcb_out.y_offset = y_offset; 429 430 xcb_parts[2].iov_base = (char *) &xcb_out; 431 xcb_parts[2].iov_len = sizeof(xcb_out); 432 xcb_parts[3].iov_base = 0; 433 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 434 435 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 436 return xcb_ret; 437 } 438 439 xcb_void_cookie_t 440 xcb_shape_offset (xcb_connection_t *c, 441 xcb_shape_kind_t destination_kind, 442 xcb_window_t destination_window, 443 int16_t x_offset, 444 int16_t y_offset) 445 { 446 static const xcb_protocol_request_t xcb_req = { 447 .count = 2, 448 .ext = &xcb_shape_id, 449 .opcode = XCB_SHAPE_OFFSET, 450 .isvoid = 1 451 }; 452 453 struct iovec xcb_parts[4]; 454 xcb_void_cookie_t xcb_ret; 455 xcb_shape_offset_request_t xcb_out; 456 457 xcb_out.destination_kind = destination_kind; 458 memset(xcb_out.pad0, 0, 3); 459 xcb_out.destination_window = destination_window; 460 xcb_out.x_offset = x_offset; 461 xcb_out.y_offset = y_offset; 462 463 xcb_parts[2].iov_base = (char *) &xcb_out; 464 xcb_parts[2].iov_len = sizeof(xcb_out); 465 xcb_parts[3].iov_base = 0; 466 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 467 468 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 469 return xcb_ret; 470 } 471 472 xcb_shape_query_extents_cookie_t 473 xcb_shape_query_extents (xcb_connection_t *c, 474 xcb_window_t destination_window) 475 { 476 static const xcb_protocol_request_t xcb_req = { 477 .count = 2, 478 .ext = &xcb_shape_id, 479 .opcode = XCB_SHAPE_QUERY_EXTENTS, 480 .isvoid = 0 481 }; 482 483 struct iovec xcb_parts[4]; 484 xcb_shape_query_extents_cookie_t xcb_ret; 485 xcb_shape_query_extents_request_t xcb_out; 486 487 xcb_out.destination_window = destination_window; 488 489 xcb_parts[2].iov_base = (char *) &xcb_out; 490 xcb_parts[2].iov_len = sizeof(xcb_out); 491 xcb_parts[3].iov_base = 0; 492 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 493 494 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 495 return xcb_ret; 496 } 497 498 xcb_shape_query_extents_cookie_t 499 xcb_shape_query_extents_unchecked (xcb_connection_t *c, 500 xcb_window_t destination_window) 501 { 502 static const xcb_protocol_request_t xcb_req = { 503 .count = 2, 504 .ext = &xcb_shape_id, 505 .opcode = XCB_SHAPE_QUERY_EXTENTS, 506 .isvoid = 0 507 }; 508 509 struct iovec xcb_parts[4]; 510 xcb_shape_query_extents_cookie_t xcb_ret; 511 xcb_shape_query_extents_request_t xcb_out; 512 513 xcb_out.destination_window = destination_window; 514 515 xcb_parts[2].iov_base = (char *) &xcb_out; 516 xcb_parts[2].iov_len = sizeof(xcb_out); 517 xcb_parts[3].iov_base = 0; 518 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 519 520 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 521 return xcb_ret; 522 } 523 524 xcb_shape_query_extents_reply_t * 525 xcb_shape_query_extents_reply (xcb_connection_t *c, 526 xcb_shape_query_extents_cookie_t cookie /**< */, 527 xcb_generic_error_t **e) 528 { 529 return (xcb_shape_query_extents_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 530 } 531 532 xcb_void_cookie_t 533 xcb_shape_select_input_checked (xcb_connection_t *c, 534 xcb_window_t destination_window, 535 uint8_t enable) 536 { 537 static const xcb_protocol_request_t xcb_req = { 538 .count = 2, 539 .ext = &xcb_shape_id, 540 .opcode = XCB_SHAPE_SELECT_INPUT, 541 .isvoid = 1 542 }; 543 544 struct iovec xcb_parts[4]; 545 xcb_void_cookie_t xcb_ret; 546 xcb_shape_select_input_request_t xcb_out; 547 548 xcb_out.destination_window = destination_window; 549 xcb_out.enable = enable; 550 memset(xcb_out.pad0, 0, 3); 551 552 xcb_parts[2].iov_base = (char *) &xcb_out; 553 xcb_parts[2].iov_len = sizeof(xcb_out); 554 xcb_parts[3].iov_base = 0; 555 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 556 557 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 558 return xcb_ret; 559 } 560 561 xcb_void_cookie_t 562 xcb_shape_select_input (xcb_connection_t *c, 563 xcb_window_t destination_window, 564 uint8_t enable) 565 { 566 static const xcb_protocol_request_t xcb_req = { 567 .count = 2, 568 .ext = &xcb_shape_id, 569 .opcode = XCB_SHAPE_SELECT_INPUT, 570 .isvoid = 1 571 }; 572 573 struct iovec xcb_parts[4]; 574 xcb_void_cookie_t xcb_ret; 575 xcb_shape_select_input_request_t xcb_out; 576 577 xcb_out.destination_window = destination_window; 578 xcb_out.enable = enable; 579 memset(xcb_out.pad0, 0, 3); 580 581 xcb_parts[2].iov_base = (char *) &xcb_out; 582 xcb_parts[2].iov_len = sizeof(xcb_out); 583 xcb_parts[3].iov_base = 0; 584 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 585 586 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 587 return xcb_ret; 588 } 589 590 xcb_shape_input_selected_cookie_t 591 xcb_shape_input_selected (xcb_connection_t *c, 592 xcb_window_t destination_window) 593 { 594 static const xcb_protocol_request_t xcb_req = { 595 .count = 2, 596 .ext = &xcb_shape_id, 597 .opcode = XCB_SHAPE_INPUT_SELECTED, 598 .isvoid = 0 599 }; 600 601 struct iovec xcb_parts[4]; 602 xcb_shape_input_selected_cookie_t xcb_ret; 603 xcb_shape_input_selected_request_t xcb_out; 604 605 xcb_out.destination_window = destination_window; 606 607 xcb_parts[2].iov_base = (char *) &xcb_out; 608 xcb_parts[2].iov_len = sizeof(xcb_out); 609 xcb_parts[3].iov_base = 0; 610 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 611 612 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 613 return xcb_ret; 614 } 615 616 xcb_shape_input_selected_cookie_t 617 xcb_shape_input_selected_unchecked (xcb_connection_t *c, 618 xcb_window_t destination_window) 619 { 620 static const xcb_protocol_request_t xcb_req = { 621 .count = 2, 622 .ext = &xcb_shape_id, 623 .opcode = XCB_SHAPE_INPUT_SELECTED, 624 .isvoid = 0 625 }; 626 627 struct iovec xcb_parts[4]; 628 xcb_shape_input_selected_cookie_t xcb_ret; 629 xcb_shape_input_selected_request_t xcb_out; 630 631 xcb_out.destination_window = destination_window; 632 633 xcb_parts[2].iov_base = (char *) &xcb_out; 634 xcb_parts[2].iov_len = sizeof(xcb_out); 635 xcb_parts[3].iov_base = 0; 636 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 637 638 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 639 return xcb_ret; 640 } 641 642 xcb_shape_input_selected_reply_t * 643 xcb_shape_input_selected_reply (xcb_connection_t *c, 644 xcb_shape_input_selected_cookie_t cookie /**< */, 645 xcb_generic_error_t **e) 646 { 647 return (xcb_shape_input_selected_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 648 } 649 650 int 651 xcb_shape_get_rectangles_sizeof (const void *_buffer) 652 { 653 char *xcb_tmp = (char *)_buffer; 654 const xcb_shape_get_rectangles_reply_t *_aux = (xcb_shape_get_rectangles_reply_t *)_buffer; 655 unsigned int xcb_buffer_len = 0; 656 unsigned int xcb_block_len = 0; 657 unsigned int xcb_pad = 0; 658 unsigned int xcb_align_to = 0; 659 660 661 xcb_block_len += sizeof(xcb_shape_get_rectangles_reply_t); 662 xcb_tmp += xcb_block_len; 663 xcb_buffer_len += xcb_block_len; 664 xcb_block_len = 0; 665 /* rectangles */ 666 xcb_block_len += _aux->rectangles_len * sizeof(xcb_rectangle_t); 667 xcb_tmp += xcb_block_len; 668 xcb_align_to = ALIGNOF(xcb_rectangle_t); 669 /* insert padding */ 670 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 671 xcb_buffer_len += xcb_block_len + xcb_pad; 672 if (0 != xcb_pad) { 673 xcb_tmp += xcb_pad; 674 xcb_pad = 0; 675 } 676 xcb_block_len = 0; 677 678 return xcb_buffer_len; 679 } 680 681 xcb_shape_get_rectangles_cookie_t 682 xcb_shape_get_rectangles (xcb_connection_t *c, 683 xcb_window_t window, 684 xcb_shape_kind_t source_kind) 685 { 686 static const xcb_protocol_request_t xcb_req = { 687 .count = 2, 688 .ext = &xcb_shape_id, 689 .opcode = XCB_SHAPE_GET_RECTANGLES, 690 .isvoid = 0 691 }; 692 693 struct iovec xcb_parts[4]; 694 xcb_shape_get_rectangles_cookie_t xcb_ret; 695 xcb_shape_get_rectangles_request_t xcb_out; 696 697 xcb_out.window = window; 698 xcb_out.source_kind = source_kind; 699 memset(xcb_out.pad0, 0, 3); 700 701 xcb_parts[2].iov_base = (char *) &xcb_out; 702 xcb_parts[2].iov_len = sizeof(xcb_out); 703 xcb_parts[3].iov_base = 0; 704 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 705 706 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 707 return xcb_ret; 708 } 709 710 xcb_shape_get_rectangles_cookie_t 711 xcb_shape_get_rectangles_unchecked (xcb_connection_t *c, 712 xcb_window_t window, 713 xcb_shape_kind_t source_kind) 714 { 715 static const xcb_protocol_request_t xcb_req = { 716 .count = 2, 717 .ext = &xcb_shape_id, 718 .opcode = XCB_SHAPE_GET_RECTANGLES, 719 .isvoid = 0 720 }; 721 722 struct iovec xcb_parts[4]; 723 xcb_shape_get_rectangles_cookie_t xcb_ret; 724 xcb_shape_get_rectangles_request_t xcb_out; 725 726 xcb_out.window = window; 727 xcb_out.source_kind = source_kind; 728 memset(xcb_out.pad0, 0, 3); 729 730 xcb_parts[2].iov_base = (char *) &xcb_out; 731 xcb_parts[2].iov_len = sizeof(xcb_out); 732 xcb_parts[3].iov_base = 0; 733 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 734 735 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 736 return xcb_ret; 737 } 738 739 xcb_rectangle_t * 740 xcb_shape_get_rectangles_rectangles (const xcb_shape_get_rectangles_reply_t *R) 741 { 742 return (xcb_rectangle_t *) (R + 1); 743 } 744 745 int 746 xcb_shape_get_rectangles_rectangles_length (const xcb_shape_get_rectangles_reply_t *R) 747 { 748 return R->rectangles_len; 749 } 750 751 xcb_rectangle_iterator_t 752 xcb_shape_get_rectangles_rectangles_iterator (const xcb_shape_get_rectangles_reply_t *R) 753 { 754 xcb_rectangle_iterator_t i; 755 i.data = (xcb_rectangle_t *) (R + 1); 756 i.rem = R->rectangles_len; 757 i.index = (char *) i.data - (char *) R; 758 return i; 759 } 760 761 xcb_shape_get_rectangles_reply_t * 762 xcb_shape_get_rectangles_reply (xcb_connection_t *c, 763 xcb_shape_get_rectangles_cookie_t cookie /**< */, 764 xcb_generic_error_t **e) 765 { 766 return (xcb_shape_get_rectangles_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 767 } 768 769