Xxcbint.h revision 1ab64890
1/* Copyright (C) 2003-2006 Jamey Sharp, Josh Triplett
2 * This file is licensed under the MIT license. See the file COPYING. */
3
4#ifndef XXCBINT_H
5#define XXCBINT_H
6
7#include <assert.h>
8#include <X11/Xlibint.h>
9#include <X11/Xlib-xcb.h>
10#include "locking.h" /* really just want X11/Xthreads.h but can't have it. */
11
12#define XCB_SEQUENCE_COMPARE(a,op,b)	((int) ((a) - (b)) op 0)
13#define assert_sequence_less(a,b) assert(XCB_SEQUENCE_COMPARE((a), <=, (b)))
14
15typedef struct PendingRequest PendingRequest;
16struct PendingRequest {
17	PendingRequest *next;
18	xcondition_rec condition;
19	int waiters; /* Number of threads waiting; -1 if no wait needed */
20	unsigned int sequence;
21};
22
23typedef struct _X11XCBPrivate {
24	struct _XLockPtrs lock_fns;
25	xcb_connection_t *connection;
26	PendingRequest *pending_requests;
27	PendingRequest **pending_requests_tail;
28	xcb_generic_event_t *next_event;
29	const char *request_extra;
30	int request_extra_size;
31	char *partial_request;
32	int partial_request_offset;
33	char *reply_data;
34	int reply_length;
35	int reply_consumed;
36	enum XEventQueueOwner event_owner;
37	XID next_xid;
38} _X11XCBPrivate;
39
40/* xcb_disp.c */
41
42int _XConnectXCB(Display *dpy, _Xconst char *display, char **fullnamep, int *screenp);
43void _XFreeX11XCBStructure(Display *dpy);
44
45/* xcb_lock.c */
46
47int _XCBInitDisplayLock(Display *dpy);
48void _XCBShutdownDisplayLock(Display *dpy);
49
50/* _XGetXCBBuffer and _XPutXCBBuffer calls must be paired and must not
51 * be nested. */
52
53void _XGetXCBBuffer(Display *dpy);
54void _XPutXCBBuffer(Display *dpy);
55
56#endif /* XXCBINT_H */
57