XCB 1.10

xcb.h

Go to the documentation of this file.
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 
00061 /* Pre-defined constants */
00062 
00064 #define X_PROTOCOL 11
00065 
00067 #define X_PROTOCOL_REVISION 0
00068 
00070 #define X_TCP_PORT 6000
00071 
00073 #define XCB_CONN_ERROR 1
00074 
00076 #define XCB_CONN_CLOSED_EXT_NOTSUPPORTED 2
00077 
00079 #define XCB_CONN_CLOSED_MEM_INSUFFICIENT 3
00080 
00082 #define XCB_CONN_CLOSED_REQ_LEN_EXCEED 4
00083 
00085 #define XCB_CONN_CLOSED_PARSE_ERR 5
00086 
00088 #define XCB_CONN_CLOSED_INVALID_SCREEN 6
00089 
00091 #define XCB_CONN_CLOSED_FDPASSING_FAILED 7
00092 
00093 #define XCB_TYPE_PAD(T,I) (-(I) & (sizeof(T) > 4 ? 3 : sizeof(T) - 1))
00094 
00095 /* Opaque structures */
00096 
00102 typedef struct xcb_connection_t xcb_connection_t;  
00105 /* Other types */
00106 
00112 typedef struct {
00113     void *data;   
00114     int rem;    
00115     int index;  
00116 } xcb_generic_iterator_t;
00117 
00123 typedef struct {
00124     uint8_t   response_type;  
00125     uint8_t  pad0;           
00126     uint16_t sequence;       
00127     uint32_t length;         
00128 } xcb_generic_reply_t;
00129 
00135 typedef struct {
00136     uint8_t   response_type;  
00137     uint8_t  pad0;           
00138     uint16_t sequence;       
00139     uint32_t pad[7];         
00140     uint32_t full_sequence;  
00141 } xcb_generic_event_t;
00142 
00152 typedef struct {
00153     uint8_t  response_type;  
00154     uint8_t  pad0;           
00155     uint16_t sequence;       
00156     uint32_t length;
00157     uint16_t event_type;
00158     uint16_t pad1;
00159     uint32_t pad[5];         
00160     uint32_t full_sequence;  
00161 } xcb_ge_event_t;
00162 
00168 typedef struct {
00169     uint8_t   response_type;  
00170     uint8_t   error_code;     
00171     uint16_t sequence;       
00172     uint32_t resource_id;     
00173     uint16_t minor_code;      
00174     uint8_t major_code;       
00175     uint8_t pad0;
00176     uint32_t pad[5];         
00177     uint32_t full_sequence;  
00178 } xcb_generic_error_t;
00179 
00185 typedef struct {
00186     unsigned int sequence;  
00187 } xcb_void_cookie_t;
00188 
00189 
00190 /* Include the generated xproto header. */
00191 #include "xproto.h"
00192 
00193 
00195 #define XCB_NONE 0L
00196 
00198 #define XCB_COPY_FROM_PARENT 0L
00199 
00201 #define XCB_CURRENT_TIME 0L
00202 
00204 #define XCB_NO_SYMBOL 0L
00205 
00206 
00207 /* xcb_auth.c */
00208 
00214 typedef struct xcb_auth_info_t {
00215     int   namelen;  
00216     char *name;     
00217     int   datalen;  
00218     char *data;   
00219 } xcb_auth_info_t;
00220 
00221 
00222 /* xcb_out.c */
00223 
00232 int xcb_flush(xcb_connection_t *c);
00233 
00249 uint32_t xcb_get_maximum_request_length(xcb_connection_t *c);
00250 
00268 void xcb_prefetch_maximum_request_length(xcb_connection_t *c);
00269 
00270 
00271 /* xcb_in.c */
00272 
00282 xcb_generic_event_t *xcb_wait_for_event(xcb_connection_t *c);
00283 
00295 xcb_generic_event_t *xcb_poll_for_event(xcb_connection_t *c);
00296 
00311 xcb_generic_event_t *xcb_poll_for_queued_event(xcb_connection_t *c);
00312 
00313 typedef struct xcb_special_event xcb_special_event_t;
00314 
00318 xcb_generic_event_t *xcb_poll_for_special_event(xcb_connection_t *c,
00319                                                 xcb_special_event_t *se);
00320  
00324 xcb_generic_event_t *xcb_wait_for_special_event(xcb_connection_t *c,
00325                                                 xcb_special_event_t *se);
00329 typedef struct xcb_extension_t xcb_extension_t;  
00335 xcb_special_event_t *xcb_register_for_special_xge(xcb_connection_t *c,
00336                                                   xcb_extension_t *ext,
00337                                                   uint32_t eid,
00338                                                   uint32_t *stamp);
00339 
00343 void xcb_unregister_for_special_event(xcb_connection_t *c,
00344                                       xcb_special_event_t *se);
00345 
00362 xcb_generic_error_t *xcb_request_check(xcb_connection_t *c, xcb_void_cookie_t cookie);
00363 
00378 void xcb_discard_reply(xcb_connection_t *c, unsigned int sequence);
00379 
00380 
00381 /* xcb_ext.c */
00382 
00399 const xcb_query_extension_reply_t *xcb_get_extension_data(xcb_connection_t *c, xcb_extension_t *ext);
00400 
00412 void xcb_prefetch_extension_data(xcb_connection_t *c, xcb_extension_t *ext);
00413 
00414 
00415 /* xcb_conn.c */
00416 
00435 const xcb_setup_t *xcb_get_setup(xcb_connection_t *c);
00436 
00445 int xcb_get_file_descriptor(xcb_connection_t *c);
00446 
00464 int xcb_connection_has_error(xcb_connection_t *c);
00465 
00478 xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info);
00479 
00487 void xcb_disconnect(xcb_connection_t *c);
00488 
00489 
00490 /* xcb_util.c */
00491 
00509 int xcb_parse_display(const char *name, char **host, int *display, int *screen);
00510 
00523 xcb_connection_t *xcb_connect(const char *displayname, int *screenp);
00524 
00537 xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *display, xcb_auth_info_t *auth, int *screen);
00538 
00539 
00540 /* xcb_xid.c */
00541 
00550 uint32_t xcb_generate_id(xcb_connection_t *c);
00551 
00552 
00557 #ifdef __cplusplus
00558 }
00559 #endif
00560 
00561 
00562 #endif /* __XCB_H__ */