xref: /minix3/external/mit/xorg/lib/libxcb/files/present.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /*
2*0a6a1f1dSLionel Sambuc  * This file generated automatically from present.xml by c_client.py.
3*0a6a1f1dSLionel Sambuc  * Edit at your peril.
4*0a6a1f1dSLionel Sambuc  */
5*0a6a1f1dSLionel Sambuc 
6*0a6a1f1dSLionel Sambuc #ifdef HAVE_CONFIG_H
7*0a6a1f1dSLionel Sambuc #include "config.h"
8*0a6a1f1dSLionel Sambuc #endif
9*0a6a1f1dSLionel Sambuc #include <stdlib.h>
10*0a6a1f1dSLionel Sambuc #include <string.h>
11*0a6a1f1dSLionel Sambuc #include <assert.h>
12*0a6a1f1dSLionel Sambuc #include <stddef.h>  /* for offsetof() */
13*0a6a1f1dSLionel Sambuc #include "xcbext.h"
14*0a6a1f1dSLionel Sambuc #include "present.h"
15*0a6a1f1dSLionel Sambuc 
16*0a6a1f1dSLionel Sambuc #define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member)
17*0a6a1f1dSLionel Sambuc #include "xproto.h"
18*0a6a1f1dSLionel Sambuc #include "randr.h"
19*0a6a1f1dSLionel Sambuc #include "xfixes.h"
20*0a6a1f1dSLionel Sambuc #include "sync.h"
21*0a6a1f1dSLionel Sambuc 
22*0a6a1f1dSLionel Sambuc xcb_extension_t xcb_present_id = { "Present", 0 };
23*0a6a1f1dSLionel Sambuc 
24*0a6a1f1dSLionel Sambuc void
xcb_present_notify_next(xcb_present_notify_iterator_t * i)25*0a6a1f1dSLionel Sambuc xcb_present_notify_next (xcb_present_notify_iterator_t *i  /**< */)
26*0a6a1f1dSLionel Sambuc {
27*0a6a1f1dSLionel Sambuc     --i->rem;
28*0a6a1f1dSLionel Sambuc     ++i->data;
29*0a6a1f1dSLionel Sambuc     i->index += sizeof(xcb_present_notify_t);
30*0a6a1f1dSLionel Sambuc }
31*0a6a1f1dSLionel Sambuc 
32*0a6a1f1dSLionel Sambuc xcb_generic_iterator_t
xcb_present_notify_end(xcb_present_notify_iterator_t i)33*0a6a1f1dSLionel Sambuc xcb_present_notify_end (xcb_present_notify_iterator_t i  /**< */)
34*0a6a1f1dSLionel Sambuc {
35*0a6a1f1dSLionel Sambuc     xcb_generic_iterator_t ret;
36*0a6a1f1dSLionel Sambuc     ret.data = i.data + i.rem;
37*0a6a1f1dSLionel Sambuc     ret.index = i.index + ((char *) ret.data - (char *) i.data);
38*0a6a1f1dSLionel Sambuc     ret.rem = 0;
39*0a6a1f1dSLionel Sambuc     return ret;
40*0a6a1f1dSLionel Sambuc }
41*0a6a1f1dSLionel Sambuc 
42*0a6a1f1dSLionel Sambuc xcb_present_query_version_cookie_t
xcb_present_query_version(xcb_connection_t * c,uint32_t major_version,uint32_t minor_version)43*0a6a1f1dSLionel Sambuc xcb_present_query_version (xcb_connection_t *c  /**< */,
44*0a6a1f1dSLionel Sambuc                            uint32_t          major_version  /**< */,
45*0a6a1f1dSLionel Sambuc                            uint32_t          minor_version  /**< */)
46*0a6a1f1dSLionel Sambuc {
47*0a6a1f1dSLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
48*0a6a1f1dSLionel Sambuc         /* count */ 2,
49*0a6a1f1dSLionel Sambuc         /* ext */ &xcb_present_id,
50*0a6a1f1dSLionel Sambuc         /* opcode */ XCB_PRESENT_QUERY_VERSION,
51*0a6a1f1dSLionel Sambuc         /* isvoid */ 0
52*0a6a1f1dSLionel Sambuc     };
53*0a6a1f1dSLionel Sambuc 
54*0a6a1f1dSLionel Sambuc     struct iovec xcb_parts[4];
55*0a6a1f1dSLionel Sambuc     xcb_present_query_version_cookie_t xcb_ret;
56*0a6a1f1dSLionel Sambuc     xcb_present_query_version_request_t xcb_out;
57*0a6a1f1dSLionel Sambuc 
58*0a6a1f1dSLionel Sambuc     xcb_out.major_version = major_version;
59*0a6a1f1dSLionel Sambuc     xcb_out.minor_version = minor_version;
60*0a6a1f1dSLionel Sambuc 
61*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
62*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
63*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_base = 0;
64*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
65*0a6a1f1dSLionel Sambuc 
66*0a6a1f1dSLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
67*0a6a1f1dSLionel Sambuc     return xcb_ret;
68*0a6a1f1dSLionel Sambuc }
69*0a6a1f1dSLionel Sambuc 
70*0a6a1f1dSLionel Sambuc xcb_present_query_version_cookie_t
xcb_present_query_version_unchecked(xcb_connection_t * c,uint32_t major_version,uint32_t minor_version)71*0a6a1f1dSLionel Sambuc xcb_present_query_version_unchecked (xcb_connection_t *c  /**< */,
72*0a6a1f1dSLionel Sambuc                                      uint32_t          major_version  /**< */,
73*0a6a1f1dSLionel Sambuc                                      uint32_t          minor_version  /**< */)
74*0a6a1f1dSLionel Sambuc {
75*0a6a1f1dSLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
76*0a6a1f1dSLionel Sambuc         /* count */ 2,
77*0a6a1f1dSLionel Sambuc         /* ext */ &xcb_present_id,
78*0a6a1f1dSLionel Sambuc         /* opcode */ XCB_PRESENT_QUERY_VERSION,
79*0a6a1f1dSLionel Sambuc         /* isvoid */ 0
80*0a6a1f1dSLionel Sambuc     };
81*0a6a1f1dSLionel Sambuc 
82*0a6a1f1dSLionel Sambuc     struct iovec xcb_parts[4];
83*0a6a1f1dSLionel Sambuc     xcb_present_query_version_cookie_t xcb_ret;
84*0a6a1f1dSLionel Sambuc     xcb_present_query_version_request_t xcb_out;
85*0a6a1f1dSLionel Sambuc 
86*0a6a1f1dSLionel Sambuc     xcb_out.major_version = major_version;
87*0a6a1f1dSLionel Sambuc     xcb_out.minor_version = minor_version;
88*0a6a1f1dSLionel Sambuc 
89*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
90*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
91*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_base = 0;
92*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
93*0a6a1f1dSLionel Sambuc 
94*0a6a1f1dSLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
95*0a6a1f1dSLionel Sambuc     return xcb_ret;
96*0a6a1f1dSLionel Sambuc }
97*0a6a1f1dSLionel Sambuc 
98*0a6a1f1dSLionel Sambuc xcb_present_query_version_reply_t *
xcb_present_query_version_reply(xcb_connection_t * c,xcb_present_query_version_cookie_t cookie,xcb_generic_error_t ** e)99*0a6a1f1dSLionel Sambuc xcb_present_query_version_reply (xcb_connection_t                    *c  /**< */,
100*0a6a1f1dSLionel Sambuc                                  xcb_present_query_version_cookie_t   cookie  /**< */,
101*0a6a1f1dSLionel Sambuc                                  xcb_generic_error_t                **e  /**< */)
102*0a6a1f1dSLionel Sambuc {
103*0a6a1f1dSLionel Sambuc     return (xcb_present_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
104*0a6a1f1dSLionel Sambuc }
105*0a6a1f1dSLionel Sambuc 
106*0a6a1f1dSLionel Sambuc int
xcb_present_pixmap_sizeof(const void * _buffer,uint32_t notifies_len)107*0a6a1f1dSLionel Sambuc xcb_present_pixmap_sizeof (const void  *_buffer  /**< */,
108*0a6a1f1dSLionel Sambuc                            uint32_t     notifies_len  /**< */)
109*0a6a1f1dSLionel Sambuc {
110*0a6a1f1dSLionel Sambuc     char *xcb_tmp = (char *)_buffer;
111*0a6a1f1dSLionel Sambuc     unsigned int xcb_buffer_len = 0;
112*0a6a1f1dSLionel Sambuc     unsigned int xcb_block_len = 0;
113*0a6a1f1dSLionel Sambuc     unsigned int xcb_pad = 0;
114*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
115*0a6a1f1dSLionel Sambuc 
116*0a6a1f1dSLionel Sambuc 
117*0a6a1f1dSLionel Sambuc     xcb_block_len += sizeof(xcb_present_pixmap_request_t);
118*0a6a1f1dSLionel Sambuc     xcb_tmp += xcb_block_len;
119*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
120*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
121*0a6a1f1dSLionel Sambuc     /* notifies */
122*0a6a1f1dSLionel Sambuc     xcb_block_len += notifies_len * sizeof(xcb_present_notify_t);
123*0a6a1f1dSLionel Sambuc     xcb_tmp += xcb_block_len;
124*0a6a1f1dSLionel Sambuc     xcb_align_to = ALIGNOF(xcb_present_notify_t);
125*0a6a1f1dSLionel Sambuc     /* insert padding */
126*0a6a1f1dSLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
127*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
128*0a6a1f1dSLionel Sambuc     if (0 != xcb_pad) {
129*0a6a1f1dSLionel Sambuc         xcb_tmp += xcb_pad;
130*0a6a1f1dSLionel Sambuc         xcb_pad = 0;
131*0a6a1f1dSLionel Sambuc     }
132*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
133*0a6a1f1dSLionel Sambuc 
134*0a6a1f1dSLionel Sambuc     return xcb_buffer_len;
135*0a6a1f1dSLionel Sambuc }
136*0a6a1f1dSLionel Sambuc 
137*0a6a1f1dSLionel Sambuc xcb_void_cookie_t
xcb_present_pixmap_checked(xcb_connection_t * c,xcb_window_t window,xcb_pixmap_t pixmap,uint32_t serial,xcb_xfixes_region_t valid,xcb_xfixes_region_t update,int16_t x_off,int16_t y_off,xcb_randr_crtc_t target_crtc,xcb_sync_fence_t wait_fence,xcb_sync_fence_t idle_fence,uint32_t options,uint64_t target_msc,uint64_t divisor,uint64_t remainder,uint32_t notifies_len,const xcb_present_notify_t * notifies)138*0a6a1f1dSLionel Sambuc xcb_present_pixmap_checked (xcb_connection_t           *c  /**< */,
139*0a6a1f1dSLionel Sambuc                             xcb_window_t                window  /**< */,
140*0a6a1f1dSLionel Sambuc                             xcb_pixmap_t                pixmap  /**< */,
141*0a6a1f1dSLionel Sambuc                             uint32_t                    serial  /**< */,
142*0a6a1f1dSLionel Sambuc                             xcb_xfixes_region_t         valid  /**< */,
143*0a6a1f1dSLionel Sambuc                             xcb_xfixes_region_t         update  /**< */,
144*0a6a1f1dSLionel Sambuc                             int16_t                     x_off  /**< */,
145*0a6a1f1dSLionel Sambuc                             int16_t                     y_off  /**< */,
146*0a6a1f1dSLionel Sambuc                             xcb_randr_crtc_t            target_crtc  /**< */,
147*0a6a1f1dSLionel Sambuc                             xcb_sync_fence_t            wait_fence  /**< */,
148*0a6a1f1dSLionel Sambuc                             xcb_sync_fence_t            idle_fence  /**< */,
149*0a6a1f1dSLionel Sambuc                             uint32_t                    options  /**< */,
150*0a6a1f1dSLionel Sambuc                             uint64_t                    target_msc  /**< */,
151*0a6a1f1dSLionel Sambuc                             uint64_t                    divisor  /**< */,
152*0a6a1f1dSLionel Sambuc                             uint64_t                    remainder  /**< */,
153*0a6a1f1dSLionel Sambuc                             uint32_t                    notifies_len  /**< */,
154*0a6a1f1dSLionel Sambuc                             const xcb_present_notify_t *notifies  /**< */)
155*0a6a1f1dSLionel Sambuc {
156*0a6a1f1dSLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
157*0a6a1f1dSLionel Sambuc         /* count */ 4,
158*0a6a1f1dSLionel Sambuc         /* ext */ &xcb_present_id,
159*0a6a1f1dSLionel Sambuc         /* opcode */ XCB_PRESENT_PIXMAP,
160*0a6a1f1dSLionel Sambuc         /* isvoid */ 1
161*0a6a1f1dSLionel Sambuc     };
162*0a6a1f1dSLionel Sambuc 
163*0a6a1f1dSLionel Sambuc     struct iovec xcb_parts[6];
164*0a6a1f1dSLionel Sambuc     xcb_void_cookie_t xcb_ret;
165*0a6a1f1dSLionel Sambuc     xcb_present_pixmap_request_t xcb_out;
166*0a6a1f1dSLionel Sambuc 
167*0a6a1f1dSLionel Sambuc     xcb_out.window = window;
168*0a6a1f1dSLionel Sambuc     xcb_out.pixmap = pixmap;
169*0a6a1f1dSLionel Sambuc     xcb_out.serial = serial;
170*0a6a1f1dSLionel Sambuc     xcb_out.valid = valid;
171*0a6a1f1dSLionel Sambuc     xcb_out.update = update;
172*0a6a1f1dSLionel Sambuc     xcb_out.x_off = x_off;
173*0a6a1f1dSLionel Sambuc     xcb_out.y_off = y_off;
174*0a6a1f1dSLionel Sambuc     xcb_out.target_crtc = target_crtc;
175*0a6a1f1dSLionel Sambuc     xcb_out.wait_fence = wait_fence;
176*0a6a1f1dSLionel Sambuc     xcb_out.idle_fence = idle_fence;
177*0a6a1f1dSLionel Sambuc     xcb_out.options = options;
178*0a6a1f1dSLionel Sambuc     memset(xcb_out.pad0, 0, 4);
179*0a6a1f1dSLionel Sambuc     xcb_out.target_msc = target_msc;
180*0a6a1f1dSLionel Sambuc     xcb_out.divisor = divisor;
181*0a6a1f1dSLionel Sambuc     xcb_out.remainder = remainder;
182*0a6a1f1dSLionel Sambuc 
183*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
184*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
185*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_base = 0;
186*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
187*0a6a1f1dSLionel Sambuc     /* xcb_present_notify_t notifies */
188*0a6a1f1dSLionel Sambuc     xcb_parts[4].iov_base = (char *) notifies;
189*0a6a1f1dSLionel Sambuc     xcb_parts[4].iov_len = notifies_len * sizeof(xcb_present_notify_t);
190*0a6a1f1dSLionel Sambuc     xcb_parts[5].iov_base = 0;
191*0a6a1f1dSLionel Sambuc     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
192*0a6a1f1dSLionel Sambuc 
193*0a6a1f1dSLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
194*0a6a1f1dSLionel Sambuc     return xcb_ret;
195*0a6a1f1dSLionel Sambuc }
196*0a6a1f1dSLionel Sambuc 
197*0a6a1f1dSLionel Sambuc xcb_void_cookie_t
xcb_present_pixmap(xcb_connection_t * c,xcb_window_t window,xcb_pixmap_t pixmap,uint32_t serial,xcb_xfixes_region_t valid,xcb_xfixes_region_t update,int16_t x_off,int16_t y_off,xcb_randr_crtc_t target_crtc,xcb_sync_fence_t wait_fence,xcb_sync_fence_t idle_fence,uint32_t options,uint64_t target_msc,uint64_t divisor,uint64_t remainder,uint32_t notifies_len,const xcb_present_notify_t * notifies)198*0a6a1f1dSLionel Sambuc xcb_present_pixmap (xcb_connection_t           *c  /**< */,
199*0a6a1f1dSLionel Sambuc                     xcb_window_t                window  /**< */,
200*0a6a1f1dSLionel Sambuc                     xcb_pixmap_t                pixmap  /**< */,
201*0a6a1f1dSLionel Sambuc                     uint32_t                    serial  /**< */,
202*0a6a1f1dSLionel Sambuc                     xcb_xfixes_region_t         valid  /**< */,
203*0a6a1f1dSLionel Sambuc                     xcb_xfixes_region_t         update  /**< */,
204*0a6a1f1dSLionel Sambuc                     int16_t                     x_off  /**< */,
205*0a6a1f1dSLionel Sambuc                     int16_t                     y_off  /**< */,
206*0a6a1f1dSLionel Sambuc                     xcb_randr_crtc_t            target_crtc  /**< */,
207*0a6a1f1dSLionel Sambuc                     xcb_sync_fence_t            wait_fence  /**< */,
208*0a6a1f1dSLionel Sambuc                     xcb_sync_fence_t            idle_fence  /**< */,
209*0a6a1f1dSLionel Sambuc                     uint32_t                    options  /**< */,
210*0a6a1f1dSLionel Sambuc                     uint64_t                    target_msc  /**< */,
211*0a6a1f1dSLionel Sambuc                     uint64_t                    divisor  /**< */,
212*0a6a1f1dSLionel Sambuc                     uint64_t                    remainder  /**< */,
213*0a6a1f1dSLionel Sambuc                     uint32_t                    notifies_len  /**< */,
214*0a6a1f1dSLionel Sambuc                     const xcb_present_notify_t *notifies  /**< */)
215*0a6a1f1dSLionel Sambuc {
216*0a6a1f1dSLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
217*0a6a1f1dSLionel Sambuc         /* count */ 4,
218*0a6a1f1dSLionel Sambuc         /* ext */ &xcb_present_id,
219*0a6a1f1dSLionel Sambuc         /* opcode */ XCB_PRESENT_PIXMAP,
220*0a6a1f1dSLionel Sambuc         /* isvoid */ 1
221*0a6a1f1dSLionel Sambuc     };
222*0a6a1f1dSLionel Sambuc 
223*0a6a1f1dSLionel Sambuc     struct iovec xcb_parts[6];
224*0a6a1f1dSLionel Sambuc     xcb_void_cookie_t xcb_ret;
225*0a6a1f1dSLionel Sambuc     xcb_present_pixmap_request_t xcb_out;
226*0a6a1f1dSLionel Sambuc 
227*0a6a1f1dSLionel Sambuc     xcb_out.window = window;
228*0a6a1f1dSLionel Sambuc     xcb_out.pixmap = pixmap;
229*0a6a1f1dSLionel Sambuc     xcb_out.serial = serial;
230*0a6a1f1dSLionel Sambuc     xcb_out.valid = valid;
231*0a6a1f1dSLionel Sambuc     xcb_out.update = update;
232*0a6a1f1dSLionel Sambuc     xcb_out.x_off = x_off;
233*0a6a1f1dSLionel Sambuc     xcb_out.y_off = y_off;
234*0a6a1f1dSLionel Sambuc     xcb_out.target_crtc = target_crtc;
235*0a6a1f1dSLionel Sambuc     xcb_out.wait_fence = wait_fence;
236*0a6a1f1dSLionel Sambuc     xcb_out.idle_fence = idle_fence;
237*0a6a1f1dSLionel Sambuc     xcb_out.options = options;
238*0a6a1f1dSLionel Sambuc     memset(xcb_out.pad0, 0, 4);
239*0a6a1f1dSLionel Sambuc     xcb_out.target_msc = target_msc;
240*0a6a1f1dSLionel Sambuc     xcb_out.divisor = divisor;
241*0a6a1f1dSLionel Sambuc     xcb_out.remainder = remainder;
242*0a6a1f1dSLionel Sambuc 
243*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
244*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
245*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_base = 0;
246*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
247*0a6a1f1dSLionel Sambuc     /* xcb_present_notify_t notifies */
248*0a6a1f1dSLionel Sambuc     xcb_parts[4].iov_base = (char *) notifies;
249*0a6a1f1dSLionel Sambuc     xcb_parts[4].iov_len = notifies_len * sizeof(xcb_present_notify_t);
250*0a6a1f1dSLionel Sambuc     xcb_parts[5].iov_base = 0;
251*0a6a1f1dSLionel Sambuc     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
252*0a6a1f1dSLionel Sambuc 
253*0a6a1f1dSLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
254*0a6a1f1dSLionel Sambuc     return xcb_ret;
255*0a6a1f1dSLionel Sambuc }
256*0a6a1f1dSLionel Sambuc 
257*0a6a1f1dSLionel Sambuc xcb_void_cookie_t
xcb_present_notify_msc_checked(xcb_connection_t * c,xcb_window_t window,uint32_t serial,uint64_t target_msc,uint64_t divisor,uint64_t remainder)258*0a6a1f1dSLionel Sambuc xcb_present_notify_msc_checked (xcb_connection_t *c  /**< */,
259*0a6a1f1dSLionel Sambuc                                 xcb_window_t      window  /**< */,
260*0a6a1f1dSLionel Sambuc                                 uint32_t          serial  /**< */,
261*0a6a1f1dSLionel Sambuc                                 uint64_t          target_msc  /**< */,
262*0a6a1f1dSLionel Sambuc                                 uint64_t          divisor  /**< */,
263*0a6a1f1dSLionel Sambuc                                 uint64_t          remainder  /**< */)
264*0a6a1f1dSLionel Sambuc {
265*0a6a1f1dSLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
266*0a6a1f1dSLionel Sambuc         /* count */ 2,
267*0a6a1f1dSLionel Sambuc         /* ext */ &xcb_present_id,
268*0a6a1f1dSLionel Sambuc         /* opcode */ XCB_PRESENT_NOTIFY_MSC,
269*0a6a1f1dSLionel Sambuc         /* isvoid */ 1
270*0a6a1f1dSLionel Sambuc     };
271*0a6a1f1dSLionel Sambuc 
272*0a6a1f1dSLionel Sambuc     struct iovec xcb_parts[4];
273*0a6a1f1dSLionel Sambuc     xcb_void_cookie_t xcb_ret;
274*0a6a1f1dSLionel Sambuc     xcb_present_notify_msc_request_t xcb_out;
275*0a6a1f1dSLionel Sambuc 
276*0a6a1f1dSLionel Sambuc     xcb_out.window = window;
277*0a6a1f1dSLionel Sambuc     xcb_out.serial = serial;
278*0a6a1f1dSLionel Sambuc     memset(xcb_out.pad0, 0, 4);
279*0a6a1f1dSLionel Sambuc     xcb_out.target_msc = target_msc;
280*0a6a1f1dSLionel Sambuc     xcb_out.divisor = divisor;
281*0a6a1f1dSLionel Sambuc     xcb_out.remainder = remainder;
282*0a6a1f1dSLionel Sambuc 
283*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
284*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
285*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_base = 0;
286*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
287*0a6a1f1dSLionel Sambuc 
288*0a6a1f1dSLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
289*0a6a1f1dSLionel Sambuc     return xcb_ret;
290*0a6a1f1dSLionel Sambuc }
291*0a6a1f1dSLionel Sambuc 
292*0a6a1f1dSLionel Sambuc xcb_void_cookie_t
xcb_present_notify_msc(xcb_connection_t * c,xcb_window_t window,uint32_t serial,uint64_t target_msc,uint64_t divisor,uint64_t remainder)293*0a6a1f1dSLionel Sambuc xcb_present_notify_msc (xcb_connection_t *c  /**< */,
294*0a6a1f1dSLionel Sambuc                         xcb_window_t      window  /**< */,
295*0a6a1f1dSLionel Sambuc                         uint32_t          serial  /**< */,
296*0a6a1f1dSLionel Sambuc                         uint64_t          target_msc  /**< */,
297*0a6a1f1dSLionel Sambuc                         uint64_t          divisor  /**< */,
298*0a6a1f1dSLionel Sambuc                         uint64_t          remainder  /**< */)
299*0a6a1f1dSLionel Sambuc {
300*0a6a1f1dSLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
301*0a6a1f1dSLionel Sambuc         /* count */ 2,
302*0a6a1f1dSLionel Sambuc         /* ext */ &xcb_present_id,
303*0a6a1f1dSLionel Sambuc         /* opcode */ XCB_PRESENT_NOTIFY_MSC,
304*0a6a1f1dSLionel Sambuc         /* isvoid */ 1
305*0a6a1f1dSLionel Sambuc     };
306*0a6a1f1dSLionel Sambuc 
307*0a6a1f1dSLionel Sambuc     struct iovec xcb_parts[4];
308*0a6a1f1dSLionel Sambuc     xcb_void_cookie_t xcb_ret;
309*0a6a1f1dSLionel Sambuc     xcb_present_notify_msc_request_t xcb_out;
310*0a6a1f1dSLionel Sambuc 
311*0a6a1f1dSLionel Sambuc     xcb_out.window = window;
312*0a6a1f1dSLionel Sambuc     xcb_out.serial = serial;
313*0a6a1f1dSLionel Sambuc     memset(xcb_out.pad0, 0, 4);
314*0a6a1f1dSLionel Sambuc     xcb_out.target_msc = target_msc;
315*0a6a1f1dSLionel Sambuc     xcb_out.divisor = divisor;
316*0a6a1f1dSLionel Sambuc     xcb_out.remainder = remainder;
317*0a6a1f1dSLionel Sambuc 
318*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
319*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
320*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_base = 0;
321*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
322*0a6a1f1dSLionel Sambuc 
323*0a6a1f1dSLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
324*0a6a1f1dSLionel Sambuc     return xcb_ret;
325*0a6a1f1dSLionel Sambuc }
326*0a6a1f1dSLionel Sambuc 
327*0a6a1f1dSLionel Sambuc void
xcb_present_event_next(xcb_present_event_iterator_t * i)328*0a6a1f1dSLionel Sambuc xcb_present_event_next (xcb_present_event_iterator_t *i  /**< */)
329*0a6a1f1dSLionel Sambuc {
330*0a6a1f1dSLionel Sambuc     --i->rem;
331*0a6a1f1dSLionel Sambuc     ++i->data;
332*0a6a1f1dSLionel Sambuc     i->index += sizeof(xcb_present_event_t);
333*0a6a1f1dSLionel Sambuc }
334*0a6a1f1dSLionel Sambuc 
335*0a6a1f1dSLionel Sambuc xcb_generic_iterator_t
xcb_present_event_end(xcb_present_event_iterator_t i)336*0a6a1f1dSLionel Sambuc xcb_present_event_end (xcb_present_event_iterator_t i  /**< */)
337*0a6a1f1dSLionel Sambuc {
338*0a6a1f1dSLionel Sambuc     xcb_generic_iterator_t ret;
339*0a6a1f1dSLionel Sambuc     ret.data = i.data + i.rem;
340*0a6a1f1dSLionel Sambuc     ret.index = i.index + ((char *) ret.data - (char *) i.data);
341*0a6a1f1dSLionel Sambuc     ret.rem = 0;
342*0a6a1f1dSLionel Sambuc     return ret;
343*0a6a1f1dSLionel Sambuc }
344*0a6a1f1dSLionel Sambuc 
345*0a6a1f1dSLionel Sambuc xcb_void_cookie_t
xcb_present_select_input_checked(xcb_connection_t * c,xcb_present_event_t eid,xcb_window_t window,uint32_t event_mask)346*0a6a1f1dSLionel Sambuc xcb_present_select_input_checked (xcb_connection_t    *c  /**< */,
347*0a6a1f1dSLionel Sambuc                                   xcb_present_event_t  eid  /**< */,
348*0a6a1f1dSLionel Sambuc                                   xcb_window_t         window  /**< */,
349*0a6a1f1dSLionel Sambuc                                   uint32_t             event_mask  /**< */)
350*0a6a1f1dSLionel Sambuc {
351*0a6a1f1dSLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
352*0a6a1f1dSLionel Sambuc         /* count */ 2,
353*0a6a1f1dSLionel Sambuc         /* ext */ &xcb_present_id,
354*0a6a1f1dSLionel Sambuc         /* opcode */ XCB_PRESENT_SELECT_INPUT,
355*0a6a1f1dSLionel Sambuc         /* isvoid */ 1
356*0a6a1f1dSLionel Sambuc     };
357*0a6a1f1dSLionel Sambuc 
358*0a6a1f1dSLionel Sambuc     struct iovec xcb_parts[4];
359*0a6a1f1dSLionel Sambuc     xcb_void_cookie_t xcb_ret;
360*0a6a1f1dSLionel Sambuc     xcb_present_select_input_request_t xcb_out;
361*0a6a1f1dSLionel Sambuc 
362*0a6a1f1dSLionel Sambuc     xcb_out.eid = eid;
363*0a6a1f1dSLionel Sambuc     xcb_out.window = window;
364*0a6a1f1dSLionel Sambuc     xcb_out.event_mask = event_mask;
365*0a6a1f1dSLionel Sambuc 
366*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
367*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
368*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_base = 0;
369*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
370*0a6a1f1dSLionel Sambuc 
371*0a6a1f1dSLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
372*0a6a1f1dSLionel Sambuc     return xcb_ret;
373*0a6a1f1dSLionel Sambuc }
374*0a6a1f1dSLionel Sambuc 
375*0a6a1f1dSLionel Sambuc xcb_void_cookie_t
xcb_present_select_input(xcb_connection_t * c,xcb_present_event_t eid,xcb_window_t window,uint32_t event_mask)376*0a6a1f1dSLionel Sambuc xcb_present_select_input (xcb_connection_t    *c  /**< */,
377*0a6a1f1dSLionel Sambuc                           xcb_present_event_t  eid  /**< */,
378*0a6a1f1dSLionel Sambuc                           xcb_window_t         window  /**< */,
379*0a6a1f1dSLionel Sambuc                           uint32_t             event_mask  /**< */)
380*0a6a1f1dSLionel Sambuc {
381*0a6a1f1dSLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
382*0a6a1f1dSLionel Sambuc         /* count */ 2,
383*0a6a1f1dSLionel Sambuc         /* ext */ &xcb_present_id,
384*0a6a1f1dSLionel Sambuc         /* opcode */ XCB_PRESENT_SELECT_INPUT,
385*0a6a1f1dSLionel Sambuc         /* isvoid */ 1
386*0a6a1f1dSLionel Sambuc     };
387*0a6a1f1dSLionel Sambuc 
388*0a6a1f1dSLionel Sambuc     struct iovec xcb_parts[4];
389*0a6a1f1dSLionel Sambuc     xcb_void_cookie_t xcb_ret;
390*0a6a1f1dSLionel Sambuc     xcb_present_select_input_request_t xcb_out;
391*0a6a1f1dSLionel Sambuc 
392*0a6a1f1dSLionel Sambuc     xcb_out.eid = eid;
393*0a6a1f1dSLionel Sambuc     xcb_out.window = window;
394*0a6a1f1dSLionel Sambuc     xcb_out.event_mask = event_mask;
395*0a6a1f1dSLionel Sambuc 
396*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
397*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
398*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_base = 0;
399*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
400*0a6a1f1dSLionel Sambuc 
401*0a6a1f1dSLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
402*0a6a1f1dSLionel Sambuc     return xcb_ret;
403*0a6a1f1dSLionel Sambuc }
404*0a6a1f1dSLionel Sambuc 
405*0a6a1f1dSLionel Sambuc xcb_present_query_capabilities_cookie_t
xcb_present_query_capabilities(xcb_connection_t * c,uint32_t target)406*0a6a1f1dSLionel Sambuc xcb_present_query_capabilities (xcb_connection_t *c  /**< */,
407*0a6a1f1dSLionel Sambuc                                 uint32_t          target  /**< */)
408*0a6a1f1dSLionel Sambuc {
409*0a6a1f1dSLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
410*0a6a1f1dSLionel Sambuc         /* count */ 2,
411*0a6a1f1dSLionel Sambuc         /* ext */ &xcb_present_id,
412*0a6a1f1dSLionel Sambuc         /* opcode */ XCB_PRESENT_QUERY_CAPABILITIES,
413*0a6a1f1dSLionel Sambuc         /* isvoid */ 0
414*0a6a1f1dSLionel Sambuc     };
415*0a6a1f1dSLionel Sambuc 
416*0a6a1f1dSLionel Sambuc     struct iovec xcb_parts[4];
417*0a6a1f1dSLionel Sambuc     xcb_present_query_capabilities_cookie_t xcb_ret;
418*0a6a1f1dSLionel Sambuc     xcb_present_query_capabilities_request_t xcb_out;
419*0a6a1f1dSLionel Sambuc 
420*0a6a1f1dSLionel Sambuc     xcb_out.target = target;
421*0a6a1f1dSLionel Sambuc 
422*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
423*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
424*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_base = 0;
425*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
426*0a6a1f1dSLionel Sambuc 
427*0a6a1f1dSLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
428*0a6a1f1dSLionel Sambuc     return xcb_ret;
429*0a6a1f1dSLionel Sambuc }
430*0a6a1f1dSLionel Sambuc 
431*0a6a1f1dSLionel Sambuc xcb_present_query_capabilities_cookie_t
xcb_present_query_capabilities_unchecked(xcb_connection_t * c,uint32_t target)432*0a6a1f1dSLionel Sambuc xcb_present_query_capabilities_unchecked (xcb_connection_t *c  /**< */,
433*0a6a1f1dSLionel Sambuc                                           uint32_t          target  /**< */)
434*0a6a1f1dSLionel Sambuc {
435*0a6a1f1dSLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
436*0a6a1f1dSLionel Sambuc         /* count */ 2,
437*0a6a1f1dSLionel Sambuc         /* ext */ &xcb_present_id,
438*0a6a1f1dSLionel Sambuc         /* opcode */ XCB_PRESENT_QUERY_CAPABILITIES,
439*0a6a1f1dSLionel Sambuc         /* isvoid */ 0
440*0a6a1f1dSLionel Sambuc     };
441*0a6a1f1dSLionel Sambuc 
442*0a6a1f1dSLionel Sambuc     struct iovec xcb_parts[4];
443*0a6a1f1dSLionel Sambuc     xcb_present_query_capabilities_cookie_t xcb_ret;
444*0a6a1f1dSLionel Sambuc     xcb_present_query_capabilities_request_t xcb_out;
445*0a6a1f1dSLionel Sambuc 
446*0a6a1f1dSLionel Sambuc     xcb_out.target = target;
447*0a6a1f1dSLionel Sambuc 
448*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
449*0a6a1f1dSLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
450*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_base = 0;
451*0a6a1f1dSLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
452*0a6a1f1dSLionel Sambuc 
453*0a6a1f1dSLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
454*0a6a1f1dSLionel Sambuc     return xcb_ret;
455*0a6a1f1dSLionel Sambuc }
456*0a6a1f1dSLionel Sambuc 
457*0a6a1f1dSLionel Sambuc xcb_present_query_capabilities_reply_t *
xcb_present_query_capabilities_reply(xcb_connection_t * c,xcb_present_query_capabilities_cookie_t cookie,xcb_generic_error_t ** e)458*0a6a1f1dSLionel Sambuc xcb_present_query_capabilities_reply (xcb_connection_t                         *c  /**< */,
459*0a6a1f1dSLionel Sambuc                                       xcb_present_query_capabilities_cookie_t   cookie  /**< */,
460*0a6a1f1dSLionel Sambuc                                       xcb_generic_error_t                     **e  /**< */)
461*0a6a1f1dSLionel Sambuc {
462*0a6a1f1dSLionel Sambuc     return (xcb_present_query_capabilities_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
463*0a6a1f1dSLionel Sambuc }
464*0a6a1f1dSLionel Sambuc 
465*0a6a1f1dSLionel Sambuc int
xcb_present_redirect_notify_sizeof(const void * _buffer,uint32_t notifies_len)466*0a6a1f1dSLionel Sambuc xcb_present_redirect_notify_sizeof (const void  *_buffer  /**< */,
467*0a6a1f1dSLionel Sambuc                                     uint32_t     notifies_len  /**< */)
468*0a6a1f1dSLionel Sambuc {
469*0a6a1f1dSLionel Sambuc     char *xcb_tmp = (char *)_buffer;
470*0a6a1f1dSLionel Sambuc     unsigned int xcb_buffer_len = 0;
471*0a6a1f1dSLionel Sambuc     unsigned int xcb_block_len = 0;
472*0a6a1f1dSLionel Sambuc     unsigned int xcb_pad = 0;
473*0a6a1f1dSLionel Sambuc     unsigned int xcb_align_to = 0;
474*0a6a1f1dSLionel Sambuc 
475*0a6a1f1dSLionel Sambuc 
476*0a6a1f1dSLionel Sambuc     xcb_block_len += sizeof(xcb_present_redirect_notify_event_t);
477*0a6a1f1dSLionel Sambuc     xcb_tmp += xcb_block_len;
478*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len;
479*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
480*0a6a1f1dSLionel Sambuc     /* notifies */
481*0a6a1f1dSLionel Sambuc     xcb_block_len += notifies_len * sizeof(xcb_present_notify_t);
482*0a6a1f1dSLionel Sambuc     xcb_tmp += xcb_block_len;
483*0a6a1f1dSLionel Sambuc     xcb_align_to = ALIGNOF(xcb_present_notify_t);
484*0a6a1f1dSLionel Sambuc     /* insert padding */
485*0a6a1f1dSLionel Sambuc     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
486*0a6a1f1dSLionel Sambuc     xcb_buffer_len += xcb_block_len + xcb_pad;
487*0a6a1f1dSLionel Sambuc     if (0 != xcb_pad) {
488*0a6a1f1dSLionel Sambuc         xcb_tmp += xcb_pad;
489*0a6a1f1dSLionel Sambuc         xcb_pad = 0;
490*0a6a1f1dSLionel Sambuc     }
491*0a6a1f1dSLionel Sambuc     xcb_block_len = 0;
492*0a6a1f1dSLionel Sambuc 
493*0a6a1f1dSLionel Sambuc     return xcb_buffer_len;
494*0a6a1f1dSLionel Sambuc }
495*0a6a1f1dSLionel Sambuc 
496