xref: /minix/external/mit/xorg/lib/libxcb/files/xtest.c (revision 9f988b79)
1 /*
2  * This file generated automatically from xtest.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 "xtest.h"
15 
16 #define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member)
17 #include "xproto.h"
18 
19 xcb_extension_t xcb_test_id = { "XTEST", 0 };
20 
21 
22 /*****************************************************************************
23  **
24  ** xcb_test_get_version_cookie_t xcb_test_get_version
25  **
26  ** @param xcb_connection_t *c
27  ** @param uint8_t           major_version
28  ** @param uint16_t          minor_version
29  ** @returns xcb_test_get_version_cookie_t
30  **
31  *****************************************************************************/
32 
33 xcb_test_get_version_cookie_t
34 xcb_test_get_version (xcb_connection_t *c  /**< */,
35                       uint8_t           major_version  /**< */,
36                       uint16_t          minor_version  /**< */)
37 {
38     static const xcb_protocol_request_t xcb_req = {
39         /* count */ 2,
40         /* ext */ &xcb_test_id,
41         /* opcode */ XCB_TEST_GET_VERSION,
42         /* isvoid */ 0
43     };
44 
45     struct iovec xcb_parts[4];
46     xcb_test_get_version_cookie_t xcb_ret;
47     xcb_test_get_version_request_t xcb_out;
48 
49     xcb_out.major_version = major_version;
50     xcb_out.pad0 = 0;
51     xcb_out.minor_version = minor_version;
52 
53     xcb_parts[2].iov_base = (char *) &xcb_out;
54     xcb_parts[2].iov_len = sizeof(xcb_out);
55     xcb_parts[3].iov_base = 0;
56     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
57 
58     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
59     return xcb_ret;
60 }
61 
62 
63 /*****************************************************************************
64  **
65  ** xcb_test_get_version_cookie_t xcb_test_get_version_unchecked
66  **
67  ** @param xcb_connection_t *c
68  ** @param uint8_t           major_version
69  ** @param uint16_t          minor_version
70  ** @returns xcb_test_get_version_cookie_t
71  **
72  *****************************************************************************/
73 
74 xcb_test_get_version_cookie_t
75 xcb_test_get_version_unchecked (xcb_connection_t *c  /**< */,
76                                 uint8_t           major_version  /**< */,
77                                 uint16_t          minor_version  /**< */)
78 {
79     static const xcb_protocol_request_t xcb_req = {
80         /* count */ 2,
81         /* ext */ &xcb_test_id,
82         /* opcode */ XCB_TEST_GET_VERSION,
83         /* isvoid */ 0
84     };
85 
86     struct iovec xcb_parts[4];
87     xcb_test_get_version_cookie_t xcb_ret;
88     xcb_test_get_version_request_t xcb_out;
89 
90     xcb_out.major_version = major_version;
91     xcb_out.pad0 = 0;
92     xcb_out.minor_version = minor_version;
93 
94     xcb_parts[2].iov_base = (char *) &xcb_out;
95     xcb_parts[2].iov_len = sizeof(xcb_out);
96     xcb_parts[3].iov_base = 0;
97     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
98 
99     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
100     return xcb_ret;
101 }
102 
103 
104 /*****************************************************************************
105  **
106  ** xcb_test_get_version_reply_t * xcb_test_get_version_reply
107  **
108  ** @param xcb_connection_t               *c
109  ** @param xcb_test_get_version_cookie_t   cookie
110  ** @param xcb_generic_error_t           **e
111  ** @returns xcb_test_get_version_reply_t *
112  **
113  *****************************************************************************/
114 
115 xcb_test_get_version_reply_t *
116 xcb_test_get_version_reply (xcb_connection_t               *c  /**< */,
117                             xcb_test_get_version_cookie_t   cookie  /**< */,
118                             xcb_generic_error_t           **e  /**< */)
119 {
120     return (xcb_test_get_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
121 }
122 
123 
124 /*****************************************************************************
125  **
126  ** xcb_test_compare_cursor_cookie_t xcb_test_compare_cursor
127  **
128  ** @param xcb_connection_t *c
129  ** @param xcb_window_t      window
130  ** @param xcb_cursor_t      cursor
131  ** @returns xcb_test_compare_cursor_cookie_t
132  **
133  *****************************************************************************/
134 
135 xcb_test_compare_cursor_cookie_t
136 xcb_test_compare_cursor (xcb_connection_t *c  /**< */,
137                          xcb_window_t      window  /**< */,
138                          xcb_cursor_t      cursor  /**< */)
139 {
140     static const xcb_protocol_request_t xcb_req = {
141         /* count */ 2,
142         /* ext */ &xcb_test_id,
143         /* opcode */ XCB_TEST_COMPARE_CURSOR,
144         /* isvoid */ 0
145     };
146 
147     struct iovec xcb_parts[4];
148     xcb_test_compare_cursor_cookie_t xcb_ret;
149     xcb_test_compare_cursor_request_t xcb_out;
150 
151     xcb_out.window = window;
152     xcb_out.cursor = cursor;
153 
154     xcb_parts[2].iov_base = (char *) &xcb_out;
155     xcb_parts[2].iov_len = sizeof(xcb_out);
156     xcb_parts[3].iov_base = 0;
157     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
158 
159     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
160     return xcb_ret;
161 }
162 
163 
164 /*****************************************************************************
165  **
166  ** xcb_test_compare_cursor_cookie_t xcb_test_compare_cursor_unchecked
167  **
168  ** @param xcb_connection_t *c
169  ** @param xcb_window_t      window
170  ** @param xcb_cursor_t      cursor
171  ** @returns xcb_test_compare_cursor_cookie_t
172  **
173  *****************************************************************************/
174 
175 xcb_test_compare_cursor_cookie_t
176 xcb_test_compare_cursor_unchecked (xcb_connection_t *c  /**< */,
177                                    xcb_window_t      window  /**< */,
178                                    xcb_cursor_t      cursor  /**< */)
179 {
180     static const xcb_protocol_request_t xcb_req = {
181         /* count */ 2,
182         /* ext */ &xcb_test_id,
183         /* opcode */ XCB_TEST_COMPARE_CURSOR,
184         /* isvoid */ 0
185     };
186 
187     struct iovec xcb_parts[4];
188     xcb_test_compare_cursor_cookie_t xcb_ret;
189     xcb_test_compare_cursor_request_t xcb_out;
190 
191     xcb_out.window = window;
192     xcb_out.cursor = cursor;
193 
194     xcb_parts[2].iov_base = (char *) &xcb_out;
195     xcb_parts[2].iov_len = sizeof(xcb_out);
196     xcb_parts[3].iov_base = 0;
197     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
198 
199     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
200     return xcb_ret;
201 }
202 
203 
204 /*****************************************************************************
205  **
206  ** xcb_test_compare_cursor_reply_t * xcb_test_compare_cursor_reply
207  **
208  ** @param xcb_connection_t                  *c
209  ** @param xcb_test_compare_cursor_cookie_t   cookie
210  ** @param xcb_generic_error_t              **e
211  ** @returns xcb_test_compare_cursor_reply_t *
212  **
213  *****************************************************************************/
214 
215 xcb_test_compare_cursor_reply_t *
216 xcb_test_compare_cursor_reply (xcb_connection_t                  *c  /**< */,
217                                xcb_test_compare_cursor_cookie_t   cookie  /**< */,
218                                xcb_generic_error_t              **e  /**< */)
219 {
220     return (xcb_test_compare_cursor_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
221 }
222 
223 
224 /*****************************************************************************
225  **
226  ** xcb_void_cookie_t xcb_test_fake_input_checked
227  **
228  ** @param xcb_connection_t *c
229  ** @param uint8_t           type
230  ** @param uint8_t           detail
231  ** @param uint32_t          time
232  ** @param xcb_window_t      root
233  ** @param int16_t           rootX
234  ** @param int16_t           rootY
235  ** @param uint8_t           deviceid
236  ** @returns xcb_void_cookie_t
237  **
238  *****************************************************************************/
239 
240 xcb_void_cookie_t
241 xcb_test_fake_input_checked (xcb_connection_t *c  /**< */,
242                              uint8_t           type  /**< */,
243                              uint8_t           detail  /**< */,
244                              uint32_t          time  /**< */,
245                              xcb_window_t      root  /**< */,
246                              int16_t           rootX  /**< */,
247                              int16_t           rootY  /**< */,
248                              uint8_t           deviceid  /**< */)
249 {
250     static const xcb_protocol_request_t xcb_req = {
251         /* count */ 2,
252         /* ext */ &xcb_test_id,
253         /* opcode */ XCB_TEST_FAKE_INPUT,
254         /* isvoid */ 1
255     };
256 
257     struct iovec xcb_parts[4];
258     xcb_void_cookie_t xcb_ret;
259     xcb_test_fake_input_request_t xcb_out;
260 
261     xcb_out.type = type;
262     xcb_out.detail = detail;
263     memset(xcb_out.pad0, 0, 2);
264     xcb_out.time = time;
265     xcb_out.root = root;
266     memset(xcb_out.pad1, 0, 8);
267     xcb_out.rootX = rootX;
268     xcb_out.rootY = rootY;
269     memset(xcb_out.pad2, 0, 7);
270     xcb_out.deviceid = deviceid;
271 
272     xcb_parts[2].iov_base = (char *) &xcb_out;
273     xcb_parts[2].iov_len = sizeof(xcb_out);
274     xcb_parts[3].iov_base = 0;
275     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
276 
277     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
278     return xcb_ret;
279 }
280 
281 
282 /*****************************************************************************
283  **
284  ** xcb_void_cookie_t xcb_test_fake_input
285  **
286  ** @param xcb_connection_t *c
287  ** @param uint8_t           type
288  ** @param uint8_t           detail
289  ** @param uint32_t          time
290  ** @param xcb_window_t      root
291  ** @param int16_t           rootX
292  ** @param int16_t           rootY
293  ** @param uint8_t           deviceid
294  ** @returns xcb_void_cookie_t
295  **
296  *****************************************************************************/
297 
298 xcb_void_cookie_t
299 xcb_test_fake_input (xcb_connection_t *c  /**< */,
300                      uint8_t           type  /**< */,
301                      uint8_t           detail  /**< */,
302                      uint32_t          time  /**< */,
303                      xcb_window_t      root  /**< */,
304                      int16_t           rootX  /**< */,
305                      int16_t           rootY  /**< */,
306                      uint8_t           deviceid  /**< */)
307 {
308     static const xcb_protocol_request_t xcb_req = {
309         /* count */ 2,
310         /* ext */ &xcb_test_id,
311         /* opcode */ XCB_TEST_FAKE_INPUT,
312         /* isvoid */ 1
313     };
314 
315     struct iovec xcb_parts[4];
316     xcb_void_cookie_t xcb_ret;
317     xcb_test_fake_input_request_t xcb_out;
318 
319     xcb_out.type = type;
320     xcb_out.detail = detail;
321     memset(xcb_out.pad0, 0, 2);
322     xcb_out.time = time;
323     xcb_out.root = root;
324     memset(xcb_out.pad1, 0, 8);
325     xcb_out.rootX = rootX;
326     xcb_out.rootY = rootY;
327     memset(xcb_out.pad2, 0, 7);
328     xcb_out.deviceid = deviceid;
329 
330     xcb_parts[2].iov_base = (char *) &xcb_out;
331     xcb_parts[2].iov_len = sizeof(xcb_out);
332     xcb_parts[3].iov_base = 0;
333     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
334 
335     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
336     return xcb_ret;
337 }
338 
339 
340 /*****************************************************************************
341  **
342  ** xcb_void_cookie_t xcb_test_grab_control_checked
343  **
344  ** @param xcb_connection_t *c
345  ** @param uint8_t           impervious
346  ** @returns xcb_void_cookie_t
347  **
348  *****************************************************************************/
349 
350 xcb_void_cookie_t
351 xcb_test_grab_control_checked (xcb_connection_t *c  /**< */,
352                                uint8_t           impervious  /**< */)
353 {
354     static const xcb_protocol_request_t xcb_req = {
355         /* count */ 2,
356         /* ext */ &xcb_test_id,
357         /* opcode */ XCB_TEST_GRAB_CONTROL,
358         /* isvoid */ 1
359     };
360 
361     struct iovec xcb_parts[4];
362     xcb_void_cookie_t xcb_ret;
363     xcb_test_grab_control_request_t xcb_out;
364 
365     xcb_out.impervious = impervious;
366     memset(xcb_out.pad0, 0, 3);
367 
368     xcb_parts[2].iov_base = (char *) &xcb_out;
369     xcb_parts[2].iov_len = sizeof(xcb_out);
370     xcb_parts[3].iov_base = 0;
371     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
372 
373     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
374     return xcb_ret;
375 }
376 
377 
378 /*****************************************************************************
379  **
380  ** xcb_void_cookie_t xcb_test_grab_control
381  **
382  ** @param xcb_connection_t *c
383  ** @param uint8_t           impervious
384  ** @returns xcb_void_cookie_t
385  **
386  *****************************************************************************/
387 
388 xcb_void_cookie_t
389 xcb_test_grab_control (xcb_connection_t *c  /**< */,
390                        uint8_t           impervious  /**< */)
391 {
392     static const xcb_protocol_request_t xcb_req = {
393         /* count */ 2,
394         /* ext */ &xcb_test_id,
395         /* opcode */ XCB_TEST_GRAB_CONTROL,
396         /* isvoid */ 1
397     };
398 
399     struct iovec xcb_parts[4];
400     xcb_void_cookie_t xcb_ret;
401     xcb_test_grab_control_request_t xcb_out;
402 
403     xcb_out.impervious = impervious;
404     memset(xcb_out.pad0, 0, 3);
405 
406     xcb_parts[2].iov_base = (char *) &xcb_out;
407     xcb_parts[2].iov_len = sizeof(xcb_out);
408     xcb_parts[3].iov_base = 0;
409     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
410 
411     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
412     return xcb_ret;
413 }
414 
415