XCB
1.13.1
|
00001 /* 00002 * Copyright (C) 2001-2006 Bart Massey, Jamey Sharp, and Josh Triplett. 00003 * All Rights Reserved. 00004 * 00005 * Permission is hereby granted, free of charge, to any person obtaining a 00006 * copy of this software and associated documentation files (the "Software"), 00007 * to deal in the Software without restriction, including without limitation 00008 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00009 * and/or sell copies of the Software, and to permit persons to whom the 00010 * Software is furnished to do so, subject to the following conditions: 00011 * 00012 * The above copyright notice and this permission notice shall be included in 00013 * all copies or substantial portions of the Software. 00014 * 00015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00018 * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 00019 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00020 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00021 * 00022 * Except as contained in this notice, the names of the authors or their 00023 * institutions shall not be used in advertising or otherwise to promote the 00024 * sale, use or other dealings in this Software without prior written 00025 * authorization from the authors. 00026 */ 00027 00028 #ifndef __XCB_H__ 00029 #define __XCB_H__ 00030 #include <sys/types.h> 00031 00032 #if defined(__solaris__) 00033 #include <inttypes.h> 00034 #else 00035 #include <stdint.h> 00036 #endif 00037 00038 #ifndef _WIN32 00039 #include <sys/uio.h> 00040 #else 00041 #include "xcb_windefs.h" 00042 #endif 00043 #include <pthread.h> 00044 00045 00046 #ifdef __cplusplus 00047 extern "C" { 00048 #endif 00049 00054 #define XCB_PACKED __attribute__((__packed__)) 00055 00063 /* Pre-defined constants */ 00064 00066 #define X_PROTOCOL 11 00067 00069 #define X_PROTOCOL_REVISION 0 00070 00072 #define X_TCP_PORT 6000 00073 00075 #define XCB_CONN_ERROR 1 00076 00078 #define XCB_CONN_CLOSED_EXT_NOTSUPPORTED 2 00079 00081 #define XCB_CONN_CLOSED_MEM_INSUFFICIENT 3 00082 00084 #define XCB_CONN_CLOSED_REQ_LEN_EXCEED 4 00085 00087 #define XCB_CONN_CLOSED_PARSE_ERR 5 00088 00090 #define XCB_CONN_CLOSED_INVALID_SCREEN 6 00091 00093 #define XCB_CONN_CLOSED_FDPASSING_FAILED 7 00094 00095 #define XCB_TYPE_PAD(T,I) (-(I) & (sizeof(T) > 4 ? 3 : sizeof(T) - 1)) 00096 00097 /* Opaque structures */ 00098 00104 typedef struct xcb_connection_t xcb_connection_t; 00107 /* Other types */ 00108 00114 typedef struct { 00115 void *data; 00116 int rem; 00117 int index; 00118 } xcb_generic_iterator_t; 00119 00125 typedef struct { 00126 uint8_t response_type; 00127 uint8_t pad0; 00128 uint16_t sequence; 00129 uint32_t length; 00130 } xcb_generic_reply_t; 00131 00137 typedef struct { 00138 uint8_t response_type; 00139 uint8_t pad0; 00140 uint16_t sequence; 00141 uint32_t pad[7]; 00142 uint32_t full_sequence; 00143 } xcb_generic_event_t; 00144 00150 typedef struct { 00151 uint8_t response_type; 00152 uint8_t pad0; 00153 uint16_t sequence; 00154 uint32_t pad[7]; 00155 } xcb_raw_generic_event_t; 00156 00166 typedef struct { 00167 uint8_t response_type; 00168 uint8_t pad0; 00169 uint16_t sequence; 00170 uint32_t length; 00171 uint16_t event_type; 00172 uint16_t pad1; 00173 uint32_t pad[5]; 00174 uint32_t full_sequence; 00175 } xcb_ge_event_t; 00176 00182 typedef struct { 00183 uint8_t response_type; 00184 uint8_t error_code; 00185 uint16_t sequence; 00186 uint32_t resource_id; 00187 uint16_t minor_code; 00188 uint8_t major_code; 00189 uint8_t pad0; 00190 uint32_t pad[5]; 00191 uint32_t full_sequence; 00192 } xcb_generic_error_t; 00193 00199 typedef struct { 00200 unsigned int sequence; 00201 } xcb_void_cookie_t; 00202 00203 00204 /* Include the generated xproto header. */ 00205 #include "xproto.h" 00206 00207 00209 #define XCB_NONE 0L 00210 00212 #define XCB_COPY_FROM_PARENT 0L 00213 00215 #define XCB_CURRENT_TIME 0L 00216 00218 #define XCB_NO_SYMBOL 0L 00219 00220 00221 /* xcb_auth.c */ 00222 00228 typedef struct xcb_auth_info_t { 00229 int namelen; 00230 char *name; 00231 int datalen; 00232 char *data; 00233 } xcb_auth_info_t; 00234 00235 00236 /* xcb_out.c */ 00237 00246 int xcb_flush(xcb_connection_t *c); 00247 00263 uint32_t xcb_get_maximum_request_length(xcb_connection_t *c); 00264 00282 void xcb_prefetch_maximum_request_length(xcb_connection_t *c); 00283 00284 00285 /* xcb_in.c */ 00286 00296 xcb_generic_event_t *xcb_wait_for_event(xcb_connection_t *c); 00297 00309 xcb_generic_event_t *xcb_poll_for_event(xcb_connection_t *c); 00310 00325 xcb_generic_event_t *xcb_poll_for_queued_event(xcb_connection_t *c); 00326 00327 typedef struct xcb_special_event xcb_special_event_t; 00328 00332 xcb_generic_event_t *xcb_poll_for_special_event(xcb_connection_t *c, 00333 xcb_special_event_t *se); 00334 00338 xcb_generic_event_t *xcb_wait_for_special_event(xcb_connection_t *c, 00339 xcb_special_event_t *se); 00343 typedef struct xcb_extension_t xcb_extension_t; 00348 xcb_special_event_t *xcb_register_for_special_xge(xcb_connection_t *c, 00349 xcb_extension_t *ext, 00350 uint32_t eid, 00351 uint32_t *stamp); 00352 00356 void xcb_unregister_for_special_event(xcb_connection_t *c, 00357 xcb_special_event_t *se); 00358 00375 xcb_generic_error_t *xcb_request_check(xcb_connection_t *c, xcb_void_cookie_t cookie); 00376 00391 void xcb_discard_reply(xcb_connection_t *c, unsigned int sequence); 00392 00412 void xcb_discard_reply64(xcb_connection_t *c, uint64_t sequence); 00413 00414 /* xcb_ext.c */ 00415 00432 const struct xcb_query_extension_reply_t *xcb_get_extension_data(xcb_connection_t *c, xcb_extension_t *ext); 00433 00445 void xcb_prefetch_extension_data(xcb_connection_t *c, xcb_extension_t *ext); 00446 00447 00448 /* xcb_conn.c */ 00449 00468 const struct xcb_setup_t *xcb_get_setup(xcb_connection_t *c); 00469 00478 int xcb_get_file_descriptor(xcb_connection_t *c); 00479 00498 int xcb_connection_has_error(xcb_connection_t *c); 00499 00517 xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info); 00518 00526 void xcb_disconnect(xcb_connection_t *c); 00527 00528 00529 /* xcb_util.c */ 00530 00548 int xcb_parse_display(const char *name, char **host, int *display, int *screen); 00549 00567 xcb_connection_t *xcb_connect(const char *displayname, int *screenp); 00568 00586 xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *display, xcb_auth_info_t *auth, int *screen); 00587 00588 00589 /* xcb_xid.c */ 00590 00599 uint32_t xcb_generate_id(xcb_connection_t *c); 00600 00601 00606 #ifdef __cplusplus 00607 } 00608 #endif 00609 00610 00611 #endif /* __XCB_H__ */