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