XCB 1.8.1

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

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
87 #define XCB_TYPE_PAD(T,I) (-(I) & (sizeof(T) > 4 ? 3 : sizeof(T) - 1))
88
89 /* Opaque structures */
90
96 typedef struct xcb_connection_t xcb_connection_t;
99 /* Other types */
100
106 typedef struct {
107 void *data;
108 int rem;
109 int index;
110 } xcb_generic_iterator_t;
111
117 typedef struct {
118 uint8_t response_type;
119 uint8_t pad0;
120 uint16_t sequence;
121 uint32_t length;
122 } xcb_generic_reply_t;
123
129 typedef struct {
130 uint8_t response_type;
131 uint8_t pad0;
132 uint16_t sequence;
133 uint32_t pad[7];
134 uint32_t full_sequence;
135 } xcb_generic_event_t;
136
143 typedef struct {
144 uint8_t response_type;
145 uint8_t pad0;
146 uint16_t sequence;
147 uint32_t length;
148 uint16_t event_type;
149 uint16_t pad1;
150 uint32_t pad[5];
151 uint32_t full_sequence;
152 } xcb_ge_event_t;
153
159 typedef struct {
160 uint8_t response_type;
161 uint8_t error_code;
162 uint16_t sequence;
163 uint32_t resource_id;
164 uint16_t minor_code;
165 uint8_t major_code;
166 uint8_t pad0;
167 uint32_t pad[5];
168 uint32_t full_sequence;
169 } xcb_generic_error_t;
170
176 typedef struct {
177 unsigned int sequence;
178 } xcb_void_cookie_t;
179
180
181 /* Include the generated xproto header. */
182 #include "xproto.h"
183
184
186 #define XCB_NONE 0L
187
189 #define XCB_COPY_FROM_PARENT 0L
190
192 #define XCB_CURRENT_TIME 0L
193
195 #define XCB_NO_SYMBOL 0L
196
197
198 /* xcb_auth.c */
199
205 typedef struct xcb_auth_info_t {
206 int namelen;
207 char *name;
208 int datalen;
209 char *data;
210 } xcb_auth_info_t;
211
212
213 /* xcb_out.c */
214
223 int xcb_flush(xcb_connection_t *c);
224
240 uint32_t xcb_get_maximum_request_length(xcb_connection_t *c);
241
259 void xcb_prefetch_maximum_request_length(xcb_connection_t *c);
260
261
262 /* xcb_in.c */
263
273 xcb_generic_event_t *xcb_wait_for_event(xcb_connection_t *c);
274
287 xcb_generic_event_t *xcb_poll_for_event(xcb_connection_t *c);
288
303 xcb_generic_event_t *xcb_poll_for_queued_event(xcb_connection_t *c);
304
321 xcb_generic_error_t *xcb_request_check(xcb_connection_t *c, xcb_void_cookie_t cookie);
322
337 void xcb_discard_reply(xcb_connection_t *c, unsigned int sequence);
338
339
340 /* xcb_ext.c */
341
345 typedef struct xcb_extension_t xcb_extension_t;
363 const xcb_query_extension_reply_t *xcb_get_extension_data(xcb_connection_t *c, xcb_extension_t *ext);
364
376 void xcb_prefetch_extension_data(xcb_connection_t *c, xcb_extension_t *ext);
377
378
379 /* xcb_conn.c */
380
399 const xcb_setup_t *xcb_get_setup(xcb_connection_t *c);
400
409 int xcb_get_file_descriptor(xcb_connection_t *c);
410
427 int xcb_connection_has_error(xcb_connection_t *c);
428
441 xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info);
442
450 void xcb_disconnect(xcb_connection_t *c);
451
452
453 /* xcb_util.c */
454
472 int xcb_parse_display(const char *name, char **host, int *display, int *screen);
473
486 xcb_connection_t *xcb_connect(const char *displayname, int *screenp);
487
500 xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *display, xcb_auth_info_t *auth, int *screen);
501
502
503 /* xcb_xid.c */
504
513 uint32_t xcb_generate_id(xcb_connection_t *c);
514
515
520 #ifdef __cplusplus
521 }
522 #endif
523
524
525 #endif /* __XCB_H__ */