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.
37 WORKAROUND_GLX_GET_FB_CONFIGS_BUG
40 #define XCB_PAD(i) (-(i) & 3)
44 typedef struct _xcb_list _xcb_list;
45 typedef void (*XCBListFreeFunc)(void *);
47 _xcb_list *_xcb_list_new(void);
48 void _xcb_list_delete(_xcb_list *list, XCBListFreeFunc do_free);
49 int _xcb_list_append(_xcb_list *list, void *data);
50 void *_xcb_list_peek_head(_xcb_list *list);
51 void *_xcb_list_remove(_xcb_list *list, int (*cmp)(const void *, const void *), const void *data);
52 void *_xcb_list_find(_xcb_list *list, int (*cmp)(const void *, const void *), const void *data);
54 typedef _xcb_list _xcb_map;
56 _xcb_map *_xcb_map_new(void);
57 void _xcb_map_delete(_xcb_map *q, XCBListFreeFunc do_free);
58 int _xcb_map_put(_xcb_map *q, unsigned int key, void *data);
59 void *_xcb_map_remove(_xcb_map *q, unsigned int key);
64 typedef struct _xcb_out {
74 unsigned int request_written;
76 pthread_mutex_t reqlenlock;
77 CARD32 maximum_request_length;
80 int _xcb_out_init(_xcb_out *out);
81 void _xcb_out_destroy(_xcb_out *out);
83 int _xcb_out_write(XCBConnection *c);
84 int _xcb_out_write_block(XCBConnection *c, struct iovec *vector, size_t count);
85 int _xcb_out_flush(XCBConnection *c);
90 typedef struct _xcb_in {
91 pthread_cond_t event_cond;
97 unsigned int request_read;
98 struct reply_list *current_reply;
99 struct reply_list **current_reply_tail;
102 struct event_list *events;
103 struct event_list **events_tail;
106 struct pending_reply *pending_replies;
107 struct pending_reply **pending_replies_tail;
110 int _xcb_in_init(_xcb_in *in);
111 void _xcb_in_destroy(_xcb_in *in);
113 int _xcb_in_expect_reply(XCBConnection *c, unsigned int request, enum workarounds workaround, int flags);
115 int _xcb_in_read(XCBConnection *c);
116 int _xcb_in_read_block(XCBConnection *c, void *buf, int nread);
121 typedef struct _xcb_xid {
122 pthread_mutex_t lock;
129 int _xcb_xid_init(XCBConnection *c);
130 void _xcb_xid_destroy(XCBConnection *c);
135 typedef struct _xcb_ext {
136 pthread_mutex_t lock;
137 struct lazyreply *extensions;
141 int _xcb_ext_init(XCBConnection *c);
142 void _xcb_ext_destroy(XCBConnection *c);
147 struct XCBConnection {
149 XCBConnSetupSuccessRep *setup;
153 pthread_mutex_t iolock;
162 int _xcb_conn_wait(XCBConnection *c, const int should_write, pthread_cond_t *cond);