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 #include <sys/uio.h>
00039 #include <pthread.h>
00040 
00041 
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045 
00057 /* Pre-defined constants */
00058 
00060 #define X_PROTOCOL 11
00061 
00063 #define X_PROTOCOL_REVISION 0
00064 
00066 #define X_TCP_PORT 6000
00067 
00068 #define XCB_TYPE_PAD(T,I) (-(I) & (sizeof(T) > 4 ? 3 : sizeof(T) - 1))
00069 
00070 /* Opaque structures */
00071 
00077 typedef struct xcb_connection_t xcb_connection_t;  
00080 /* Other types */
00081 
00087 typedef struct {
00088     void *data;   
00089     int rem;    
00090     int index;  
00091 } xcb_generic_iterator_t;
00092 
00098 typedef struct {
00099     uint8_t   response_type;  
00100     uint8_t  pad0;           
00101     uint16_t sequence;       
00102     uint32_t length;         
00103 } xcb_generic_reply_t;
00104 
00110 typedef struct {
00111     uint8_t   response_type;  
00112     uint8_t  pad0;           
00113     uint16_t sequence;       
00114     uint32_t pad[7];         
00115     uint32_t full_sequence;  
00116 } xcb_generic_event_t;
00117 
00124 typedef struct {
00125     uint8_t  response_type;  
00126     uint8_t  pad0;           
00127     uint16_t sequence;       
00128     uint32_t length;
00129     uint16_t event_type;
00130     uint16_t pad1;
00131     uint32_t pad[5];         
00132     uint32_t full_sequence;  
00133 } xcb_ge_event_t;
00134 
00140 typedef struct {
00141     uint8_t   response_type;  
00142     uint8_t   error_code;     
00143     uint16_t sequence;       
00144     uint32_t pad[7];         
00145     uint32_t full_sequence;  
00146 } xcb_generic_error_t;
00147 
00153 typedef struct {
00154     unsigned int sequence;  
00155 } xcb_void_cookie_t;
00156 
00157 
00158 /* Include the generated xproto header. */
00159 #include "xproto.h"
00160 
00161 
00163 #define XCB_NONE 0L
00164 
00166 #define XCB_COPY_FROM_PARENT 0L
00167 
00169 #define XCB_CURRENT_TIME 0L
00170 
00172 #define XCB_NO_SYMBOL 0L
00173 
00174 
00175 /* xcb_auth.c */
00176 
00182 typedef struct xcb_auth_info_t {
00183     int   namelen;  
00184     char *name;     
00185     int   datalen;  
00186     char *data;   
00187 } xcb_auth_info_t;
00188 
00189 
00190 /* xcb_out.c */
00191 
00200 int xcb_flush(xcb_connection_t *c);
00201 
00217 uint32_t xcb_get_maximum_request_length(xcb_connection_t *c);
00218 
00236 void xcb_prefetch_maximum_request_length(xcb_connection_t *c);
00237 
00238 
00239 /* xcb_in.c */
00240 
00250 xcb_generic_event_t *xcb_wait_for_event(xcb_connection_t *c);
00251 
00264 xcb_generic_event_t *xcb_poll_for_event(xcb_connection_t *c);
00265 
00282 xcb_generic_error_t *xcb_request_check(xcb_connection_t *c, xcb_void_cookie_t cookie);
00283 
00284 
00285 /* xcb_ext.c */
00286 
00290 typedef struct xcb_extension_t xcb_extension_t;  
00308 const xcb_query_extension_reply_t *xcb_get_extension_data(xcb_connection_t *c, xcb_extension_t *ext);
00309 
00321 void xcb_prefetch_extension_data(xcb_connection_t *c, xcb_extension_t *ext);
00322 
00323 
00324 /* xcb_conn.c */
00325 
00344 const xcb_setup_t *xcb_get_setup(xcb_connection_t *c);
00345 
00354 int xcb_get_file_descriptor(xcb_connection_t *c);
00355 
00369 int xcb_connection_has_error(xcb_connection_t *c);
00370 
00383 xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info);
00384 
00392 void xcb_disconnect(xcb_connection_t *c);
00393 
00394 
00395 /* xcb_util.c */
00396 
00414 int xcb_parse_display(const char *name, char **host, int *display, int *screen);
00415 
00428 xcb_connection_t *xcb_connect(const char *displayname, int *screenp);
00429 
00442 xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *display, xcb_auth_info_t *auth, int *screen);
00443 
00444 
00445 /* xcb_xid.c */
00446 
00455 uint32_t xcb_generate_id(xcb_connection_t *c);
00456 
00457 
00462 #ifdef __cplusplus
00463 }
00464 #endif
00465 
00466 
00467 #endif /* __XCB_H__ */

Generated on Thu Jul 16 21:52:42 2009 for XCB by  doxygen 1.5.4