xref: /minix3/external/mit/xorg/lib/libxcb/files/xtest.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*971bb1a5SLionel Sambuc /*
2*971bb1a5SLionel Sambuc  * This file generated automatically from xtest.xml by c_client.py.
3*971bb1a5SLionel Sambuc  * Edit at your peril.
4*971bb1a5SLionel Sambuc  */
5*971bb1a5SLionel Sambuc 
6*971bb1a5SLionel Sambuc #ifdef HAVE_CONFIG_H
7*971bb1a5SLionel Sambuc #include "config.h"
8*971bb1a5SLionel Sambuc #endif
9*971bb1a5SLionel Sambuc #include <stdlib.h>
10*971bb1a5SLionel Sambuc #include <string.h>
11*971bb1a5SLionel Sambuc #include <assert.h>
12*971bb1a5SLionel Sambuc #include <stddef.h>  /* for offsetof() */
13*971bb1a5SLionel Sambuc #include "xcbext.h"
14*971bb1a5SLionel Sambuc #include "xtest.h"
15*971bb1a5SLionel Sambuc 
16*971bb1a5SLionel Sambuc #define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member)
17*971bb1a5SLionel Sambuc #include "xproto.h"
18*971bb1a5SLionel Sambuc 
19*971bb1a5SLionel Sambuc xcb_extension_t xcb_test_id = { "XTEST", 0 };
20*971bb1a5SLionel Sambuc 
21*971bb1a5SLionel Sambuc xcb_test_get_version_cookie_t
xcb_test_get_version(xcb_connection_t * c,uint8_t major_version,uint16_t minor_version)22*971bb1a5SLionel Sambuc xcb_test_get_version (xcb_connection_t *c  /**< */,
23*971bb1a5SLionel Sambuc                       uint8_t           major_version  /**< */,
24*971bb1a5SLionel Sambuc                       uint16_t          minor_version  /**< */)
25*971bb1a5SLionel Sambuc {
26*971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
27*971bb1a5SLionel Sambuc         /* count */ 2,
28*971bb1a5SLionel Sambuc         /* ext */ &xcb_test_id,
29*971bb1a5SLionel Sambuc         /* opcode */ XCB_TEST_GET_VERSION,
30*971bb1a5SLionel Sambuc         /* isvoid */ 0
31*971bb1a5SLionel Sambuc     };
32*971bb1a5SLionel Sambuc 
33*971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
34*971bb1a5SLionel Sambuc     xcb_test_get_version_cookie_t xcb_ret;
35*971bb1a5SLionel Sambuc     xcb_test_get_version_request_t xcb_out;
36*971bb1a5SLionel Sambuc 
37*971bb1a5SLionel Sambuc     xcb_out.major_version = major_version;
38*971bb1a5SLionel Sambuc     xcb_out.pad0 = 0;
39*971bb1a5SLionel Sambuc     xcb_out.minor_version = minor_version;
40*971bb1a5SLionel Sambuc 
41*971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
42*971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
43*971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
44*971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
45*971bb1a5SLionel Sambuc 
46*971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
47*971bb1a5SLionel Sambuc     return xcb_ret;
48*971bb1a5SLionel Sambuc }
49*971bb1a5SLionel Sambuc 
50*971bb1a5SLionel Sambuc xcb_test_get_version_cookie_t
xcb_test_get_version_unchecked(xcb_connection_t * c,uint8_t major_version,uint16_t minor_version)51*971bb1a5SLionel Sambuc xcb_test_get_version_unchecked (xcb_connection_t *c  /**< */,
52*971bb1a5SLionel Sambuc                                 uint8_t           major_version  /**< */,
53*971bb1a5SLionel Sambuc                                 uint16_t          minor_version  /**< */)
54*971bb1a5SLionel Sambuc {
55*971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
56*971bb1a5SLionel Sambuc         /* count */ 2,
57*971bb1a5SLionel Sambuc         /* ext */ &xcb_test_id,
58*971bb1a5SLionel Sambuc         /* opcode */ XCB_TEST_GET_VERSION,
59*971bb1a5SLionel Sambuc         /* isvoid */ 0
60*971bb1a5SLionel Sambuc     };
61*971bb1a5SLionel Sambuc 
62*971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
63*971bb1a5SLionel Sambuc     xcb_test_get_version_cookie_t xcb_ret;
64*971bb1a5SLionel Sambuc     xcb_test_get_version_request_t xcb_out;
65*971bb1a5SLionel Sambuc 
66*971bb1a5SLionel Sambuc     xcb_out.major_version = major_version;
67*971bb1a5SLionel Sambuc     xcb_out.pad0 = 0;
68*971bb1a5SLionel Sambuc     xcb_out.minor_version = minor_version;
69*971bb1a5SLionel Sambuc 
70*971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
71*971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
72*971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
73*971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
74*971bb1a5SLionel Sambuc 
75*971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
76*971bb1a5SLionel Sambuc     return xcb_ret;
77*971bb1a5SLionel Sambuc }
78*971bb1a5SLionel Sambuc 
79*971bb1a5SLionel Sambuc xcb_test_get_version_reply_t *
xcb_test_get_version_reply(xcb_connection_t * c,xcb_test_get_version_cookie_t cookie,xcb_generic_error_t ** e)80*971bb1a5SLionel Sambuc xcb_test_get_version_reply (xcb_connection_t               *c  /**< */,
81*971bb1a5SLionel Sambuc                             xcb_test_get_version_cookie_t   cookie  /**< */,
82*971bb1a5SLionel Sambuc                             xcb_generic_error_t           **e  /**< */)
83*971bb1a5SLionel Sambuc {
84*971bb1a5SLionel Sambuc     return (xcb_test_get_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
85*971bb1a5SLionel Sambuc }
86*971bb1a5SLionel Sambuc 
87*971bb1a5SLionel Sambuc xcb_test_compare_cursor_cookie_t
xcb_test_compare_cursor(xcb_connection_t * c,xcb_window_t window,xcb_cursor_t cursor)88*971bb1a5SLionel Sambuc xcb_test_compare_cursor (xcb_connection_t *c  /**< */,
89*971bb1a5SLionel Sambuc                          xcb_window_t      window  /**< */,
90*971bb1a5SLionel Sambuc                          xcb_cursor_t      cursor  /**< */)
91*971bb1a5SLionel Sambuc {
92*971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
93*971bb1a5SLionel Sambuc         /* count */ 2,
94*971bb1a5SLionel Sambuc         /* ext */ &xcb_test_id,
95*971bb1a5SLionel Sambuc         /* opcode */ XCB_TEST_COMPARE_CURSOR,
96*971bb1a5SLionel Sambuc         /* isvoid */ 0
97*971bb1a5SLionel Sambuc     };
98*971bb1a5SLionel Sambuc 
99*971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
100*971bb1a5SLionel Sambuc     xcb_test_compare_cursor_cookie_t xcb_ret;
101*971bb1a5SLionel Sambuc     xcb_test_compare_cursor_request_t xcb_out;
102*971bb1a5SLionel Sambuc 
103*971bb1a5SLionel Sambuc     xcb_out.window = window;
104*971bb1a5SLionel Sambuc     xcb_out.cursor = cursor;
105*971bb1a5SLionel Sambuc 
106*971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
107*971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
108*971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
109*971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
110*971bb1a5SLionel Sambuc 
111*971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
112*971bb1a5SLionel Sambuc     return xcb_ret;
113*971bb1a5SLionel Sambuc }
114*971bb1a5SLionel Sambuc 
115*971bb1a5SLionel Sambuc xcb_test_compare_cursor_cookie_t
xcb_test_compare_cursor_unchecked(xcb_connection_t * c,xcb_window_t window,xcb_cursor_t cursor)116*971bb1a5SLionel Sambuc xcb_test_compare_cursor_unchecked (xcb_connection_t *c  /**< */,
117*971bb1a5SLionel Sambuc                                    xcb_window_t      window  /**< */,
118*971bb1a5SLionel Sambuc                                    xcb_cursor_t      cursor  /**< */)
119*971bb1a5SLionel Sambuc {
120*971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
121*971bb1a5SLionel Sambuc         /* count */ 2,
122*971bb1a5SLionel Sambuc         /* ext */ &xcb_test_id,
123*971bb1a5SLionel Sambuc         /* opcode */ XCB_TEST_COMPARE_CURSOR,
124*971bb1a5SLionel Sambuc         /* isvoid */ 0
125*971bb1a5SLionel Sambuc     };
126*971bb1a5SLionel Sambuc 
127*971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
128*971bb1a5SLionel Sambuc     xcb_test_compare_cursor_cookie_t xcb_ret;
129*971bb1a5SLionel Sambuc     xcb_test_compare_cursor_request_t xcb_out;
130*971bb1a5SLionel Sambuc 
131*971bb1a5SLionel Sambuc     xcb_out.window = window;
132*971bb1a5SLionel Sambuc     xcb_out.cursor = cursor;
133*971bb1a5SLionel Sambuc 
134*971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
135*971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
136*971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
137*971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
138*971bb1a5SLionel Sambuc 
139*971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
140*971bb1a5SLionel Sambuc     return xcb_ret;
141*971bb1a5SLionel Sambuc }
142*971bb1a5SLionel Sambuc 
143*971bb1a5SLionel Sambuc xcb_test_compare_cursor_reply_t *
xcb_test_compare_cursor_reply(xcb_connection_t * c,xcb_test_compare_cursor_cookie_t cookie,xcb_generic_error_t ** e)144*971bb1a5SLionel Sambuc xcb_test_compare_cursor_reply (xcb_connection_t                  *c  /**< */,
145*971bb1a5SLionel Sambuc                                xcb_test_compare_cursor_cookie_t   cookie  /**< */,
146*971bb1a5SLionel Sambuc                                xcb_generic_error_t              **e  /**< */)
147*971bb1a5SLionel Sambuc {
148*971bb1a5SLionel Sambuc     return (xcb_test_compare_cursor_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
149*971bb1a5SLionel Sambuc }
150*971bb1a5SLionel Sambuc 
151*971bb1a5SLionel Sambuc xcb_void_cookie_t
xcb_test_fake_input_checked(xcb_connection_t * c,uint8_t type,uint8_t detail,uint32_t time,xcb_window_t root,int16_t rootX,int16_t rootY,uint8_t deviceid)152*971bb1a5SLionel Sambuc xcb_test_fake_input_checked (xcb_connection_t *c  /**< */,
153*971bb1a5SLionel Sambuc                              uint8_t           type  /**< */,
154*971bb1a5SLionel Sambuc                              uint8_t           detail  /**< */,
155*971bb1a5SLionel Sambuc                              uint32_t          time  /**< */,
156*971bb1a5SLionel Sambuc                              xcb_window_t      root  /**< */,
157*971bb1a5SLionel Sambuc                              int16_t           rootX  /**< */,
158*971bb1a5SLionel Sambuc                              int16_t           rootY  /**< */,
159*971bb1a5SLionel Sambuc                              uint8_t           deviceid  /**< */)
160*971bb1a5SLionel Sambuc {
161*971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
162*971bb1a5SLionel Sambuc         /* count */ 2,
163*971bb1a5SLionel Sambuc         /* ext */ &xcb_test_id,
164*971bb1a5SLionel Sambuc         /* opcode */ XCB_TEST_FAKE_INPUT,
165*971bb1a5SLionel Sambuc         /* isvoid */ 1
166*971bb1a5SLionel Sambuc     };
167*971bb1a5SLionel Sambuc 
168*971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
169*971bb1a5SLionel Sambuc     xcb_void_cookie_t xcb_ret;
170*971bb1a5SLionel Sambuc     xcb_test_fake_input_request_t xcb_out;
171*971bb1a5SLionel Sambuc 
172*971bb1a5SLionel Sambuc     xcb_out.type = type;
173*971bb1a5SLionel Sambuc     xcb_out.detail = detail;
174*971bb1a5SLionel Sambuc     memset(xcb_out.pad0, 0, 2);
175*971bb1a5SLionel Sambuc     xcb_out.time = time;
176*971bb1a5SLionel Sambuc     xcb_out.root = root;
177*971bb1a5SLionel Sambuc     memset(xcb_out.pad1, 0, 8);
178*971bb1a5SLionel Sambuc     xcb_out.rootX = rootX;
179*971bb1a5SLionel Sambuc     xcb_out.rootY = rootY;
180*971bb1a5SLionel Sambuc     memset(xcb_out.pad2, 0, 7);
181*971bb1a5SLionel Sambuc     xcb_out.deviceid = deviceid;
182*971bb1a5SLionel Sambuc 
183*971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
184*971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
185*971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
186*971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
187*971bb1a5SLionel Sambuc 
188*971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
189*971bb1a5SLionel Sambuc     return xcb_ret;
190*971bb1a5SLionel Sambuc }
191*971bb1a5SLionel Sambuc 
192*971bb1a5SLionel Sambuc xcb_void_cookie_t
xcb_test_fake_input(xcb_connection_t * c,uint8_t type,uint8_t detail,uint32_t time,xcb_window_t root,int16_t rootX,int16_t rootY,uint8_t deviceid)193*971bb1a5SLionel Sambuc xcb_test_fake_input (xcb_connection_t *c  /**< */,
194*971bb1a5SLionel Sambuc                      uint8_t           type  /**< */,
195*971bb1a5SLionel Sambuc                      uint8_t           detail  /**< */,
196*971bb1a5SLionel Sambuc                      uint32_t          time  /**< */,
197*971bb1a5SLionel Sambuc                      xcb_window_t      root  /**< */,
198*971bb1a5SLionel Sambuc                      int16_t           rootX  /**< */,
199*971bb1a5SLionel Sambuc                      int16_t           rootY  /**< */,
200*971bb1a5SLionel Sambuc                      uint8_t           deviceid  /**< */)
201*971bb1a5SLionel Sambuc {
202*971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
203*971bb1a5SLionel Sambuc         /* count */ 2,
204*971bb1a5SLionel Sambuc         /* ext */ &xcb_test_id,
205*971bb1a5SLionel Sambuc         /* opcode */ XCB_TEST_FAKE_INPUT,
206*971bb1a5SLionel Sambuc         /* isvoid */ 1
207*971bb1a5SLionel Sambuc     };
208*971bb1a5SLionel Sambuc 
209*971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
210*971bb1a5SLionel Sambuc     xcb_void_cookie_t xcb_ret;
211*971bb1a5SLionel Sambuc     xcb_test_fake_input_request_t xcb_out;
212*971bb1a5SLionel Sambuc 
213*971bb1a5SLionel Sambuc     xcb_out.type = type;
214*971bb1a5SLionel Sambuc     xcb_out.detail = detail;
215*971bb1a5SLionel Sambuc     memset(xcb_out.pad0, 0, 2);
216*971bb1a5SLionel Sambuc     xcb_out.time = time;
217*971bb1a5SLionel Sambuc     xcb_out.root = root;
218*971bb1a5SLionel Sambuc     memset(xcb_out.pad1, 0, 8);
219*971bb1a5SLionel Sambuc     xcb_out.rootX = rootX;
220*971bb1a5SLionel Sambuc     xcb_out.rootY = rootY;
221*971bb1a5SLionel Sambuc     memset(xcb_out.pad2, 0, 7);
222*971bb1a5SLionel Sambuc     xcb_out.deviceid = deviceid;
223*971bb1a5SLionel Sambuc 
224*971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
225*971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
226*971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
227*971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
228*971bb1a5SLionel Sambuc 
229*971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
230*971bb1a5SLionel Sambuc     return xcb_ret;
231*971bb1a5SLionel Sambuc }
232*971bb1a5SLionel Sambuc 
233*971bb1a5SLionel Sambuc xcb_void_cookie_t
xcb_test_grab_control_checked(xcb_connection_t * c,uint8_t impervious)234*971bb1a5SLionel Sambuc xcb_test_grab_control_checked (xcb_connection_t *c  /**< */,
235*971bb1a5SLionel Sambuc                                uint8_t           impervious  /**< */)
236*971bb1a5SLionel Sambuc {
237*971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
238*971bb1a5SLionel Sambuc         /* count */ 2,
239*971bb1a5SLionel Sambuc         /* ext */ &xcb_test_id,
240*971bb1a5SLionel Sambuc         /* opcode */ XCB_TEST_GRAB_CONTROL,
241*971bb1a5SLionel Sambuc         /* isvoid */ 1
242*971bb1a5SLionel Sambuc     };
243*971bb1a5SLionel Sambuc 
244*971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
245*971bb1a5SLionel Sambuc     xcb_void_cookie_t xcb_ret;
246*971bb1a5SLionel Sambuc     xcb_test_grab_control_request_t xcb_out;
247*971bb1a5SLionel Sambuc 
248*971bb1a5SLionel Sambuc     xcb_out.impervious = impervious;
249*971bb1a5SLionel Sambuc     memset(xcb_out.pad0, 0, 3);
250*971bb1a5SLionel Sambuc 
251*971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
252*971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
253*971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
254*971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
255*971bb1a5SLionel Sambuc 
256*971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
257*971bb1a5SLionel Sambuc     return xcb_ret;
258*971bb1a5SLionel Sambuc }
259*971bb1a5SLionel Sambuc 
260*971bb1a5SLionel Sambuc xcb_void_cookie_t
xcb_test_grab_control(xcb_connection_t * c,uint8_t impervious)261*971bb1a5SLionel Sambuc xcb_test_grab_control (xcb_connection_t *c  /**< */,
262*971bb1a5SLionel Sambuc                        uint8_t           impervious  /**< */)
263*971bb1a5SLionel Sambuc {
264*971bb1a5SLionel Sambuc     static const xcb_protocol_request_t xcb_req = {
265*971bb1a5SLionel Sambuc         /* count */ 2,
266*971bb1a5SLionel Sambuc         /* ext */ &xcb_test_id,
267*971bb1a5SLionel Sambuc         /* opcode */ XCB_TEST_GRAB_CONTROL,
268*971bb1a5SLionel Sambuc         /* isvoid */ 1
269*971bb1a5SLionel Sambuc     };
270*971bb1a5SLionel Sambuc 
271*971bb1a5SLionel Sambuc     struct iovec xcb_parts[4];
272*971bb1a5SLionel Sambuc     xcb_void_cookie_t xcb_ret;
273*971bb1a5SLionel Sambuc     xcb_test_grab_control_request_t xcb_out;
274*971bb1a5SLionel Sambuc 
275*971bb1a5SLionel Sambuc     xcb_out.impervious = impervious;
276*971bb1a5SLionel Sambuc     memset(xcb_out.pad0, 0, 3);
277*971bb1a5SLionel Sambuc 
278*971bb1a5SLionel Sambuc     xcb_parts[2].iov_base = (char *) &xcb_out;
279*971bb1a5SLionel Sambuc     xcb_parts[2].iov_len = sizeof(xcb_out);
280*971bb1a5SLionel Sambuc     xcb_parts[3].iov_base = 0;
281*971bb1a5SLionel Sambuc     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
282*971bb1a5SLionel Sambuc 
283*971bb1a5SLionel Sambuc     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
284*971bb1a5SLionel Sambuc     return xcb_ret;
285*971bb1a5SLionel Sambuc }
286*971bb1a5SLionel Sambuc 
287