xref: /netbsd/external/mit/xorg/lib/libxcb/files/shm.c (revision 6550d01e)
1 /*
2  * This file generated automatically from shm.xml by c_client.py.
3  * Edit at your peril.
4  */
5 
6 #include <string.h>
7 #include <assert.h>
8 #include "xcbext.h"
9 #include "shm.h"
10 #include "xproto.h"
11 
12 xcb_extension_t xcb_shm_id = { "MIT-SHM", 0 };
13 
14 
15 /*****************************************************************************
16  **
17  ** void xcb_shm_seg_next
18  **
19  ** @param xcb_shm_seg_iterator_t *i
20  ** @returns void
21  **
22  *****************************************************************************/
23 
24 void
25 xcb_shm_seg_next (xcb_shm_seg_iterator_t *i  /**< */)
26 {
27     --i->rem;
28     ++i->data;
29     i->index += sizeof(xcb_shm_seg_t);
30 }
31 
32 
33 /*****************************************************************************
34  **
35  ** xcb_generic_iterator_t xcb_shm_seg_end
36  **
37  ** @param xcb_shm_seg_iterator_t i
38  ** @returns xcb_generic_iterator_t
39  **
40  *****************************************************************************/
41 
42 xcb_generic_iterator_t
43 xcb_shm_seg_end (xcb_shm_seg_iterator_t i  /**< */)
44 {
45     xcb_generic_iterator_t ret;
46     ret.data = i.data + i.rem;
47     ret.index = i.index + ((char *) ret.data - (char *) i.data);
48     ret.rem = 0;
49     return ret;
50 }
51 
52 
53 /*****************************************************************************
54  **
55  ** xcb_shm_query_version_cookie_t xcb_shm_query_version
56  **
57  ** @param xcb_connection_t *c
58  ** @returns xcb_shm_query_version_cookie_t
59  **
60  *****************************************************************************/
61 
62 xcb_shm_query_version_cookie_t
63 xcb_shm_query_version (xcb_connection_t *c  /**< */)
64 {
65     static const xcb_protocol_request_t xcb_req = {
66         /* count */ 2,
67         /* ext */ &xcb_shm_id,
68         /* opcode */ XCB_SHM_QUERY_VERSION,
69         /* isvoid */ 0
70     };
71 
72     struct iovec xcb_parts[4];
73     xcb_shm_query_version_cookie_t xcb_ret;
74     xcb_shm_query_version_request_t xcb_out;
75 
76 
77     xcb_parts[2].iov_base = (char *) &xcb_out;
78     xcb_parts[2].iov_len = sizeof(xcb_out);
79     xcb_parts[3].iov_base = 0;
80     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
81     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
82     return xcb_ret;
83 }
84 
85 
86 /*****************************************************************************
87  **
88  ** xcb_shm_query_version_cookie_t xcb_shm_query_version_unchecked
89  **
90  ** @param xcb_connection_t *c
91  ** @returns xcb_shm_query_version_cookie_t
92  **
93  *****************************************************************************/
94 
95 xcb_shm_query_version_cookie_t
96 xcb_shm_query_version_unchecked (xcb_connection_t *c  /**< */)
97 {
98     static const xcb_protocol_request_t xcb_req = {
99         /* count */ 2,
100         /* ext */ &xcb_shm_id,
101         /* opcode */ XCB_SHM_QUERY_VERSION,
102         /* isvoid */ 0
103     };
104 
105     struct iovec xcb_parts[4];
106     xcb_shm_query_version_cookie_t xcb_ret;
107     xcb_shm_query_version_request_t xcb_out;
108 
109 
110     xcb_parts[2].iov_base = (char *) &xcb_out;
111     xcb_parts[2].iov_len = sizeof(xcb_out);
112     xcb_parts[3].iov_base = 0;
113     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
114     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
115     return xcb_ret;
116 }
117 
118 
119 /*****************************************************************************
120  **
121  ** xcb_shm_query_version_reply_t * xcb_shm_query_version_reply
122  **
123  ** @param xcb_connection_t                *c
124  ** @param xcb_shm_query_version_cookie_t   cookie
125  ** @param xcb_generic_error_t            **e
126  ** @returns xcb_shm_query_version_reply_t *
127  **
128  *****************************************************************************/
129 
130 xcb_shm_query_version_reply_t *
131 xcb_shm_query_version_reply (xcb_connection_t                *c  /**< */,
132                              xcb_shm_query_version_cookie_t   cookie  /**< */,
133                              xcb_generic_error_t            **e  /**< */)
134 {
135     return (xcb_shm_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
136 }
137 
138 
139 /*****************************************************************************
140  **
141  ** xcb_void_cookie_t xcb_shm_attach_checked
142  **
143  ** @param xcb_connection_t *c
144  ** @param xcb_shm_seg_t     shmseg
145  ** @param uint32_t          shmid
146  ** @param uint8_t           read_only
147  ** @returns xcb_void_cookie_t
148  **
149  *****************************************************************************/
150 
151 xcb_void_cookie_t
152 xcb_shm_attach_checked (xcb_connection_t *c  /**< */,
153                         xcb_shm_seg_t     shmseg  /**< */,
154                         uint32_t          shmid  /**< */,
155                         uint8_t           read_only  /**< */)
156 {
157     static const xcb_protocol_request_t xcb_req = {
158         /* count */ 2,
159         /* ext */ &xcb_shm_id,
160         /* opcode */ XCB_SHM_ATTACH,
161         /* isvoid */ 1
162     };
163 
164     struct iovec xcb_parts[4];
165     xcb_void_cookie_t xcb_ret;
166     xcb_shm_attach_request_t xcb_out;
167 
168     xcb_out.shmseg = shmseg;
169     xcb_out.shmid = shmid;
170     xcb_out.read_only = read_only;
171     memset(xcb_out.pad0, 0, 3);
172 
173     xcb_parts[2].iov_base = (char *) &xcb_out;
174     xcb_parts[2].iov_len = sizeof(xcb_out);
175     xcb_parts[3].iov_base = 0;
176     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
177     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
178     return xcb_ret;
179 }
180 
181 
182 /*****************************************************************************
183  **
184  ** xcb_void_cookie_t xcb_shm_attach
185  **
186  ** @param xcb_connection_t *c
187  ** @param xcb_shm_seg_t     shmseg
188  ** @param uint32_t          shmid
189  ** @param uint8_t           read_only
190  ** @returns xcb_void_cookie_t
191  **
192  *****************************************************************************/
193 
194 xcb_void_cookie_t
195 xcb_shm_attach (xcb_connection_t *c  /**< */,
196                 xcb_shm_seg_t     shmseg  /**< */,
197                 uint32_t          shmid  /**< */,
198                 uint8_t           read_only  /**< */)
199 {
200     static const xcb_protocol_request_t xcb_req = {
201         /* count */ 2,
202         /* ext */ &xcb_shm_id,
203         /* opcode */ XCB_SHM_ATTACH,
204         /* isvoid */ 1
205     };
206 
207     struct iovec xcb_parts[4];
208     xcb_void_cookie_t xcb_ret;
209     xcb_shm_attach_request_t xcb_out;
210 
211     xcb_out.shmseg = shmseg;
212     xcb_out.shmid = shmid;
213     xcb_out.read_only = read_only;
214     memset(xcb_out.pad0, 0, 3);
215 
216     xcb_parts[2].iov_base = (char *) &xcb_out;
217     xcb_parts[2].iov_len = sizeof(xcb_out);
218     xcb_parts[3].iov_base = 0;
219     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
220     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
221     return xcb_ret;
222 }
223 
224 
225 /*****************************************************************************
226  **
227  ** xcb_void_cookie_t xcb_shm_detach_checked
228  **
229  ** @param xcb_connection_t *c
230  ** @param xcb_shm_seg_t     shmseg
231  ** @returns xcb_void_cookie_t
232  **
233  *****************************************************************************/
234 
235 xcb_void_cookie_t
236 xcb_shm_detach_checked (xcb_connection_t *c  /**< */,
237                         xcb_shm_seg_t     shmseg  /**< */)
238 {
239     static const xcb_protocol_request_t xcb_req = {
240         /* count */ 2,
241         /* ext */ &xcb_shm_id,
242         /* opcode */ XCB_SHM_DETACH,
243         /* isvoid */ 1
244     };
245 
246     struct iovec xcb_parts[4];
247     xcb_void_cookie_t xcb_ret;
248     xcb_shm_detach_request_t xcb_out;
249 
250     xcb_out.shmseg = shmseg;
251 
252     xcb_parts[2].iov_base = (char *) &xcb_out;
253     xcb_parts[2].iov_len = sizeof(xcb_out);
254     xcb_parts[3].iov_base = 0;
255     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
256     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
257     return xcb_ret;
258 }
259 
260 
261 /*****************************************************************************
262  **
263  ** xcb_void_cookie_t xcb_shm_detach
264  **
265  ** @param xcb_connection_t *c
266  ** @param xcb_shm_seg_t     shmseg
267  ** @returns xcb_void_cookie_t
268  **
269  *****************************************************************************/
270 
271 xcb_void_cookie_t
272 xcb_shm_detach (xcb_connection_t *c  /**< */,
273                 xcb_shm_seg_t     shmseg  /**< */)
274 {
275     static const xcb_protocol_request_t xcb_req = {
276         /* count */ 2,
277         /* ext */ &xcb_shm_id,
278         /* opcode */ XCB_SHM_DETACH,
279         /* isvoid */ 1
280     };
281 
282     struct iovec xcb_parts[4];
283     xcb_void_cookie_t xcb_ret;
284     xcb_shm_detach_request_t xcb_out;
285 
286     xcb_out.shmseg = shmseg;
287 
288     xcb_parts[2].iov_base = (char *) &xcb_out;
289     xcb_parts[2].iov_len = sizeof(xcb_out);
290     xcb_parts[3].iov_base = 0;
291     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
292     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
293     return xcb_ret;
294 }
295 
296 
297 /*****************************************************************************
298  **
299  ** xcb_void_cookie_t xcb_shm_put_image_checked
300  **
301  ** @param xcb_connection_t *c
302  ** @param xcb_drawable_t    drawable
303  ** @param xcb_gcontext_t    gc
304  ** @param uint16_t          total_width
305  ** @param uint16_t          total_height
306  ** @param uint16_t          src_x
307  ** @param uint16_t          src_y
308  ** @param uint16_t          src_width
309  ** @param uint16_t          src_height
310  ** @param int16_t           dst_x
311  ** @param int16_t           dst_y
312  ** @param uint8_t           depth
313  ** @param uint8_t           format
314  ** @param uint8_t           send_event
315  ** @param xcb_shm_seg_t     shmseg
316  ** @param uint32_t          offset
317  ** @returns xcb_void_cookie_t
318  **
319  *****************************************************************************/
320 
321 xcb_void_cookie_t
322 xcb_shm_put_image_checked (xcb_connection_t *c  /**< */,
323                            xcb_drawable_t    drawable  /**< */,
324                            xcb_gcontext_t    gc  /**< */,
325                            uint16_t          total_width  /**< */,
326                            uint16_t          total_height  /**< */,
327                            uint16_t          src_x  /**< */,
328                            uint16_t          src_y  /**< */,
329                            uint16_t          src_width  /**< */,
330                            uint16_t          src_height  /**< */,
331                            int16_t           dst_x  /**< */,
332                            int16_t           dst_y  /**< */,
333                            uint8_t           depth  /**< */,
334                            uint8_t           format  /**< */,
335                            uint8_t           send_event  /**< */,
336                            xcb_shm_seg_t     shmseg  /**< */,
337                            uint32_t          offset  /**< */)
338 {
339     static const xcb_protocol_request_t xcb_req = {
340         /* count */ 2,
341         /* ext */ &xcb_shm_id,
342         /* opcode */ XCB_SHM_PUT_IMAGE,
343         /* isvoid */ 1
344     };
345 
346     struct iovec xcb_parts[4];
347     xcb_void_cookie_t xcb_ret;
348     xcb_shm_put_image_request_t xcb_out;
349 
350     xcb_out.drawable = drawable;
351     xcb_out.gc = gc;
352     xcb_out.total_width = total_width;
353     xcb_out.total_height = total_height;
354     xcb_out.src_x = src_x;
355     xcb_out.src_y = src_y;
356     xcb_out.src_width = src_width;
357     xcb_out.src_height = src_height;
358     xcb_out.dst_x = dst_x;
359     xcb_out.dst_y = dst_y;
360     xcb_out.depth = depth;
361     xcb_out.format = format;
362     xcb_out.send_event = send_event;
363     xcb_out.pad0 = 0;
364     xcb_out.shmseg = shmseg;
365     xcb_out.offset = offset;
366 
367     xcb_parts[2].iov_base = (char *) &xcb_out;
368     xcb_parts[2].iov_len = sizeof(xcb_out);
369     xcb_parts[3].iov_base = 0;
370     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
371     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
372     return xcb_ret;
373 }
374 
375 
376 /*****************************************************************************
377  **
378  ** xcb_void_cookie_t xcb_shm_put_image
379  **
380  ** @param xcb_connection_t *c
381  ** @param xcb_drawable_t    drawable
382  ** @param xcb_gcontext_t    gc
383  ** @param uint16_t          total_width
384  ** @param uint16_t          total_height
385  ** @param uint16_t          src_x
386  ** @param uint16_t          src_y
387  ** @param uint16_t          src_width
388  ** @param uint16_t          src_height
389  ** @param int16_t           dst_x
390  ** @param int16_t           dst_y
391  ** @param uint8_t           depth
392  ** @param uint8_t           format
393  ** @param uint8_t           send_event
394  ** @param xcb_shm_seg_t     shmseg
395  ** @param uint32_t          offset
396  ** @returns xcb_void_cookie_t
397  **
398  *****************************************************************************/
399 
400 xcb_void_cookie_t
401 xcb_shm_put_image (xcb_connection_t *c  /**< */,
402                    xcb_drawable_t    drawable  /**< */,
403                    xcb_gcontext_t    gc  /**< */,
404                    uint16_t          total_width  /**< */,
405                    uint16_t          total_height  /**< */,
406                    uint16_t          src_x  /**< */,
407                    uint16_t          src_y  /**< */,
408                    uint16_t          src_width  /**< */,
409                    uint16_t          src_height  /**< */,
410                    int16_t           dst_x  /**< */,
411                    int16_t           dst_y  /**< */,
412                    uint8_t           depth  /**< */,
413                    uint8_t           format  /**< */,
414                    uint8_t           send_event  /**< */,
415                    xcb_shm_seg_t     shmseg  /**< */,
416                    uint32_t          offset  /**< */)
417 {
418     static const xcb_protocol_request_t xcb_req = {
419         /* count */ 2,
420         /* ext */ &xcb_shm_id,
421         /* opcode */ XCB_SHM_PUT_IMAGE,
422         /* isvoid */ 1
423     };
424 
425     struct iovec xcb_parts[4];
426     xcb_void_cookie_t xcb_ret;
427     xcb_shm_put_image_request_t xcb_out;
428 
429     xcb_out.drawable = drawable;
430     xcb_out.gc = gc;
431     xcb_out.total_width = total_width;
432     xcb_out.total_height = total_height;
433     xcb_out.src_x = src_x;
434     xcb_out.src_y = src_y;
435     xcb_out.src_width = src_width;
436     xcb_out.src_height = src_height;
437     xcb_out.dst_x = dst_x;
438     xcb_out.dst_y = dst_y;
439     xcb_out.depth = depth;
440     xcb_out.format = format;
441     xcb_out.send_event = send_event;
442     xcb_out.pad0 = 0;
443     xcb_out.shmseg = shmseg;
444     xcb_out.offset = offset;
445 
446     xcb_parts[2].iov_base = (char *) &xcb_out;
447     xcb_parts[2].iov_len = sizeof(xcb_out);
448     xcb_parts[3].iov_base = 0;
449     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
450     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
451     return xcb_ret;
452 }
453 
454 
455 /*****************************************************************************
456  **
457  ** xcb_shm_get_image_cookie_t xcb_shm_get_image
458  **
459  ** @param xcb_connection_t *c
460  ** @param xcb_drawable_t    drawable
461  ** @param int16_t           x
462  ** @param int16_t           y
463  ** @param uint16_t          width
464  ** @param uint16_t          height
465  ** @param uint32_t          plane_mask
466  ** @param uint8_t           format
467  ** @param xcb_shm_seg_t     shmseg
468  ** @param uint32_t          offset
469  ** @returns xcb_shm_get_image_cookie_t
470  **
471  *****************************************************************************/
472 
473 xcb_shm_get_image_cookie_t
474 xcb_shm_get_image (xcb_connection_t *c  /**< */,
475                    xcb_drawable_t    drawable  /**< */,
476                    int16_t           x  /**< */,
477                    int16_t           y  /**< */,
478                    uint16_t          width  /**< */,
479                    uint16_t          height  /**< */,
480                    uint32_t          plane_mask  /**< */,
481                    uint8_t           format  /**< */,
482                    xcb_shm_seg_t     shmseg  /**< */,
483                    uint32_t          offset  /**< */)
484 {
485     static const xcb_protocol_request_t xcb_req = {
486         /* count */ 2,
487         /* ext */ &xcb_shm_id,
488         /* opcode */ XCB_SHM_GET_IMAGE,
489         /* isvoid */ 0
490     };
491 
492     struct iovec xcb_parts[4];
493     xcb_shm_get_image_cookie_t xcb_ret;
494     xcb_shm_get_image_request_t xcb_out;
495 
496     xcb_out.drawable = drawable;
497     xcb_out.x = x;
498     xcb_out.y = y;
499     xcb_out.width = width;
500     xcb_out.height = height;
501     xcb_out.plane_mask = plane_mask;
502     xcb_out.format = format;
503     memset(xcb_out.pad0, 0, 3);
504     xcb_out.shmseg = shmseg;
505     xcb_out.offset = offset;
506 
507     xcb_parts[2].iov_base = (char *) &xcb_out;
508     xcb_parts[2].iov_len = sizeof(xcb_out);
509     xcb_parts[3].iov_base = 0;
510     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
511     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
512     return xcb_ret;
513 }
514 
515 
516 /*****************************************************************************
517  **
518  ** xcb_shm_get_image_cookie_t xcb_shm_get_image_unchecked
519  **
520  ** @param xcb_connection_t *c
521  ** @param xcb_drawable_t    drawable
522  ** @param int16_t           x
523  ** @param int16_t           y
524  ** @param uint16_t          width
525  ** @param uint16_t          height
526  ** @param uint32_t          plane_mask
527  ** @param uint8_t           format
528  ** @param xcb_shm_seg_t     shmseg
529  ** @param uint32_t          offset
530  ** @returns xcb_shm_get_image_cookie_t
531  **
532  *****************************************************************************/
533 
534 xcb_shm_get_image_cookie_t
535 xcb_shm_get_image_unchecked (xcb_connection_t *c  /**< */,
536                              xcb_drawable_t    drawable  /**< */,
537                              int16_t           x  /**< */,
538                              int16_t           y  /**< */,
539                              uint16_t          width  /**< */,
540                              uint16_t          height  /**< */,
541                              uint32_t          plane_mask  /**< */,
542                              uint8_t           format  /**< */,
543                              xcb_shm_seg_t     shmseg  /**< */,
544                              uint32_t          offset  /**< */)
545 {
546     static const xcb_protocol_request_t xcb_req = {
547         /* count */ 2,
548         /* ext */ &xcb_shm_id,
549         /* opcode */ XCB_SHM_GET_IMAGE,
550         /* isvoid */ 0
551     };
552 
553     struct iovec xcb_parts[4];
554     xcb_shm_get_image_cookie_t xcb_ret;
555     xcb_shm_get_image_request_t xcb_out;
556 
557     xcb_out.drawable = drawable;
558     xcb_out.x = x;
559     xcb_out.y = y;
560     xcb_out.width = width;
561     xcb_out.height = height;
562     xcb_out.plane_mask = plane_mask;
563     xcb_out.format = format;
564     memset(xcb_out.pad0, 0, 3);
565     xcb_out.shmseg = shmseg;
566     xcb_out.offset = offset;
567 
568     xcb_parts[2].iov_base = (char *) &xcb_out;
569     xcb_parts[2].iov_len = sizeof(xcb_out);
570     xcb_parts[3].iov_base = 0;
571     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
572     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
573     return xcb_ret;
574 }
575 
576 
577 /*****************************************************************************
578  **
579  ** xcb_shm_get_image_reply_t * xcb_shm_get_image_reply
580  **
581  ** @param xcb_connection_t            *c
582  ** @param xcb_shm_get_image_cookie_t   cookie
583  ** @param xcb_generic_error_t        **e
584  ** @returns xcb_shm_get_image_reply_t *
585  **
586  *****************************************************************************/
587 
588 xcb_shm_get_image_reply_t *
589 xcb_shm_get_image_reply (xcb_connection_t            *c  /**< */,
590                          xcb_shm_get_image_cookie_t   cookie  /**< */,
591                          xcb_generic_error_t        **e  /**< */)
592 {
593     return (xcb_shm_get_image_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
594 }
595 
596 
597 /*****************************************************************************
598  **
599  ** xcb_void_cookie_t xcb_shm_create_pixmap_checked
600  **
601  ** @param xcb_connection_t *c
602  ** @param xcb_pixmap_t      pid
603  ** @param xcb_drawable_t    drawable
604  ** @param uint16_t          width
605  ** @param uint16_t          height
606  ** @param uint8_t           depth
607  ** @param xcb_shm_seg_t     shmseg
608  ** @param uint32_t          offset
609  ** @returns xcb_void_cookie_t
610  **
611  *****************************************************************************/
612 
613 xcb_void_cookie_t
614 xcb_shm_create_pixmap_checked (xcb_connection_t *c  /**< */,
615                                xcb_pixmap_t      pid  /**< */,
616                                xcb_drawable_t    drawable  /**< */,
617                                uint16_t          width  /**< */,
618                                uint16_t          height  /**< */,
619                                uint8_t           depth  /**< */,
620                                xcb_shm_seg_t     shmseg  /**< */,
621                                uint32_t          offset  /**< */)
622 {
623     static const xcb_protocol_request_t xcb_req = {
624         /* count */ 2,
625         /* ext */ &xcb_shm_id,
626         /* opcode */ XCB_SHM_CREATE_PIXMAP,
627         /* isvoid */ 1
628     };
629 
630     struct iovec xcb_parts[4];
631     xcb_void_cookie_t xcb_ret;
632     xcb_shm_create_pixmap_request_t xcb_out;
633 
634     xcb_out.pid = pid;
635     xcb_out.drawable = drawable;
636     xcb_out.width = width;
637     xcb_out.height = height;
638     xcb_out.depth = depth;
639     memset(xcb_out.pad0, 0, 3);
640     xcb_out.shmseg = shmseg;
641     xcb_out.offset = offset;
642 
643     xcb_parts[2].iov_base = (char *) &xcb_out;
644     xcb_parts[2].iov_len = sizeof(xcb_out);
645     xcb_parts[3].iov_base = 0;
646     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
647     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
648     return xcb_ret;
649 }
650 
651 
652 /*****************************************************************************
653  **
654  ** xcb_void_cookie_t xcb_shm_create_pixmap
655  **
656  ** @param xcb_connection_t *c
657  ** @param xcb_pixmap_t      pid
658  ** @param xcb_drawable_t    drawable
659  ** @param uint16_t          width
660  ** @param uint16_t          height
661  ** @param uint8_t           depth
662  ** @param xcb_shm_seg_t     shmseg
663  ** @param uint32_t          offset
664  ** @returns xcb_void_cookie_t
665  **
666  *****************************************************************************/
667 
668 xcb_void_cookie_t
669 xcb_shm_create_pixmap (xcb_connection_t *c  /**< */,
670                        xcb_pixmap_t      pid  /**< */,
671                        xcb_drawable_t    drawable  /**< */,
672                        uint16_t          width  /**< */,
673                        uint16_t          height  /**< */,
674                        uint8_t           depth  /**< */,
675                        xcb_shm_seg_t     shmseg  /**< */,
676                        uint32_t          offset  /**< */)
677 {
678     static const xcb_protocol_request_t xcb_req = {
679         /* count */ 2,
680         /* ext */ &xcb_shm_id,
681         /* opcode */ XCB_SHM_CREATE_PIXMAP,
682         /* isvoid */ 1
683     };
684 
685     struct iovec xcb_parts[4];
686     xcb_void_cookie_t xcb_ret;
687     xcb_shm_create_pixmap_request_t xcb_out;
688 
689     xcb_out.pid = pid;
690     xcb_out.drawable = drawable;
691     xcb_out.width = width;
692     xcb_out.height = height;
693     xcb_out.depth = depth;
694     memset(xcb_out.pad0, 0, 3);
695     xcb_out.shmseg = shmseg;
696     xcb_out.offset = offset;
697 
698     xcb_parts[2].iov_base = (char *) &xcb_out;
699     xcb_parts[2].iov_len = sizeof(xcb_out);
700     xcb_parts[3].iov_base = 0;
701     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
702     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
703     return xcb_ret;
704 }
705 
706