XCB  1.10
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 
54 #define XCB_PACKED __attribute__((__packed__))
55 
63 /* Pre-defined constants */
64 
66 #define X_PROTOCOL 11
67 
69 #define X_PROTOCOL_REVISION 0
70 
72 #define X_TCP_PORT 6000
73 
75 #define XCB_CONN_ERROR 1
76 
78 #define XCB_CONN_CLOSED_EXT_NOTSUPPORTED 2
79 
81 #define XCB_CONN_CLOSED_MEM_INSUFFICIENT 3
82 
84 #define XCB_CONN_CLOSED_REQ_LEN_EXCEED 4
85 
87 #define XCB_CONN_CLOSED_PARSE_ERR 5
88 
90 #define XCB_CONN_CLOSED_INVALID_SCREEN 6
91 
93 #define XCB_CONN_CLOSED_FDPASSING_FAILED 7
94 
95 #define XCB_TYPE_PAD(T,I) (-(I) & (sizeof(T) > 4 ? 3 : sizeof(T) - 1))
96 
97 /* Opaque structures */
98 
107 /* Other types */
108 
114 typedef struct {
115  void *data;
116  int rem;
117  int index;
119 
125 typedef struct {
126  uint8_t response_type;
127  uint8_t pad0;
128  uint16_t sequence;
129  uint32_t length;
131 
137 typedef struct {
138  uint8_t response_type;
139  uint8_t pad0;
140  uint16_t sequence;
141  uint32_t pad[7];
142  uint32_t full_sequence;
144 
154 typedef struct {
155  uint8_t response_type;
156  uint8_t pad0;
157  uint16_t sequence;
158  uint32_t length;
159  uint16_t event_type;
160  uint16_t pad1;
161  uint32_t pad[5];
162  uint32_t full_sequence;
164 
170 typedef struct {
171  uint8_t response_type;
172  uint8_t error_code;
173  uint16_t sequence;
174  uint32_t resource_id;
175  uint16_t minor_code;
176  uint8_t major_code;
177  uint8_t pad0;
178  uint32_t pad[5];
179  uint32_t full_sequence;
181 
187 typedef struct {
188  unsigned int sequence;
190 
191 
192 /* Include the generated xproto header. */
193 #include "xproto.h"
194 
195 
197 #define XCB_NONE 0L
198 
200 #define XCB_COPY_FROM_PARENT 0L
201 
203 #define XCB_CURRENT_TIME 0L
204 
206 #define XCB_NO_SYMBOL 0L
207 
208 
209 /* xcb_auth.c */
210 
216 typedef struct xcb_auth_info_t {
217  int namelen;
218  char *name;
219  int datalen;
220  char *data;
222 
223 
224 /* xcb_out.c */
225 
235 
252 
271 
272 
273 /* xcb_in.c */
274 
285 
298 
314 
316 
321  xcb_special_event_t *se);
322 
327  xcb_special_event_t *se);
338  xcb_extension_t *ext,
339  uint32_t eid,
340  uint32_t *stamp);
341 
346  xcb_special_event_t *se);
347 
365 
380 void xcb_discard_reply(xcb_connection_t *c, unsigned int sequence);
381 
382 
383 /* xcb_ext.c */
384 
402 
415 
416 
417 /* xcb_conn.c */
418 
438 
448 
467 
481 
490 
491 
492 /* xcb_util.c */
493 
511 int xcb_parse_display(const char *name, char **host, int *display, int *screen);
512 
525 xcb_connection_t *xcb_connect(const char *displayname, int *screenp);
526 
539 xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *display, xcb_auth_info_t *auth, int *screen);
540 
541 
542 /* xcb_xid.c */
543 
552 uint32_t xcb_generate_id(xcb_connection_t *c);
553 
554 
559 #ifdef __cplusplus
560 }
561 #endif
562 
563 
564 #endif /* __XCB_H__ */