| 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 | * @brief Query the version of the MIT-SHM extension. |
| 288 | * |
| 289 | * @param c The connection |
| 290 | * @return A cookie |
| 291 | * |
| 292 | * This is used to determine the version of the MIT-SHM extension supported by the |
| 293 | * X server. Clients MUST NOT make other requests in this extension until a reply |
| 294 | * to this requests indicates the X server supports them. |
| 295 | * |
| 296 | */ |
| 297 | xcb_shm_query_version_cookie_t |
| 298 | xcb_shm_query_version (xcb_connection_t *c); |
| 299 | |
| 300 | /** |
| 301 | * @brief Query the version of the MIT-SHM extension. |
| 302 | * |
| 303 | * @param c The connection |
| 304 | * @return A cookie |
| 305 | * |
| 306 | * This is used to determine the version of the MIT-SHM extension supported by the |
| 307 | * X server. Clients MUST NOT make other requests in this extension until a reply |
| 308 | * to this requests indicates the X server supports them. |
| 309 | * |
| 310 | * This form can be used only if the request will cause |
| 311 | * a reply to be generated. Any returned error will be |
| 312 | * placed in the event queue. |
| 313 | */ |
| 314 | xcb_shm_query_version_cookie_t |
| 315 | xcb_shm_query_version_unchecked (xcb_connection_t *c); |
| 316 | |
| 317 | /** |
| 318 | * Return the reply |
| 319 | * @param c The connection |
| 320 | * @param cookie The cookie |
| 321 | * @param e The xcb_generic_error_t supplied |
| 322 | * |
| 323 | * Returns the reply of the request asked by |
| 324 | * |
| 325 | * The parameter @p e supplied to this function must be NULL if |
| 326 | * xcb_shm_query_version_unchecked(). is used. |
| 327 | * Otherwise, it stores the error if any. |
| 328 | * |
| 329 | * The returned value must be freed by the caller using free(). |
| 330 | */ |
| 331 | xcb_shm_query_version_reply_t * |
| 332 | xcb_shm_query_version_reply (xcb_connection_t *c, |
| 333 | xcb_shm_query_version_cookie_t cookie /**< */, |
| 334 | xcb_generic_error_t **e); |
| 335 | |
| 336 | /** |
| 337 | * @brief Attach a System V shared memory segment. |
| 338 | * |
| 339 | * @param c The connection |
| 340 | * @param shmseg A shared memory segment ID created with xcb_generate_id(). |
| 341 | * @param shmid The System V shared memory segment the server should map. |
| 342 | * @param read_only True if the segment shall be mapped read only by the X11 server, otherwise false. |
| 343 | * @return A cookie |
| 344 | * |
| 345 | * Attach a System V shared memory segment to the server. This will fail unless |
| 346 | * the server has permission to map the segment. The client may destroy the segment |
| 347 | * as soon as it receives a XCB_SHM_COMPLETION event with the shmseg value in this |
| 348 | * request and with the appropriate serial number. |
| 349 | * |
| 350 | * This form can be used only if the request will not cause |
| 351 | * a reply to be generated. Any returned error will be |
| 352 | * saved for handling by xcb_request_check(). |
| 353 | */ |
| 354 | xcb_void_cookie_t |
| 355 | xcb_shm_attach_checked (xcb_connection_t *c, |
| 356 | xcb_shm_seg_t shmseg, |
| 357 | uint32_t shmid, |
| 358 | uint8_t read_only); |
| 359 | |
| 360 | /** |
| 361 | * @brief Attach a System V shared memory segment. |
| 362 | * |
| 363 | * @param c The connection |
| 364 | * @param shmseg A shared memory segment ID created with xcb_generate_id(). |
| 365 | * @param shmid The System V shared memory segment the server should map. |
| 366 | * @param read_only True if the segment shall be mapped read only by the X11 server, otherwise false. |
| 367 | * @return A cookie |
| 368 | * |
| 369 | * Attach a System V shared memory segment to the server. This will fail unless |
| 370 | * the server has permission to map the segment. The client may destroy the segment |
| 371 | * as soon as it receives a XCB_SHM_COMPLETION event with the shmseg value in this |
| 372 | * request and with the appropriate serial number. |
| 373 | * |
| 374 | */ |
| 375 | xcb_void_cookie_t |
| 376 | xcb_shm_attach (xcb_connection_t *c, |
| 377 | xcb_shm_seg_t shmseg, |
| 378 | uint32_t shmid, |
| 379 | uint8_t read_only); |
| 380 | |
| 381 | /** |
| 382 | * @brief Destroys the specified shared memory segment. |
| 383 | * |
| 384 | * @param c The connection |
| 385 | * @param shmseg The segment to be destroyed. |
| 386 | * @return A cookie |
| 387 | * |
| 388 | * Destroys the specified shared memory segment. This will never fail unless the |
| 389 | * segment number is incorrect. |
| 390 | * |
| 391 | * This form can be used only if the request will not cause |
| 392 | * a reply to be generated. Any returned error will be |
| 393 | * saved for handling by xcb_request_check(). |
| 394 | */ |
| 395 | xcb_void_cookie_t |
| 396 | xcb_shm_detach_checked (xcb_connection_t *c, |
| 397 | xcb_shm_seg_t shmseg); |
| 398 | |
| 399 | /** |
| 400 | * @brief Destroys the specified shared memory segment. |
| 401 | * |
| 402 | * @param c The connection |
| 403 | * @param shmseg The segment to be destroyed. |
| 404 | * @return A cookie |
| 405 | * |
| 406 | * Destroys the specified shared memory segment. This will never fail unless the |
| 407 | * segment number is incorrect. |
| 408 | * |
| 409 | */ |
| 410 | xcb_void_cookie_t |
| 411 | xcb_shm_detach (xcb_connection_t *c, |
| 412 | xcb_shm_seg_t shmseg); |
| 413 | |
| 414 | /** |
| 415 | * @brief Copy data from the shared memory to the specified drawable. |
| 416 | * |
| 417 | * @param c The connection |
| 418 | * @param drawable The drawable to draw to. |
| 419 | * @param gc The graphics context to use. |
| 420 | * @param total_width The total width of the source image. |
| 421 | * @param total_height The total height of the source image. |
| 422 | * @param src_x The source X coordinate of the sub-image to copy. |
| 423 | * @param src_y The source Y coordinate of the sub-image to copy. |
| 424 | * @param src_width The width, in source image coordinates, of the data to copy from the source. |
| 425 | * The X server will use this to determine the amount of data to copy. The amount |
| 426 | * of the destination image that is overwritten is determined automatically. |
| 427 | * @param src_height The height, in source image coordinates, of the data to copy from the source. |
| 428 | * The X server will use this to determine the amount of data to copy. The amount |
| 429 | * of the destination image that is overwritten is determined automatically. |
| 430 | * @param dst_x The X coordinate on the destination drawable to copy to. |
| 431 | * @param dst_y The Y coordinate on the destination drawable to copy to. |
| 432 | * @param depth The depth to use. |
| 433 | * @param format The format of the image being drawn. If it is XYBitmap, depth must be 1, or a |
| 434 | * “BadMatch” error results. The foreground pixel in the GC determines the source |
| 435 | * for the one bits in the image, and the background pixel determines the source |
| 436 | * for the zero bits. For XYPixmap and ZPixmap, the depth must match the depth of |
| 437 | * the drawable, or a “BadMatch” error results. |
| 438 | * @param send_event True if the server should send an XCB_SHM_COMPLETION event when the blit |
| 439 | * completes. |
| 440 | * @param offset The offset that the source image starts at. |
| 441 | * @return A cookie |
| 442 | * |
| 443 | * Copy data from the shared memory to the specified drawable. The amount of bytes |
| 444 | * written to the destination image is always equal to the number of bytes read |
| 445 | * from the shared memory segment. |
| 446 | * |
| 447 | * This form can be used only if the request will not cause |
| 448 | * a reply to be generated. Any returned error will be |
| 449 | * saved for handling by xcb_request_check(). |
| 450 | */ |
| 451 | xcb_void_cookie_t |
| 452 | xcb_shm_put_image_checked (xcb_connection_t *c, |
| 453 | xcb_drawable_t drawable, |
| 454 | xcb_gcontext_t gc, |
| 455 | uint16_t total_width, |
| 456 | uint16_t total_height, |
| 457 | uint16_t src_x, |
| 458 | uint16_t src_y, |
| 459 | uint16_t src_width, |
| 460 | uint16_t src_height, |
| 461 | int16_t dst_x, |
| 462 | int16_t dst_y, |
| 463 | uint8_t depth, |
| 464 | uint8_t format, |
| 465 | uint8_t send_event, |
| 466 | xcb_shm_seg_t shmseg, |
| 467 | uint32_t offset); |
| 468 | |
| 469 | /** |
| 470 | * @brief Copy data from the shared memory to the specified drawable. |
| 471 | * |
| 472 | * @param c The connection |
| 473 | * @param drawable The drawable to draw to. |
| 474 | * @param gc The graphics context to use. |
| 475 | * @param total_width The total width of the source image. |
| 476 | * @param total_height The total height of the source image. |
| 477 | * @param src_x The source X coordinate of the sub-image to copy. |
| 478 | * @param src_y The source Y coordinate of the sub-image to copy. |
| 479 | * @param src_width The width, in source image coordinates, of the data to copy from the source. |
| 480 | * The X server will use this to determine the amount of data to copy. The amount |
| 481 | * of the destination image that is overwritten is determined automatically. |
| 482 | * @param src_height The height, in source image coordinates, of the data to copy from the source. |
| 483 | * The X server will use this to determine the amount of data to copy. The amount |
| 484 | * of the destination image that is overwritten is determined automatically. |
| 485 | * @param dst_x The X coordinate on the destination drawable to copy to. |
| 486 | * @param dst_y The Y coordinate on the destination drawable to copy to. |
| 487 | * @param depth The depth to use. |
| 488 | * @param format The format of the image being drawn. If it is XYBitmap, depth must be 1, or a |
| 489 | * “BadMatch” error results. The foreground pixel in the GC determines the source |
| 490 | * for the one bits in the image, and the background pixel determines the source |
| 491 | * for the zero bits. For XYPixmap and ZPixmap, the depth must match the depth of |
| 492 | * the drawable, or a “BadMatch” error results. |
| 493 | * @param send_event True if the server should send an XCB_SHM_COMPLETION event when the blit |
| 494 | * completes. |
| 495 | * @param offset The offset that the source image starts at. |
| 496 | * @return A cookie |
| 497 | * |
| 498 | * Copy data from the shared memory to the specified drawable. The amount of bytes |
| 499 | * written to the destination image is always equal to the number of bytes read |
| 500 | * from the shared memory segment. |
| 501 | * |
| 502 | */ |
| 503 | xcb_void_cookie_t |
| 504 | xcb_shm_put_image (xcb_connection_t *c, |
| 505 | xcb_drawable_t drawable, |
| 506 | xcb_gcontext_t gc, |
| 507 | uint16_t total_width, |
| 508 | uint16_t total_height, |
| 509 | uint16_t src_x, |
| 510 | uint16_t src_y, |
| 511 | uint16_t src_width, |
| 512 | uint16_t src_height, |
| 513 | int16_t dst_x, |
| 514 | int16_t dst_y, |
| 515 | uint8_t depth, |
| 516 | uint8_t format, |
| 517 | uint8_t send_event, |
| 518 | xcb_shm_seg_t shmseg, |
| 519 | uint32_t offset); |
| 520 | |
| 521 | /** |
| 522 | * @brief Copies data from the specified drawable to the shared memory segment. |
| 523 | * |
| 524 | * @param c The connection |
| 525 | * @param drawable The drawable to copy the image out of. |
| 526 | * @param x The X coordinate in the drawable to begin copying at. |
| 527 | * @param y The Y coordinate in the drawable to begin copying at. |
| 528 | * @param width The width of the image to copy. |
| 529 | * @param height The height of the image to copy. |
| 530 | * @param plane_mask A mask that determines which planes are used. |
| 531 | * @param format The format to use for the copy (???). |
| 532 | * @param shmseg The destination shared memory segment. |
| 533 | * @param offset The offset in the shared memory segment to copy data to. |
| 534 | * @return A cookie |
| 535 | * |
| 536 | * Copy data from the specified drawable to the shared memory segment. The amount |
| 537 | * of bytes written to the destination image is always equal to the number of bytes |
| 538 | * read from the shared memory segment. |
| 539 | * |
| 540 | */ |
| 541 | xcb_shm_get_image_cookie_t |
| 542 | xcb_shm_get_image (xcb_connection_t *c, |
| 543 | xcb_drawable_t drawable, |
| 544 | int16_t x, |
| 545 | int16_t y, |
| 546 | uint16_t width, |
| 547 | uint16_t height, |
| 548 | uint32_t plane_mask, |
| 549 | uint8_t format, |
| 550 | xcb_shm_seg_t shmseg, |
| 551 | uint32_t offset); |
| 552 | |
| 553 | /** |
| 554 | * @brief Copies data from the specified drawable to the shared memory segment. |
| 555 | * |
| 556 | * @param c The connection |
| 557 | * @param drawable The drawable to copy the image out of. |
| 558 | * @param x The X coordinate in the drawable to begin copying at. |
| 559 | * @param y The Y coordinate in the drawable to begin copying at. |
| 560 | * @param width The width of the image to copy. |
| 561 | * @param height The height of the image to copy. |
| 562 | * @param plane_mask A mask that determines which planes are used. |
| 563 | * @param format The format to use for the copy (???). |
| 564 | * @param shmseg The destination shared memory segment. |
| 565 | * @param offset The offset in the shared memory segment to copy data to. |
| 566 | * @return A cookie |
| 567 | * |
| 568 | * Copy data from the specified drawable to the shared memory segment. The amount |
| 569 | * of bytes written to the destination image is always equal to the number of bytes |
| 570 | * read from the shared memory segment. |
| 571 | * |
| 572 | * This form can be used only if the request will cause |
| 573 | * a reply to be generated. Any returned error will be |
| 574 | * placed in the event queue. |
| 575 | */ |
| 576 | xcb_shm_get_image_cookie_t |
| 577 | xcb_shm_get_image_unchecked (xcb_connection_t *c, |
| 578 | xcb_drawable_t drawable, |
| 579 | int16_t x, |
| 580 | int16_t y, |
| 581 | uint16_t width, |
| 582 | uint16_t height, |
| 583 | uint32_t plane_mask, |
| 584 | uint8_t format, |
| 585 | xcb_shm_seg_t shmseg, |
| 586 | uint32_t offset); |
| 587 | |
| 588 | /** |
| 589 | * Return the reply |
| 590 | * @param c The connection |
| 591 | * @param cookie The cookie |
| 592 | * @param e The xcb_generic_error_t supplied |
| 593 | * |
| 594 | * Returns the reply of the request asked by |
| 595 | * |
| 596 | * The parameter @p e supplied to this function must be NULL if |
| 597 | * xcb_shm_get_image_unchecked(). is used. |
| 598 | * Otherwise, it stores the error if any. |
| 599 | * |
| 600 | * The returned value must be freed by the caller using free(). |
| 601 | */ |
| 602 | xcb_shm_get_image_reply_t * |
| 603 | xcb_shm_get_image_reply (xcb_connection_t *c, |
| 604 | xcb_shm_get_image_cookie_t cookie /**< */, |
| 605 | xcb_generic_error_t **e); |
| 606 | |
| 607 | /** |
| 608 | * @brief Create a pixmap backed by shared memory. |
| 609 | * |
| 610 | * @param c The connection |
| 611 | * @param pid A pixmap ID created with xcb_generate_id(). |
| 612 | * @param drawable The drawable to create the pixmap in. |
| 613 | * @param width The width of the pixmap to create. Must be nonzero, or a Value error results. |
| 614 | * @param height The height of the pixmap to create. Must be nonzero, or a Value error results. |
| 615 | * @param depth The depth of the pixmap to create. Must be nonzero, or a Value error results. |
| 616 | * @param shmseg The shared memory segment to use to create the pixmap. |
| 617 | * @param offset The offset in the segment to create the pixmap at. |
| 618 | * @return A cookie |
| 619 | * |
| 620 | * Create a pixmap backed by shared memory. Writes to the shared memory will be |
| 621 | * reflected in the contents of the pixmap, and writes to the pixmap will be |
| 622 | * reflected in the contents of the shared memory. |
| 623 | * |
| 624 | * This form can be used only if the request will not cause |
| 625 | * a reply to be generated. Any returned error will be |
| 626 | * saved for handling by xcb_request_check(). |
| 627 | */ |
| 628 | xcb_void_cookie_t |
| 629 | xcb_shm_create_pixmap_checked (xcb_connection_t *c, |
| 630 | xcb_pixmap_t pid, |
| 631 | xcb_drawable_t drawable, |
| 632 | uint16_t width, |
| 633 | uint16_t height, |
| 634 | uint8_t depth, |
| 635 | xcb_shm_seg_t shmseg, |
| 636 | uint32_t offset); |
| 637 | |
| 638 | /** |
| 639 | * @brief Create a pixmap backed by shared memory. |
| 640 | * |
| 641 | * @param c The connection |
| 642 | * @param pid A pixmap ID created with xcb_generate_id(). |
| 643 | * @param drawable The drawable to create the pixmap in. |
| 644 | * @param width The width of the pixmap to create. Must be nonzero, or a Value error results. |
| 645 | * @param height The height of the pixmap to create. Must be nonzero, or a Value error results. |
| 646 | * @param depth The depth of the pixmap to create. Must be nonzero, or a Value error results. |
| 647 | * @param shmseg The shared memory segment to use to create the pixmap. |
| 648 | * @param offset The offset in the segment to create the pixmap at. |
| 649 | * @return A cookie |
| 650 | * |
| 651 | * Create a pixmap backed by shared memory. Writes to the shared memory will be |
| 652 | * reflected in the contents of the pixmap, and writes to the pixmap will be |
| 653 | * reflected in the contents of the shared memory. |
| 654 | * |
| 655 | */ |
| 656 | xcb_void_cookie_t |
| 657 | xcb_shm_create_pixmap (xcb_connection_t *c, |
| 658 | xcb_pixmap_t pid, |
| 659 | xcb_drawable_t drawable, |
| 660 | uint16_t width, |
| 661 | uint16_t height, |
| 662 | uint8_t depth, |
| 663 | xcb_shm_seg_t shmseg, |
| 664 | uint32_t offset); |
| 665 | |
| 666 | /** |
| 667 | * @brief Create a shared memory segment |
| 668 | * |
| 669 | * @param c The connection |
| 670 | * @param shmseg A shared memory segment ID created with xcb_generate_id(). |
| 671 | * @param shm_fd The file descriptor the server should mmap(). |
| 672 | * @param read_only True if the segment shall be mapped read only by the X11 server, otherwise false. |
| 673 | * @return A cookie |
| 674 | * |
| 675 | * Create a shared memory segment. The file descriptor will be mapped at offset |
| 676 | * zero, and the size will be obtained using fstat(). A zero size will result in a |
| 677 | * Value error. |
| 678 | * |
| 679 | * This form can be used only if the request will not cause |
| 680 | * a reply to be generated. Any returned error will be |
| 681 | * saved for handling by xcb_request_check(). |
| 682 | */ |
| 683 | xcb_void_cookie_t |
| 684 | xcb_shm_attach_fd_checked (xcb_connection_t *c, |
| 685 | xcb_shm_seg_t shmseg, |
| 686 | int32_t shm_fd, |
| 687 | uint8_t read_only); |
| 688 | |
| 689 | /** |
| 690 | * @brief Create a shared memory segment |
| 691 | * |
| 692 | * @param c The connection |
| 693 | * @param shmseg A shared memory segment ID created with xcb_generate_id(). |
| 694 | * @param shm_fd The file descriptor the server should mmap(). |
| 695 | * @param read_only True if the segment shall be mapped read only by the X11 server, otherwise false. |
| 696 | * @return A cookie |
| 697 | * |
| 698 | * Create a shared memory segment. The file descriptor will be mapped at offset |
| 699 | * zero, and the size will be obtained using fstat(). A zero size will result in a |
| 700 | * Value error. |
| 701 | * |
| 702 | */ |
| 703 | xcb_void_cookie_t |
| 704 | xcb_shm_attach_fd (xcb_connection_t *c, |
| 705 | xcb_shm_seg_t shmseg, |
| 706 | int32_t shm_fd, |
| 707 | uint8_t read_only); |
| 708 | |
| 709 | /** |
| 710 | * @brief Asks the server to allocate a shared memory segment. |
| 711 | * |
| 712 | * @param c The connection |
| 713 | * @param shmseg A shared memory segment ID created with xcb_generate_id(). |
| 714 | * @param size The size of the segment to create. |
| 715 | * @param read_only True if the server should map the segment read-only; otherwise false. |
| 716 | * @return A cookie |
| 717 | * |
| 718 | * Asks the server to allocate a shared memory segment. The server’s reply will |
| 719 | * include a file descriptor for the client to pass to mmap(). |
| 720 | * |
| 721 | */ |
| 722 | xcb_shm_create_segment_cookie_t |
| 723 | xcb_shm_create_segment (xcb_connection_t *c, |
| 724 | xcb_shm_seg_t shmseg, |
| 725 | uint32_t size, |
| 726 | uint8_t read_only); |
| 727 | |
| 728 | /** |
| 729 | * @brief Asks the server to allocate a shared memory segment. |
| 730 | * |
| 731 | * @param c The connection |
| 732 | * @param shmseg A shared memory segment ID created with xcb_generate_id(). |
| 733 | * @param size The size of the segment to create. |
| 734 | * @param read_only True if the server should map the segment read-only; otherwise false. |
| 735 | * @return A cookie |
| 736 | * |
| 737 | * Asks the server to allocate a shared memory segment. The server’s reply will |
| 738 | * include a file descriptor for the client to pass to mmap(). |
| 739 | * |
| 740 | * This form can be used only if the request will cause |
| 741 | * a reply to be generated. Any returned error will be |
| 742 | * placed in the event queue. |
| 743 | */ |
| 744 | xcb_shm_create_segment_cookie_t |
| 745 | xcb_shm_create_segment_unchecked (xcb_connection_t *c, |
| 746 | xcb_shm_seg_t shmseg, |
| 747 | uint32_t size, |
| 748 | uint8_t read_only); |
| 749 | |
| 750 | /** |
| 751 | * Return the reply |
| 752 | * @param c The connection |
| 753 | * @param cookie The cookie |
| 754 | * @param e The xcb_generic_error_t supplied |
| 755 | * |
| 756 | * Returns the reply of the request asked by |
| 757 | * |
| 758 | * The parameter @p e supplied to this function must be NULL if |
| 759 | * xcb_shm_create_segment_unchecked(). is used. |
| 760 | * Otherwise, it stores the error if any. |
| 761 | * |
| 762 | * The returned value must be freed by the caller using free(). |
| 763 | */ |
| 764 | xcb_shm_create_segment_reply_t * |
| 765 | xcb_shm_create_segment_reply (xcb_connection_t *c, |
| 766 | xcb_shm_create_segment_cookie_t cookie /**< */, |
| 767 | xcb_generic_error_t **e); |
| 768 | |
| 769 | /** |
| 770 | * Return the reply fds |
| 771 | * @param c The connection |
| 772 | * @param reply The reply |
| 773 | * |
| 774 | * Returns a pointer to the array of reply fds of the reply. |
| 775 | * |
| 776 | * The returned value points into the reply and must not be free(). |
| 777 | * The fds are not managed by xcb. You must close() them before freeing the reply. |
| 778 | */ |
| 779 | int * |
| 780 | xcb_shm_create_segment_reply_fds (xcb_connection_t *c /**< */, |
| 781 | xcb_shm_create_segment_reply_t *reply); |
| 782 | |
| 783 | |
| 784 | #ifdef __cplusplus |
| 785 | } |
| 786 | #endif |
| 787 | |
| 788 | #endif |
| 789 | |
| 790 | /** |
| 791 | * @} |
| 792 | */ |
| 793 | |