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