xref: /netbsd/external/mit/xorg/lib/libxcb/files/shm.h (revision 9a467d0f)
1 /*
2  * This file generated automatically from shm.xml by c_client.py.
3  * Edit at your peril.
4  */
5 
6 /**
7  * @defgroup XCB_Shm_API XCB Shm API
8  * @brief Shm XCB Protocol Implementation.
9  * @{
10  **/
11 
12 #ifndef __SHM_H
13 #define __SHM_H
14 
15 #include "xcb.h"
16 #include "xproto.h"
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 #define XCB_SHM_MAJOR_VERSION 1
23 #define XCB_SHM_MINOR_VERSION 2
24 
25 extern xcb_extension_t xcb_shm_id;
26 
27 typedef uint32_t xcb_shm_seg_t;
28 
29 /**
30  * @brief xcb_shm_seg_iterator_t
31  **/
32 typedef struct xcb_shm_seg_iterator_t {
33     xcb_shm_seg_t *data;
34     int            rem;
35     int            index;
36 } xcb_shm_seg_iterator_t;
37 
38 /** Opcode for xcb_shm_completion. */
39 #define XCB_SHM_COMPLETION 0
40 
41 /**
42  * @brief xcb_shm_completion_event_t
43  **/
44 typedef struct xcb_shm_completion_event_t {
45     uint8_t        response_type;
46     uint8_t        pad0;
47     uint16_t       sequence;
48     xcb_drawable_t drawable;
49     uint16_t       minor_event;
50     uint8_t        major_event;
51     uint8_t        pad1;
52     xcb_shm_seg_t  shmseg;
53     uint32_t       offset;
54 } xcb_shm_completion_event_t;
55 
56 /** Opcode for xcb_shm_bad_seg. */
57 #define XCB_SHM_BAD_SEG 0
58 
59 typedef xcb_value_error_t xcb_shm_bad_seg_error_t;
60 
61 /**
62  * @brief xcb_shm_query_version_cookie_t
63  **/
64 typedef struct xcb_shm_query_version_cookie_t {
65     unsigned int sequence;
66 } xcb_shm_query_version_cookie_t;
67 
68 /** Opcode for xcb_shm_query_version. */
69 #define XCB_SHM_QUERY_VERSION 0
70 
71 /**
72  * @brief xcb_shm_query_version_request_t
73  **/
74 typedef struct xcb_shm_query_version_request_t {
75     uint8_t  major_opcode;
76     uint8_t  minor_opcode;
77     uint16_t length;
78 } xcb_shm_query_version_request_t;
79 
80 /**
81  * @brief xcb_shm_query_version_reply_t
82  **/
83 typedef struct xcb_shm_query_version_reply_t {
84     uint8_t  response_type;
85     uint8_t  shared_pixmaps;
86     uint16_t sequence;
87     uint32_t length;
88     uint16_t major_version;
89     uint16_t minor_version;
90     uint16_t uid;
91     uint16_t gid;
92     uint8_t  pixmap_format;
93     uint8_t  pad0[15];
94 } xcb_shm_query_version_reply_t;
95 
96 /** Opcode for xcb_shm_attach. */
97 #define XCB_SHM_ATTACH 1
98 
99 /**
100  * @brief xcb_shm_attach_request_t
101  **/
102 typedef struct xcb_shm_attach_request_t {
103     uint8_t       major_opcode;
104     uint8_t       minor_opcode;
105     uint16_t      length;
106     xcb_shm_seg_t shmseg;
107     uint32_t      shmid;
108     uint8_t       read_only;
109     uint8_t       pad0[3];
110 } xcb_shm_attach_request_t;
111 
112 /** Opcode for xcb_shm_detach. */
113 #define XCB_SHM_DETACH 2
114 
115 /**
116  * @brief xcb_shm_detach_request_t
117  **/
118 typedef struct xcb_shm_detach_request_t {
119     uint8_t       major_opcode;
120     uint8_t       minor_opcode;
121     uint16_t      length;
122     xcb_shm_seg_t shmseg;
123 } xcb_shm_detach_request_t;
124 
125 /** Opcode for xcb_shm_put_image. */
126 #define XCB_SHM_PUT_IMAGE 3
127 
128 /**
129  * @brief xcb_shm_put_image_request_t
130  **/
131 typedef struct xcb_shm_put_image_request_t {
132     uint8_t        major_opcode;
133     uint8_t        minor_opcode;
134     uint16_t       length;
135     xcb_drawable_t drawable;
136     xcb_gcontext_t gc;
137     uint16_t       total_width;
138     uint16_t       total_height;
139     uint16_t       src_x;
140     uint16_t       src_y;
141     uint16_t       src_width;
142     uint16_t       src_height;
143     int16_t        dst_x;
144     int16_t        dst_y;
145     uint8_t        depth;
146     uint8_t        format;
147     uint8_t        send_event;
148     uint8_t        pad0;
149     xcb_shm_seg_t  shmseg;
150     uint32_t       offset;
151 } xcb_shm_put_image_request_t;
152 
153 /**
154  * @brief xcb_shm_get_image_cookie_t
155  **/
156 typedef struct xcb_shm_get_image_cookie_t {
157     unsigned int sequence;
158 } xcb_shm_get_image_cookie_t;
159 
160 /** Opcode for xcb_shm_get_image. */
161 #define XCB_SHM_GET_IMAGE 4
162 
163 /**
164  * @brief xcb_shm_get_image_request_t
165  **/
166 typedef struct xcb_shm_get_image_request_t {
167     uint8_t        major_opcode;
168     uint8_t        minor_opcode;
169     uint16_t       length;
170     xcb_drawable_t drawable;
171     int16_t        x;
172     int16_t        y;
173     uint16_t       width;
174     uint16_t       height;
175     uint32_t       plane_mask;
176     uint8_t        format;
177     uint8_t        pad0[3];
178     xcb_shm_seg_t  shmseg;
179     uint32_t       offset;
180 } xcb_shm_get_image_request_t;
181 
182 /**
183  * @brief xcb_shm_get_image_reply_t
184  **/
185 typedef struct xcb_shm_get_image_reply_t {
186     uint8_t        response_type;
187     uint8_t        depth;
188     uint16_t       sequence;
189     uint32_t       length;
190     xcb_visualid_t visual;
191     uint32_t       size;
192 } xcb_shm_get_image_reply_t;
193 
194 /** Opcode for xcb_shm_create_pixmap. */
195 #define XCB_SHM_CREATE_PIXMAP 5
196 
197 /**
198  * @brief xcb_shm_create_pixmap_request_t
199  **/
200 typedef struct xcb_shm_create_pixmap_request_t {
201     uint8_t        major_opcode;
202     uint8_t        minor_opcode;
203     uint16_t       length;
204     xcb_pixmap_t   pid;
205     xcb_drawable_t drawable;
206     uint16_t       width;
207     uint16_t       height;
208     uint8_t        depth;
209     uint8_t        pad0[3];
210     xcb_shm_seg_t  shmseg;
211     uint32_t       offset;
212 } xcb_shm_create_pixmap_request_t;
213 
214 /** Opcode for xcb_shm_attach_fd. */
215 #define XCB_SHM_ATTACH_FD 6
216 
217 /**
218  * @brief xcb_shm_attach_fd_request_t
219  **/
220 typedef struct xcb_shm_attach_fd_request_t {
221     uint8_t       major_opcode;
222     uint8_t       minor_opcode;
223     uint16_t      length;
224     xcb_shm_seg_t shmseg;
225     uint8_t       read_only;
226     uint8_t       pad0[3];
227 } xcb_shm_attach_fd_request_t;
228 
229 /**
230  * @brief xcb_shm_create_segment_cookie_t
231  **/
232 typedef struct xcb_shm_create_segment_cookie_t {
233     unsigned int sequence;
234 } xcb_shm_create_segment_cookie_t;
235 
236 /** Opcode for xcb_shm_create_segment. */
237 #define XCB_SHM_CREATE_SEGMENT 7
238 
239 /**
240  * @brief xcb_shm_create_segment_request_t
241  **/
242 typedef struct xcb_shm_create_segment_request_t {
243     uint8_t       major_opcode;
244     uint8_t       minor_opcode;
245     uint16_t      length;
246     xcb_shm_seg_t shmseg;
247     uint32_t      size;
248     uint8_t       read_only;
249     uint8_t       pad0[3];
250 } xcb_shm_create_segment_request_t;
251 
252 /**
253  * @brief xcb_shm_create_segment_reply_t
254  **/
255 typedef struct xcb_shm_create_segment_reply_t {
256     uint8_t  response_type;
257     uint8_t  nfd;
258     uint16_t sequence;
259     uint32_t length;
260     uint8_t  pad0[24];
261 } xcb_shm_create_segment_reply_t;
262 
263 /**
264  * Get the next element of the iterator
265  * @param i Pointer to a xcb_shm_seg_iterator_t
266  *
267  * Get the next element in the iterator. The member rem is
268  * decreased by one. The member data points to the next
269  * element. The member index is increased by sizeof(xcb_shm_seg_t)
270  */
271 void
272 xcb_shm_seg_next (xcb_shm_seg_iterator_t *i);
273 
274 /**
275  * Return the iterator pointing to the last element
276  * @param i An xcb_shm_seg_iterator_t
277  * @return  The iterator pointing to the last element
278  *
279  * Set the current element in the iterator to the last element.
280  * The member rem is set to 0. The member data points to the
281  * last element.
282  */
283 xcb_generic_iterator_t
284 xcb_shm_seg_end (xcb_shm_seg_iterator_t i);
285 
286 /**
287  *
288  * @param c The connection
289  * @return A cookie
290  *
291  * Delivers a request to the X server.
292  *
293  */
294 xcb_shm_query_version_cookie_t
295 xcb_shm_query_version (xcb_connection_t *c);
296 
297 /**
298  *
299  * @param c The connection
300  * @return A cookie
301  *
302  * Delivers a request to the X server.
303  *
304  * This form can be used only if the request will cause
305  * a reply to be generated. Any returned error will be
306  * placed in the event queue.
307  */
308 xcb_shm_query_version_cookie_t
309 xcb_shm_query_version_unchecked (xcb_connection_t *c);
310 
311 /**
312  * Return the reply
313  * @param c      The connection
314  * @param cookie The cookie
315  * @param e      The xcb_generic_error_t supplied
316  *
317  * Returns the reply of the request asked by
318  *
319  * The parameter @p e supplied to this function must be NULL if
320  * xcb_shm_query_version_unchecked(). is used.
321  * Otherwise, it stores the error if any.
322  *
323  * The returned value must be freed by the caller using free().
324  */
325 xcb_shm_query_version_reply_t *
326 xcb_shm_query_version_reply (xcb_connection_t                *c,
327                              xcb_shm_query_version_cookie_t   cookie  /**< */,
328                              xcb_generic_error_t            **e);
329 
330 /**
331  *
332  * @param c The connection
333  * @return A cookie
334  *
335  * Delivers a request to the X server.
336  *
337  * This form can be used only if the request will not cause
338  * a reply to be generated. Any returned error will be
339  * saved for handling by xcb_request_check().
340  */
341 xcb_void_cookie_t
342 xcb_shm_attach_checked (xcb_connection_t *c,
343                         xcb_shm_seg_t     shmseg,
344                         uint32_t          shmid,
345                         uint8_t           read_only);
346 
347 /**
348  *
349  * @param c The connection
350  * @return A cookie
351  *
352  * Delivers a request to the X server.
353  *
354  */
355 xcb_void_cookie_t
356 xcb_shm_attach (xcb_connection_t *c,
357                 xcb_shm_seg_t     shmseg,
358                 uint32_t          shmid,
359                 uint8_t           read_only);
360 
361 /**
362  *
363  * @param c The connection
364  * @return A cookie
365  *
366  * Delivers a request to the X server.
367  *
368  * This form can be used only if the request will not cause
369  * a reply to be generated. Any returned error will be
370  * saved for handling by xcb_request_check().
371  */
372 xcb_void_cookie_t
373 xcb_shm_detach_checked (xcb_connection_t *c,
374                         xcb_shm_seg_t     shmseg);
375 
376 /**
377  *
378  * @param c The connection
379  * @return A cookie
380  *
381  * Delivers a request to the X server.
382  *
383  */
384 xcb_void_cookie_t
385 xcb_shm_detach (xcb_connection_t *c,
386                 xcb_shm_seg_t     shmseg);
387 
388 /**
389  *
390  * @param c The connection
391  * @return A cookie
392  *
393  * Delivers a request to the X server.
394  *
395  * This form can be used only if the request will not cause
396  * a reply to be generated. Any returned error will be
397  * saved for handling by xcb_request_check().
398  */
399 xcb_void_cookie_t
400 xcb_shm_put_image_checked (xcb_connection_t *c,
401                            xcb_drawable_t    drawable,
402                            xcb_gcontext_t    gc,
403                            uint16_t          total_width,
404                            uint16_t          total_height,
405                            uint16_t          src_x,
406                            uint16_t          src_y,
407                            uint16_t          src_width,
408                            uint16_t          src_height,
409                            int16_t           dst_x,
410                            int16_t           dst_y,
411                            uint8_t           depth,
412                            uint8_t           format,
413                            uint8_t           send_event,
414                            xcb_shm_seg_t     shmseg,
415                            uint32_t          offset);
416 
417 /**
418  *
419  * @param c The connection
420  * @return A cookie
421  *
422  * Delivers a request to the X server.
423  *
424  */
425 xcb_void_cookie_t
426 xcb_shm_put_image (xcb_connection_t *c,
427                    xcb_drawable_t    drawable,
428                    xcb_gcontext_t    gc,
429                    uint16_t          total_width,
430                    uint16_t          total_height,
431                    uint16_t          src_x,
432                    uint16_t          src_y,
433                    uint16_t          src_width,
434                    uint16_t          src_height,
435                    int16_t           dst_x,
436                    int16_t           dst_y,
437                    uint8_t           depth,
438                    uint8_t           format,
439                    uint8_t           send_event,
440                    xcb_shm_seg_t     shmseg,
441                    uint32_t          offset);
442 
443 /**
444  *
445  * @param c The connection
446  * @return A cookie
447  *
448  * Delivers a request to the X server.
449  *
450  */
451 xcb_shm_get_image_cookie_t
452 xcb_shm_get_image (xcb_connection_t *c,
453                    xcb_drawable_t    drawable,
454                    int16_t           x,
455                    int16_t           y,
456                    uint16_t          width,
457                    uint16_t          height,
458                    uint32_t          plane_mask,
459                    uint8_t           format,
460                    xcb_shm_seg_t     shmseg,
461                    uint32_t          offset);
462 
463 /**
464  *
465  * @param c The connection
466  * @return A cookie
467  *
468  * Delivers a request to the X server.
469  *
470  * This form can be used only if the request will cause
471  * a reply to be generated. Any returned error will be
472  * placed in the event queue.
473  */
474 xcb_shm_get_image_cookie_t
475 xcb_shm_get_image_unchecked (xcb_connection_t *c,
476                              xcb_drawable_t    drawable,
477                              int16_t           x,
478                              int16_t           y,
479                              uint16_t          width,
480                              uint16_t          height,
481                              uint32_t          plane_mask,
482                              uint8_t           format,
483                              xcb_shm_seg_t     shmseg,
484                              uint32_t          offset);
485 
486 /**
487  * Return the reply
488  * @param c      The connection
489  * @param cookie The cookie
490  * @param e      The xcb_generic_error_t supplied
491  *
492  * Returns the reply of the request asked by
493  *
494  * The parameter @p e supplied to this function must be NULL if
495  * xcb_shm_get_image_unchecked(). is used.
496  * Otherwise, it stores the error if any.
497  *
498  * The returned value must be freed by the caller using free().
499  */
500 xcb_shm_get_image_reply_t *
501 xcb_shm_get_image_reply (xcb_connection_t            *c,
502                          xcb_shm_get_image_cookie_t   cookie  /**< */,
503                          xcb_generic_error_t        **e);
504 
505 /**
506  *
507  * @param c The connection
508  * @return A cookie
509  *
510  * Delivers a request to the X server.
511  *
512  * This form can be used only if the request will not cause
513  * a reply to be generated. Any returned error will be
514  * saved for handling by xcb_request_check().
515  */
516 xcb_void_cookie_t
517 xcb_shm_create_pixmap_checked (xcb_connection_t *c,
518                                xcb_pixmap_t      pid,
519                                xcb_drawable_t    drawable,
520                                uint16_t          width,
521                                uint16_t          height,
522                                uint8_t           depth,
523                                xcb_shm_seg_t     shmseg,
524                                uint32_t          offset);
525 
526 /**
527  *
528  * @param c The connection
529  * @return A cookie
530  *
531  * Delivers a request to the X server.
532  *
533  */
534 xcb_void_cookie_t
535 xcb_shm_create_pixmap (xcb_connection_t *c,
536                        xcb_pixmap_t      pid,
537                        xcb_drawable_t    drawable,
538                        uint16_t          width,
539                        uint16_t          height,
540                        uint8_t           depth,
541                        xcb_shm_seg_t     shmseg,
542                        uint32_t          offset);
543 
544 /**
545  *
546  * @param c The connection
547  * @return A cookie
548  *
549  * Delivers a request to the X server.
550  *
551  * This form can be used only if the request will not cause
552  * a reply to be generated. Any returned error will be
553  * saved for handling by xcb_request_check().
554  */
555 xcb_void_cookie_t
556 xcb_shm_attach_fd_checked (xcb_connection_t *c,
557                            xcb_shm_seg_t     shmseg,
558                            int32_t           shm_fd,
559                            uint8_t           read_only);
560 
561 /**
562  *
563  * @param c The connection
564  * @return A cookie
565  *
566  * Delivers a request to the X server.
567  *
568  */
569 xcb_void_cookie_t
570 xcb_shm_attach_fd (xcb_connection_t *c,
571                    xcb_shm_seg_t     shmseg,
572                    int32_t           shm_fd,
573                    uint8_t           read_only);
574 
575 /**
576  *
577  * @param c The connection
578  * @return A cookie
579  *
580  * Delivers a request to the X server.
581  *
582  */
583 xcb_shm_create_segment_cookie_t
584 xcb_shm_create_segment (xcb_connection_t *c,
585                         xcb_shm_seg_t     shmseg,
586                         uint32_t          size,
587                         uint8_t           read_only);
588 
589 /**
590  *
591  * @param c The connection
592  * @return A cookie
593  *
594  * Delivers a request to the X server.
595  *
596  * This form can be used only if the request will cause
597  * a reply to be generated. Any returned error will be
598  * placed in the event queue.
599  */
600 xcb_shm_create_segment_cookie_t
601 xcb_shm_create_segment_unchecked (xcb_connection_t *c,
602                                   xcb_shm_seg_t     shmseg,
603                                   uint32_t          size,
604                                   uint8_t           read_only);
605 
606 /**
607  * Return the reply
608  * @param c      The connection
609  * @param cookie The cookie
610  * @param e      The xcb_generic_error_t supplied
611  *
612  * Returns the reply of the request asked by
613  *
614  * The parameter @p e supplied to this function must be NULL if
615  * xcb_shm_create_segment_unchecked(). is used.
616  * Otherwise, it stores the error if any.
617  *
618  * The returned value must be freed by the caller using free().
619  */
620 xcb_shm_create_segment_reply_t *
621 xcb_shm_create_segment_reply (xcb_connection_t                 *c,
622                               xcb_shm_create_segment_cookie_t   cookie  /**< */,
623                               xcb_generic_error_t             **e);
624 
625 /**
626  * Return the reply fds
627  * @param c      The connection
628  * @param reply  The reply
629  *
630  * Returns a pointer to the array of reply fds of the reply.
631  *
632  * The returned value points into the reply and must not be free().
633  * The fds are not managed by xcb. You must close() them before freeing the reply.
634  */
635 int *
636 xcb_shm_create_segment_reply_fds (xcb_connection_t                *c  /**< */,
637                                   xcb_shm_create_segment_reply_t  *reply);
638 
639 
640 #ifdef __cplusplus
641 }
642 #endif
643 
644 #endif
645 
646 /**
647  * @}
648  */
649