Merge branch 'master' of git+ssh://git.freedesktop.org/git/xcb/libxcb into debian

This commit is contained in:
Josh Triplett 2006-11-24 00:47:19 -08:00
commit da5148ca5e
23 changed files with 1876 additions and 220 deletions

View File

@ -1,4 +1,4 @@
SUBDIRS=src tests
SUBDIRS=src tests doc
pkgconfigdir = $(libdir)/pkgconfig
@ -20,6 +20,7 @@ xcb-sync.pc \
xcb-xevie.pc \
xcb-xf86dri.pc \
xcb-xfixes.pc \
xcb-xinerama.pc \
xcb-xprint.pc \
xcb-xtest.pc \
xcb-xv.pc \
@ -41,6 +42,7 @@ xcb-shape.pc.in \
xcb-shm.pc.in \
xcb-sync.pc.in \
xcb-xevie.pc.in \
xcb-xinerama.pc.in \
xcb-xf86dri.pc.in \
xcb-xfixes.pc.in \
xcb-xprint.pc.in \

88
NEWS
View File

@ -1,3 +1,91 @@
Release 1.0 (2006-11-23)
========================
The "Thanksgiving" release: We feel thankful to have it released. Five years
have passed since XCB's initial commit on September 3rd, 2001:
<http://gitweb.freedesktop.org/?p=xcb.git;a=commit;h=09e54c4a3c>
* Support IPv6. XCB now supports displays with IPv6 addresses, with or without
enclosing square brackets, or with hosts which resolve to IPv6 addresses, by
using getaddrinfo instead of gethostbyname, and by including support for
authentication for such connections. This allows such displays as "::1:1.1".
* XCB now uses the libpthread-stubs, to properly support optional use of
pthreads even on platforms which do not have all the necessary pthread stubs
in libc or otherwise available by default.
* Switch from the old AM_PATH_CHECK macro to pkg-config. check 0.9.4 is now
required to build XCB's unit tests. The version that we were requiring was
not actually new enough to let our unit tests compile, and the AM_PATH_CHECK
macro is now considered deprecated. We know that versions of check using
pkg-config are new enough to work, and the check dependency was optional
anyway, so we've dropped support for older versions.
* Provide a xcb_prefetch_maximum_request_length counterpart to
xcb_get_maximum_request_length.
* Fix Bug #5958: zero out padding bytes in requests.
* Change xcb_connect to pass the display number to _xcb_get_auth_info, which
passes it to get_authptr. This allows get_authptr to stop hacking the
display number out of the sockaddrs of various address families, such as
port - X_TCP_PORT, or the number after the last X in the UNIX socket path.
* Remove --with-opt and --with-debug options from configure.ac; configure
supports the use of custom CFLAGS, so please use that instead.
* Reove support for the <localfield> tag in protocol descriptions, since they
no longer use it, and since new protocol descriptions should not need it
either.
* xcb-proto has no libraries or headers, so don't use XCBPROTO_CFLAGS or
XCBPROTO_LIBS.
* XCB builds which use xdmcp now include it in Requires.private, to support
static linking.
* Replace "long" with uint32_t when used for a 32-bit quantity
* Various enhancements to the generation of documentation with Doxygen:
* Check for doxygen in configure.ac
* Fix some Doxygen warnings.
* Install documentation.
* Handle out-of-tree builds, with srcdir != builddir. xcb.doxygen now gets
generated from xcb.doxygen.in, so that it can use top_builddir and
top_srcdir to find source and to output documentation.
* Fill in PROJECT_NUMBER from @VERSION@, now that we have it readily
available via autoconf.
Release 1.0 RC3 (2006-11-02)
============================
Note: Version 0.9.4 of the test suite tool "check" provides a broken
version of the AM_PATH_CHECK macro, which causes autoconf to fail due to
insufficient quoting on the macro names it prints in its deprecation
message. We have written a patch to fix this problem, available at:
<http://bugs.debian.org/cgi-bin/bugreport.cgi/check-m4-am-path-check-use-quadrigraphs-in-macro-names-to-unbreak-autoconf.patch?bug=395466;msg=20;att=1>
Version 0.9.4-2 of the Debian package for check includes this patch.
Users of other distributions who want to re-autotool libxcb will need to
apply this patch, use an older version of check, or wait for a fixed
upstream version. This bug does not affect users who use the distributed
tarballs and do not re-autotool.
* Add library support for xcb-xinerama, using new protocol description
from xcb-proto.
* In the generated protocol code, define and use constants for opcode
numbers rather than hard-coding them.
* In the API conversion script, match only XCB-namespaced XID generators
when converting to xcb_generate_id.
* Quit treating xproto specially in Makefile.am: handle it like all the
extensions.
* Generate Doxygen documentation comments in the protocol stubs, and
provide a Doxygen config file for building HTML documentation for XCB.
* Add note to xcbxlib.h that nothing except Xlib/XCB should use it.
* Extend test suite to test xcb_parse_display with NULL argument and
display in $DISPLAY.
Release 1.0 RC2 (2006-10-07)
============================

5
README
View File

@ -1,9 +1,8 @@
About libxcb
============
libxcb provides an interface to the X Window System protocol, slated to
replace the current Xlib interface. It has several advantages over
Xlib, including:
libxcb provides an interface to the X Window System protocol, which replaces
the current Xlib interface. It has several advantages over Xlib, including:
- size: small library and lower memory footprint
- latency hiding: batch several requests and wait for the replies later
- direct protocol access: one-to-one mapping between interface and protocol

View File

@ -27,3 +27,78 @@ extern void f(int);
AC_MSG_RESULT(no)])
CFLAGS=${save_CFLAGS}
])
dnl Configure script for doxygen
dnl Vincent Torri 2006-05-11
dnl
dnl AM_CHECK_DOXYGEN([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test for the doxygen program, and define BUILD_DOCS and DOXYGEN.
dnl
AC_DEFUN([AM_CHECK_DOXYGEN],
[
DOXYGEN="doxygen"
dnl
dnl Disable the build of the documentation
dnl
AC_ARG_ENABLE(
[build_docs],
AC_HELP_STRING(
[--disable-build-docs],
[Disable the build of the documentation]),
[if test "${disable_build_docs}" = "yes" ; then
enable_build_docs="no"
else
enable_build_docs="yes"
fi],
[enable_build_docs="yes"])
dnl
dnl Get the prefix where doxygen is installed.
dnl
AC_ARG_WITH(
[doxygen],
AC_HELP_STRING(
[--with-doxygen=FILE],
[doxygen program to use (eg /usr/bin/doxygen)]),
dnl
dnl Check the given doxygen program.
dnl
[DOXYGEN=${withval}
AC_CHECK_PROG(
[BUILD_DOCS],
[${DOXYGEN}],
[yes],
[no])
if test $BUILD_DOCS = no; then
echo "WARNING:"
echo "The doxygen program you specified:"
echo "$DOXYGEN"
echo "was not found. Please check the path and make sure "
echo "the program exists and is executable."
AC_MSG_WARN(
[Warning: no doxygen detected. Documentation will not be built])
fi],
[AC_CHECK_PROG(
[BUILD_DOCS],
[${DOXYGEN}],
[yes],
[no])
if test ${BUILD_DOCS} = no; then
echo "WARNING:"
echo "The doxygen program was not found in your execute"
echo "You may have doxygen installed somewhere not covered by your path."
echo ""
echo "If this is the case make sure you have the packages installed, AND"
echo "that the doxygen program is in your execute path (see your"
echo "shell's manual page on setting the \$PATH environment variable), OR"
echo "alternatively, specify the program to use with --with-doxygen."
AC_MSG_WARN(
[Warning: no doxygen detected. Documentation will not be built])
fi])
AC_MSG_CHECKING([whether documentation is built])
AC_MSG_RESULT([${BUILD_DOCS}])
dnl
dnl Substitution
dnl
AC_SUBST([DOXYGEN])
AM_CONDITIONAL(BUILD_DOCS, test "x$BUILD_DOCS" = "xyes")
])
dnl End of acinclude.m4

View File

@ -3,16 +3,12 @@
AC_PREREQ(2.57)
AC_INIT([libxcb],
0.9.92,
1.0,
[xcb@lists.freedesktop.org])
AC_CONFIG_SRCDIR([xcb.pc.in])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
dnl This ifdef has no useful effect prior to automake 1.9, but in 1.9
dnl it allows the user to not have check.m4 installed.
m4_ifdef([AM_PATH_CHECK],[
AM_PATH_CHECK(0.8.2, [HAVE_CHECK=true], [HAVE_CHECK=false])
])
PKG_CHECK_MODULES(CHECK, [check >= 0.9.4], [HAVE_CHECK=true], [HAVE_CHECK=false])
AM_CONDITIONAL(HAVE_CHECK, test x$HAVE_CHECK = xtrue)
AC_CONFIG_HEADERS([src/config.h])
@ -34,13 +30,15 @@ fi
AC_SUBST(HTML_CHECK_RESULT)
# Checks for pkg-config packages
PKG_CHECK_MODULES(XCBPROTO, xcb-proto >= 0.9.92)
PKG_CHECK_MODULES(XAU, xau)
PKG_CHECK_MODULES(XCBPROTO, xcb-proto >= 1.0)
NEEDED="xau pthread-stubs"
PKG_CHECK_MODULES(NEEDED, $NEEDED)
PKG_CHECK_MODULES(XDMCP, xdmcp,
AC_CHECK_LIB(Xdmcp, XdmcpWrap,
[
AC_DEFINE(HASXDMAUTH,1,[Has Wraphelp.c needed for XDM AUTH protocols])
NEEDED="$NEEDED xdmcp"
],
[
XDMCP_CFLAGS=
@ -48,6 +46,8 @@ PKG_CHECK_MODULES(XDMCP, xdmcp,
], [$XDMCP_LIBS]),
[AC_MSG_RESULT(no)])
AC_SUBST(NEEDED)
# Find the xcb-proto protocol descriptions
AC_MSG_CHECKING(XCBPROTO_XCBINCLUDEDIR)
XCBPROTO_XCBINCLUDEDIR=`$PKG_CONFIG --variable=xcbincludedir xcb-proto`
@ -55,56 +55,12 @@ AC_MSG_RESULT($XCBPROTO_XCBINCLUDEDIR)
AC_SUBST(XCBPROTO_XCBINCLUDEDIR)
AC_HEADER_STDC
AC_SEARCH_LIBS(gethostbyname, nsl)
AC_SEARCH_LIBS(getaddrinfo, socket)
AC_SEARCH_LIBS(connect, socket)
xcbincludedir='${includedir}/xcb'
AC_SUBST(xcbincludedir)
AC_ARG_WITH(opt,
AC_HELP_STRING([--with-opt], [compile with reasonable optimizations])
AC_HELP_STRING([--with-opt=FLAGS], [compile with specified FLAGS])
AC_HELP_STRING([--with-opt=small], [compile for smallest code])
AC_HELP_STRING([--without-opt], [compile without optimization (default)]),
[
case "$withval" in
yes)
COPTFLAGS="-O3"
;;
small)
COPTFLAGS="-Os -fomit-frame-pointer -DNDEBUG"
;;
no)
COPTFLAGS=""
;;
*)
COPTFLAGS="$withval"
;;
esac
])
AC_CACHE_CHECK([what compiler optimizations to apply], [COPTFLAGS], [COPTFLAGS=""])
AC_SUBST(COPTFLAGS)
AC_ARG_WITH(debug,
AC_HELP_STRING([--with-debug], [compile with debugging (default)])
AC_HELP_STRING([--with-debug=FLAGS], [compile with specified debugging FLAGS])
AC_HELP_STRING([--without-debug], [compile without debugging]),
[
case "$withval" in
yes)
CDEBUGFLAGS="-g"
;;
no)
CDEBUGFLAGS=""
;;
*)
CDEBUGFLAGS="$withval"
;;
esac
])
AC_CACHE_CHECK([what debugging options to apply], [CDEBUGFLAGS], [CDEBUGFLAGS="-g"])
AC_SUBST(CDEBUGFLAGS)
if test "x$GCC" = xyes ; then
CWARNFLAGS="-Wall -pedantic -Wpointer-arith \
-Wstrict-prototypes -Wmissing-declarations -Wnested-externs"
@ -118,7 +74,16 @@ AC_SUBST(CWARNFLAGS)
GCC_CHECK_VISIBILITY()
AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile])
AC_CONFIG_FILES([xcb.pc xcb-xlib.pc xcb-composite.pc xcb-damage.pc xcb-dpms.pc xcb-glx.pc xcb-randr.pc xcb-record.pc xcb-render.pc xcb-res.pc xcb-screensaver.pc xcb-shape.pc xcb-shm.pc xcb-sync.pc xcb-xevie.pc xcb-xf86dri.pc xcb-xfixes.pc xcb-xprint.pc xcb-xtest.pc xcb-xv.pc xcb-xvmc.pc])
# htmldir is not defined prior to autoconf 2.59c, so on earlier versions
# set an equivalent value.
AC_PREREQ([2.59c], [], [AC_SUBST([htmldir], [m4_ifset([AC_PACKAGE_TARNAME],
['${datadir}/doc/${PACKAGE_TARNAME}'],
['${datadir}/doc/${PACKAGE}'])
])])
AM_CHECK_DOXYGEN()
AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile doc/Makefile])
AC_CONFIG_FILES([xcb.pc xcb-xlib.pc xcb-composite.pc xcb-damage.pc xcb-dpms.pc xcb-glx.pc xcb-randr.pc xcb-record.pc xcb-render.pc xcb-res.pc xcb-screensaver.pc xcb-shape.pc xcb-shm.pc xcb-sync.pc xcb-xevie.pc xcb-xf86dri.pc xcb-xfixes.pc xcb-xinerama.pc xcb-xprint.pc xcb-xtest.pc xcb-xv.pc xcb-xvmc.pc])
AC_CONFIG_FILES([doc/xcb.doxygen])
AC_OUTPUT

2
doc/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
manual
xcb.doxygen

42
doc/Makefile.am Normal file
View File

@ -0,0 +1,42 @@
EXTRA_DIST = \
tutorial/index.html \
tutorial/xcb.css \
xcb.doxygen.in
docdirs = $(srcdir)/tutorial
if BUILD_DOCS
docdirs += manual
# rule to build documentation and copy necessary files
manual:
doxygen xcb.doxygen
# rules to clean
clean-local:
rm -rf manual/
endif
all-local: $(docdirs)
# rule to install the html documentation and tutorial in $(htmldir)
install-data-local:
@if ! test -d "$(DESTDIR)$(htmldir)"; then \
echo "$(mkinstalldirs) '$(DESTDIR)$(htmldir)'"; \
$(mkinstalldirs) '$(DESTDIR)$(htmldir)'; \
fi
@for d in $(docdirs); do \
echo "cp -pR $$d '$(DESTDIR)$(htmldir)/'"; \
cp -pR $$d '$(DESTDIR)$(htmldir)/'; \
done
uninstall-local:
@for d in $(docdirs); do \
d=`basename $$d`; \
echo "test ! -d '$(DESTDIR)$(htmldir)/'$$d || { find '$(DESTDIR)$(htmldir)/'$$d -type d ! -perm -200 -exec chmod u+w '{}' ';' && rm -rf '$(DESTDIR)$(htmldir)/'$$d; }"; \
test ! -d '$(DESTDIR)$(htmldir)/'$$d || { find '$(DESTDIR)$(htmldir)/'$$d -type d ! -perm -200 -exec chmod u+w '{}' ';' && rm -rf '$(DESTDIR)$(htmldir)/'$$d; }; \
done
rmdir "$(DESTDIR)$(htmldir)/" || true

1253
doc/xcb.doxygen.in Normal file

File diff suppressed because it is too large Load Diff

1
src/.gitignore vendored
View File

@ -15,6 +15,7 @@ xc_misc.*
xevie.*
xf86dri.*
xfixes.*
xinerama.*
xprint.*
xtest.*
xv.*

View File

@ -15,12 +15,13 @@ lib_LTLIBRARIES = libxcb.la \
libxcb-xevie.la \
libxcb-xf86dri.la \
libxcb-xfixes.la \
libxcb-xinerama.la \
libxcb-xprint.la \
libxcb-xtest.la \
libxcb-xv.la \
libxcb-xvmc.la
EXTHEADERS = \
EXTHEADERS = xproto.h \
bigreq.h \
composite.h \
damage.h \
@ -38,11 +39,12 @@ EXTHEADERS = \
xevie.h \
xf86dri.h \
xfixes.h \
xinerama.h \
xprint.h \
xtest.h \
xv.h \
xvmc.h
EXTSOURCES = \
EXTSOURCES = xproto.c \
bigreq.c \
composite.c \
damage.c \
@ -60,19 +62,12 @@ EXTSOURCES = \
xevie.c \
xf86dri.c \
xfixes.c \
xinerama.c \
xprint.c \
xtest.c \
xv.c \
xvmc.c
EXTENSIONS = $(EXTSOURCES) $(EXTHEADERS)
ESSENTIAL_EXTENSIONS = \
bigreq.h \
bigreq.c \
xc_misc.h \
xc_misc.c
EXTENSION_XML = \
EXTENSION_XML = xproto.xml \
bigreq.xml \
composite.xml \
damage.xml \
@ -90,24 +85,21 @@ EXTENSION_XML = \
xevie.xml \
xf86dri.xml \
xfixes.xml \
xinerama.xml \
xprint.xml \
xtest.xml \
xvmc.xml \
xv.xml
COREHEADERS = xproto.h
CORESOURCES = xproto.c
COREPROTO = $(CORESOURCES) $(COREHEADERS)
xcbinclude_HEADERS = xcb.h xcbext.h xcbxlib.h $(COREHEADERS) $(EXTHEADERS)
xcbinclude_HEADERS = xcb.h xcbext.h xcbxlib.h $(EXTHEADERS)
noinst_HEADERS = xcbint.h
AM_CFLAGS = $(COPTFLAGS) $(CWARNFLAGS) $(CDEBUGFLAGS) $(XCBPROTO_CFLAGS) $(XAU_CFLAGS) $(XDMCP_CFLAGS)
libxcb_la_LIBADD = $(XCBPROTO_LIBS) $(XAU_LIBS) $(XDMCP_LIBS)
AM_CFLAGS = $(CWARNFLAGS) $(NEEDED_CFLAGS) $(XDMCP_CFLAGS)
libxcb_la_LIBADD = $(NEEDED_LIBS) $(XDMCP_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 \
$(COREPROTO) $(ESSENTIAL_EXTENSIONS) c-client.xsl
xcb_list.c xcb_util.c xcb_auth.c c-client.xsl \
xproto.c bigreq.c xc_misc.c
# Explanation for -version-info:
# -version-info current:revision:age
@ -118,8 +110,8 @@ libxcb_la_SOURCES = \
# and age to 0.
libxcb_la_LDFLAGS = -version-info 1:0:0
BUILT_SOURCES = $(COREPROTO) $(EXTENSIONS)
CLEANFILES = $(COREPROTO) $(EXTENSIONS)
BUILT_SOURCES = $(EXTSOURCES) $(EXTHEADERS)
CLEANFILES = $(EXTSOURCES) $(EXTHEADERS) $(EXTENSION_XML)
XCB_LIBS = libxcb.la
@ -205,6 +197,10 @@ libxcb_xvmc_la_LDFLAGS = -version-info 0:0:0
libxcb_xvmc_la_LIBADD = $(XCB_LIBS)
libxcb_xvmc_la_SOURCES = xvmc.c xvmc.h
libxcb_xinerama_la_LDFLAGS = -version-info 0:0:0
libxcb_xinerama_la_LIBADD = $(XCB_LIBS)
libxcb_xinerama_la_SOURCES = xinerama.c xinerama.h
$(EXTHEADERS) $(EXTSOURCES): c-client.xsl
SUFFIXES = .xml
@ -223,11 +219,5 @@ SUFFIXES = .xml
--stringparam extension-path $(XCBPROTO_XCBINCLUDEDIR)/ \
-o $@ $(srcdir)/c-client.xsl $<
xproto.xml: $(XCBPROTO_XCBINCLUDEDIR)/xproto.xml
$(LN_S) $(XCBPROTO_XCBINCLUDEDIR)/xproto.xml $@
$(EXTENSION_XML):
for i in $(EXTENSION_XML) ; do \
rm -f $$i ; \
$(LN_S) $(XCBPROTO_XCBINCLUDEDIR)/$$i $$i ; \
done
$(LN_S) -f $(XCBPROTO_XCBINCLUDEDIR)/$@ $@

View File

@ -47,6 +47,8 @@ authorization from the authors.
<xsl:variable name="h" select="$mode = 'header'" />
<xsl:variable name="c" select="$mode = 'source'" />
<xsl:variable name="need-string-h" select="//request/pad[@bytes != 1]" />
<!-- String used to indent lines of code. -->
<xsl:variable name="indent-string" select="' '" />
@ -342,7 +344,7 @@ authorization from the authors.
</xsl:attribute>
<field type="xcb_connection_t *" name="c" />
<xsl:apply-templates select="$req/*[not(self::reply)]" mode="param" />
<do-request ref="{xcb:xcb-prefix($req/@name)}_request_t" opcode="{$req/@opcode}"
<do-request ref="{xcb:xcb-prefix($req/@name)}_request_t" opcode="{translate(xcb:xcb-prefix($req/@name), $lcase, $ucase)}"
checked="{$checked}">
<xsl:if test="$req/reply">
<xsl:attribute name="has-reply">true</xsl:attribute>
@ -358,6 +360,7 @@ authorization from the authors.
<field type="unsigned int" name="sequence" />
</struct>
</xsl:if>
<constant type="number" name="{xcb:xcb-prefix($req/@name)}" value="{$req/@opcode}" />
<struct name="{xcb:xcb-prefix(@name)}_request_t">
<field type="uint8_t" name="major_opcode" no-assign="true" />
<xsl:if test="$ext">
@ -587,7 +590,7 @@ authorization from the authors.
</list>
</xsl:template>
<xsl:template match="field|localfield" mode="param">
<xsl:template match="field" mode="param">
<field>
<xsl:attribute name="type">
<xsl:call-template name="canonical-type-name" />
@ -719,7 +722,11 @@ authorization from the authors.
<l><xsl:value-of select="@ref" /> xcb_out;</l>
<l />
<xsl:apply-templates select="$struct//*[(self::field or self::exprfield)
<xsl:if test="not ($ext) and not($struct//*[(self::field or self::exprfield or self::pad)
and not(boolean(@no-assign))])">
<l>xcb_out.pad0 = 0;</l>
</xsl:if>
<xsl:apply-templates select="$struct//*[(self::field or self::exprfield or self::pad)
and not(boolean(@no-assign))]"
mode="assign" />
@ -778,6 +785,14 @@ authorization from the authors.
</l>
</xsl:template>
<xsl:template match="pad" mode="assign">
<xsl:variable name="padnum"><xsl:number /></xsl:variable>
<l><xsl:choose>
<xsl:when test="@bytes = 1">xcb_out.pad<xsl:value-of select="$padnum - 1" /> = 0;</xsl:when>
<xsl:otherwise>memset(xcb_out.pad<xsl:value-of select="$padnum - 1" />, 0, <xsl:value-of select="@bytes" />);</xsl:otherwise>
</xsl:choose></l>
</xsl:template>
<xsl:template match="iterator" mode="pass2">
<struct name="{@ref}_iterator_t">
<field type="{@ref}_t *" name="data" />
@ -978,8 +993,16 @@ authorization from the authors.
* Edit at your peril.
*/
</xsl:text>
<xsl:if test="$h"><xsl:text>
/**
* @defgroup XCB_</xsl:text><xsl:value-of select="$ext" /><xsl:text>_API XCB </xsl:text><xsl:value-of select="$ext" /><xsl:text> API
* @brief </xsl:text><xsl:value-of select="$ext" /><xsl:text> XCB Protocol Implementation.</xsl:text>
<xsl:text>
* @{
**/
</xsl:text>
<xsl:text>
#ifndef </xsl:text><xsl:value-of select="$guard" /><xsl:text>
#define </xsl:text><xsl:value-of select="$guard" /><xsl:text>
</xsl:text>
@ -991,8 +1014,23 @@ authorization from the authors.
<xsl:text>
</xsl:text>
</xsl:if>
<xsl:if test="$h">
<xsl:choose>
<xsl:when test="string($ext)">
<xsl:text>#define XCB_</xsl:text><xsl:value-of select="translate($ext, $lcase, $ucase)"/><xsl:text>_MAJOR_VERSION </xsl:text><xsl:value-of select="/xcb/@major-version" /><xsl:text>
</xsl:text>
<xsl:text>#define XCB_</xsl:text><xsl:value-of select="translate($ext, $lcase, $ucase)"/><xsl:text>_MINOR_VERSION </xsl:text><xsl:value-of select="/xcb/@minor-version" />
<xsl:text>
</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:if>
<xsl:if test="$c"><xsl:text>
<xsl:if test="$c">
<xsl:if test="$need-string-h">
#include &lt;string.h&gt;</xsl:if>
<xsl:text>
#include &lt;assert.h&gt;
#include "xcbext.h"
#include "</xsl:text><xsl:value-of select="$header" /><xsl:text>.h"
@ -1004,6 +1042,10 @@ authorization from the authors.
<xsl:if test="$h">
<xsl:text>
#endif
/**
* @}
*/
</xsl:text>
</xsl:if>
</xsl:template>
@ -1012,6 +1054,8 @@ authorization from the authors.
<xsl:choose>
<xsl:when test="@type = 'number'">
<xsl:if test="$h">
<xsl:text>/** Opcode for </xsl:text><xsl:value-of select="@name"/><xsl:text>. */
</xsl:text>
<xsl:text>#define </xsl:text>
<xsl:value-of select="translate(@name, $lcase, $ucase)" />
<xsl:text> </xsl:text>
@ -1072,6 +1116,10 @@ authorization from the authors.
<xsl:with-param name="items" select="field/@type" />
</xsl:call-template>
</xsl:variable>
<xsl:text>/**
* @brief </xsl:text><xsl:value-of select="@name" /><xsl:text>
**/
</xsl:text>
<xsl:text>typedef </xsl:text>
<xsl:if test="not(@kind)">struct</xsl:if><xsl:value-of select="@kind" />
<xsl:text> </xsl:text>
@ -1083,7 +1131,7 @@ authorization from the authors.
<xsl:apply-templates select=".">
<xsl:with-param name="type-lengths" select="$type-lengths" />
</xsl:apply-templates>
<xsl:text>;
<xsl:text>; /**&lt; </xsl:text><xsl:text> */
</xsl:text>
</xsl:for-each>
<xsl:text>} </xsl:text>
@ -1128,8 +1176,31 @@ authorization from the authors.
<xsl:call-template name="type-lengths">
<xsl:with-param name="items" select="field/@type" />
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="@type" />
</xsl:variable>
<!-- Doxygen for functions in header. -->
/*****************************************************************************
**
** <xsl:value-of select="@type" />
<xsl:text> </xsl:text>
<xsl:value-of select="@name" />
** <xsl:call-template name="list">
<xsl:with-param name="items">
<xsl:for-each select="field">
<item>
<xsl:text>
** @param </xsl:text>
<xsl:apply-templates select=".">
<xsl:with-param name="type-lengths" select="$type-lengths" />
</xsl:apply-templates>
</item>
</xsl:for-each>
</xsl:with-param>
</xsl:call-template>
** @returns <xsl:value-of select="@type" />
**
*****************************************************************************/
<xsl:value-of select="@type" />
<xsl:text>
</xsl:text>
<xsl:value-of select="$decl-open" />
@ -1147,6 +1218,7 @@ authorization from the authors.
<xsl:apply-templates select=".">
<xsl:with-param name="type-lengths" select="$type-lengths" />
</xsl:apply-templates>
<xsl:text> /**&lt; */</xsl:text>
</item>
</xsl:for-each>
</xsl:with-param>

View File

@ -112,7 +112,7 @@ typedef struct {
uint8_t pad0; /**< Padding */
uint16_t sequence; /**< Sequence number */
uint32_t pad[7]; /**< Padding */
uint32_t full_sequence;
uint32_t full_sequence; /**< full sequence */
} xcb_generic_event_t;
/**
@ -125,7 +125,7 @@ typedef struct {
uint8_t error_code; /**< Error code */
uint16_t sequence; /**< Sequence number */
uint32_t pad[7]; /**< Padding */
uint32_t full_sequence;
uint32_t full_sequence; /**< full sequence */
} xcb_generic_error_t;
/**
@ -183,8 +183,7 @@ typedef struct xcb_auth_info_t {
int xcb_flush(xcb_connection_t *c);
/**
* @brief Returns the maximum request length field from the connection
* setup data.
* @brief Returns the maximum request length that this server accepts.
* @param c: The connection to the X server.
* @return The maximum request length field.
*
@ -200,6 +199,25 @@ int xcb_flush(xcb_connection_t *c);
*/
uint32_t xcb_get_maximum_request_length(xcb_connection_t *c);
/**
* @brief Prefetch the maximum request length without blocking.
* @param c: The connection to the X server.
*
* Without blocking, does as much work as possible toward computing
* the maximum request length accepted by the X server.
*
* Invoking this function may cause a call to xcb_big_requests_enable,
* but will not block waiting for the reply.
* xcb_get_maximum_request_length will return the prefetched data
* after possibly blocking while the reply is retrieved.
*
* Note that in order for this function to be fully non-blocking, the
* application must previously have called
* xcb_prefetch_extension_data(c, &xcb_big_requests_id) and the reply
* must have already arrived.
*/
void xcb_prefetch_maximum_request_length(xcb_connection_t *c);
/* xcb_in.c */
@ -217,7 +235,6 @@ xcb_generic_event_t *xcb_wait_for_event(xcb_connection_t *c);
/**
* @brief Returns the next event or error from the server.
* @param c: The connection to the X server.
* @param error: A pointer to an int to be filled in with the I/O
* error status of the operation.
* @return The next event from the server.
*
@ -362,10 +379,10 @@ void xcb_disconnect(xcb_connection_t *c);
/**
* @brief Parses a display string name in the form documented by X(7x).
* @param displayname: The name of the display.
* @param hostp: A pointer to a malloc'd copy of the hostname.
* @param displayp: A pointer to the display number.
* @param screenp: A pointer to the screen number.
* @param name: The name of the display.
* @param host: A pointer to a malloc'd copy of the hostname.
* @param display: A pointer to the display number.
* @param screen: A pointer to the screen number.
* @return 0 on failure, non 0 otherwise.
*
* Parses the display string name @p display_name in the form
@ -395,9 +412,9 @@ xcb_connection_t *xcb_connect(const char *displayname, int *screenp);
/**
* @brief Connects to the X server, using an authorization information.
* @param displayname: The name of the display.
* @param display: The name of the display.
* @param auth: The authorization information.
* @param screenp: A pointer to a preferred screen number.
* @param screen: A pointer to a preferred screen number.
* @return A newly allocated xcb_connection_t structure.
*
* Connects to the X server specified by @p displayname, using the

View File

@ -77,46 +77,48 @@ static int authname_match(enum auth_protos kind, char *name, int namelen)
return 1;
}
static Xauth *get_authptr(struct sockaddr *sockname, unsigned int socknamelen)
#define SIN6_ADDR(s) (&((struct sockaddr_in6 *)s)->sin6_addr)
static Xauth *get_authptr(struct sockaddr *sockname, unsigned int socknamelen,
int display)
{
char *addr = 0;
int addrlen = 0;
unsigned short family;
char hostnamebuf[256]; /* big enough for max hostname */
char dispbuf[40]; /* big enough to hold more than 2^64 base 10 */
char *display;
int authnamelens[N_AUTH_PROTOS];
int i;
family = FamilyLocal; /* 256 */
switch (sockname->sa_family) {
case AF_INET:
/*block*/ {
struct sockaddr_in *si = (struct sockaddr_in *) sockname;
assert(sizeof(*si) == socknamelen);
addr = (char *) &si->sin_addr;
addrlen = 4;
if (ntohl(si->sin_addr.s_addr) != 0x7f000001)
family = XCB_FAMILY_INTERNET;
snprintf(dispbuf, sizeof(dispbuf), "%d", ntohs(si->sin_port) - X_TCP_PORT);
display = dispbuf;
switch(sockname->sa_family)
{
case AF_INET6:
addr = (char *) SIN6_ADDR(sockname);
addrlen = sizeof(*SIN6_ADDR(sockname));
if(!IN6_IS_ADDR_V4MAPPED(SIN6_ADDR(sockname)))
{
if(!IN6_IS_ADDR_LOOPBACK(SIN6_ADDR(sockname)))
family = XCB_FAMILY_INTERNET_6;
break;
}
break;
addr += 12;
/* if v4-mapped, fall through. */
case AF_INET:
if(!addr)
addr = (char *) &((struct sockaddr_in *)sockname)->sin_addr;
addrlen = sizeof(((struct sockaddr_in *)sockname)->sin_addr);
if(*(in_addr_t *) addr != htonl(INADDR_LOOPBACK))
family = XCB_FAMILY_INTERNET;
break;
case AF_UNIX:
/*block*/ {
struct sockaddr_un *su = (struct sockaddr_un *) sockname;
char *sockbuf = (char *) sockname;
assert(sizeof(*su) >= socknamelen);
sockbuf[socknamelen] = 0; /* null-terminate path */
display = strrchr(su->sun_path, 'X');
if (display == 0)
return 0; /* sockname is mangled somehow */
display++;
}
break;
break;
default:
return 0; /* cannot authenticate this family */
}
snprintf(dispbuf, sizeof(dispbuf), "%d", display);
if (family == FamilyLocal) {
if (gethostname(hostnamebuf, sizeof(hostnamebuf)) == -1)
return 0; /* do not know own hostname */
@ -128,7 +130,7 @@ static Xauth *get_authptr(struct sockaddr *sockname, unsigned int socknamelen)
authnamelens[i] = strlen(authnames[i]);
return XauGetBestAuthByAddr (family,
(unsigned short) addrlen, addr,
(unsigned short) strlen(display), display,
(unsigned short) strlen(dispbuf), dispbuf,
N_AUTH_PROTOS, authnames, authnamelens);
}
@ -177,10 +179,30 @@ static int compute_auth(xcb_auth_info_t *info, Xauth *authptr, struct sockaddr *
APPEND(info->data, j, si->sin_port);
}
break;
case AF_INET6:
/*block*/ {
struct sockaddr_in6 *si6 = (struct sockaddr_in6 *) sockname;
if(IN6_IS_ADDR_V4MAPPED(SIN6_ADDR(sockname)))
{
APPEND(info->data, j, si6->sin6_addr.s6_addr[12]);
APPEND(info->data, j, si6->sin6_port);
}
else
{
/* XDM-AUTHORIZATION-1 does not handle IPv6 correctly. Do the
same thing Xlib does: use all zeroes for the 4-byte address
and 2-byte port number. */
uint32_t fakeaddr = 0;
uint16_t fakeport = 0;
APPEND(info->data, j, fakeaddr);
APPEND(info->data, j, fakeport);
}
}
break;
case AF_UNIX:
/*block*/ {
long fakeaddr = htonl(0xffffffff - next_nonce());
short fakeport = htons(getpid());
uint32_t fakeaddr = htonl(0xffffffff - next_nonce());
uint16_t fakeport = htons(getpid());
APPEND(info->data, j, fakeaddr);
APPEND(info->data, j, fakeport);
}
@ -190,9 +212,7 @@ static int compute_auth(xcb_auth_info_t *info, Xauth *authptr, struct sockaddr *
return 0; /* do not know how to build this */
}
{
long now;
time(&now);
now = htonl(now);
uint32_t now = htonl(time(0));
APPEND(info->data, j, now);
}
assert(j <= 192 / 8);
@ -208,7 +228,7 @@ static int compute_auth(xcb_auth_info_t *info, Xauth *authptr, struct sockaddr *
return 0; /* Unknown authorization type */
}
int _xcb_get_auth_info(int fd, xcb_auth_info_t *info)
int _xcb_get_auth_info(int fd, xcb_auth_info_t *info, int display)
{
/* code adapted from Xlib/ConnDis.c, xtrans/Xtranssocket.c,
xtrans/Xtransutils.c */
@ -218,17 +238,10 @@ int _xcb_get_auth_info(int fd, xcb_auth_info_t *info)
Xauth *authptr = 0;
int ret = 1;
/* ensure info has reasonable contents */
/* XXX This should be removed, but Jamey depends on it
somehow but can't remember how. Principle: don't touch
someone else's data if you're borken. */
info->namelen = info->datalen = 0;
info->name = info->data = 0;
if (getpeername(fd, sockname, &socknamelen) == -1)
return 0; /* can only authenticate sockets */
authptr = get_authptr(sockname, socknamelen);
authptr = get_authptr(sockname, socknamelen, display);
if (authptr == 0)
return 0; /* cannot find good auth data */

View File

@ -48,7 +48,7 @@ static const int error_connection = 1;
static int set_fd_flags(const int fd)
{
long flags = fcntl(fd, F_GETFL, 0);
int flags = fcntl(fd, F_GETFL, 0);
if(flags == -1)
return 0;
flags |= O_NONBLOCK;

View File

@ -33,7 +33,7 @@
#include "xcbint.h"
typedef struct lazyreply {
enum { LAZY_NONE = 0, LAZY_COOKIE, LAZY_FORCED } tag;
enum lazy_reply_tag tag;
union {
xcb_query_extension_cookie_t cookie;
xcb_query_extension_reply_t *reply;

View File

@ -57,25 +57,49 @@ static int write_block(xcb_connection_t *c, struct iovec *vector, int count)
/* Public interface */
void xcb_prefetch_maximum_request_length(xcb_connection_t *c)
{
if(c->has_error)
return;
pthread_mutex_lock(&c->out.reqlenlock);
if(c->out.maximum_request_length_tag == LAZY_NONE)
{
const xcb_query_extension_reply_t *ext;
ext = xcb_get_extension_data(c, &xcb_big_requests_id);
if(ext && ext->present)
{
c->out.maximum_request_length_tag = LAZY_COOKIE;
c->out.maximum_request_length.cookie = xcb_big_requests_enable(c);
}
else
{
c->out.maximum_request_length_tag = LAZY_FORCED;
c->out.maximum_request_length.value = c->setup->maximum_request_length;
}
}
pthread_mutex_unlock(&c->out.reqlenlock);
}
uint32_t xcb_get_maximum_request_length(xcb_connection_t *c)
{
if(c->has_error)
return 0;
xcb_prefetch_maximum_request_length(c);
pthread_mutex_lock(&c->out.reqlenlock);
if(!c->out.maximum_request_length)
if(c->out.maximum_request_length_tag == LAZY_COOKIE)
{
const xcb_query_extension_reply_t *ext;
c->out.maximum_request_length = c->setup->maximum_request_length;
ext = xcb_get_extension_data(c, &xcb_big_requests_id);
if(ext && ext->present)
xcb_big_requests_enable_reply_t *r = xcb_big_requests_enable_reply(c, c->out.maximum_request_length.cookie, 0);
c->out.maximum_request_length_tag = LAZY_FORCED;
if(r)
{
xcb_big_requests_enable_reply_t *r = xcb_big_requests_enable_reply(c, xcb_big_requests_enable(c), 0);
c->out.maximum_request_length = r->maximum_request_length;
c->out.maximum_request_length.value = r->maximum_request_length;
free(r);
}
else
c->out.maximum_request_length.value = c->setup->maximum_request_length;
}
pthread_mutex_unlock(&c->out.reqlenlock);
return c->out.maximum_request_length;
return c->out.maximum_request_length.value;
}
unsigned int xcb_send_request(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *req)
@ -237,7 +261,7 @@ int _xcb_out_init(_xcb_out *out)
if(pthread_mutex_init(&out->reqlenlock, 0))
return 0;
out->maximum_request_length = 0;
out->maximum_request_length_tag = LAZY_NONE;
return 1;
}

View File

@ -49,7 +49,7 @@ static const int error_connection = 1;
int xcb_popcount(uint32_t mask)
{
unsigned long y;
uint32_t y;
y = (mask >> 1) & 033333333333;
y = mask - y - ((y >> 1) & 033333333333);
return ((y + (y >> 3)) & 030707070707) % 077;
@ -96,28 +96,28 @@ int xcb_parse_display(const char *name, char **host, int *displayp, int *screenp
return 1;
}
static int _xcb_open_tcp(const char *host, const unsigned short port);
static int _xcb_open_tcp(char *host, const unsigned short port);
static int _xcb_open_unix(const char *file);
#ifdef DNETCONN
static int _xcb_open_decnet(const char *host, const unsigned short port);
#endif
static int _xcb_open(const char *host, const int display)
static int _xcb_open(char *host, const int display)
{
int fd;
if(*host)
{
#ifdef DNETCONN
if (strchr(host, ':'))
/* DECnet displays have two colons, so xcb_parse_display will have left
one at the end. However, an IPv6 address can end with *two* colons,
so only treat this as a DECnet display if host ends with exactly one
colon. */
char *colon = strchr(host, ':');
if(colon && *(colon+1) == '\0')
{
/* DECnet displays have two colons, so the parser will have left
one at the end */
char *dnethost = strdup(host);
dnethost[strlen(dnethost)-1] = '\0';
fd = _xcb_open_decnet(dnethost, display);
free(dnethost);
*colon = '\0';
fd = _xcb_open_decnet(host, display);
}
else
#endif
@ -173,22 +173,40 @@ static int _xcb_open_decnet(const char *host, const unsigned short port)
}
#endif
static int _xcb_open_tcp(const char *host, const unsigned short port)
static int _xcb_open_tcp(char *host, const unsigned short port)
{
int fd;
struct sockaddr_in addr;
struct hostent *hostaddr = gethostbyname(host);
if(!hostaddr)
return -1;
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
memcpy(&addr.sin_addr, hostaddr->h_addr_list[0], sizeof(addr.sin_addr));
int fd = -1;
struct addrinfo hints = { AI_ADDRCONFIG
#ifdef AI_NUMERICSERV
| AI_NUMERICSERV
#endif
, AF_UNSPEC, SOCK_STREAM };
char service[6]; /* "65535" with the trailing '\0' */
struct addrinfo *results, *addr;
char *bracket;
/* Allow IPv6 addresses enclosed in brackets. */
if(host[0] == '[' && (bracket = strrchr(host, ']')) && bracket[1] == '\0')
{
*bracket = '\0';
++host;
hints.ai_flags |= AI_NUMERICHOST;
hints.ai_family = AF_INET6;
}
fd = socket(PF_INET, SOCK_STREAM, 0);
if(fd == -1)
return -1;
if(connect(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1)
snprintf(service, sizeof(service), "%hu", port);
if(getaddrinfo(host, service, &hints, &results))
/* FIXME: use gai_strerror, and fill in error connection */
return -1;
for(addr = results; addr; addr = addr->ai_next)
{
fd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
if(fd >= 0 && connect(fd, addr->ai_addr, addr->ai_addrlen) >= 0)
break;
fd = -1;
}
freeaddrinfo(results);
return fd;
}
@ -220,10 +238,14 @@ xcb_connection_t *xcb_connect(const char *displayname, int *screenp)
if(fd == -1)
return (xcb_connection_t *) &error_connection;
_xcb_get_auth_info(fd, &auth);
c = xcb_connect_to_fd(fd, &auth);
free(auth.name);
free(auth.data);
if(_xcb_get_auth_info(fd, &auth, display))
{
c = xcb_connect_to_fd(fd, &auth);
free(auth.name);
free(auth.data);
}
else
c = xcb_connect_to_fd(fd, 0);
return c;
}

View File

@ -28,6 +28,8 @@
#ifndef __XCBINT_H
#define __XCBINT_H
#include "bigreq.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@ -41,6 +43,13 @@ enum workarounds {
WORKAROUND_GLX_GET_FB_CONFIGS_BUG
};
enum lazy_reply_tag
{
LAZY_NONE = 0,
LAZY_COOKIE,
LAZY_FORCED
};
#define XCB_PAD(i) (-(i) & 3)
#define XCB_SEQUENCE_COMPARE(a,op,b) ((int) ((a) - (b)) op 0)
@ -70,7 +79,11 @@ typedef struct _xcb_out {
unsigned int request_written;
pthread_mutex_t reqlenlock;
uint32_t maximum_request_length;
enum lazy_reply_tag maximum_request_length_tag;
union {
xcb_big_requests_enable_cookie_t cookie;
uint32_t value;
} maximum_request_length;
} _xcb_out;
int _xcb_out_init(_xcb_out *out);
@ -174,7 +187,7 @@ int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vec
/* xcb_auth.c */
int _xcb_get_auth_info(int fd, xcb_auth_info_t *info);
int _xcb_get_auth_info(int fd, xcb_auth_info_t *info, int display);
#ifdef GCC_HAS_VISIBILITY
#pragma GCC visibility pop

View File

@ -25,6 +25,9 @@
* authorization from the authors.
*/
/* This include file declares functions used by Xlib/XCB, but nothing else
* should ever use these functions or link to libxcb-xlib. */
#ifndef __XCBXLIB_H
#define __XCBXLIB_H

View File

@ -6,28 +6,50 @@
/* xcb_parse_display tests {{{ */
typedef enum test_type_t {
TEST_ARGUMENT, TEST_ENVIRONMENT, TEST_END
} test_type_t;
static const char *const test_string[] = { "", "via $DISPLAY " };
static void parse_display_pass(const char *name, const char *host, const int display, const int screen)
{
int success;
char *got_host;
int got_display, got_screen;
const char *argument = 0;
test_type_t test_type;
got_host = (char *) -1;
got_display = got_screen = -42;
mark_point();
success = xcb_parse_display(name, &got_host, &got_display, &got_screen);
fail_unless(success, "unexpected parse failure for '%s'", name);
fail_unless(strcmp(host, got_host) == 0, "parse produced unexpected hostname '%s' for '%s': expected '%s'", got_host, name, host);
fail_unless(display == got_display, "parse produced unexpected display '%d' for '%s': expected '%d'", got_display, name, display);
fail_unless(screen == got_screen, "parse produced unexpected screen '%d' for '%s': expected '%d'", got_screen, name, screen);
for(test_type = TEST_ARGUMENT; test_type != TEST_END; test_type++)
{
if(test_type == TEST_ARGUMENT)
{
argument = name;
putenv("DISPLAY");
}
else if(test_type == TEST_ENVIRONMENT)
{
argument = 0;
setenv("DISPLAY", name, 1);
}
got_host = (char *) -1;
got_display = got_screen = -42;
mark_point();
success = xcb_parse_display(name, &got_host, &got_display, 0);
fail_unless(success, "unexpected screenless parse failure for '%s'", name);
fail_unless(strcmp(host, got_host) == 0, "screenless parse produced unexpected hostname '%s' for '%s': expected '%s'", got_host, name, host);
fail_unless(display == got_display, "screenless parse produced unexpected display '%d' for '%s': expected '%d'", got_display, name, display);
got_host = (char *) -1;
got_display = got_screen = -42;
mark_point();
success = xcb_parse_display(argument, &got_host, &got_display, &got_screen);
fail_unless(success, "unexpected parse failure %sfor '%s'", test_string[test_type], name);
fail_unless(strcmp(host, got_host) == 0, "parse %sproduced unexpected hostname '%s' for '%s': expected '%s'", test_string[test_type], got_host, name, host);
fail_unless(display == got_display, "parse %sproduced unexpected display '%d' for '%s': expected '%d'", test_string[test_type], got_display, name, display);
fail_unless(screen == got_screen, "parse %sproduced unexpected screen '%d' for '%s': expected '%d'", test_string[test_type], got_screen, name, screen);
got_host = (char *) -1;
got_display = got_screen = -42;
mark_point();
success = xcb_parse_display(argument, &got_host, &got_display, 0);
fail_unless(success, "unexpected screenless parse failure %sfor '%s'", test_string[test_type], name);
fail_unless(strcmp(host, got_host) == 0, "screenless parse %sproduced unexpected hostname '%s' for '%s': expected '%s'", test_string[test_type], got_host, name, host);
fail_unless(display == got_display, "screenless parse %sproduced unexpected display '%d' for '%s': expected '%d'", test_string[test_type], got_display, name, display);
}
putenv("DISPLAY");
}
static void parse_display_fail(const char *name)
@ -35,23 +57,40 @@ static void parse_display_fail(const char *name)
int success;
char *got_host;
int got_display, got_screen;
const char *argument = 0;
test_type_t test_type;
got_host = (char *) -1;
got_display = got_screen = -42;
mark_point();
success = xcb_parse_display(name, &got_host, &got_display, &got_screen);
fail_unless(!success, "unexpected parse success for '%s'", name);
fail_unless(got_host == (char *) -1, "host changed on failure for '%s': got %p", got_host);
fail_unless(got_display == -42, "display changed on failure for '%s': got %d", got_display);
fail_unless(got_screen == -42, "screen changed on failure for '%s': got %d", got_screen);
for(test_type = TEST_ARGUMENT; test_type != TEST_END; test_type++)
{
if(test_type == TEST_ARGUMENT)
{
argument = name;
putenv("DISPLAY");
}
else if(test_type == TEST_ENVIRONMENT)
{
argument = 0;
setenv("DISPLAY", name, 1);
}
got_host = (char *) -1;
got_display = got_screen = -42;
mark_point();
success = xcb_parse_display(name, &got_host, &got_display, 0);
fail_unless(!success, "unexpected screenless parse success for '%s'", name);
fail_unless(got_host == (char *) -1, "host changed on failure for '%s': got %p", got_host);
fail_unless(got_display == -42, "display changed on failure for '%s': got %d", got_display);
got_host = (char *) -1;
got_display = got_screen = -42;
mark_point();
success = xcb_parse_display(argument, &got_host, &got_display, &got_screen);
fail_unless(!success, "unexpected parse success %sfor '%s'", test_string[test_type], name);
fail_unless(got_host == (char *) -1, "host changed on parse failure %sfor '%s': got %p", test_string[test_type], name, got_host);
fail_unless(got_display == -42, "display changed on parse failure %sfor '%s': got %d", test_string[test_type], name, got_display);
fail_unless(got_screen == -42, "screen changed on parse failure %sfor '%s': got %d", test_string[test_type], name, got_screen);
got_host = (char *) -1;
got_display = got_screen = -42;
mark_point();
success = xcb_parse_display(argument, &got_host, &got_display, 0);
fail_unless(!success, "unexpected screenless parse success %sfor '%s'", test_string[test_type], name);
fail_unless(got_host == (char *) -1, "host changed on parse failure %sfor '%s': got %p", test_string[test_type], name, got_host);
fail_unless(got_display == -42, "display changed on parse failure %sfor '%s': got %d", test_string[test_type], name, got_display);
}
putenv("DISPLAY");
}
START_TEST(parse_display_unix)
@ -80,10 +119,22 @@ END_TEST
START_TEST(parse_display_ipv6)
{
parse_display_pass(":::0", "::", 0, 0);
parse_display_pass("1:::0", "1::", 0, 0);
parse_display_pass("::1:0", "::1", 0, 0);
parse_display_pass("::1:0.1", "::1", 0, 1);
parse_display_pass("::127.0.0.1:0", "::127.0.0.1", 0, 0);
parse_display_pass("::ffff:127.0.0.1:0", "::ffff:127.0.0.1", 0, 0);
parse_display_pass("2002:83fc:d052::1:0", "2002:83fc:d052::1", 0, 0);
parse_display_pass("2002:83fc:d052::1:0.1", "2002:83fc:d052::1", 0, 1);
parse_display_pass("[::]:0", "[::]", 0, 0);
parse_display_pass("[1::]:0", "[1::]", 0, 0);
parse_display_pass("[::1]:0", "[::1]", 0, 0);
parse_display_pass("[::1]:0.1", "[::1]", 0, 1);
parse_display_pass("[::127.0.0.1]:0", "[::127.0.0.1]", 0, 0);
parse_display_pass("[::ffff:127.0.0.1]:0", "[::ffff:127.0.0.1]", 0, 0);
parse_display_pass("[2002:83fc:d052::1]:0", "[2002:83fc:d052::1]", 0, 0);
parse_display_pass("[2002:83fc:d052::1]:0.1", "[2002:83fc:d052::1]", 0, 1);
}
END_TEST
@ -101,15 +152,28 @@ START_TEST(parse_display_negative)
parse_display_fail("");
parse_display_fail(":");
parse_display_fail("::");
parse_display_fail(":::");
parse_display_fail(":.");
parse_display_fail(":a");
parse_display_fail(":a.");
parse_display_fail(":0.");
parse_display_fail(":.a");
parse_display_fail(":.0");
parse_display_fail(":0.a");
parse_display_fail(":0.0.");
parse_display_fail("127.0.0.1");
parse_display_fail("127.0.0.1:");
parse_display_fail("127.0.0.1::");
parse_display_fail("::127.0.0.1");
parse_display_fail("::127.0.0.1:");
parse_display_fail("::127.0.0.1::");
parse_display_fail("::ffff:127.0.0.1");
parse_display_fail("::ffff:127.0.0.1:");
parse_display_fail("::ffff:127.0.0.1::");
parse_display_fail("localhost");
parse_display_fail("localhost:");
parse_display_fail("localhost::");
}
END_TEST

View File

@ -59,6 +59,7 @@ sub convert($$)
local $_ = shift;
my ($fun) = @_;
return "xcb_generate_id" if /^xcb_[a-z0-9_]+_new$/ or /^XCB[A-Z0-9]+New$/;
return "uint$1_t" if /^CARD(8|16|32)$/;
return "int$1_t" if /^INT(8|16|32)$/;
return "uint8_t" if $_ eq 'BOOL' or $_ eq 'BYTE';
@ -95,4 +96,3 @@ sub convert($$)
s/^(\s*#\s*include\s*<)X11\/XCB\//$1xcb\//;
s/([_A-Za-z][_A-Za-z0-9]*)([ \t]*\()?/convert($1, defined $2) . ($2 or "")/eg;
s/xcb_[a-z0-9_]*_new/xcb_generate_id/g;

11
xcb-xinerama.pc.in Normal file
View File

@ -0,0 +1,11 @@
prefix=/opt/fdo/
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: XCB Xinerama
Description: XCB Xinerama Extension
Version: 0.9.92
Requires: xcb
Libs: -L${libdir} -lxcb-xinerama
Cflags: -I${includedir}

View File

@ -6,7 +6,7 @@ includedir=@includedir@
Name: XCB
Description: X-protocol C Binding
Version: @PACKAGE_VERSION@
Requires.private: xau
Requires.private: @NEEDED@
Libs: -L${libdir} -lxcb
Libs.private: @LIBS@
Cflags: -I${includedir}