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
xcb_shape_op_next(xcb_shape_op_iterator_t * i)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
xcb_shape_op_end(xcb_shape_op_iterator_t i)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
xcb_shape_kind_next(xcb_shape_kind_iterator_t * i)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
xcb_shape_kind_end(xcb_shape_kind_iterator_t i)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
xcb_shape_query_version(xcb_connection_t * c)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
xcb_shape_query_version_unchecked(xcb_connection_t * c)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 *
xcb_shape_query_version_reply(xcb_connection_t * c,xcb_shape_query_version_cookie_t cookie,xcb_generic_error_t ** e)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
xcb_shape_rectangles_sizeof(const void * _buffer,uint32_t rectangles_len)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
xcb_shape_rectangles_checked(xcb_connection_t * c,xcb_shape_op_t operation,xcb_shape_kind_t destination_kind,uint8_t ordering,xcb_window_t destination_window,int16_t x_offset,int16_t y_offset,uint32_t rectangles_len,const xcb_rectangle_t * rectangles)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
xcb_shape_rectangles(xcb_connection_t * c,xcb_shape_op_t operation,xcb_shape_kind_t destination_kind,uint8_t ordering,xcb_window_t destination_window,int16_t x_offset,int16_t y_offset,uint32_t rectangles_len,const xcb_rectangle_t * rectangles)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_void_cookie_t
xcb_shape_mask_checked(xcb_connection_t * c,xcb_shape_op_t operation,xcb_shape_kind_t destination_kind,xcb_window_t destination_window,int16_t x_offset,int16_t y_offset,xcb_pixmap_t source_bitmap)233 xcb_shape_mask_checked (xcb_connection_t *c /**< */,
234 xcb_shape_op_t operation /**< */,
235 xcb_shape_kind_t destination_kind /**< */,
236 xcb_window_t destination_window /**< */,
237 int16_t x_offset /**< */,
238 int16_t y_offset /**< */,
239 xcb_pixmap_t source_bitmap /**< */)
240 {
241 static const xcb_protocol_request_t xcb_req = {
242 /* count */ 2,
243 /* ext */ &xcb_shape_id,
244 /* opcode */ XCB_SHAPE_MASK,
245 /* isvoid */ 1
246 };
247
248 struct iovec xcb_parts[4];
249 xcb_void_cookie_t xcb_ret;
250 xcb_shape_mask_request_t xcb_out;
251
252 xcb_out.operation = operation;
253 xcb_out.destination_kind = destination_kind;
254 memset(xcb_out.pad0, 0, 2);
255 xcb_out.destination_window = destination_window;
256 xcb_out.x_offset = x_offset;
257 xcb_out.y_offset = y_offset;
258 xcb_out.source_bitmap = source_bitmap;
259
260 xcb_parts[2].iov_base = (char *) &xcb_out;
261 xcb_parts[2].iov_len = sizeof(xcb_out);
262 xcb_parts[3].iov_base = 0;
263 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
264
265 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
266 return xcb_ret;
267 }
268
269 xcb_void_cookie_t
xcb_shape_mask(xcb_connection_t * c,xcb_shape_op_t operation,xcb_shape_kind_t destination_kind,xcb_window_t destination_window,int16_t x_offset,int16_t y_offset,xcb_pixmap_t source_bitmap)270 xcb_shape_mask (xcb_connection_t *c /**< */,
271 xcb_shape_op_t operation /**< */,
272 xcb_shape_kind_t destination_kind /**< */,
273 xcb_window_t destination_window /**< */,
274 int16_t x_offset /**< */,
275 int16_t y_offset /**< */,
276 xcb_pixmap_t source_bitmap /**< */)
277 {
278 static const xcb_protocol_request_t xcb_req = {
279 /* count */ 2,
280 /* ext */ &xcb_shape_id,
281 /* opcode */ XCB_SHAPE_MASK,
282 /* isvoid */ 1
283 };
284
285 struct iovec xcb_parts[4];
286 xcb_void_cookie_t xcb_ret;
287 xcb_shape_mask_request_t xcb_out;
288
289 xcb_out.operation = operation;
290 xcb_out.destination_kind = destination_kind;
291 memset(xcb_out.pad0, 0, 2);
292 xcb_out.destination_window = destination_window;
293 xcb_out.x_offset = x_offset;
294 xcb_out.y_offset = y_offset;
295 xcb_out.source_bitmap = source_bitmap;
296
297 xcb_parts[2].iov_base = (char *) &xcb_out;
298 xcb_parts[2].iov_len = sizeof(xcb_out);
299 xcb_parts[3].iov_base = 0;
300 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
301
302 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
303 return xcb_ret;
304 }
305
306 xcb_void_cookie_t
xcb_shape_combine_checked(xcb_connection_t * c,xcb_shape_op_t operation,xcb_shape_kind_t destination_kind,xcb_shape_kind_t source_kind,xcb_window_t destination_window,int16_t x_offset,int16_t y_offset,xcb_window_t source_window)307 xcb_shape_combine_checked (xcb_connection_t *c /**< */,
308 xcb_shape_op_t operation /**< */,
309 xcb_shape_kind_t destination_kind /**< */,
310 xcb_shape_kind_t source_kind /**< */,
311 xcb_window_t destination_window /**< */,
312 int16_t x_offset /**< */,
313 int16_t y_offset /**< */,
314 xcb_window_t source_window /**< */)
315 {
316 static const xcb_protocol_request_t xcb_req = {
317 /* count */ 2,
318 /* ext */ &xcb_shape_id,
319 /* opcode */ XCB_SHAPE_COMBINE,
320 /* isvoid */ 1
321 };
322
323 struct iovec xcb_parts[4];
324 xcb_void_cookie_t xcb_ret;
325 xcb_shape_combine_request_t xcb_out;
326
327 xcb_out.operation = operation;
328 xcb_out.destination_kind = destination_kind;
329 xcb_out.source_kind = source_kind;
330 xcb_out.pad0 = 0;
331 xcb_out.destination_window = destination_window;
332 xcb_out.x_offset = x_offset;
333 xcb_out.y_offset = y_offset;
334 xcb_out.source_window = source_window;
335
336 xcb_parts[2].iov_base = (char *) &xcb_out;
337 xcb_parts[2].iov_len = sizeof(xcb_out);
338 xcb_parts[3].iov_base = 0;
339 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
340
341 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
342 return xcb_ret;
343 }
344
345 xcb_void_cookie_t
xcb_shape_combine(xcb_connection_t * c,xcb_shape_op_t operation,xcb_shape_kind_t destination_kind,xcb_shape_kind_t source_kind,xcb_window_t destination_window,int16_t x_offset,int16_t y_offset,xcb_window_t source_window)346 xcb_shape_combine (xcb_connection_t *c /**< */,
347 xcb_shape_op_t operation /**< */,
348 xcb_shape_kind_t destination_kind /**< */,
349 xcb_shape_kind_t source_kind /**< */,
350 xcb_window_t destination_window /**< */,
351 int16_t x_offset /**< */,
352 int16_t y_offset /**< */,
353 xcb_window_t source_window /**< */)
354 {
355 static const xcb_protocol_request_t xcb_req = {
356 /* count */ 2,
357 /* ext */ &xcb_shape_id,
358 /* opcode */ XCB_SHAPE_COMBINE,
359 /* isvoid */ 1
360 };
361
362 struct iovec xcb_parts[4];
363 xcb_void_cookie_t xcb_ret;
364 xcb_shape_combine_request_t xcb_out;
365
366 xcb_out.operation = operation;
367 xcb_out.destination_kind = destination_kind;
368 xcb_out.source_kind = source_kind;
369 xcb_out.pad0 = 0;
370 xcb_out.destination_window = destination_window;
371 xcb_out.x_offset = x_offset;
372 xcb_out.y_offset = y_offset;
373 xcb_out.source_window = source_window;
374
375 xcb_parts[2].iov_base = (char *) &xcb_out;
376 xcb_parts[2].iov_len = sizeof(xcb_out);
377 xcb_parts[3].iov_base = 0;
378 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
379
380 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
381 return xcb_ret;
382 }
383
384 xcb_void_cookie_t
xcb_shape_offset_checked(xcb_connection_t * c,xcb_shape_kind_t destination_kind,xcb_window_t destination_window,int16_t x_offset,int16_t y_offset)385 xcb_shape_offset_checked (xcb_connection_t *c /**< */,
386 xcb_shape_kind_t destination_kind /**< */,
387 xcb_window_t destination_window /**< */,
388 int16_t x_offset /**< */,
389 int16_t y_offset /**< */)
390 {
391 static const xcb_protocol_request_t xcb_req = {
392 /* count */ 2,
393 /* ext */ &xcb_shape_id,
394 /* opcode */ XCB_SHAPE_OFFSET,
395 /* isvoid */ 1
396 };
397
398 struct iovec xcb_parts[4];
399 xcb_void_cookie_t xcb_ret;
400 xcb_shape_offset_request_t xcb_out;
401
402 xcb_out.destination_kind = destination_kind;
403 memset(xcb_out.pad0, 0, 3);
404 xcb_out.destination_window = destination_window;
405 xcb_out.x_offset = x_offset;
406 xcb_out.y_offset = y_offset;
407
408 xcb_parts[2].iov_base = (char *) &xcb_out;
409 xcb_parts[2].iov_len = sizeof(xcb_out);
410 xcb_parts[3].iov_base = 0;
411 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
412
413 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
414 return xcb_ret;
415 }
416
417 xcb_void_cookie_t
xcb_shape_offset(xcb_connection_t * c,xcb_shape_kind_t destination_kind,xcb_window_t destination_window,int16_t x_offset,int16_t y_offset)418 xcb_shape_offset (xcb_connection_t *c /**< */,
419 xcb_shape_kind_t destination_kind /**< */,
420 xcb_window_t destination_window /**< */,
421 int16_t x_offset /**< */,
422 int16_t y_offset /**< */)
423 {
424 static const xcb_protocol_request_t xcb_req = {
425 /* count */ 2,
426 /* ext */ &xcb_shape_id,
427 /* opcode */ XCB_SHAPE_OFFSET,
428 /* isvoid */ 1
429 };
430
431 struct iovec xcb_parts[4];
432 xcb_void_cookie_t xcb_ret;
433 xcb_shape_offset_request_t xcb_out;
434
435 xcb_out.destination_kind = destination_kind;
436 memset(xcb_out.pad0, 0, 3);
437 xcb_out.destination_window = destination_window;
438 xcb_out.x_offset = x_offset;
439 xcb_out.y_offset = y_offset;
440
441 xcb_parts[2].iov_base = (char *) &xcb_out;
442 xcb_parts[2].iov_len = sizeof(xcb_out);
443 xcb_parts[3].iov_base = 0;
444 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
445
446 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
447 return xcb_ret;
448 }
449
450 xcb_shape_query_extents_cookie_t
xcb_shape_query_extents(xcb_connection_t * c,xcb_window_t destination_window)451 xcb_shape_query_extents (xcb_connection_t *c /**< */,
452 xcb_window_t destination_window /**< */)
453 {
454 static const xcb_protocol_request_t xcb_req = {
455 /* count */ 2,
456 /* ext */ &xcb_shape_id,
457 /* opcode */ XCB_SHAPE_QUERY_EXTENTS,
458 /* isvoid */ 0
459 };
460
461 struct iovec xcb_parts[4];
462 xcb_shape_query_extents_cookie_t xcb_ret;
463 xcb_shape_query_extents_request_t xcb_out;
464
465 xcb_out.destination_window = destination_window;
466
467 xcb_parts[2].iov_base = (char *) &xcb_out;
468 xcb_parts[2].iov_len = sizeof(xcb_out);
469 xcb_parts[3].iov_base = 0;
470 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
471
472 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
473 return xcb_ret;
474 }
475
476 xcb_shape_query_extents_cookie_t
xcb_shape_query_extents_unchecked(xcb_connection_t * c,xcb_window_t destination_window)477 xcb_shape_query_extents_unchecked (xcb_connection_t *c /**< */,
478 xcb_window_t destination_window /**< */)
479 {
480 static const xcb_protocol_request_t xcb_req = {
481 /* count */ 2,
482 /* ext */ &xcb_shape_id,
483 /* opcode */ XCB_SHAPE_QUERY_EXTENTS,
484 /* isvoid */ 0
485 };
486
487 struct iovec xcb_parts[4];
488 xcb_shape_query_extents_cookie_t xcb_ret;
489 xcb_shape_query_extents_request_t xcb_out;
490
491 xcb_out.destination_window = destination_window;
492
493 xcb_parts[2].iov_base = (char *) &xcb_out;
494 xcb_parts[2].iov_len = sizeof(xcb_out);
495 xcb_parts[3].iov_base = 0;
496 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
497
498 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
499 return xcb_ret;
500 }
501
502 xcb_shape_query_extents_reply_t *
xcb_shape_query_extents_reply(xcb_connection_t * c,xcb_shape_query_extents_cookie_t cookie,xcb_generic_error_t ** e)503 xcb_shape_query_extents_reply (xcb_connection_t *c /**< */,
504 xcb_shape_query_extents_cookie_t cookie /**< */,
505 xcb_generic_error_t **e /**< */)
506 {
507 return (xcb_shape_query_extents_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
508 }
509
510 xcb_void_cookie_t
xcb_shape_select_input_checked(xcb_connection_t * c,xcb_window_t destination_window,uint8_t enable)511 xcb_shape_select_input_checked (xcb_connection_t *c /**< */,
512 xcb_window_t destination_window /**< */,
513 uint8_t enable /**< */)
514 {
515 static const xcb_protocol_request_t xcb_req = {
516 /* count */ 2,
517 /* ext */ &xcb_shape_id,
518 /* opcode */ XCB_SHAPE_SELECT_INPUT,
519 /* isvoid */ 1
520 };
521
522 struct iovec xcb_parts[4];
523 xcb_void_cookie_t xcb_ret;
524 xcb_shape_select_input_request_t xcb_out;
525
526 xcb_out.destination_window = destination_window;
527 xcb_out.enable = enable;
528 memset(xcb_out.pad0, 0, 3);
529
530 xcb_parts[2].iov_base = (char *) &xcb_out;
531 xcb_parts[2].iov_len = sizeof(xcb_out);
532 xcb_parts[3].iov_base = 0;
533 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
534
535 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
536 return xcb_ret;
537 }
538
539 xcb_void_cookie_t
xcb_shape_select_input(xcb_connection_t * c,xcb_window_t destination_window,uint8_t enable)540 xcb_shape_select_input (xcb_connection_t *c /**< */,
541 xcb_window_t destination_window /**< */,
542 uint8_t enable /**< */)
543 {
544 static const xcb_protocol_request_t xcb_req = {
545 /* count */ 2,
546 /* ext */ &xcb_shape_id,
547 /* opcode */ XCB_SHAPE_SELECT_INPUT,
548 /* isvoid */ 1
549 };
550
551 struct iovec xcb_parts[4];
552 xcb_void_cookie_t xcb_ret;
553 xcb_shape_select_input_request_t xcb_out;
554
555 xcb_out.destination_window = destination_window;
556 xcb_out.enable = enable;
557 memset(xcb_out.pad0, 0, 3);
558
559 xcb_parts[2].iov_base = (char *) &xcb_out;
560 xcb_parts[2].iov_len = sizeof(xcb_out);
561 xcb_parts[3].iov_base = 0;
562 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
563
564 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
565 return xcb_ret;
566 }
567
568 xcb_shape_input_selected_cookie_t
xcb_shape_input_selected(xcb_connection_t * c,xcb_window_t destination_window)569 xcb_shape_input_selected (xcb_connection_t *c /**< */,
570 xcb_window_t destination_window /**< */)
571 {
572 static const xcb_protocol_request_t xcb_req = {
573 /* count */ 2,
574 /* ext */ &xcb_shape_id,
575 /* opcode */ XCB_SHAPE_INPUT_SELECTED,
576 /* isvoid */ 0
577 };
578
579 struct iovec xcb_parts[4];
580 xcb_shape_input_selected_cookie_t xcb_ret;
581 xcb_shape_input_selected_request_t xcb_out;
582
583 xcb_out.destination_window = destination_window;
584
585 xcb_parts[2].iov_base = (char *) &xcb_out;
586 xcb_parts[2].iov_len = sizeof(xcb_out);
587 xcb_parts[3].iov_base = 0;
588 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
589
590 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
591 return xcb_ret;
592 }
593
594 xcb_shape_input_selected_cookie_t
xcb_shape_input_selected_unchecked(xcb_connection_t * c,xcb_window_t destination_window)595 xcb_shape_input_selected_unchecked (xcb_connection_t *c /**< */,
596 xcb_window_t destination_window /**< */)
597 {
598 static const xcb_protocol_request_t xcb_req = {
599 /* count */ 2,
600 /* ext */ &xcb_shape_id,
601 /* opcode */ XCB_SHAPE_INPUT_SELECTED,
602 /* isvoid */ 0
603 };
604
605 struct iovec xcb_parts[4];
606 xcb_shape_input_selected_cookie_t xcb_ret;
607 xcb_shape_input_selected_request_t xcb_out;
608
609 xcb_out.destination_window = destination_window;
610
611 xcb_parts[2].iov_base = (char *) &xcb_out;
612 xcb_parts[2].iov_len = sizeof(xcb_out);
613 xcb_parts[3].iov_base = 0;
614 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
615
616 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
617 return xcb_ret;
618 }
619
620 xcb_shape_input_selected_reply_t *
xcb_shape_input_selected_reply(xcb_connection_t * c,xcb_shape_input_selected_cookie_t cookie,xcb_generic_error_t ** e)621 xcb_shape_input_selected_reply (xcb_connection_t *c /**< */,
622 xcb_shape_input_selected_cookie_t cookie /**< */,
623 xcb_generic_error_t **e /**< */)
624 {
625 return (xcb_shape_input_selected_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
626 }
627
628 int
xcb_shape_get_rectangles_sizeof(const void * _buffer)629 xcb_shape_get_rectangles_sizeof (const void *_buffer /**< */)
630 {
631 char *xcb_tmp = (char *)_buffer;
632 const xcb_shape_get_rectangles_reply_t *_aux = (xcb_shape_get_rectangles_reply_t *)_buffer;
633 unsigned int xcb_buffer_len = 0;
634 unsigned int xcb_block_len = 0;
635 unsigned int xcb_pad = 0;
636 unsigned int xcb_align_to = 0;
637
638
639 xcb_block_len += sizeof(xcb_shape_get_rectangles_reply_t);
640 xcb_tmp += xcb_block_len;
641 xcb_buffer_len += xcb_block_len;
642 xcb_block_len = 0;
643 /* rectangles */
644 xcb_block_len += _aux->rectangles_len * sizeof(xcb_rectangle_t);
645 xcb_tmp += xcb_block_len;
646 xcb_align_to = ALIGNOF(xcb_rectangle_t);
647 /* insert padding */
648 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
649 xcb_buffer_len += xcb_block_len + xcb_pad;
650 if (0 != xcb_pad) {
651 xcb_tmp += xcb_pad;
652 xcb_pad = 0;
653 }
654 xcb_block_len = 0;
655
656 return xcb_buffer_len;
657 }
658
659 xcb_shape_get_rectangles_cookie_t
xcb_shape_get_rectangles(xcb_connection_t * c,xcb_window_t window,xcb_shape_kind_t source_kind)660 xcb_shape_get_rectangles (xcb_connection_t *c /**< */,
661 xcb_window_t window /**< */,
662 xcb_shape_kind_t source_kind /**< */)
663 {
664 static const xcb_protocol_request_t xcb_req = {
665 /* count */ 2,
666 /* ext */ &xcb_shape_id,
667 /* opcode */ XCB_SHAPE_GET_RECTANGLES,
668 /* isvoid */ 0
669 };
670
671 struct iovec xcb_parts[4];
672 xcb_shape_get_rectangles_cookie_t xcb_ret;
673 xcb_shape_get_rectangles_request_t xcb_out;
674
675 xcb_out.window = window;
676 xcb_out.source_kind = source_kind;
677 memset(xcb_out.pad0, 0, 3);
678
679 xcb_parts[2].iov_base = (char *) &xcb_out;
680 xcb_parts[2].iov_len = sizeof(xcb_out);
681 xcb_parts[3].iov_base = 0;
682 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
683
684 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
685 return xcb_ret;
686 }
687
688 xcb_shape_get_rectangles_cookie_t
xcb_shape_get_rectangles_unchecked(xcb_connection_t * c,xcb_window_t window,xcb_shape_kind_t source_kind)689 xcb_shape_get_rectangles_unchecked (xcb_connection_t *c /**< */,
690 xcb_window_t window /**< */,
691 xcb_shape_kind_t source_kind /**< */)
692 {
693 static const xcb_protocol_request_t xcb_req = {
694 /* count */ 2,
695 /* ext */ &xcb_shape_id,
696 /* opcode */ XCB_SHAPE_GET_RECTANGLES,
697 /* isvoid */ 0
698 };
699
700 struct iovec xcb_parts[4];
701 xcb_shape_get_rectangles_cookie_t xcb_ret;
702 xcb_shape_get_rectangles_request_t xcb_out;
703
704 xcb_out.window = window;
705 xcb_out.source_kind = source_kind;
706 memset(xcb_out.pad0, 0, 3);
707
708 xcb_parts[2].iov_base = (char *) &xcb_out;
709 xcb_parts[2].iov_len = sizeof(xcb_out);
710 xcb_parts[3].iov_base = 0;
711 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
712
713 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
714 return xcb_ret;
715 }
716
717 xcb_rectangle_t *
xcb_shape_get_rectangles_rectangles(const xcb_shape_get_rectangles_reply_t * R)718 xcb_shape_get_rectangles_rectangles (const xcb_shape_get_rectangles_reply_t *R /**< */)
719 {
720 return (xcb_rectangle_t *) (R + 1);
721 }
722
723 int
xcb_shape_get_rectangles_rectangles_length(const xcb_shape_get_rectangles_reply_t * R)724 xcb_shape_get_rectangles_rectangles_length (const xcb_shape_get_rectangles_reply_t *R /**< */)
725 {
726 return R->rectangles_len;
727 }
728
729 xcb_rectangle_iterator_t
xcb_shape_get_rectangles_rectangles_iterator(const xcb_shape_get_rectangles_reply_t * R)730 xcb_shape_get_rectangles_rectangles_iterator (const xcb_shape_get_rectangles_reply_t *R /**< */)
731 {
732 xcb_rectangle_iterator_t i;
733 i.data = (xcb_rectangle_t *) (R + 1);
734 i.rem = R->rectangles_len;
735 i.index = (char *) i.data - (char *) R;
736 return i;
737 }
738
739 xcb_shape_get_rectangles_reply_t *
xcb_shape_get_rectangles_reply(xcb_connection_t * c,xcb_shape_get_rectangles_cookie_t cookie,xcb_generic_error_t ** e)740 xcb_shape_get_rectangles_reply (xcb_connection_t *c /**< */,
741 xcb_shape_get_rectangles_cookie_t cookie /**< */,
742 xcb_generic_error_t **e /**< */)
743 {
744 return (xcb_shape_get_rectangles_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
745 }
746
747