From d7937b8bb2e3eb3a5d302a5ca2cd6239383cb5eb Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Sat, 24 Dec 2005 10:30:15 +0000 Subject: New header and two functions specifically for Xlib's use, so we can quit installing xcbint.h. Now that Xlib uses entirely public API, force_sequence_wrap is purely internal to xcb_out. --- xcb/ChangeLog | 10 ++++++++++ xcb/src/Makefile.am | 4 ++-- xcb/src/xcb_out.c | 26 +++++++++++++------------- xcb/src/xcb_xlib.c | 41 +++++++++++++++++++++++++++++++++++++++++ xcb/src/xcbint.h | 1 - xcb/src/xcbxlib.h | 38 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 104 insertions(+), 16 deletions(-) create mode 100644 xcb/src/xcb_xlib.c create mode 100644 xcb/src/xcbxlib.h diff --git a/xcb/ChangeLog b/xcb/ChangeLog index 968dbad..49ed96f 100644 --- a/xcb/ChangeLog +++ b/xcb/ChangeLog @@ -1,3 +1,13 @@ +2005-12-24 Jamey Sharp + + * src/xcb_xlib.c, src/xcbxlib.h, src/Makefile.am: + New header and two functions specifically for Xlib's use, so + we can quit installing xcbint.h. + + * src/xcb_out.c, src/xcbint.h: + Now that Xlib uses entirely public API, force_sequence_wrap is + purely internal to xcb_out. + 2005-12-20 Jamey Sharp * src/xcb_util.c: diff --git a/xcb/src/Makefile.am b/xcb/src/Makefile.am index 8d18241..47fdb16 100644 --- a/xcb/src/Makefile.am +++ b/xcb/src/Makefile.am @@ -38,14 +38,14 @@ COREHEADERS = xproto.h xcb_types.h CORESOURCES = xproto.c xcb_types.c COREPROTO = $(CORESOURCES) $(COREHEADERS) -xcbinclude_HEADERS = xcb.h xcbext.h xcbint.h $(COREHEADERS) $(EXTHEADERS) +xcbinclude_HEADERS = xcb.h xcbext.h xcbxlib.h $(COREHEADERS) $(EXTHEADERS) CFLAGS = AM_CFLAGS = -include config.h $(CDEBUGFLAGS) $(XCBPROTO_CFLAGS) $(XPROTO_CFLAGS) $(XAU_CFLAGS) libXCB_la_LIBADD = $(XCBPROTO_LIBS) $(XPROTO_LIBS) $(XAU_LIBS) libXCB_la_SOURCES = \ xcb_conn.c xcb_out.c xcb_in.c xcb_ext.c xcb_xid.c \ - xcb_list.c xcb_util.c xcb_auth.c xcb_des.c \ + xcb_list.c xcb_util.c xcb_xlib.c xcb_auth.c xcb_des.c \ $(COREPROTO) $(EXTENSIONS) xcb_des.c: diff --git a/xcb/src/xcb_out.c b/xcb/src/xcb_out.c index 337f87a..b3a556a 100644 --- a/xcb/src/xcb_out.c +++ b/xcb/src/xcb_out.c @@ -35,6 +35,18 @@ #include "xcbint.h" #include "extensions/bigreq.h" +static int force_sequence_wrap(XCBConnection *c) +{ + int ret = 1; + if((c->out.request - c->in.request_read) > 65530) + { + pthread_mutex_unlock(&c->iolock); + ret = XCBSync(c, 0); + pthread_mutex_lock(&c->iolock); + } + return ret; +} + /* Public interface */ CARD32 XCBGetMaximumRequestLength(XCBConnection *c) @@ -115,7 +127,7 @@ int XCBSendRequest(XCBConnection *c, unsigned int *request, struct iovec *vector /* get a sequence number and arrange for delivery. */ pthread_mutex_lock(&c->iolock); - if(req->isvoid && !_xcb_out_force_sequence_wrap(c)) + if(req->isvoid && !force_sequence_wrap(c)) { pthread_mutex_unlock(&c->iolock); return -1; @@ -173,18 +185,6 @@ void _xcb_out_destroy(_xcb_out *out) free(out->vec); } -int _xcb_out_force_sequence_wrap(XCBConnection *c) -{ - int ret = 1; - if((c->out.request - c->in.request_read) > 65530) - { - pthread_mutex_unlock(&c->iolock); - ret = XCBSync(c, 0); - pthread_mutex_lock(&c->iolock); - } - return ret; -} - int _xcb_out_write(XCBConnection *c) { int n; diff --git a/xcb/src/xcb_xlib.c b/xcb/src/xcb_xlib.c new file mode 100644 index 0000000..8cc6837 --- /dev/null +++ b/xcb/src/xcb_xlib.c @@ -0,0 +1,41 @@ +/* Copyright (C) 2005 Bart Massey and Jamey Sharp. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the names of the authors or their + * institutions shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the authors. + */ + +#include "xcbxlib.h" +#include "xcbint.h" + +unsigned int XCBGetRequestSent(XCBConnection *c) +{ + unsigned int ret; + pthread_mutex_lock(&c->iolock); + ret = c->out.request; + pthread_mutex_unlock(&c->iolock); + return ret; +} + +pthread_mutex_t *XCBGetIOLock(XCBConnection *c) +{ + return &c->iolock; +} diff --git a/xcb/src/xcbint.h b/xcb/src/xcbint.h index a3823fe..057a315 100644 --- a/xcb/src/xcbint.h +++ b/xcb/src/xcbint.h @@ -105,7 +105,6 @@ typedef struct _xcb_out { int _xcb_out_init(_xcb_out *out); void _xcb_out_destroy(_xcb_out *out); -int _xcb_out_force_sequence_wrap(XCBConnection *c); int _xcb_out_write(XCBConnection *c); int _xcb_out_write_block(XCBConnection *c, struct iovec *vector, size_t count); int _xcb_out_flush(XCBConnection *c); diff --git a/xcb/src/xcbxlib.h b/xcb/src/xcbxlib.h new file mode 100644 index 0000000..e9f7140 --- /dev/null +++ b/xcb/src/xcbxlib.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2005 Bart Massey and Jamey Sharp. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the names of the authors or their + * institutions shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the authors. + */ + +#ifndef __XCBXLIB_H +#define __XCBXLIB_H + +#include +#include "xcb.h" + +unsigned int XCBGetRequestSent(XCBConnection *c); + +pthread_mutex_t *XCBGetIOLock(XCBConnection *c); + +#endif -- cgit v1.2.3