XCB  1.9.3
xcb.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2001-2006 Bart Massey, Jamey Sharp, and Josh Triplett.
3  * All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18  * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * Except as contained in this notice, the names of the authors or their
23  * institutions shall not be used in advertising or otherwise to promote the
24  * sale, use or other dealings in this Software without prior written
25  * authorization from the authors.
26  */
27 
28 #ifndef __XCB_H__
29 #define __XCB_H__
30 #include <sys/types.h>
31 
32 #if defined(__solaris__)
33 #include <inttypes.h>
34 #else
35 #include <stdint.h>
36 #endif
37 
38 #ifndef _WIN32
39 #include <sys/uio.h>
40 #else
41 #include "xcb_windefs.h"
42 #endif
43 #include <pthread.h>
44 
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
61 /* Pre-defined constants */
62 
64 #define X_PROTOCOL 11
65 
67 #define X_PROTOCOL_REVISION 0
68 
70 #define X_TCP_PORT 6000
71 
73 #define XCB_CONN_ERROR 1
74 
76 #define XCB_CONN_CLOSED_EXT_NOTSUPPORTED 2
77 
79 #define XCB_CONN_CLOSED_MEM_INSUFFICIENT 3
80 
82 #define XCB_CONN_CLOSED_REQ_LEN_EXCEED 4
83 
85 #define XCB_CONN_CLOSED_PARSE_ERR 5
86 
88 #define XCB_CONN_CLOSED_INVALID_SCREEN 6
89 
91 #define XCB_CONN_CLOSED_FDPASSING_FAILED 7
92 
93 #define XCB_TYPE_PAD(T,I) (-(I) & (sizeof(T) > 4 ? 3 : sizeof(T) - 1))
94 
95 /* Opaque structures */
96 
105 /* Other types */
106 
112 typedef struct {
113  void *data;
114  int rem;
115  int index;
117 
123 typedef struct {
124  uint8_t response_type;
125  uint8_t pad0;
126  uint16_t sequence;
127  uint32_t length;
129 
135 typedef struct {
136  uint8_t response_type;
137  uint8_t pad0;
138  uint16_t sequence;
139  uint32_t pad[7];
140  uint32_t full_sequence;
142 
148 typedef struct {
149  uint8_t response_type;
150  uint8_t error_code;
151  uint16_t sequence;
152  uint32_t resource_id;
153  uint16_t minor_code;
154  uint8_t major_code;
155  uint8_t pad0;
156  uint32_t pad[5];
157  uint32_t full_sequence;
159 
165 typedef struct {
166  unsigned int sequence;
168 
169 
170 /* Include the generated xproto header. */
171 #include "xproto.h"
172 
173 
175 #define XCB_NONE 0L
176 
178 #define XCB_COPY_FROM_PARENT 0L
179 
181 #define XCB_CURRENT_TIME 0L
182 
184 #define XCB_NO_SYMBOL 0L
185 
186 
187 /* xcb_auth.c */
188 
194 typedef struct xcb_auth_info_t {
195  int namelen;
196  char *name;
197  int datalen;
198  char *data;
200 
201 
202 /* xcb_out.c */
203 
213 
230 
249 
250 
251 /* xcb_in.c */
252 
263 
277 
293 
295 
300  xcb_special_event_t *se);
301 
306  xcb_special_event_t *se);
317  xcb_extension_t *ext,
318  uint32_t eid,
319  uint32_t *stamp);
320 
325  xcb_special_event_t *se);
326 
344 
359 void xcb_discard_reply(xcb_connection_t *c, unsigned int sequence);
360 
361 
362 /* xcb_ext.c */
363 
381 
394 
395 
396 /* xcb_conn.c */
397 
417 
427 
446 
460 
469 
470 
471 /* xcb_util.c */
472 
490 int xcb_parse_display(const char *name, char **host, int *display, int *screen);
491 
504 xcb_connection_t *xcb_connect(const char *displayname, int *screenp);
505 
518 xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *display, xcb_auth_info_t *auth, int *screen);
519 
520 
521 /* xcb_xid.c */
522 
531 uint32_t xcb_generate_id(xcb_connection_t *c);
532 
533 
538 #ifdef __cplusplus
539 }
540 #endif
541 
542 
543 #endif /* __XCB_H__ */
uint32_t xcb_generate_id(xcb_connection_t *c)
Allocates an XID for a new object.
Definition: xcb_xid.c:41
Generic error.
Definition: xcb.h:148
void xcb_prefetch_extension_data(xcb_connection_t *c, xcb_extension_t *ext)
Prefetch of extension data into the extension cache.
Definition: xcb_ext.c:106
uint8_t pad0
Definition: xcb.h:137
xcb_query_extension_reply_t
Definition: xproto.h:4152
int index
Definition: xcb.h:115
uint8_t major_code
Definition: xcb.h:154
int xcb_parse_display(const char *name, char **host, int *display, int *screen)
Parses a display string name in the form documented by X(7x).
Definition: xcb_util.c:154
Definition: xcbext.h:39
Generic reply.
Definition: xcb.h:123
void * data
Definition: xcb.h:113
int namelen
Definition: xcb.h:195
uint8_t response_type
Definition: xcb.h:124
uint32_t xcb_get_maximum_request_length(xcb_connection_t *c)
Returns the maximum request length that this server accepts.
Definition: xcb_out.c:131
char * data
Definition: xcb.h:198
Generic iterator.
Definition: xcb.h:112
xcb_connection_t * xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info)
Connects to the X server.
Definition: xcb_conn.c:299
int xcb_get_file_descriptor(xcb_connection_t *c)
Access the file descriptor of the connection.
Definition: xcb_conn.c:285
char * name
Definition: xcb.h:196
uint8_t pad0
Definition: xcb.h:125
uint16_t sequence
Definition: xcb.h:151
void xcb_disconnect(xcb_connection_t *c)
Closes the connection.
Definition: xcb_conn.c:339
struct xcb_auth_info_t xcb_auth_info_t
Container for authorization information.
uint16_t minor_code
Definition: xcb.h:153
int xcb_flush(xcb_connection_t *c)
Forces any buffered output to be written to the server.
Definition: xcb_out.c:320
xcb_generic_event_t * xcb_poll_for_event(xcb_connection_t *c)
Returns the next event or error from the server.
Definition: xcb_in.c:645
void xcb_prefetch_maximum_request_length(xcb_connection_t *c)
Prefetch the maximum request length without blocking.
Definition: xcb_out.c:108
xcb_connection_t * xcb_connect(const char *displayname, int *screenp)
Connects to the X server.
Definition: xcb_util.c:419
uint32_t full_sequence
Definition: xcb.h:157
uint8_t response_type
Definition: xcb.h:136
uint32_t length
Definition: xcb.h:127
xcb_generic_error_t * xcb_request_check(xcb_connection_t *c, xcb_void_cookie_t cookie)
Return the error for a request, or NULL if none can ever arrive.
Definition: xcb_in.c:655
int rem
Definition: xcb.h:114
Definition: xcb_in.c:63
xcb_generic_event_t * xcb_poll_for_special_event(xcb_connection_t *c, xcb_special_event_t *se)
Returns the next event from a special queue.
Definition: xcb_in.c:691
uint16_t sequence
Definition: xcb.h:138
uint8_t pad0
Definition: xcb.h:155
void xcb_unregister_for_special_event(xcb_connection_t *c, xcb_special_event_t *se)
Stop listening for a special event.
Definition: xcb_in.c:766
uint8_t error_code
Definition: xcb.h:150
uint16_t sequence
Definition: xcb.h:126
int datalen
Definition: xcb.h:197
const xcb_setup_t * xcb_get_setup(xcb_connection_t *c)
Access the data returned by the server.
Definition: xcb_conn.c:277
xcb_generic_event_t * xcb_wait_for_event(xcb_connection_t *c)
Returns the next event or error from the server.
Definition: xcb_in.c:614
xcb_special_event_t * xcb_register_for_special_xge(xcb_connection_t *c, xcb_extension_t *ext, uint32_t eid, uint32_t *stamp)
Listen for a special event.
Definition: xcb_in.c:723
Generic event.
Definition: xcb.h:135
xcb_generic_event_t * xcb_poll_for_queued_event(xcb_connection_t *c)
Returns the next event without reading from the connection.
Definition: xcb_in.c:650
Definition: xcbint.h:196
int xcb_connection_has_error(xcb_connection_t *c)
Test whether the connection has shut down due to a fatal error.
Definition: xcb_conn.c:293
xcb_connection_t * xcb_connect_to_display_with_auth_info(const char *display, xcb_auth_info_t *auth, int *screen)
Connects to the X server, using an authorization information.
Definition: xcb_util.c:424
uint32_t full_sequence
Definition: xcb.h:140
xcb_setup_t
Definition: xproto.h:453
void xcb_discard_reply(xcb_connection_t *c, unsigned int sequence)
Discards the reply for a request.
Definition: xcb_in.c:583
xcb_generic_event_t * xcb_wait_for_special_event(xcb_connection_t *c, xcb_special_event_t *se)
Returns the next event from a special queue, blocking until one arrives.
Definition: xcb_in.c:704
uint8_t response_type
Definition: xcb.h:149
Container for authorization information.
Definition: xcb.h:194
const xcb_query_extension_reply_t * xcb_get_extension_data(xcb_connection_t *c, xcb_extension_t *ext)
Caches reply information from QueryExtension requests.
Definition: xcb_ext.c:88