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