XCB 1.17.0
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
47extern "C" {
48#endif
49
53
54#ifdef __GNUC__
55#define XCB_PACKED __attribute__((__packed__))
56#else
57#define XCB_PACKED
58#endif
59
66
67/* Pre-defined constants */
68
70#define X_PROTOCOL 11
71
73#define X_PROTOCOL_REVISION 0
74
76#define X_TCP_PORT 6000
77
79#define XCB_CONN_ERROR 1
80
82#define XCB_CONN_CLOSED_EXT_NOTSUPPORTED 2
83
85#define XCB_CONN_CLOSED_MEM_INSUFFICIENT 3
86
88#define XCB_CONN_CLOSED_REQ_LEN_EXCEED 4
89
91#define XCB_CONN_CLOSED_PARSE_ERR 5
92
94#define XCB_CONN_CLOSED_INVALID_SCREEN 6
95
97#define XCB_CONN_CLOSED_FDPASSING_FAILED 7
98
100#define XCB_CONN_CLOSED_SERVER_IMPL_UNAUTHORIZED 8
101
102#define XCB_TYPE_PAD(T,I) (-(I) & (sizeof(T) > 4 ? 3 : sizeof(T) - 1))
103
104/* Opaque structures */
105
112
113
114/* Other types */
115
121typedef struct {
122 void *data;
123 int rem;
124 int index;
126
132typedef struct {
134 uint8_t pad0;
135 uint16_t sequence;
136 uint32_t length;
138
144typedef struct {
146 uint8_t pad0;
147 uint16_t sequence;
148 uint32_t pad[7];
149 uint32_t full_sequence;
151
157typedef struct {
159 uint8_t pad0;
160 uint16_t sequence;
161 uint32_t pad[7];
163
173typedef struct {
175 uint8_t pad0;
176 uint16_t sequence;
177 uint32_t length;
178 uint16_t event_type;
179 uint16_t pad1;
180 uint32_t pad[5];
181 uint32_t full_sequence;
183
189typedef struct {
191 uint8_t error_code;
192 uint16_t sequence;
193 uint32_t resource_id;
194 uint16_t minor_code;
195 uint8_t major_code;
196 uint8_t pad0;
197 uint32_t pad[5];
198 uint32_t full_sequence;
200
206typedef struct {
207 unsigned int sequence;
209
210
211/* Include the generated xproto header. */
212#include "xproto.h"
213
214
216#define XCB_NONE 0L
217
219#define XCB_COPY_FROM_PARENT 0L
220
222#define XCB_CURRENT_TIME 0L
223
225#define XCB_NO_SYMBOL 0L
226
227
228/* xcb_auth.c */
229
241
242
243/* xcb_out.c */
244
254
271
290
291
292/* xcb_in.c */
293
304
317
333
334typedef struct xcb_special_event xcb_special_event_t;
335
340 xcb_special_event_t *se);
341
346 xcb_special_event_t *se);
351
355xcb_special_event_t *xcb_register_for_special_xge(xcb_connection_t *c,
356 xcb_extension_t *ext,
357 uint32_t eid,
358 uint32_t *stamp);
359
364 xcb_special_event_t *se);
365
383
398void xcb_discard_reply(xcb_connection_t *c, unsigned int sequence);
399
419void xcb_discard_reply64(xcb_connection_t *c, uint64_t sequence);
420
421/* xcb_ext.c */
422
440
453
454
455/* xcb_conn.c */
456
476
486
506
525
534
535
536/* xcb_util.c */
537
555int xcb_parse_display(const char *name, char **host, int *display, int *screen);
556
574xcb_connection_t *xcb_connect(const char *displayname, int *screenp);
575
593xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *display, xcb_auth_info_t *auth, int *screen);
594
595
596/* xcb_xid.c */
597
607
608
619
620uint64_t
622
634
635uint64_t
637
641
642#ifdef __cplusplus
643}
644#endif
645
646
647#endif /* __XCB_H__ */
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:792
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:731
uint64_t xcb_total_written(xcb_connection_t *c)
Obtain number of bytes written to the connection.
Definition xcb_conn.c:589
uint64_t xcb_total_read(xcb_connection_t *c)
Obtain number of bytes read from the connection.
Definition xcb_conn.c:576
uint32_t xcb_generate_id(xcb_connection_t *c)
Allocates an XID for a new object.
Definition xcb_xid.c:41
void xcb_prefetch_maximum_request_length(xcb_connection_t *c)
Prefetch the maximum request length without blocking.
Definition xcb_out.c:139
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:525
int xcb_get_file_descriptor(xcb_connection_t *c)
Access the file descriptor of the connection.
Definition xcb_conn.c:342
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:695
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:350
void xcb_discard_reply64(xcb_connection_t *c, uint64_t sequence)
Discards the reply for a request, given by a 64bit sequence number.
Definition xcb_in.c:643
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:860
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:736
int xcb_flush(xcb_connection_t *c)
Forces any buffered output to be written to the server.
Definition xcb_out.c:421
xcb_connection_t * xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info)
Connects to the X server.
Definition xcb_conn.c:356
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
const struct xcb_setup_t * xcb_get_setup(xcb_connection_t *c)
Access the data returned by the server.
Definition xcb_conn.c:334
uint32_t xcb_get_maximum_request_length(xcb_connection_t *c)
Returns the maximum request length that this server accepts.
Definition xcb_out.c:162
void xcb_discard_reply(xcb_connection_t *c, unsigned int sequence)
Discards the reply for a request.
Definition xcb_in.c:629
const struct 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
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:777
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:233
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:726
void xcb_disconnect(xcb_connection_t *c)
Closes the connection.
Definition xcb_conn.c:407
xcb_connection_t * xcb_connect(const char *displayname, int *screenp)
Connects to the X server.
Definition xcb_util.c:520
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:817
Container for authorization information.
Definition xcb.h:235
int namelen
Definition xcb.h:236
char * data
Definition xcb.h:239
int datalen
Definition xcb.h:238
char * name
Definition xcb.h:237
Definition xcbint.h:208
Definition xcbext.h:39
GE event.
Definition xcb.h:173
uint16_t sequence
Definition xcb.h:176
uint32_t pad[5]
Definition xcb.h:180
uint32_t full_sequence
Definition xcb.h:181
uint8_t response_type
Definition xcb.h:174
uint8_t pad0
Definition xcb.h:175
Generic error.
Definition xcb.h:189
uint16_t sequence
Definition xcb.h:192
uint8_t pad0
Definition xcb.h:196
uint32_t pad[5]
Definition xcb.h:197
uint16_t minor_code
Definition xcb.h:194
uint8_t response_type
Definition xcb.h:190
uint8_t major_code
Definition xcb.h:195
uint32_t full_sequence
Definition xcb.h:198
uint8_t error_code
Definition xcb.h:191
Generic event.
Definition xcb.h:144
uint32_t full_sequence
Definition xcb.h:149
uint16_t sequence
Definition xcb.h:147
uint32_t pad[7]
Definition xcb.h:148
uint8_t pad0
Definition xcb.h:146
uint8_t response_type
Definition xcb.h:145
Generic iterator.
Definition xcb.h:121
int rem
Definition xcb.h:123
void * data
Definition xcb.h:122
int index
Definition xcb.h:124
Generic reply.
Definition xcb.h:132
uint32_t length
Definition xcb.h:136
uint8_t response_type
Definition xcb.h:133
uint16_t sequence
Definition xcb.h:135
uint8_t pad0
Definition xcb.h:134
xcb_query_extension_reply_t
Definition xproto.h:4287
Raw Generic event.
Definition xcb.h:157
uint8_t pad0
Definition xcb.h:159
uint8_t response_type
Definition xcb.h:158
uint32_t pad[7]
Definition xcb.h:161
uint16_t sequence
Definition xcb.h:160
xcb_setup_t
Definition xproto.h:475
Definition xcb_in.c:64