2 * Copyright (C) 2001-2004 Bart Massey and Jamey Sharp.
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:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
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.
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.
35 #ifdef GCC_HAS_VISIBILITY
36 #pragma GCC visibility push(hidden)
41 WORKAROUND_GLX_GET_FB_CONFIGS_BUG
44 #define XCB_PAD(i) (-(i) & 3)
48 typedef void (*XCBListFreeFunc)(void *);
50 typedef struct _xcb_map _xcb_map;
52 _xcb_map *_xcb_map_new(void);
53 void _xcb_map_delete(_xcb_map *q, XCBListFreeFunc do_free);
54 int _xcb_map_put(_xcb_map *q, unsigned int key, void *data);
55 void *_xcb_map_remove(_xcb_map *q, unsigned int key);
60 typedef struct _xcb_out {
68 unsigned int request_written;
70 pthread_mutex_t reqlenlock;
71 CARD32 maximum_request_length;
74 int _xcb_out_init(_xcb_out *out);
75 void _xcb_out_destroy(_xcb_out *out);
77 int _xcb_out_write(XCBConnection *c, struct iovec **vector, int *count);
78 int _xcb_out_send(XCBConnection *c, struct iovec **vector, int *count);
79 int _xcb_out_flush_to(XCBConnection *c, unsigned int request);
84 typedef struct _xcb_in {
85 pthread_cond_t event_cond;
91 unsigned int request_expected;
92 unsigned int request_read;
93 unsigned int request_completed;
94 struct reply_list *current_reply;
95 struct reply_list **current_reply_tail;
98 struct event_list *events;
99 struct event_list **events_tail;
100 struct reader_list *readers;
102 struct pending_reply *pending_replies;
103 struct pending_reply **pending_replies_tail;
106 int _xcb_in_init(_xcb_in *in);
107 void _xcb_in_destroy(_xcb_in *in);
109 int _xcb_in_expect_reply(XCBConnection *c, unsigned int request, enum workarounds workaround, int flags);
111 int _xcb_in_read(XCBConnection *c);
112 int _xcb_in_read_block(XCBConnection *c, void *buf, int nread);
117 typedef struct _xcb_xid {
118 pthread_mutex_t lock;
125 int _xcb_xid_init(XCBConnection *c);
126 void _xcb_xid_destroy(XCBConnection *c);
131 typedef struct _xcb_ext {
132 pthread_mutex_t lock;
133 struct lazyreply *extensions;
137 int _xcb_ext_init(XCBConnection *c);
138 void _xcb_ext_destroy(XCBConnection *c);
143 struct XCBConnection {
145 XCBConnSetupSuccessRep *setup;
149 pthread_mutex_t iolock;
158 int _xcb_conn_wait(XCBConnection *c, pthread_cond_t *cond, struct iovec **vector, int *count);
160 #ifdef GCC_HAS_VISIBILITY
161 #pragma GCC visibility pop