11ab64890Smrg/* Copyright (C) 2003-2006 Jamey Sharp, Josh Triplett
21ab64890Smrg * This file is licensed under the MIT license. See the file COPYING. */
31ab64890Smrg
41ab64890Smrg#ifndef XXCBINT_H
51ab64890Smrg#define XXCBINT_H
61ab64890Smrg
71ab64890Smrg#include <assert.h>
861b2299dSmrg#include <stdint.h>
91ab64890Smrg#include <X11/Xlibint.h>
10eb411b4bSmrg#ifdef WIN32
11eb411b4bSmrg#include <X11/Xwindows.h>
12eb411b4bSmrg#endif
131ab64890Smrg#include <X11/Xlib-xcb.h>
1461b2299dSmrg#include "locking.h"
151ab64890Smrg
162d67cb4fSmrg#define XLIB_SEQUENCE_COMPARE(a,op,b)	(((int64_t) (a) - (int64_t) (b)) op 0)
171ab64890Smrg
181ab64890Smrgtypedef struct PendingRequest PendingRequest;
191ab64890Smrgstruct PendingRequest {
201ab64890Smrg	PendingRequest *next;
212d67cb4fSmrg	uint64_t sequence;
2288de56ccSmrg	unsigned reply_waiter;
231ab64890Smrg};
241ab64890Smrg
251ab64890Smrgtypedef struct _X11XCBPrivate {
261ab64890Smrg	xcb_connection_t *connection;
271ab64890Smrg	PendingRequest *pending_requests;
2888de56ccSmrg	PendingRequest *pending_requests_tail;
291ab64890Smrg	xcb_generic_event_t *next_event;
30d4a3aaf4Smrg	void *next_response;
3161b2299dSmrg	char *real_bufmax;
321ab64890Smrg	char *reply_data;
331ab64890Smrg	int reply_length;
341ab64890Smrg	int reply_consumed;
3561b2299dSmrg	uint64_t last_flushed;
361ab64890Smrg	enum XEventQueueOwner event_owner;
371ab64890Smrg	XID next_xid;
3861b2299dSmrg
3988de56ccSmrg	/* handle simultaneous threads waiting for responses */
4061b2299dSmrg	xcondition_t event_notify;
4161b2299dSmrg	int event_waiter;
4288de56ccSmrg	xcondition_t reply_notify;
431ab64890Smrg} _X11XCBPrivate;
441ab64890Smrg
451ab64890Smrg/* xcb_disp.c */
461ab64890Smrg
47e9fcaa8aSmrgint _XConnectXCB(Display *dpy, _Xconst char *display, int *screenp);
481ab64890Smrgvoid _XFreeX11XCBStructure(Display *dpy);
491ab64890Smrg
502d67cb4fSmrg_X_HIDDEN
510f8248bfSmrgunsigned long _XNextRequest(Display *dpy);
520f8248bfSmrg
531ab64890Smrg#endif /* XXCBINT_H */
54