Compare commits
No commits in common. "master" and "1.1" have entirely different histories.
|
@ -1,3 +0,0 @@
|
||||||
begin-language: "Autoconf-without-aclocal-m4"
|
|
||||||
args: --cache=build-aux
|
|
||||||
end-language: "Autoconf-without-aclocal-m4"
|
|
|
@ -1,28 +1,30 @@
|
||||||
*.la
|
aclocal.m4
|
||||||
|
autom4te.cache
|
||||||
|
compile
|
||||||
|
depcomp
|
||||||
|
install-sh
|
||||||
|
libtool
|
||||||
|
ltmain.sh
|
||||||
|
missing
|
||||||
|
mkinstalldirs
|
||||||
|
config.guess
|
||||||
|
config.h
|
||||||
|
config.h.in
|
||||||
|
config.log
|
||||||
|
config.status
|
||||||
|
config.sub
|
||||||
|
configure
|
||||||
|
configure.lineno
|
||||||
|
.deps
|
||||||
|
.dirstamp
|
||||||
|
.libs
|
||||||
*.lo
|
*.lo
|
||||||
*.loT
|
*.loT
|
||||||
|
*.la
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
stamp-h1
|
||||||
*.o
|
*.o
|
||||||
*.pc
|
*.pc
|
||||||
*.tar.bz2
|
*.tar.bz2
|
||||||
*.tar.gz
|
*.tar.gz
|
||||||
.deps
|
|
||||||
.dirstamp
|
|
||||||
.libs
|
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
aclocal.m4
|
|
||||||
build-aux
|
|
||||||
config.h*
|
|
||||||
config.log
|
|
||||||
config.status
|
|
||||||
configure
|
|
||||||
configure.lineno
|
|
||||||
libtool
|
|
||||||
m4/l*.m4
|
|
||||||
mkinstalldirs
|
|
||||||
stamp-h1
|
|
||||||
ChangeLog
|
|
||||||
INSTALL
|
|
||||||
check-pc-requires.log
|
|
||||||
check-pc-requires.trs
|
|
||||||
test-suite.log
|
|
||||||
|
|
123
.gitlab-ci.yml
123
.gitlab-ci.yml
|
@ -1,123 +0,0 @@
|
||||||
# vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0 filetype=yaml:
|
|
||||||
#
|
|
||||||
# This CI uses the freedesktop.org ci-templates.
|
|
||||||
# Please see the ci-templates documentation for details:
|
|
||||||
# https://freedesktop.pages.freedesktop.org/ci-templates/
|
|
||||||
|
|
||||||
.templates_sha: &template_sha b791bd48996e3ced9ca13f1c5ee82be8540b8adb # see https://docs.gitlab.com/ee/ci/yaml/#includefile
|
|
||||||
|
|
||||||
|
|
||||||
include:
|
|
||||||
# Arch container builder template
|
|
||||||
- project: 'freedesktop/ci-templates'
|
|
||||||
ref: *template_sha
|
|
||||||
file: '/templates/arch.yml'
|
|
||||||
- project: 'freedesktop/ci-templates'
|
|
||||||
ref: *template_sha
|
|
||||||
file: '/templates/ci-fairy.yml'
|
|
||||||
- template: Security/SAST.gitlab-ci.yml
|
|
||||||
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- prep # prep work like rebuilding the container images if there is a change
|
|
||||||
- install xcbproto
|
|
||||||
- build # for actually building and testing things in a container
|
|
||||||
- test
|
|
||||||
- deploy
|
|
||||||
|
|
||||||
|
|
||||||
variables:
|
|
||||||
FDO_UPSTREAM_REPO: 'xorg/lib/libxcb'
|
|
||||||
# The tag should be updated each time the list of packages is updated.
|
|
||||||
# Changing a tag forces the associated image to be rebuilt.
|
|
||||||
# Note: the tag has no meaning, we use a date format purely for readability
|
|
||||||
FDO_DISTRIBUTION_TAG: '2023-08-21.0'
|
|
||||||
FDO_DISTRIBUTION_PACKAGES: 'git gcc pkgconf autoconf automake libtool make xorg-util-macros python doxygen graphviz check libxslt libxau libxdmcp'
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Verify that commit messages are as expected
|
|
||||||
#
|
|
||||||
check-commits:
|
|
||||||
extends:
|
|
||||||
- .fdo.ci-fairy
|
|
||||||
stage: prep
|
|
||||||
script:
|
|
||||||
- ci-fairy check-commits --junit-xml=results.xml
|
|
||||||
except:
|
|
||||||
- master@xorg/lib/libxcb
|
|
||||||
variables:
|
|
||||||
GIT_DEPTH: 100
|
|
||||||
artifacts:
|
|
||||||
reports:
|
|
||||||
junit: results.xml
|
|
||||||
|
|
||||||
#
|
|
||||||
# Verify that the merge request has the allow-collaboration checkbox ticked
|
|
||||||
#
|
|
||||||
check-merge-request:
|
|
||||||
extends:
|
|
||||||
- .fdo.ci-fairy
|
|
||||||
stage: deploy
|
|
||||||
script:
|
|
||||||
- ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml
|
|
||||||
artifacts:
|
|
||||||
when: on_failure
|
|
||||||
reports:
|
|
||||||
junit: results.xml
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Build a container with the given tag and the packages pre-installed.
|
|
||||||
# This only happens if/when the tag changes, otherwise the existing image is
|
|
||||||
# re-used.
|
|
||||||
#
|
|
||||||
container-prep:
|
|
||||||
extends:
|
|
||||||
- .fdo.container-build@arch
|
|
||||||
stage: prep
|
|
||||||
variables:
|
|
||||||
GIT_STRATEGY: none
|
|
||||||
|
|
||||||
#
|
|
||||||
# Build latest xcbproto from git, instead of relying on the container
|
|
||||||
# to package a new enough version.
|
|
||||||
#
|
|
||||||
xcbproto-build:
|
|
||||||
extends:
|
|
||||||
- .fdo.distribution-image@arch
|
|
||||||
stage: install xcbproto
|
|
||||||
script:
|
|
||||||
- export INSTDIR="$PWD/_inst"
|
|
||||||
- git clone --depth=1 https://gitlab.freedesktop.org/xorg/proto/xcbproto
|
|
||||||
- pushd xcbproto > /dev/null
|
|
||||||
- mkdir _builddir
|
|
||||||
- pushd _builddir > /dev/null
|
|
||||||
- ../autogen.sh --disable-silent-rules --prefix="$INSTDIR"
|
|
||||||
- make -j${FDO_CI_CONCURRENT:-4} install
|
|
||||||
- popd > /dev/null
|
|
||||||
- popd > /dev/null
|
|
||||||
variables:
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- _inst
|
|
||||||
|
|
||||||
#
|
|
||||||
# The default build, runs on the image built above.
|
|
||||||
#
|
|
||||||
build:
|
|
||||||
stage: build
|
|
||||||
extends:
|
|
||||||
- .fdo.distribution-image@arch
|
|
||||||
script:
|
|
||||||
- export INSTDIR="$PWD/_inst"
|
|
||||||
- export PKG_CONFIG_PATH=$(find $INSTDIR/ -name '*.pc' -printf "%h:")
|
|
||||||
- autoreconf -ivf
|
|
||||||
- mkdir _builddir
|
|
||||||
- pushd _builddir > /dev/null
|
|
||||||
- ../configure --disable-silent-rules --enable-devel-docs --with-doxygen
|
|
||||||
- make
|
|
||||||
- make check
|
|
||||||
- make distcheck
|
|
||||||
- popd > /dev/null
|
|
|
@ -0,0 +1,229 @@
|
||||||
|
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
|
||||||
|
Foundation, Inc.
|
||||||
|
|
||||||
|
This file is free documentation; the Free Software Foundation gives
|
||||||
|
unlimited permission to copy, distribute and modify it.
|
||||||
|
|
||||||
|
Basic Installation
|
||||||
|
==================
|
||||||
|
|
||||||
|
These are generic installation instructions.
|
||||||
|
|
||||||
|
The `configure' shell script attempts to guess correct values for
|
||||||
|
various system-dependent variables used during compilation. It uses
|
||||||
|
those values to create a `Makefile' in each directory of the package.
|
||||||
|
It may also create one or more `.h' files containing system-dependent
|
||||||
|
definitions. Finally, it creates a shell script `config.status' that
|
||||||
|
you can run in the future to recreate the current configuration, and a
|
||||||
|
file `config.log' containing compiler output (useful mainly for
|
||||||
|
debugging `configure').
|
||||||
|
|
||||||
|
It can also use an optional file (typically called `config.cache'
|
||||||
|
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
||||||
|
the results of its tests to speed up reconfiguring. (Caching is
|
||||||
|
disabled by default to prevent problems with accidental use of stale
|
||||||
|
cache files.)
|
||||||
|
|
||||||
|
If you need to do unusual things to compile the package, please try
|
||||||
|
to figure out how `configure' could check whether to do them, and mail
|
||||||
|
diffs or instructions to the address given in the `README' so they can
|
||||||
|
be considered for the next release. If you are using the cache, and at
|
||||||
|
some point `config.cache' contains results you don't want to keep, you
|
||||||
|
may remove or edit it.
|
||||||
|
|
||||||
|
The file `configure.ac' (or `configure.in') is used to create
|
||||||
|
`configure' by a program called `autoconf'. You only need
|
||||||
|
`configure.ac' if you want to change it or regenerate `configure' using
|
||||||
|
a newer version of `autoconf'.
|
||||||
|
|
||||||
|
The simplest way to compile this package is:
|
||||||
|
|
||||||
|
1. `cd' to the directory containing the package's source code and type
|
||||||
|
`./configure' to configure the package for your system. If you're
|
||||||
|
using `csh' on an old version of System V, you might need to type
|
||||||
|
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||||
|
`configure' itself.
|
||||||
|
|
||||||
|
Running `configure' takes awhile. While running, it prints some
|
||||||
|
messages telling which features it is checking for.
|
||||||
|
|
||||||
|
2. Type `make' to compile the package.
|
||||||
|
|
||||||
|
3. Optionally, type `make check' to run any self-tests that come with
|
||||||
|
the package.
|
||||||
|
|
||||||
|
4. Type `make install' to install the programs and any data files and
|
||||||
|
documentation.
|
||||||
|
|
||||||
|
5. You can remove the program binaries and object files from the
|
||||||
|
source code directory by typing `make clean'. To also remove the
|
||||||
|
files that `configure' created (so you can compile the package for
|
||||||
|
a different kind of computer), type `make distclean'. There is
|
||||||
|
also a `make maintainer-clean' target, but that is intended mainly
|
||||||
|
for the package's developers. If you use it, you may have to get
|
||||||
|
all sorts of other programs in order to regenerate files that came
|
||||||
|
with the distribution.
|
||||||
|
|
||||||
|
Compilers and Options
|
||||||
|
=====================
|
||||||
|
|
||||||
|
Some systems require unusual options for compilation or linking that
|
||||||
|
the `configure' script does not know about. Run `./configure --help'
|
||||||
|
for details on some of the pertinent environment variables.
|
||||||
|
|
||||||
|
You can give `configure' initial values for configuration parameters
|
||||||
|
by setting variables in the command line or in the environment. Here
|
||||||
|
is an example:
|
||||||
|
|
||||||
|
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
|
||||||
|
|
||||||
|
*Note Defining Variables::, for more details.
|
||||||
|
|
||||||
|
Compiling For Multiple Architectures
|
||||||
|
====================================
|
||||||
|
|
||||||
|
You can compile the package for more than one kind of computer at the
|
||||||
|
same time, by placing the object files for each architecture in their
|
||||||
|
own directory. To do this, you must use a version of `make' that
|
||||||
|
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||||
|
directory where you want the object files and executables to go and run
|
||||||
|
the `configure' script. `configure' automatically checks for the
|
||||||
|
source code in the directory that `configure' is in and in `..'.
|
||||||
|
|
||||||
|
If you have to use a `make' that does not support the `VPATH'
|
||||||
|
variable, you have to compile the package for one architecture at a
|
||||||
|
time in the source code directory. After you have installed the
|
||||||
|
package for one architecture, use `make distclean' before reconfiguring
|
||||||
|
for another architecture.
|
||||||
|
|
||||||
|
Installation Names
|
||||||
|
==================
|
||||||
|
|
||||||
|
By default, `make install' will install the package's files in
|
||||||
|
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||||
|
installation prefix other than `/usr/local' by giving `configure' the
|
||||||
|
option `--prefix=PATH'.
|
||||||
|
|
||||||
|
You can specify separate installation prefixes for
|
||||||
|
architecture-specific files and architecture-independent files. If you
|
||||||
|
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||||
|
PATH as the prefix for installing programs and libraries.
|
||||||
|
Documentation and other data files will still use the regular prefix.
|
||||||
|
|
||||||
|
In addition, if you use an unusual directory layout you can give
|
||||||
|
options like `--bindir=PATH' to specify different values for particular
|
||||||
|
kinds of files. Run `configure --help' for a list of the directories
|
||||||
|
you can set and what kinds of files go in them.
|
||||||
|
|
||||||
|
If the package supports it, you can cause programs to be installed
|
||||||
|
with an extra prefix or suffix on their names by giving `configure' the
|
||||||
|
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||||
|
|
||||||
|
Optional Features
|
||||||
|
=================
|
||||||
|
|
||||||
|
Some packages pay attention to `--enable-FEATURE' options to
|
||||||
|
`configure', where FEATURE indicates an optional part of the package.
|
||||||
|
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||||
|
is something like `gnu-as' or `x' (for the X Window System). The
|
||||||
|
`README' should mention any `--enable-' and `--with-' options that the
|
||||||
|
package recognizes.
|
||||||
|
|
||||||
|
For packages that use the X Window System, `configure' can usually
|
||||||
|
find the X include and library files automatically, but if it doesn't,
|
||||||
|
you can use the `configure' options `--x-includes=DIR' and
|
||||||
|
`--x-libraries=DIR' to specify their locations.
|
||||||
|
|
||||||
|
Specifying the System Type
|
||||||
|
==========================
|
||||||
|
|
||||||
|
There may be some features `configure' cannot figure out
|
||||||
|
automatically, but needs to determine by the type of machine the package
|
||||||
|
will run on. Usually, assuming the package is built to be run on the
|
||||||
|
_same_ architectures, `configure' can figure that out, but if it prints
|
||||||
|
a message saying it cannot guess the machine type, give it the
|
||||||
|
`--build=TYPE' option. TYPE can either be a short name for the system
|
||||||
|
type, such as `sun4', or a canonical name which has the form:
|
||||||
|
|
||||||
|
CPU-COMPANY-SYSTEM
|
||||||
|
|
||||||
|
where SYSTEM can have one of these forms:
|
||||||
|
|
||||||
|
OS KERNEL-OS
|
||||||
|
|
||||||
|
See the file `config.sub' for the possible values of each field. If
|
||||||
|
`config.sub' isn't included in this package, then this package doesn't
|
||||||
|
need to know the machine type.
|
||||||
|
|
||||||
|
If you are _building_ compiler tools for cross-compiling, you should
|
||||||
|
use the `--target=TYPE' option to select the type of system they will
|
||||||
|
produce code for.
|
||||||
|
|
||||||
|
If you want to _use_ a cross compiler, that generates code for a
|
||||||
|
platform different from the build platform, you should specify the
|
||||||
|
"host" platform (i.e., that on which the generated programs will
|
||||||
|
eventually be run) with `--host=TYPE'.
|
||||||
|
|
||||||
|
Sharing Defaults
|
||||||
|
================
|
||||||
|
|
||||||
|
If you want to set default values for `configure' scripts to share,
|
||||||
|
you can create a site shell script called `config.site' that gives
|
||||||
|
default values for variables like `CC', `cache_file', and `prefix'.
|
||||||
|
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||||
|
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||||
|
`CONFIG_SITE' environment variable to the location of the site script.
|
||||||
|
A warning: not all `configure' scripts look for a site script.
|
||||||
|
|
||||||
|
Defining Variables
|
||||||
|
==================
|
||||||
|
|
||||||
|
Variables not defined in a site shell script can be set in the
|
||||||
|
environment passed to `configure'. However, some packages may run
|
||||||
|
configure again during the build, and the customized values of these
|
||||||
|
variables may be lost. In order to avoid this problem, you should set
|
||||||
|
them in the `configure' command line, using `VAR=value'. For example:
|
||||||
|
|
||||||
|
./configure CC=/usr/local2/bin/gcc
|
||||||
|
|
||||||
|
will cause the specified gcc to be used as the C compiler (unless it is
|
||||||
|
overridden in the site shell script).
|
||||||
|
|
||||||
|
`configure' Invocation
|
||||||
|
======================
|
||||||
|
|
||||||
|
`configure' recognizes the following options to control how it
|
||||||
|
operates.
|
||||||
|
|
||||||
|
`--help'
|
||||||
|
`-h'
|
||||||
|
Print a summary of the options to `configure', and exit.
|
||||||
|
|
||||||
|
`--version'
|
||||||
|
`-V'
|
||||||
|
Print the version of Autoconf used to generate the `configure'
|
||||||
|
script, and exit.
|
||||||
|
|
||||||
|
`--cache-file=FILE'
|
||||||
|
Enable the cache: use and save the results of the tests in FILE,
|
||||||
|
traditionally `config.cache'. FILE defaults to `/dev/null' to
|
||||||
|
disable caching.
|
||||||
|
|
||||||
|
`--config-cache'
|
||||||
|
`-C'
|
||||||
|
Alias for `--cache-file=config.cache'.
|
||||||
|
|
||||||
|
`--quiet'
|
||||||
|
`--silent'
|
||||||
|
`-q'
|
||||||
|
Do not print messages saying which checks are being made. To
|
||||||
|
suppress all normal output, redirect it to `/dev/null' (any error
|
||||||
|
messages will still be shown).
|
||||||
|
|
||||||
|
`--srcdir=DIR'
|
||||||
|
Look for the package's source code in directory DIR. Usually
|
||||||
|
`configure' can determine that directory automatically.
|
||||||
|
|
||||||
|
`configure' also accepts some other, not widely useful, options. Run
|
||||||
|
`configure --help' for more details.
|
||||||
|
|
157
Makefile.am
157
Makefile.am
|
@ -1,118 +1,55 @@
|
||||||
ACLOCAL_AMFLAGS=-I m4
|
SUBDIRS=src tests doc
|
||||||
|
|
||||||
SUBDIRS=src tests doc man
|
|
||||||
|
|
||||||
pkgconfigdir = $(libdir)/pkgconfig
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
|
|
||||||
pkgconfig_DATA = xcb.pc
|
pkgconfig_DATA = \
|
||||||
|
xcb.pc \
|
||||||
if BUILD_COMPOSITE
|
xcb-xlib.pc \
|
||||||
pkgconfig_DATA += xcb-composite.pc
|
xcb-composite.pc \
|
||||||
endif
|
xcb-damage.pc \
|
||||||
if BUILD_DAMAGE
|
xcb-dpms.pc \
|
||||||
pkgconfig_DATA += xcb-damage.pc
|
xcb-glx.pc \
|
||||||
endif
|
xcb-randr.pc \
|
||||||
if BUILD_DBE
|
xcb-record.pc \
|
||||||
pkgconfig_DATA += xcb-dbe.pc
|
xcb-render.pc \
|
||||||
endif
|
xcb-res.pc \
|
||||||
if BUILD_DPMS
|
xcb-screensaver.pc \
|
||||||
pkgconfig_DATA += xcb-dpms.pc
|
xcb-shape.pc \
|
||||||
endif
|
xcb-shm.pc \
|
||||||
if BUILD_DRI2
|
xcb-sync.pc \
|
||||||
pkgconfig_DATA += xcb-dri2.pc
|
xcb-xevie.pc \
|
||||||
endif
|
xcb-xf86dri.pc \
|
||||||
if BUILD_DRI3
|
xcb-xfixes.pc \
|
||||||
pkgconfig_DATA += xcb-dri3.pc
|
xcb-xinerama.pc \
|
||||||
endif
|
xcb-xprint.pc \
|
||||||
if BUILD_GLX
|
xcb-xtest.pc \
|
||||||
pkgconfig_DATA += xcb-glx.pc
|
xcb-xv.pc \
|
||||||
endif
|
xcb-xvmc.pc
|
||||||
if BUILD_PRESENT
|
|
||||||
pkgconfig_DATA += xcb-present.pc
|
|
||||||
endif
|
|
||||||
if BUILD_RANDR
|
|
||||||
pkgconfig_DATA += xcb-randr.pc
|
|
||||||
endif
|
|
||||||
if BUILD_RECORD
|
|
||||||
pkgconfig_DATA += xcb-record.pc
|
|
||||||
endif
|
|
||||||
if BUILD_RENDER
|
|
||||||
pkgconfig_DATA += xcb-render.pc
|
|
||||||
endif
|
|
||||||
if BUILD_RESOURCE
|
|
||||||
pkgconfig_DATA += xcb-res.pc
|
|
||||||
endif
|
|
||||||
if BUILD_SCREENSAVER
|
|
||||||
pkgconfig_DATA += xcb-screensaver.pc
|
|
||||||
endif
|
|
||||||
if BUILD_SHAPE
|
|
||||||
pkgconfig_DATA += xcb-shape.pc
|
|
||||||
endif
|
|
||||||
if BUILD_SHM
|
|
||||||
pkgconfig_DATA += xcb-shm.pc
|
|
||||||
endif
|
|
||||||
if BUILD_SYNC
|
|
||||||
pkgconfig_DATA += xcb-sync.pc
|
|
||||||
endif
|
|
||||||
if BUILD_XEVIE
|
|
||||||
pkgconfig_DATA += xcb-xevie.pc
|
|
||||||
endif
|
|
||||||
if BUILD_XFREE86_DRI
|
|
||||||
pkgconfig_DATA += xcb-xf86dri.pc
|
|
||||||
endif
|
|
||||||
if BUILD_XFIXES
|
|
||||||
pkgconfig_DATA += xcb-xfixes.pc
|
|
||||||
endif
|
|
||||||
if BUILD_XINERAMA
|
|
||||||
pkgconfig_DATA += xcb-xinerama.pc
|
|
||||||
endif
|
|
||||||
if BUILD_XINPUT
|
|
||||||
pkgconfig_DATA += xcb-xinput.pc
|
|
||||||
endif
|
|
||||||
if BUILD_XKB
|
|
||||||
pkgconfig_DATA += xcb-xkb.pc
|
|
||||||
endif
|
|
||||||
if BUILD_XPRINT
|
|
||||||
pkgconfig_DATA += xcb-xprint.pc
|
|
||||||
endif
|
|
||||||
if BUILD_SELINUX
|
|
||||||
pkgconfig_DATA += xcb-xselinux.pc
|
|
||||||
endif
|
|
||||||
if BUILD_XTEST
|
|
||||||
pkgconfig_DATA += xcb-xtest.pc
|
|
||||||
endif
|
|
||||||
if BUILD_XV
|
|
||||||
pkgconfig_DATA += xcb-xv.pc
|
|
||||||
endif
|
|
||||||
if BUILD_XVMC
|
|
||||||
pkgconfig_DATA += xcb-xvmc.pc
|
|
||||||
endif
|
|
||||||
if BUILD_GE
|
|
||||||
pkgconfig_DATA += xcb-ge.pc
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
AM_TESTS_ENVIRONMENT = \
|
|
||||||
AM_SRCDIR=${srcdir}
|
|
||||||
|
|
||||||
TESTS=check-pc-requires
|
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
|
xcb.pc.in \
|
||||||
|
xcb-xlib.pc.in \
|
||||||
|
xcb-composite.pc.in \
|
||||||
|
xcb-damage.pc.in \
|
||||||
|
xcb-dpms.pc.in \
|
||||||
|
xcb-glx.pc.in \
|
||||||
|
xcb-randr.pc.in \
|
||||||
|
xcb-record.pc.in \
|
||||||
|
xcb-render.pc.in \
|
||||||
|
xcb-res.pc.in \
|
||||||
|
xcb-screensaver.pc.in \
|
||||||
|
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 \
|
||||||
|
xcb-xtest.pc.in \
|
||||||
|
xcb-xv.pc.in \
|
||||||
|
xcb-xvmc.pc.in \
|
||||||
tools/README \
|
tools/README \
|
||||||
tools/api_conv.pl \
|
tools/api_conv.pl \
|
||||||
tools/constants \
|
tools/constants \
|
||||||
autogen.sh \
|
autogen.sh
|
||||||
README.md \
|
|
||||||
$(TESTS)
|
|
||||||
|
|
||||||
MAINTAINERCLEANFILES = ChangeLog INSTALL
|
|
||||||
|
|
||||||
.PHONY: ChangeLog INSTALL
|
|
||||||
|
|
||||||
INSTALL:
|
|
||||||
$(INSTALL_CMD)
|
|
||||||
|
|
||||||
ChangeLog:
|
|
||||||
$(CHANGELOG_CMD)
|
|
||||||
|
|
||||||
dist-hook: ChangeLog INSTALL
|
|
||||||
|
|
244
NEWS
244
NEWS
|
@ -1,247 +1,3 @@
|
||||||
Release 1.14 (2020-02-22)
|
|
||||||
=========================
|
|
||||||
* Add xcb_total_read() and xcb_total_written() API
|
|
||||||
* Support check >= 0.13 API (for make check)
|
|
||||||
* Bug fix to handle EINTR from recvmsg
|
|
||||||
* Only require pthread-stubs on non-Linux platforms
|
|
||||||
|
|
||||||
Release 1.13.1 (2018-09-27)
|
|
||||||
===========================
|
|
||||||
* Don't flag extra reply in xcb_take_socket
|
|
||||||
|
|
||||||
Release 1.13 (2018-02-28)
|
|
||||||
=========================
|
|
||||||
* Add support for variable-sized lists of FDs
|
|
||||||
* Poll for events when blocking waiting for special events
|
|
||||||
* xinput: Enable XInput extension by default
|
|
||||||
* ge: Add explicit support for GenericEvent extension
|
|
||||||
* Fix documentation warnings from clang
|
|
||||||
* Cosmetic cleanups
|
|
||||||
|
|
||||||
Release 1.12 (2016-05-18)
|
|
||||||
=========================
|
|
||||||
* configure: Various fixes for dri3 and FD passing support
|
|
||||||
* configure: Don't report all the warning CFLAGS
|
|
||||||
* configure: Disable Xevie and Xprint by default
|
|
||||||
* Add support for various new constructs in the XML schema
|
|
||||||
* Make some functions also accept connections in an error state
|
|
||||||
* Never return NULL from xcb_get_setup()
|
|
||||||
* Use Requires.private in .pc files to avoid overlinking
|
|
||||||
* Fix align-pads for switches which start at unaligned positions
|
|
||||||
* Use anonymous structs for some nested structs
|
|
||||||
* Also generate accessors for variable-sized events and requests
|
|
||||||
* Improved python3 compatibility
|
|
||||||
* Generate C99 initializers instead of comments
|
|
||||||
* Various simplifications to the python code
|
|
||||||
* Fix line breaks in xcb-requests manual page
|
|
||||||
* Always close FDs in xcb_send_fd()
|
|
||||||
* Fix thread-safety issues with FD passing
|
|
||||||
* Add xcb_send_request_with_fds() and xcb_send_request_with_fds64()
|
|
||||||
* Fix endless loop with too many outstanding FDs to send
|
|
||||||
* Link with winsock library on MinGW
|
|
||||||
* Disable some unfinished API for some server-side code by default
|
|
||||||
* Use align-offsets computed by xcb-proto instead of low bits of pointers
|
|
||||||
* Fix iterator interaction with align padding
|
|
||||||
* Stop serializing padding by default
|
|
||||||
* Increase unix socket send buffer to at least 64KiB
|
|
||||||
|
|
||||||
Release 1.11.1 (2015-09-06)
|
|
||||||
===========================
|
|
||||||
* Expose 64-bit sequence numbers for XLib
|
|
||||||
* Fix some hangs related to xcb_wait_for_special_event()
|
|
||||||
|
|
||||||
Release 1.11 (2014-08-01)
|
|
||||||
=========================
|
|
||||||
* Force structures with 64-bit fields to be packed
|
|
||||||
* Add support for <pad align="n">
|
|
||||||
* Use X.org's build machinery from xorg-macros
|
|
||||||
* Fix leak with xcb_disconnect() and connections in an error state
|
|
||||||
* Make xcb_disconnect(NULL) safe
|
|
||||||
* Use less #include statements in generated code
|
|
||||||
* Automatically validate the Requires lines in our .pc.in files
|
|
||||||
* Fix a race that resulted in a failed assertion
|
|
||||||
* Improve launchd secure socket support
|
|
||||||
* Improve API documentation
|
|
||||||
* Remove trailing whitespaces
|
|
||||||
* c_client.py: prefix all monkey-patched fields with c_
|
|
||||||
* c_client.py: make the man page output deterministic
|
|
||||||
* c_client.py: remove useless generated comments
|
|
||||||
* xcb.h: add 'struct' before xcb_setup_t, xcb_query_extension_reply_t
|
|
||||||
|
|
||||||
Release 1.10 (2013-12-22)
|
|
||||||
=========================
|
|
||||||
* Bump libxcb-xkb SONAME due to ABI break introduced in 1.9.2
|
|
||||||
* Enable libxcb-xkb by default
|
|
||||||
* Bump libxcb-sync SONAME
|
|
||||||
* c_client.py: Fix _sizeof() functions
|
|
||||||
* c_client.py: Do not create pointers in unions
|
|
||||||
* c_client.py: Always initialize xcb_align_to
|
|
||||||
* Re-introduce xcb_ge_event_t (deprecated, xcb_ge_generic_event_t should be
|
|
||||||
used instead)
|
|
||||||
* Fix alignment issues in FD passing code
|
|
||||||
* Fix poll() if POLLIN == ROLLRDNORM|POLLRDBAND
|
|
||||||
* Use /usr/spool/sockets/X11/ on HP-UX for UNIX sockets
|
|
||||||
* Make xsltproc optional
|
|
||||||
|
|
||||||
Release 1.9.3 (2013-11-07)
|
|
||||||
==========================
|
|
||||||
* Check if we need to define _XOPEN_SOURCE for struct msghdr.msg_control
|
|
||||||
* Add configure option to enable or disable fd passing with sendmsg
|
|
||||||
* Switch to using the CMSG_* macros for FD passing
|
|
||||||
* Initialize automake earlier (bugfix for #66413)
|
|
||||||
|
|
||||||
Release 1.9.2 (2013-11-07)
|
|
||||||
==========================
|
|
||||||
* Add Present extension
|
|
||||||
* Add DRI3 library
|
|
||||||
* Add event queue splitting
|
|
||||||
* Add support for receiving fds in replies
|
|
||||||
* Add xcb_send_fd API
|
|
||||||
* Remove xcb_ge_event_t from xcb.h
|
|
||||||
* c_client.py: Inject full_sequence into GE events
|
|
||||||
* c_client.py: Handle multiple expr. in a bitcase
|
|
||||||
|
|
||||||
Release 1.9.1 (2013-05-30)
|
|
||||||
==========================
|
|
||||||
* Fix python code to work with python-3
|
|
||||||
* Security fix for integer overflow in read_packet() [CVE-2013-2064]
|
|
||||||
|
|
||||||
Release 1.9 (2012-10-05)
|
|
||||||
========================
|
|
||||||
* Always include "config.h" at the start of all C source files.
|
|
||||||
* Add AC_USE_SYSTEM_EXTENSIONS to allow use of more system functionality
|
|
||||||
* Return connection failure if display string specifies non-existent screen
|
|
||||||
* c_client: Fix parallel-make issue creating 'man' directory
|
|
||||||
* xcb_connect: launchd: Don't fall back on tcp if $DISPLAY is a path to a launchd socket
|
|
||||||
* c_client.py: generate manpages
|
|
||||||
* Allow xcb_send_request with >MAX_IOV iovecs
|
|
||||||
* Add a .gitignore for src/man/
|
|
||||||
* Fix a multi-thread deadlock
|
|
||||||
|
|
||||||
Release 1.8.1 (2012-03-09)
|
|
||||||
==========================
|
|
||||||
- Fix a busy loop on BSD and Mac OS
|
|
||||||
- Bump xcb-proto requirement
|
|
||||||
- Fallback to TCP if no protocol is specified and the UNIX connection fails
|
|
||||||
- Update use of error_connection under WIN32 to _xcb_conn_ret_error()
|
|
||||||
- Fix build of xcb_auth.c with XDMCP on WIN32
|
|
||||||
- Revert "Fix include order with Xdmcp on WIN32"
|
|
||||||
- darwin: Use read(2) rather than recv(2)
|
|
||||||
- Add xkb_internals and xkb_issues to EXTRA_DIST.
|
|
||||||
|
|
||||||
Release 1.8 (2012-01-11)
|
|
||||||
========================
|
|
||||||
- xcb_disconnect: call shutdown() to force a disconnect
|
|
||||||
- Use special path to sockets when running under Solaris Trusted Extensions
|
|
||||||
- Remove unused DECnet code
|
|
||||||
- Add #include <sys/socket.h> to xcb_conn.c
|
|
||||||
- Make launchd code in xcb_util.c match surrounding code indent levels
|
|
||||||
- If protocol is "unix", use a Unix domain socket, not TCP
|
|
||||||
- Added more error states and removed global error_connection
|
|
||||||
- Handle XGE events with the "send event" flag
|
|
||||||
- added xcb_sumof() with restriction to uint8_t
|
|
||||||
- xkb: updated configure.ac/Makefile.am
|
|
||||||
- xkb: added pkg config file
|
|
||||||
- special case 'intermixed variable and fixed size fields': fixed reply side, needs testing
|
|
||||||
- added accessors for special cases
|
|
||||||
- Add support for building with Python 3
|
|
||||||
- Insert, not append explicit xcbgen dir python path
|
|
||||||
- xcb_request_check: Sync even if an event was read for this sequence.
|
|
||||||
- _xcb_conn_wait: Shut down the connection on unexpected poll() events.
|
|
||||||
- xcb_send_request: Send all requests using a common internal send_request.
|
|
||||||
- xcb_request_check: Hold the I/O lock while deciding to sync.
|
|
||||||
- xcb_discard_reply: Simplify by re-using poll_for_reply helper.
|
|
||||||
- xcb_in: Use 64-bit sequence numbers internally everywhere.
|
|
||||||
- Enable AM_SILENT_RULES on automake 1.11 or newer.
|
|
||||||
- Factor reader_list management out of wait_for_reply.
|
|
||||||
- Dequeue readers that can't receive any new responses.
|
|
||||||
- Delete the old c-client.xsl.
|
|
||||||
- Keep ALIGNOF definition out of the public namespace.
|
|
||||||
- darwin: Don't use poll() when expected to run on darwin10 and prior
|
|
||||||
- Add Win32
|
|
||||||
- Allow disconnecting connections that are in error state.
|
|
||||||
- Make xcb_take_socket keep flushing until idle
|
|
||||||
- Support pre-IPv6 systems (without getaddrinfo)
|
|
||||||
- Drop AI_ADDRCONFIG when resolving TCP addresses
|
|
||||||
- xcb_auth: Fix memory leak in _xcb_get_auth_info.
|
|
||||||
- Don't emit out-of-module sizeof definitions
|
|
||||||
- Clean up a couple of warnings in xprint
|
|
||||||
- Prevent reply waiters from being blocked.
|
|
||||||
- Prevent theoretical double free and leak on get_peer_sock_name.
|
|
||||||
- Introduce a variant of xcb_poll_for_event for examining event queue.
|
|
||||||
- xcb_take_socket: Document sequence wrap requirements
|
|
||||||
- Compute alignment correctly
|
|
||||||
- Fix a dead-lock due to xcb_poll_for_reply
|
|
||||||
|
|
||||||
Release 1.7 (2010-08-13)
|
|
||||||
========================
|
|
||||||
- Always wake up readers after writing
|
|
||||||
- Get rid of PATH_MAX and MAXPATHLEN
|
|
||||||
- Add ~ operator support in code generator
|
|
||||||
- xcb_open: Improve protocol/host parsing
|
|
||||||
- xcb_connect_to_display_with_auth_info: Fix memory leak
|
|
||||||
- Report which extensions are being built
|
|
||||||
|
|
||||||
Release 1.6 (2010-04-09)
|
|
||||||
========================
|
|
||||||
- darwin: xnu doesn't support poll on ttys on the master side
|
|
||||||
- Fix descriptor leak on memory error path
|
|
||||||
- Support xcb_discard_reply
|
|
||||||
- Open the X11 socket with close-on-exec flag
|
|
||||||
- Fix authentication on hpux and Hurd
|
|
||||||
|
|
||||||
Release 1.5 (2009-12-03)
|
|
||||||
========================
|
|
||||||
- setsockopt(SO_KEEPALIVE) on TCP display connections
|
|
||||||
- Add DRI2 support
|
|
||||||
- Fix check dependency
|
|
||||||
- Cygwin build fix: Add -no-undefined to libtool flags
|
|
||||||
|
|
||||||
Release 1.4 (2009-07-15)
|
|
||||||
========================
|
|
||||||
* Add majorCode, minorCode and resourceID fields to X generic error
|
|
||||||
* Fix precedence bug: wrong length for big-requests preceded by sync
|
|
||||||
* Fix libxcb-randr version info
|
|
||||||
|
|
||||||
Release 1.3 (2009-05-29)
|
|
||||||
========================
|
|
||||||
* Copy full IPv4 mapping (Bug #20665)
|
|
||||||
* Fix XID allocation
|
|
||||||
* Use poll() instead of select() when available
|
|
||||||
* Fix local socket connection on Hurd
|
|
||||||
* Fix XDM-AUTHORIZATION-1
|
|
||||||
* Disable Nagle on TCP socket
|
|
||||||
|
|
||||||
Release 1.2 (2009-02-17)
|
|
||||||
========================
|
|
||||||
* Stop packaging auto-generated C files into tarball.
|
|
||||||
|
|
||||||
Release 1.1.93 (2008-12-11)
|
|
||||||
===========================
|
|
||||||
Enhancements:
|
|
||||||
* Apple: Enable support for launchd DISPLAY socket
|
|
||||||
* Treat XIDs the same as other cardinal values.
|
|
||||||
|
|
||||||
Release 1.1.92 (2008-11-01)
|
|
||||||
===========================
|
|
||||||
Enhancements:
|
|
||||||
* Added small fix to support trailing fixed fields; also warning for non-pad fixed fields
|
|
||||||
* Fixed overly aggressive warning about fixed field following variable
|
|
||||||
* Added generation of extern "C" for compatibility with C++
|
|
||||||
* Remove libxcb-xlib and xcbxlib.h.
|
|
||||||
* Inline _xcb_lock_io, _xcb_unlock_io, and _xcb_wait_io.
|
|
||||||
* Track 64-bit sequence numbers internally.
|
|
||||||
* Use sequence number ranges in pending replies
|
|
||||||
* Remove duplicate XCB_EXTENSION calls for Composite extension
|
|
||||||
* Factorize m4 macros and add one to set X extensions
|
|
||||||
* Allow compile-time setting for XCB queue buffer size
|
|
||||||
* Support handing off socket write permission to external code.
|
|
||||||
* Add support for the abstract socket namespace under Linux
|
|
||||||
|
|
||||||
Bug fixes:
|
|
||||||
* Fix tiny memory leak in read_packet
|
|
||||||
* Fix some fd leaks in _xcb_open_*()
|
|
||||||
|
|
||||||
Release 1.1 (2007-11-04)
|
Release 1.1 (2007-11-04)
|
||||||
========================
|
========================
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ About libxcb
|
||||||
============
|
============
|
||||||
|
|
||||||
libxcb provides an interface to the X Window System protocol, which
|
libxcb provides an interface to the X Window System protocol, which
|
||||||
replaces the traditional Xlib interface. It has several advantages over
|
replaces the current Xlib interface. It has several advantages over
|
||||||
Xlib, including:
|
Xlib, including:
|
||||||
- size: small, simple library, and lower memory footprint
|
- size: small, simple library, and lower memory footprint
|
||||||
- latency hiding: batch several requests and wait for the replies later
|
- latency hiding: batch several requests and wait for the replies later
|
||||||
|
@ -10,32 +10,27 @@ Xlib, including:
|
||||||
- proven thread support: transparently access XCB from multiple threads
|
- proven thread support: transparently access XCB from multiple threads
|
||||||
- easy extension implementation: interfaces auto-generated from XML-XCB
|
- easy extension implementation: interfaces auto-generated from XML-XCB
|
||||||
|
|
||||||
Xlib also uses XCB as a transport layer, allowing software to make
|
Xlib can also use XCB as a transport layer, allowing software to make
|
||||||
requests and receive responses with both, which eases porting to XCB.
|
requests and receive responses with both, which eases porting to XCB.
|
||||||
However, client programs, libraries, and toolkits will gain the most
|
However, client programs, libraries, and toolkits will gain the most
|
||||||
benefit from a native XCB port.
|
benefit from a native XCB port.
|
||||||
|
|
||||||
More information about xcb is available from our website:
|
|
||||||
|
|
||||||
https://xcb.freedesktop.org/
|
Please report any issues you find to the freedesktop.org bug tracker,
|
||||||
|
at:
|
||||||
|
|
||||||
Please report any issues you find to the freedesktop.org bug tracker at:
|
<https://bugs.freedesktop.org/enter_bug.cgi?product=XCB>
|
||||||
|
|
||||||
https://gitlab.freedesktop.org/xorg/lib/libxcb/issues
|
|
||||||
|
|
||||||
Discussion about XCB occurs on the XCB mailing list:
|
Discussion about XCB occurs on the XCB mailing list:
|
||||||
|
|
||||||
https://lists.freedesktop.org/mailman/listinfo/xcb
|
<mailto:xcb at lists.freedesktop.org>
|
||||||
|
<http://lists.freedesktop.org/mailman/listinfo/xcb>
|
||||||
|
|
||||||
You can obtain the latest development versions of XCB using GIT from
|
You can obtain the latest development versions of XCB using GIT.
|
||||||
the libxcb code repository at:
|
For anonymous checkouts, use:
|
||||||
|
|
||||||
https://gitlab.freedesktop.org/xorg/lib/libxcb
|
git clone git://anongit.freedesktop.org/git/xcb/libxcb
|
||||||
|
|
||||||
For anonymous checkouts, use:
|
For developers, use:
|
||||||
|
|
||||||
git clone https://gitlab.freedesktop.org/xorg/lib/libxcb.git
|
git clone git+ssh://git.freedesktop.org/git/xcb/libxcb
|
||||||
|
|
||||||
For developers, use:
|
|
||||||
|
|
||||||
git clone git@gitlab.freedesktop.org:xorg/lib/libxcb.git
|
|
|
@ -0,0 +1,109 @@
|
||||||
|
dnl Detection and configuration of the visibility feature of gcc
|
||||||
|
dnl Vincent Torri 2006-02-11
|
||||||
|
dnl
|
||||||
|
dnl GCC_CHECK_VISIBILITY([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||||
|
dnl Check the visibility feature of gcc
|
||||||
|
dnl
|
||||||
|
AC_DEFUN([GCC_CHECK_VISIBILITY],
|
||||||
|
[AC_MSG_CHECKING([whether ${CC} supports symbol visibility])
|
||||||
|
save_CFLAGS=${CFLAGS}
|
||||||
|
CFLAGS="$CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
|
||||||
|
AC_COMPILE_IFELSE(
|
||||||
|
[AC_LANG_PROGRAM(
|
||||||
|
[[
|
||||||
|
#pragma GCC visibility push(hidden)
|
||||||
|
extern void f(int);
|
||||||
|
#pragma GCC visibility pop
|
||||||
|
]],
|
||||||
|
[[]]
|
||||||
|
)],
|
||||||
|
[AC_DEFINE(
|
||||||
|
GCC_HAS_VISIBILITY,
|
||||||
|
[],
|
||||||
|
[Defined if GCC supports the visibility feature])
|
||||||
|
m4_if([$1], [], [:], [$1])
|
||||||
|
AC_MSG_RESULT(yes)],
|
||||||
|
[m4_if([$2], [], [:], [$2])
|
||||||
|
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 x"$enableval" != x"yes" ; then
|
||||||
|
enable_build_docs="no"
|
||||||
|
else
|
||||||
|
enable_build_docs="yes"
|
||||||
|
fi],
|
||||||
|
[enable_build_docs="yes"])
|
||||||
|
|
||||||
|
if test "$enable_build_docs" = "no" ; then
|
||||||
|
BUILD_DOCS=no
|
||||||
|
else
|
||||||
|
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])
|
||||||
|
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
|
13
autogen.sh
13
autogen.sh
|
@ -1,17 +1,12 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
srcdir=`dirname "$0"`
|
srcdir=`dirname $0`
|
||||||
test -z "$srcdir" && srcdir=.
|
test -z "$srcdir" && srcdir=.
|
||||||
|
|
||||||
ORIGDIR=`pwd`
|
ORIGDIR=`pwd`
|
||||||
cd "$srcdir"
|
cd $srcdir
|
||||||
|
|
||||||
autoreconf -v --install || exit 1
|
autoreconf -v --install || exit 1
|
||||||
cd "$ORIGDIR" || exit $?
|
cd $ORIGDIR || exit $?
|
||||||
|
|
||||||
git config --local --get format.subjectPrefix >/dev/null 2>&1 ||
|
$srcdir/configure --enable-maintainer-mode "$@"
|
||||||
git config --local format.subjectPrefix "PATCH libxcb"
|
|
||||||
|
|
||||||
if test -z "$NOCONFIGURE"; then
|
|
||||||
exec "$srcdir"/configure "$@"
|
|
||||||
fi
|
|
||||||
|
|
|
@ -1,70 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
case "$AM_SRCDIR" in
|
|
||||||
"")
|
|
||||||
AM_SRCDIR="."
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
fix=n
|
|
||||||
status=0
|
|
||||||
case "$1" in
|
|
||||||
"-fix")
|
|
||||||
fix=y
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
for inc in src/*.h; do
|
|
||||||
package=xcb-`basename $inc .h`
|
|
||||||
pcin="$AM_SRCDIR"/$package.pc.in
|
|
||||||
if [ -f $pcin ]; then
|
|
||||||
included=`grep '# *include' $inc |
|
|
||||||
sed -e 's/[^<"]*[<"]//' -e 's/[>"]//' |
|
|
||||||
grep -v 'xcb.h\|xproto.h'`
|
|
||||||
requires=`grep '^Requires.private:' $pcin`
|
|
||||||
missing=""
|
|
||||||
for i in $included; do
|
|
||||||
ibase=`basename $i .h`
|
|
||||||
r="xcb-$ibase"
|
|
||||||
rpcin="$AM_SRCDIR"/$r.pc.in
|
|
||||||
if [ -f $rpcin ]; then
|
|
||||||
m="$r"
|
|
||||||
for has in $requires; do
|
|
||||||
if [ $has = $r ]; then
|
|
||||||
m=""
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
case "$m" in
|
|
||||||
"")
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
case "$missing" in
|
|
||||||
"")
|
|
||||||
missing=$m
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
missing="$missing $m"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
case "$missing" in
|
|
||||||
"")
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if [ "$fix" = "y" ]; then
|
|
||||||
echo $package adding dependency on $missing
|
|
||||||
sed -i '/^Requires.private:/s/$/ '"$missing"'/' $pcin
|
|
||||||
else
|
|
||||||
echo $package missing $missing
|
|
||||||
status=1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
exit $status
|
|
329
configure.ac
329
configure.ac
|
@ -1,62 +1,37 @@
|
||||||
dnl Process this file with autoconf to produce a configure script.
|
# -*- Autoconf -*-
|
||||||
|
# Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
# Initialize Autoconf
|
AC_PREREQ(2.57)
|
||||||
AC_PREREQ([2.60])
|
AC_INIT([libxcb],
|
||||||
AC_INIT([libxcb],[1.17.0],
|
1.1,
|
||||||
[https://gitlab.freedesktop.org/xorg/lib/libxcb/-/issues],
|
[xcb@lists.freedesktop.org])
|
||||||
[libxcb])
|
|
||||||
AC_CONFIG_AUX_DIR([build-aux])
|
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
|
||||||
AC_CONFIG_SRCDIR([xcb.pc.in])
|
AC_CONFIG_SRCDIR([xcb.pc.in])
|
||||||
AC_CONFIG_HEADERS([src/config.h])
|
AM_INIT_AUTOMAKE([foreign dist-bzip2])
|
||||||
|
|
||||||
# Initialize Automake
|
PKG_CHECK_MODULES(CHECK, [check >= 0.9.4], [HAVE_CHECK=yes], [HAVE_CHECK=no])
|
||||||
AM_INIT_AUTOMAKE([foreign dist-xz])
|
|
||||||
AM_PATH_PYTHON([3.0])
|
|
||||||
|
|
||||||
# Set common system defines for POSIX extensions, such as _GNU_SOURCE
|
|
||||||
# Must be called before any macros that run the compiler (like AC_PROG_LIBTOOL)
|
|
||||||
# to avoid autoconf errors.
|
|
||||||
AC_USE_SYSTEM_EXTENSIONS
|
|
||||||
AC_SYS_LARGEFILE
|
|
||||||
|
|
||||||
# Initialize libtool
|
|
||||||
LT_PREREQ([2.2])
|
|
||||||
LT_INIT([win32-dll])
|
|
||||||
|
|
||||||
# Require xorg-macros minimum of 1.18 - Initial version
|
|
||||||
m4_ifndef([XORG_MACROS_VERSION],
|
|
||||||
[m4_fatal([must install xorg-macros 1.18 or later before running autoconf/autogen])])
|
|
||||||
XORG_MACROS_VERSION(1.18)
|
|
||||||
XORG_DEFAULT_OPTIONS
|
|
||||||
XORG_ENABLE_DEVEL_DOCS
|
|
||||||
XORG_WITH_DOXYGEN
|
|
||||||
|
|
||||||
# The dot drawing tool is checked by XORG_WITH_DOXYGEN, needed for xcb manual
|
|
||||||
if test x"$HAVE_DOT" = xno; then
|
|
||||||
AC_MSG_WARN([dot not found - doxygen targets will be skipped])
|
|
||||||
fi
|
|
||||||
|
|
||||||
PKG_CHECK_MODULES(CHECK, [check >= 0.9.6], [HAVE_CHECK=yes], [HAVE_CHECK=no])
|
|
||||||
AM_CONDITIONAL(HAVE_CHECK, test x$HAVE_CHECK = xyes)
|
AM_CONDITIONAL(HAVE_CHECK, test x$HAVE_CHECK = xyes)
|
||||||
|
|
||||||
XSLTPROC=no
|
AC_CONFIG_HEADERS([src/config.h])
|
||||||
HTML_CHECK_RESULT=no
|
|
||||||
|
AC_PROG_LIBTOOL
|
||||||
|
AC_PROG_CC
|
||||||
|
|
||||||
|
AC_PATH_PROG(XSLTPROC, xsltproc, no)
|
||||||
|
if test "$XSLTPROC" = "no"; then
|
||||||
|
AC_MSG_ERROR([XCB requires xsltproc.])
|
||||||
|
fi
|
||||||
|
|
||||||
|
HTML_CHECK_RESULT=false
|
||||||
if test x"$HAVE_CHECK" = xyes; then
|
if test x"$HAVE_CHECK" = xyes; then
|
||||||
AC_PATH_PROG(XSLTPROC, xsltproc, no)
|
|
||||||
if test x"$XSLTPROC" != xno; then
|
if test x"$XSLTPROC" != xno; then
|
||||||
HTML_CHECK_RESULT=yes
|
HTML_CHECK_RESULT=true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
AC_SUBST(HTML_CHECK_RESULT)
|
AC_SUBST(HTML_CHECK_RESULT)
|
||||||
|
|
||||||
# Checks for pkg-config packages
|
# Checks for pkg-config packages
|
||||||
PKG_CHECK_MODULES(XCBPROTO, xcb-proto >= 1.17.0)
|
PKG_CHECK_MODULES(XCBPROTO, xcb-proto >= 1.1)
|
||||||
NEEDED="xau >= 0.99.2"
|
NEEDED="pthread-stubs xau >= 0.99.2"
|
||||||
case $host_os in
|
|
||||||
linux*|darwin*|solaris*|dragonfly*|freebsd*|netbsd*) ;;
|
|
||||||
*) NEEDED="$NEEDED pthread-stubs" ;;
|
|
||||||
esac
|
|
||||||
PKG_CHECK_MODULES(NEEDED, $NEEDED)
|
PKG_CHECK_MODULES(NEEDED, $NEEDED)
|
||||||
|
|
||||||
have_xdmcp="no"
|
have_xdmcp="no"
|
||||||
|
@ -73,6 +48,8 @@ PKG_CHECK_MODULES(XDMCP, xdmcp,
|
||||||
], [$XDMCP_LIBS]),
|
], [$XDMCP_LIBS]),
|
||||||
[AC_MSG_RESULT(no)])
|
[AC_MSG_RESULT(no)])
|
||||||
|
|
||||||
|
AC_CHECK_HEADER([execinfo.h], [AC_DEFINE(HAVE_BACKTRACE,1,[Has backtrace*() needed for retrieving stack traces])])
|
||||||
|
|
||||||
AC_SUBST(NEEDED)
|
AC_SUBST(NEEDED)
|
||||||
|
|
||||||
# Find the xcb-proto protocol descriptions
|
# Find the xcb-proto protocol descriptions
|
||||||
|
@ -81,220 +58,37 @@ XCBPROTO_XCBINCLUDEDIR=`$PKG_CONFIG --variable=xcbincludedir xcb-proto`
|
||||||
AC_MSG_RESULT($XCBPROTO_XCBINCLUDEDIR)
|
AC_MSG_RESULT($XCBPROTO_XCBINCLUDEDIR)
|
||||||
AC_SUBST(XCBPROTO_XCBINCLUDEDIR)
|
AC_SUBST(XCBPROTO_XCBINCLUDEDIR)
|
||||||
|
|
||||||
# Find the xcb-proto version
|
AC_HEADER_STDC
|
||||||
XCBPROTO_VERSION=`$PKG_CONFIG --modversion xcb-proto`
|
|
||||||
AC_SUBST(XCBPROTO_VERSION)
|
|
||||||
|
|
||||||
# Find the xcbgen Python package
|
|
||||||
AC_MSG_CHECKING(XCBPROTO_XCBPYTHONDIR)
|
|
||||||
XCBPROTO_XCBPYTHONDIR=`$PKG_CONFIG --variable=pythondir xcb-proto`
|
|
||||||
AC_MSG_RESULT($XCBPROTO_XCBPYTHONDIR)
|
|
||||||
AC_SUBST(XCBPROTO_XCBPYTHONDIR)
|
|
||||||
|
|
||||||
AC_SEARCH_LIBS(getaddrinfo, socket)
|
AC_SEARCH_LIBS(getaddrinfo, socket)
|
||||||
AC_SEARCH_LIBS(connect, socket)
|
AC_SEARCH_LIBS(connect, socket)
|
||||||
|
|
||||||
# Find support for sending a message from a socket
|
|
||||||
AC_SEARCH_LIBS(sendmsg, socket, [have_sendmsg="yes"], [have_sendmsg="no"])
|
|
||||||
|
|
||||||
# XPG4v2/UNIX95 added msg_control - check to see if we need to define
|
|
||||||
# _XOPEN_SOURCE to get it (such as on Solaris)
|
|
||||||
AC_CHECK_MEMBER([struct msghdr.msg_control], [], [],
|
|
||||||
[
|
|
||||||
AC_INCLUDES_DEFAULT
|
|
||||||
#include <sys/socket.h>
|
|
||||||
])
|
|
||||||
# First try for Solaris in C99 compliant mode, which requires XPG6/UNIX03
|
|
||||||
if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
|
|
||||||
unset ac_cv_member_struct_msghdr_msg_control
|
|
||||||
AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=600])
|
|
||||||
AC_CHECK_MEMBER([struct msghdr.msg_control],
|
|
||||||
[AC_DEFINE([_XOPEN_SOURCE], [600],
|
|
||||||
[Defined if needed to expose struct msghdr.msg_control])
|
|
||||||
], [], [
|
|
||||||
#define _XOPEN_SOURCE 600
|
|
||||||
AC_INCLUDES_DEFAULT
|
|
||||||
#include <sys/socket.h>
|
|
||||||
])
|
|
||||||
fi
|
|
||||||
# If that didn't work, fall back to XPG5/UNIX98 with C89
|
|
||||||
if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then
|
|
||||||
unset ac_cv_member_struct_msghdr_msg_control
|
|
||||||
AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=500])
|
|
||||||
AC_CHECK_MEMBER([struct msghdr.msg_control],
|
|
||||||
[AC_DEFINE([_XOPEN_SOURCE], [500],
|
|
||||||
[Defined if needed to expose struct msghdr.msg_control])
|
|
||||||
], [have_sendmsg="no"], [
|
|
||||||
#define _XOPEN_SOURCE 500
|
|
||||||
AC_INCLUDES_DEFAULT
|
|
||||||
#include <sys/socket.h>
|
|
||||||
])
|
|
||||||
fi
|
|
||||||
|
|
||||||
case x$have_sendmsg in
|
|
||||||
xyes)
|
|
||||||
AC_DEFINE([HAVE_SENDMSG],1,[Define if your platform supports sendmsg])
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
have_win32="no"
|
|
||||||
lt_enable_auto_import=""
|
|
||||||
case $host_os in
|
|
||||||
mingw*)
|
|
||||||
have_win32="yes"
|
|
||||||
lt_enable_auto_import="-Wl,--enable-auto-import"
|
|
||||||
;;
|
|
||||||
linux*)
|
|
||||||
AC_DEFINE([HAVE_ABSTRACT_SOCKETS], 1, [Define if your platform supports abstract sockets])
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
AC_SUBST(lt_enable_auto_import)
|
|
||||||
AM_CONDITIONAL([XCB_HAVE_WIN32], [test "x${have_win32}" = "xyes"])
|
|
||||||
|
|
||||||
dnl define buffer queue size
|
|
||||||
AC_ARG_WITH([queue-size],
|
|
||||||
AS_HELP_STRING([--with-queue-size=SIZE],
|
|
||||||
[Set the XCB buffer queue size (default is 16384)]),
|
|
||||||
[xcb_queue_buffer_size="$withval"],
|
|
||||||
[xcb_queue_buffer_size=16384])
|
|
||||||
AC_DEFINE_UNQUOTED(XCB_QUEUE_BUFFER_SIZE, [$xcb_queue_buffer_size],
|
|
||||||
[XCB buffer queue size])
|
|
||||||
|
|
||||||
dnl check for the sockaddr_un.sun_len member
|
|
||||||
AC_CHECK_MEMBER([struct sockaddr_un.sun_len],
|
|
||||||
[AC_DEFINE(HAVE_SOCKADDR_SUN_LEN,1,[Have the sockaddr_un.sun_len member.])],
|
|
||||||
[],
|
|
||||||
[ #include <sys/types.h>
|
|
||||||
#include <sys/un.h>
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl check for support for Solaris Trusted Extensions
|
|
||||||
AC_CHECK_HEADERS([tsol/label.h])
|
|
||||||
AC_CHECK_FUNCS([is_system_labeled])
|
|
||||||
|
|
||||||
dnl check for IOV_MAX, and fall back to UIO_MAXIOV on BSDish systems
|
|
||||||
AC_CHECK_DECL([IOV_MAX], [],
|
|
||||||
[AC_CHECK_DECL([UIO_MAXIOV], [AC_DEFINE([IOV_MAX], [UIO_MAXIOV])],
|
|
||||||
[AC_DEFINE([IOV_MAX], [16], [Define if not provided by <limits.h>])],
|
|
||||||
[[#include <sys/uio.h>]])],
|
|
||||||
[[#include <limits.h>]])
|
|
||||||
|
|
||||||
xcbincludedir='${includedir}/xcb'
|
xcbincludedir='${includedir}/xcb'
|
||||||
AC_SUBST(xcbincludedir)
|
AC_SUBST(xcbincludedir)
|
||||||
|
|
||||||
XCB_CHECK_VISIBILITY()
|
if test "x$GCC" = xyes ; then
|
||||||
|
CWARNFLAGS="-Wall -pedantic -Wpointer-arith \
|
||||||
AC_CHECK_FUNC(getaddrinfo, [AC_DEFINE(HAVE_GETADDRINFO, 1, [getaddrinfo() function is available])], )
|
-Wstrict-prototypes -Wmissing-declarations -Wnested-externs"
|
||||||
|
else
|
||||||
case $host_os in
|
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
|
||||||
# darwin through Snow Leopard has poll() but can't be used to poll character devices.
|
if test "x$SUNCC" = "xyes"; then
|
||||||
darwin@<:@789@:>@*|darwin10*) ;;
|
CWARNFLAGS="-v"
|
||||||
darwin*)
|
|
||||||
_ac_xorg_macosx_version_min=""
|
|
||||||
if echo $CPPFLAGS $CFLAGS | grep -q mmacosx-version-min ; then
|
|
||||||
_ac_xorg_macosx_version_min=`echo $CPPFLAGS $CFLAGS | sed 's/^.*-mmacosx-version-min=\(@<:@^ @:>@*\).*$/\1/'`
|
|
||||||
else
|
|
||||||
_ac_xorg_macosx_version_min=$MACOSX_DEPLOYMENT_TARGET
|
|
||||||
fi
|
fi
|
||||||
case $_ac_xorg_macosx_version_min in
|
fi
|
||||||
10.@<:@0123456@:>@|10.@<:@0123456@:>@.*) ;;
|
AC_SUBST(CWARNFLAGS)
|
||||||
*)
|
|
||||||
AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], )
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
unset _ac_xorg_macosx_version_min
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() function is available])], )
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
dnl Link with winsock for socket functions on MinGW
|
GCC_CHECK_VISIBILITY()
|
||||||
case $host_os in
|
|
||||||
*mingw*)
|
|
||||||
AC_CHECK_LIB([ws2_32],[main])
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
XCB_EXTENSION(Composite, yes)
|
# htmldir is not defined prior to autoconf 2.59c, so on earlier versions
|
||||||
XCB_EXTENSION(Damage, yes)
|
# set an equivalent value.
|
||||||
XCB_EXTENSION(Dbe, yes)
|
AC_PREREQ([2.59c], [], [AC_SUBST([htmldir], [m4_ifset([AC_PACKAGE_TARNAME],
|
||||||
XCB_EXTENSION(DPMS, yes)
|
['${datadir}/doc/${PACKAGE_TARNAME}'],
|
||||||
XCB_EXTENSION(DRI2, yes)
|
['${datadir}/doc/${PACKAGE}'])
|
||||||
XCB_EXTENSION(DRI3, $have_sendmsg)
|
])])
|
||||||
XCB_EXTENSION(GE, no)
|
AM_CHECK_DOXYGEN()
|
||||||
XCB_EXTENSION(GLX, yes)
|
|
||||||
XCB_EXTENSION(Present, yes)
|
|
||||||
XCB_EXTENSION(RandR, yes)
|
|
||||||
XCB_EXTENSION(Record, yes)
|
|
||||||
XCB_EXTENSION(Render, yes)
|
|
||||||
XCB_EXTENSION(Resource, yes)
|
|
||||||
XCB_EXTENSION(Screensaver, yes)
|
|
||||||
XCB_EXTENSION(Shape, yes)
|
|
||||||
XCB_EXTENSION(Shm, yes)
|
|
||||||
XCB_EXTENSION(Sync, yes)
|
|
||||||
XCB_EXTENSION(Xevie, no)
|
|
||||||
XCB_EXTENSION(XFixes, yes)
|
|
||||||
XCB_EXTENSION(XFree86-DRI, yes)
|
|
||||||
XCB_EXTENSION(Xinerama, yes)
|
|
||||||
XCB_EXTENSION(XInput, yes)
|
|
||||||
XCB_EXTENSION(XKB, yes)
|
|
||||||
XCB_EXTENSION(Xprint, no)
|
|
||||||
XCB_EXTENSION(SELinux, no)
|
|
||||||
XCB_EXTENSION(XTest, yes)
|
|
||||||
XCB_EXTENSION(Xv, yes)
|
|
||||||
XCB_EXTENSION(XvMC, yes)
|
|
||||||
|
|
||||||
AC_ARG_WITH(serverside-support, AS_HELP_STRING([--with-serverside-support], [Build with support for server-side usage of xcb. This is still EXPERIMENTAL! ABI/API may change! (default: no)]), [XCB_SERVERSIDE_SUPPORT=$withval], [XCB_SERVERSIDE_SUPPORT=no])
|
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])
|
||||||
AM_CONDITIONAL(XCB_SERVERSIDE_SUPPORT, test "x$XCB_SERVERSIDE_SUPPORT" = "xyes")
|
AC_CONFIG_FILES([doc/xcb.doxygen])
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
|
||||||
Makefile
|
|
||||||
doc/Makefile
|
|
||||||
man/Makefile
|
|
||||||
src/Makefile
|
|
||||||
tests/Makefile
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
|
||||||
xcb.pc
|
|
||||||
xcb-composite.pc
|
|
||||||
xcb-damage.pc
|
|
||||||
xcb-dbe.pc
|
|
||||||
xcb-dpms.pc
|
|
||||||
xcb-dri2.pc
|
|
||||||
xcb-dri3.pc
|
|
||||||
xcb-ge.pc
|
|
||||||
xcb-glx.pc
|
|
||||||
xcb-present.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-xinput.pc
|
|
||||||
xcb-xkb.pc
|
|
||||||
xcb-xprint.pc
|
|
||||||
xcb-xselinux.pc
|
|
||||||
xcb-xtest.pc
|
|
||||||
xcb-xv.pc
|
|
||||||
xcb-xvmc.pc
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
|
||||||
doc/xcb.doxygen
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
||||||
|
@ -305,43 +99,12 @@ echo " Package: ${PACKAGE_NAME} ${PACKAGE_VERSION}"
|
||||||
echo ""
|
echo ""
|
||||||
echo " Configuration"
|
echo " Configuration"
|
||||||
echo " XDM support.........: ${have_xdmcp}"
|
echo " XDM support.........: ${have_xdmcp}"
|
||||||
echo " sendmsg fd passing..: ${have_sendmsg}"
|
|
||||||
echo " Build unit tests....: ${HAVE_CHECK}"
|
echo " Build unit tests....: ${HAVE_CHECK}"
|
||||||
echo " with html results.: ${HTML_CHECK_RESULT}"
|
|
||||||
echo " XCB buffer size.....: ${xcb_queue_buffer_size}"
|
|
||||||
echo ""
|
|
||||||
echo " X11 extensions"
|
|
||||||
echo " Composite...........: ${BUILD_COMPOSITE}"
|
|
||||||
echo " Damage..............: ${BUILD_DAMAGE}"
|
|
||||||
echo " Dbe.................: ${BUILD_DBE}"
|
|
||||||
echo " Dpms................: ${BUILD_DPMS}"
|
|
||||||
echo " Dri2................: ${BUILD_DRI2}"
|
|
||||||
echo " Dri3................: ${BUILD_DRI3}"
|
|
||||||
echo " GenericEvent........: ${BUILD_GE}"
|
|
||||||
echo " Glx.................: ${BUILD_GLX}"
|
|
||||||
echo " Randr...............: ${BUILD_RANDR}"
|
|
||||||
echo " Record..............: ${BUILD_RECORD}"
|
|
||||||
echo " Render..............: ${BUILD_RENDER}"
|
|
||||||
echo " Resource............: ${BUILD_RESOURCE}"
|
|
||||||
echo " Screensaver.........: ${BUILD_SCREENSAVER}"
|
|
||||||
echo " selinux.............: ${BUILD_SELINUX}"
|
|
||||||
echo " Shape...............: ${BUILD_SHAPE}"
|
|
||||||
echo " Shm.................: ${BUILD_SHM}"
|
|
||||||
echo " Sync................: ${BUILD_SYNC}"
|
|
||||||
echo " Xevie...............: ${BUILD_XEVIE}"
|
|
||||||
echo " Xfixes..............: ${BUILD_XFIXES}"
|
|
||||||
echo " Xfree86-dri.........: ${BUILD_XFREE86_DRI}"
|
|
||||||
echo " xinerama............: ${BUILD_XINERAMA}"
|
|
||||||
echo " xinput..............: ${BUILD_XINPUT}"
|
|
||||||
echo " xkb.................: ${BUILD_XKB}"
|
|
||||||
echo " xprint..............: ${BUILD_XPRINT}"
|
|
||||||
echo " xtest...............: ${BUILD_XTEST}"
|
|
||||||
echo " xv..................: ${BUILD_XV}"
|
|
||||||
echo " xvmc................: ${BUILD_XVMC}"
|
|
||||||
echo ""
|
echo ""
|
||||||
echo " Used CFLAGS:"
|
echo " Used CFLAGS:"
|
||||||
echo " CPPFLAGS............: ${CPPFLAGS}"
|
echo " CPPFLAGS............: ${CPPFLAGS}"
|
||||||
echo " CFLAGS..............: ${CFLAGS}"
|
echo " CFLAGS..............: ${CFLAGS}"
|
||||||
|
echo " Warning CFLAGS......: ${CWARNFLAGS}"
|
||||||
echo ""
|
echo ""
|
||||||
echo " Installation:"
|
echo " Installation:"
|
||||||
echo " Prefix..............: ${prefix}"
|
echo " Prefix..............: ${prefix}"
|
||||||
|
|
|
@ -2,15 +2,11 @@
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
tutorial/index.html \
|
tutorial/index.html \
|
||||||
tutorial/xcb.css \
|
tutorial/xcb.css \
|
||||||
xcb.doxygen.in \
|
xcb.doxygen.in
|
||||||
xkb_internals \
|
|
||||||
xkb_issues
|
|
||||||
|
|
||||||
docdirs = $(srcdir)/tutorial
|
docdirs = $(srcdir)/tutorial
|
||||||
|
|
||||||
if ENABLE_DEVEL_DOCS
|
if BUILD_DOCS
|
||||||
if HAVE_DOXYGEN
|
|
||||||
if HAVE_DOT
|
|
||||||
|
|
||||||
docdirs += manual
|
docdirs += manual
|
||||||
|
|
||||||
|
@ -23,8 +19,6 @@ clean-local:
|
||||||
rm -rf manual/
|
rm -rf manual/
|
||||||
|
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
all-local: $(docdirs)
|
all-local: $(docdirs)
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@
|
||||||
<li><a class="subsection" href="#DoesBackingStore">DoesBackingStore</a>
|
<li><a class="subsection" href="#DoesBackingStore">DoesBackingStore</a>
|
||||||
<li><a class="subsection" href="#EventMaskOfScreen">EventMaskOfScreen</a>
|
<li><a class="subsection" href="#EventMaskOfScreen">EventMaskOfScreen</a>
|
||||||
</ol>
|
</ol>
|
||||||
<li><a class="subsection" href="#misc">Miscellaneous macros</a>
|
<li><a class="subsection" href="#misc">Miscellaneaous macros</a>
|
||||||
<ol>
|
<ol>
|
||||||
<li><a class="subsection" href="#DisplayOfScreen">DisplayOfScreen</a>
|
<li><a class="subsection" href="#DisplayOfScreen">DisplayOfScreen</a>
|
||||||
<li><a class="subsection" href="#DisplayCells">DisplayCells / CellsOfScreen</a>
|
<li><a class="subsection" href="#DisplayCells">DisplayCells / CellsOfScreen</a>
|
||||||
|
@ -173,7 +173,7 @@
|
||||||
with the <a href="http://xcb.freedesktop.org">XCB</a>
|
with the <a href="http://xcb.freedesktop.org">XCB</a>
|
||||||
library. keep in mind that XCB, like the
|
library. keep in mind that XCB, like the
|
||||||
<a href="http://tronche.com/gui/x/xlib/introduction">Xlib</a>
|
<a href="http://tronche.com/gui/x/xlib/introduction">Xlib</a>
|
||||||
library, isn't what most programmers wanting to write X
|
library, isn't what post programmers wanting to write X
|
||||||
applications are looking for. They should use a much higher
|
applications are looking for. They should use a much higher
|
||||||
level GUI toolkit like Motif,
|
level GUI toolkit like Motif,
|
||||||
<a href="http://www.lesstif.org">LessTiff</a>,
|
<a href="http://www.lesstif.org">LessTiff</a>,
|
||||||
|
@ -471,6 +471,8 @@ main ()
|
||||||
diff = end - start;
|
diff = end - start;
|
||||||
|
|
||||||
/* free var */
|
/* free var */
|
||||||
|
for (i = 0; i < count; ++i)
|
||||||
|
free (names[i]);
|
||||||
free (atoms);
|
free (atoms);
|
||||||
free (cs);
|
free (cs);
|
||||||
|
|
||||||
|
@ -492,8 +494,6 @@ main ()
|
||||||
printf ("ratio : %f\n", diff_x / diff);
|
printf ("ratio : %f\n", diff_x / diff);
|
||||||
|
|
||||||
free (atoms_x);
|
free (atoms_x);
|
||||||
for (i = 0; i < count; ++i)
|
|
||||||
free (names[i]);
|
|
||||||
free (names);
|
free (names);
|
||||||
|
|
||||||
XCloseDisplay (disp);
|
XCloseDisplay (disp);
|
||||||
|
@ -1331,7 +1331,7 @@ main ()
|
||||||
/* We draw the polygonal line */
|
/* We draw the polygonal line */
|
||||||
xcb_poly_line (c, XCB_COORD_MODE_PREVIOUS, win, foreground, 4, polyline);
|
xcb_poly_line (c, XCB_COORD_MODE_PREVIOUS, win, foreground, 4, polyline);
|
||||||
|
|
||||||
/* We draw the segments */
|
/* We draw the segements */
|
||||||
xcb_poly_segment (c, win, foreground, 2, segments);
|
xcb_poly_segment (c, win, foreground, 2, segments);
|
||||||
|
|
||||||
/* We draw the rectangles */
|
/* We draw the rectangles */
|
||||||
|
@ -1453,7 +1453,7 @@ typedef enum {
|
||||||
</pre>
|
</pre>
|
||||||
<p>
|
<p>
|
||||||
If the window has already been created, we can use the
|
If the window has already been created, we can use the
|
||||||
<span class="code">xcb_change_window_attributes()</span> function to set
|
<span class="code">xcb_configure_window()</span> function to set
|
||||||
the events that the window will receive. The subsection
|
the events that the window will receive. The subsection
|
||||||
<a href="#winconf">Configuring a window</a> shows its
|
<a href="#winconf">Configuring a window</a> shows its
|
||||||
prototype. As an example, here is a piece of code that
|
prototype. As an example, here is a piece of code that
|
||||||
|
@ -1466,14 +1466,14 @@ const static uint32_t values[] = { XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_BUTT
|
||||||
|
|
||||||
/* The connection c and the window win are supposed to be defined */
|
/* The connection c and the window win are supposed to be defined */
|
||||||
|
|
||||||
xcb_change_window_attributes (c, win, XCB_CW_EVENT_MASK, values);
|
xcb_configure_window (c, win, XCB_CW_EVENT_MASK, values);
|
||||||
</pre>
|
</pre>
|
||||||
<div class="emph">
|
<div class="emph">
|
||||||
<p>
|
<p>
|
||||||
Note: A common bug programmers have is adding code to handle new
|
Note: A common bug programmers do is adding code to handle new
|
||||||
event types in their program, while forgetting to add the
|
event types in their program, while forgetting to add the
|
||||||
masks for these events in the creation of the window. Such a
|
masks for these events in the creation of the window. Such a
|
||||||
programmer would then sit there for hours debugging their
|
programmer then should sit down for hours debugging his
|
||||||
program, wondering "Why doesn't my program notice that I
|
program, wondering "Why doesn't my program notice that I
|
||||||
released the button?", only to find that they registered for
|
released the button?", only to find that they registered for
|
||||||
button press events but not for button release events.
|
button press events but not for button release events.
|
||||||
|
@ -1830,7 +1830,7 @@ typedef xcb_enter_notify_event_t xcb_leave_notify_event_t;
|
||||||
keyboard focus using the window manager (often by clicking
|
keyboard focus using the window manager (often by clicking
|
||||||
on the title bar of the desired window). Once our window
|
on the title bar of the desired window). Once our window
|
||||||
has the keyboard focus, every key press or key release will
|
has the keyboard focus, every key press or key release will
|
||||||
cause an event to be sent to our program (if it registered
|
cause an event to be sent to our program (if it regsitered
|
||||||
for these event types...).
|
for these event types...).
|
||||||
</p>
|
</p>
|
||||||
<li class="subsubtitle"><a name="keypress">Keyboard press and release events</a>
|
<li class="subsubtitle"><a name="keypress">Keyboard press and release events</a>
|
||||||
|
@ -2090,7 +2090,7 @@ xcb_void_cookie_t xcb_open_font (xcb_connection_t *c,
|
||||||
Once a font is opened, you have to create a Graphic Context
|
Once a font is opened, you have to create a Graphic Context
|
||||||
that will contain the informations about the color of the
|
that will contain the informations about the color of the
|
||||||
foreground and the background used when you draw a text in a
|
foreground and the background used when you draw a text in a
|
||||||
Drawable. Here is an example of a Graphic Context that will
|
Drawable. Here is an exemple of a Graphic Context that will
|
||||||
allow us to draw an opened font with a black foreground and a
|
allow us to draw an opened font with a black foreground and a
|
||||||
white background:
|
white background:
|
||||||
</p>
|
</p>
|
||||||
|
@ -2297,7 +2297,9 @@ int main ()
|
||||||
values[0] = screen->white_pixel;
|
values[0] = screen->white_pixel;
|
||||||
values[1] =
|
values[1] =
|
||||||
XCB_EVENT_MASK_KEY_RELEASE |
|
XCB_EVENT_MASK_KEY_RELEASE |
|
||||||
XCB_EVENT_MASK_EXPOSURE;
|
XCB_EVENT_MASK_BUTTON_PRESS |
|
||||||
|
XCB_EVENT_MASK_EXPOSURE |
|
||||||
|
XCB_EVENT_MASK_POINTER_MOTION;
|
||||||
cookie_window = xcb_create_window_checked (c,
|
cookie_window = xcb_create_window_checked (c,
|
||||||
screen->root_depth,
|
screen->root_depth,
|
||||||
window, screen->root,
|
window, screen->root,
|
||||||
|
@ -2402,7 +2404,7 @@ xcb_void_cookie_t xcb_change_property (xcb_connection_t *c, /* Connection
|
||||||
const void *data); /* Data */
|
const void *data); /* Data */
|
||||||
</pre>
|
</pre>
|
||||||
<p>
|
<p>
|
||||||
The <span class="code">mode</span> parameter could be one of
|
The <span class="code">mode</span> parameter coud be one of
|
||||||
the following values (defined in enumeration xcb_prop_mode_t in
|
the following values (defined in enumeration xcb_prop_mode_t in
|
||||||
the xproto.h header file):
|
the xproto.h header file):
|
||||||
</p>
|
</p>
|
||||||
|
@ -2937,7 +2939,7 @@ xcb_get_window_attributes_reply_t *xcb_get_window_attributes_reply (xcb_connecti
|
||||||
latter case, each time the mouse moves onto your window, the
|
latter case, each time the mouse moves onto your window, the
|
||||||
screen color map will be replaced by your window's color map,
|
screen color map will be replaced by your window's color map,
|
||||||
and you'll see all the other windows on screen change their
|
and you'll see all the other windows on screen change their
|
||||||
colors into something quite bizarre. In fact, this is the
|
colors into something quite bizzare. In fact, this is the
|
||||||
effect you get with X applications that use the "-install"
|
effect you get with X applications that use the "-install"
|
||||||
command line option.
|
command line option.
|
||||||
</p>
|
</p>
|
||||||
|
@ -3300,10 +3302,10 @@ xcb_void_cookie_t xcb_free_pixmap (xcb_connection_t *c, /* Pointer to the
|
||||||
<li class="title"><a name="mousecursor">Messing with the mouse cursor</a>
|
<li class="title"><a name="mousecursor">Messing with the mouse cursor</a>
|
||||||
<p>
|
<p>
|
||||||
It it possible to modify the shape of the mouse pointer (also
|
It it possible to modify the shape of the mouse pointer (also
|
||||||
called the X pointer) when in certain states, as we often see in
|
called the X pointer) when in certain states, as we otfen see in
|
||||||
programs. For example, a busy application would often display
|
programs. For example, a busy application would often display
|
||||||
the hourglass cursor over its main window, to give the user a visual
|
the sand clock over its main window, to give the user a visual
|
||||||
hint that they should wait. Let's see how we can change the mouse
|
hint that he should wait. Let's see how we can change the mouse
|
||||||
cursor of our windows.
|
cursor of our windows.
|
||||||
</p>
|
</p>
|
||||||
<ol>
|
<ol>
|
||||||
|
@ -3339,7 +3341,7 @@ xcb_void_cookie_t xcb_create_glyph_cursor (xcb_connection_t *c,
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
So we first open that font (see <a href="#loadfont">Loading a Font</a>)
|
So we first open that font (see <a href="#loadfont">Loading a Font</a>)
|
||||||
and create the new cursor. As for every X resource, we have to
|
and create the new cursor. As for every X ressource, we have to
|
||||||
ask for an X id with <span class="code">xcb_generate_id</span>
|
ask for an X id with <span class="code">xcb_generate_id</span>
|
||||||
first:
|
first:
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
|
|
||||||
XKB introduces several uncommon data structures:
|
|
||||||
- switch allows conditional inclusion of fields
|
|
||||||
- several complex objects intermix variable and fixed size fields
|
|
||||||
- lists with a variable number of variable size objects
|
|
||||||
|
|
||||||
To handle these objects, a number of new functions is generated:
|
|
||||||
- _serialize() turns a structured object into a byte stream,
|
|
||||||
(re)ordering or including fields according to the protocol
|
|
||||||
- _unserialize() rewrites data from a buffer into a structured object
|
|
||||||
- _unpack() expands a buffer representing a switch object into
|
|
||||||
a special structured type, all flags needed to resolve the switch
|
|
||||||
expression have to given as parameters
|
|
||||||
- _sizeof() calculates the size of a serialized object, often by calling
|
|
||||||
_unserialize()/_unpack() internally
|
|
||||||
|
|
||||||
The new structured data type for switch is special as it contains fixed
|
|
||||||
and variable size fields. Variable size fields can be accessed via pointers.
|
|
||||||
|
|
||||||
If switch appears in a request, an additional set of request helpers is
|
|
||||||
generated with the suffix _aux or _aux_(un)checked. While the 'common'
|
|
||||||
request functions require that switch has been serialized before, the _aux
|
|
||||||
variants take the structured data type. They are especially designed to
|
|
||||||
replace certain functions in xcb-util/aux.
|
|
||||||
|
|
||||||
Accessors for switch members need two parameters, where the first is usually
|
|
||||||
a pointer to the respective request or reply structure, while the second
|
|
||||||
is a pointer to the unpacked switch data structure.
|
|
||||||
|
|
||||||
Functions from the serialize family that take a double pointer can allocate
|
|
||||||
memory on their own, which is useful if the size of a buffer has to be
|
|
||||||
calculated depending on the data within. These functions call malloc() when
|
|
||||||
the double pointer is given as the address of a pointer that has been
|
|
||||||
initialized to 0. It is the responsibility of the user to free any allocated
|
|
||||||
memory.
|
|
||||||
|
|
||||||
Intermixed variable and fixed size fields are an important special case in XKB.
|
|
||||||
The current implementation resolves the issue by reordering the fields before
|
|
||||||
sending them on the wire as well as before returning a reply. That means that
|
|
||||||
these objects look like 'common' XCB data types and they can be accessed as such
|
|
||||||
(i.e. fixed size fields directly via the structured type and variable size fields
|
|
||||||
via accessors/iterators).
|
|
||||||
|
|
||||||
In case a list with variable size elements needs to be accessed, it is necessary
|
|
||||||
to use iterators. The iterator functions take care of determining the actual
|
|
||||||
object size for each element automatically.
|
|
||||||
|
|
||||||
A small and preliminary set of auxiliary functions is available in xkb_util.c
|
|
||||||
in the check_xkb module.
|
|
|
@ -1,38 +0,0 @@
|
||||||
|
|
||||||
There are a number of problematic special cases in XKB. The issues
|
|
||||||
mentioned here are at most partly resolved.
|
|
||||||
|
|
||||||
1. The are several XxxDoodad structures defined in xkb.xml. They are used
|
|
||||||
in a few lists, but in a rather special way:
|
|
||||||
The struct "CommonDoodad" is supposed to be a rather generic data type,
|
|
||||||
combining the most basic Doodad fields that are common in all these structures.
|
|
||||||
All Doodads are encapsulated in a union type simply called "Doodad".
|
|
||||||
Now this union is used in subsequent list definitions, aiming at a kind of
|
|
||||||
'polymorphism': From inspection of the protocol and Xlib, the Doodads are to
|
|
||||||
be discriminated based on their type field.
|
|
||||||
However the special meaning of the type field is not encoded in the protocol.
|
|
||||||
Furthermore the TextDoodad and the LogoDoodad are variable size types due to
|
|
||||||
some fields of type CountedString16, thereby turning the union into a
|
|
||||||
possibly variable size type as well.
|
|
||||||
However, for lists with variable size elements, special sizeof functions are
|
|
||||||
required. These cannot be autogenerated as it cannot be referred which
|
|
||||||
Doodad type to use for the union.
|
|
||||||
Therefore, the Doodad type structures are unsupported at the moment.
|
|
||||||
|
|
||||||
2. There are still some bugs in xkb.xml: Either certain fields are missing
|
|
||||||
that are required by the protocol, or Xlib simply has another understanding
|
|
||||||
of the protocol.
|
|
||||||
|
|
||||||
3. The interface for accessors should be reviewed.
|
|
||||||
|
|
||||||
4. Currently some bitcases carry 'name' attributes. These could be avoided if
|
|
||||||
the data within would consist of a singe struct field only.
|
|
||||||
|
|
||||||
5. switch could get a 'fixed_size' attribute, so when rewriting valueparam to switch,
|
|
||||||
an uint32_t * pointer could be used instead of void *.
|
|
||||||
|
|
||||||
6. The automatic inclusion of padding requires some complicated coding in the
|
|
||||||
generator. This is errorprone and could be avoided if all padding is explicitly
|
|
||||||
given in the protocol definition. For variable size fields that require padding,
|
|
||||||
the pad tag could get a 'fieldref' attribute. That way padding could be handled
|
|
||||||
a lot easier in the autogenerator.
|
|
|
@ -1,4 +0,0 @@
|
||||||
[wrap-git]
|
|
||||||
url = https://gitea.gigo-games.dk/frederik/libxcb.git
|
|
||||||
revision = HEAD
|
|
||||||
depth = 1
|
|
70
m4/xcb.m4
70
m4/xcb.m4
|
@ -1,70 +0,0 @@
|
||||||
dnl Detection and configuration of the visibility feature of gcc
|
|
||||||
dnl Vincent Torri 2006-02-11
|
|
||||||
dnl
|
|
||||||
dnl XCB_CHECK_VISIBILITY([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
|
||||||
dnl Check the visibility feature of gcc
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([XCB_CHECK_VISIBILITY],
|
|
||||||
[
|
|
||||||
AC_MSG_CHECKING([whether ${CC} supports symbol visibility])
|
|
||||||
|
|
||||||
save_CFLAGS=${CFLAGS}
|
|
||||||
CFLAGS="$CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
|
|
||||||
AC_COMPILE_IFELSE(
|
|
||||||
[AC_LANG_PROGRAM(
|
|
||||||
[[
|
|
||||||
#pragma GCC visibility push(hidden)
|
|
||||||
extern void f(int);
|
|
||||||
#pragma GCC visibility pop
|
|
||||||
]],
|
|
||||||
[[]]
|
|
||||||
)],
|
|
||||||
[AC_DEFINE(
|
|
||||||
GCC_HAS_VISIBILITY,
|
|
||||||
[],
|
|
||||||
[Defined if GCC supports the visibility feature])
|
|
||||||
m4_if([$1], [], [:], [$1])
|
|
||||||
AC_MSG_RESULT(yes)],
|
|
||||||
[m4_if([$2], [], [:], [$2])
|
|
||||||
AC_MSG_RESULT(no)])
|
|
||||||
|
|
||||||
CFLAGS=${save_CFLAGS}
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl Detection and configuration of the visibility feature of gcc
|
|
||||||
dnl Vincent Torri 2006-02-11
|
|
||||||
dnl
|
|
||||||
dnl XCB_EXTENSION(name, default)
|
|
||||||
dnl set the X extension
|
|
||||||
dnl
|
|
||||||
AC_DEFUN([XCB_EXTENSION],
|
|
||||||
[dnl
|
|
||||||
pushdef([UP], translit([$1], [-a-z], [_A-Z]))dnl
|
|
||||||
pushdef([DOWN], translit([$1], [A-Z], [a-z]))dnl
|
|
||||||
dnl
|
|
||||||
m4_if([$2], [yes], [m4_define([xcb_defopt], [yes])],
|
|
||||||
[$2], [no], [m4_define([xcb_defopt], [no])],
|
|
||||||
m4_define([xcb_defopt], [auto]))dnl
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(DOWN,
|
|
||||||
[AS_HELP_STRING([--enable-[]DOWN],
|
|
||||||
[Build XCB $1 Extension (default: ]xcb_defopt[)])],
|
|
||||||
[BUILD_[]UP=$enableval],
|
|
||||||
[BUILD_[]UP=xcb_defopt])
|
|
||||||
dnl
|
|
||||||
m4_if(xcb_defopt, [auto], [
|
|
||||||
# This extension has a default value of "auto" and depends on the value of $2
|
|
||||||
if test "x$BUILD_[]UP" = "xauto" ; then
|
|
||||||
BUILD_[]UP=$2
|
|
||||||
fi
|
|
||||||
if test "x$BUILD_[]UP" = "xyes" ; then
|
|
||||||
if test "x$2" = "xno" ; then
|
|
||||||
AC_MSG_ERROR([Extension []UP requested, but dependencies are not met])
|
|
||||||
fi
|
|
||||||
fi])
|
|
||||||
|
|
||||||
m4_undefine([xcb_defopt])dnl
|
|
||||||
AM_CONDITIONAL(BUILD_[]UP, [test "x$BUILD_[]UP" = "xyes"])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl End of acinclude.m4
|
|
|
@ -1 +0,0 @@
|
||||||
*.[0-9]
|
|
|
@ -1,18 +0,0 @@
|
||||||
|
|
||||||
libmandir = $(LIB_MAN_DIR)
|
|
||||||
|
|
||||||
libman_PRE = \
|
|
||||||
xcb-examples.man \
|
|
||||||
xcb-requests.man
|
|
||||||
|
|
||||||
libman_DATA = $(libman_PRE:man=$(LIB_MAN_SUFFIX))
|
|
||||||
|
|
||||||
EXTRA_DIST = $(libman_PRE)
|
|
||||||
|
|
||||||
CLEANFILES = $(libman_DATA)
|
|
||||||
|
|
||||||
# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
|
|
||||||
SUFFIXES = .$(LIB_MAN_SUFFIX) .man
|
|
||||||
|
|
||||||
.man.$(LIB_MAN_SUFFIX):
|
|
||||||
$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
|
|
|
@ -1,59 +0,0 @@
|
||||||
.TH xcb-examples __libmansuffix__ __xorgversion__ "XCB examples"
|
|
||||||
.ad l
|
|
||||||
.SH NAME
|
|
||||||
xcb-examples \- manpage examples
|
|
||||||
.SH DESCRIPTION
|
|
||||||
Many of the XCB manpages contain example code. These examples intend to explain
|
|
||||||
how to use one particular part of XCB. They almost never represent a standalone
|
|
||||||
(or even useful) program - X11 programs are relatively involved and
|
|
||||||
thus beyond the scope of a manpage example.
|
|
||||||
|
|
||||||
.SH ENVIRONMENT
|
|
||||||
|
|
||||||
Every example assumes you have an \fIxcb_connection\fP and possibly other
|
|
||||||
variables at hand. For illustrating how \fIxcb_get_property\fP works, you need
|
|
||||||
the window of which you want to get the property, for example. To make it clear
|
|
||||||
that these variables are your responsibility, these examples consist of a
|
|
||||||
single function which takes the necessary variables as parameters.
|
|
||||||
|
|
||||||
.SH FLUSHING
|
|
||||||
|
|
||||||
Flushing means calling \fIxcb_flush\fP to clear the XCB-internal write buffer
|
|
||||||
and send all pending requests to the X11 server. You don't explicitly need to
|
|
||||||
flush before using a reply function (like \fIxcb_query_pointer_reply\fP), but
|
|
||||||
you do need to flush before entering the event loop of your program.
|
|
||||||
|
|
||||||
There are only two cases when XCB flushes by itself. The first case is when
|
|
||||||
its write buffer becomes full, the second case is when you are asking for
|
|
||||||
the reply of a request which wasn't flushed out yet (like
|
|
||||||
\fIxcb_query_pointer_reply\fP). This last point also includes
|
|
||||||
xcb_request_check(). Please note that waiting for an event does \fBNOT\fP
|
|
||||||
flush.
|
|
||||||
|
|
||||||
Examples generally include the \fIxcb_flush\fP call where appropriate (for
|
|
||||||
example after setting a property). Therefore, including these functions and
|
|
||||||
calling them in your application should just work. However, you might get
|
|
||||||
better results when flushing outside of the function, depending on the
|
|
||||||
architecture of your program.
|
|
||||||
|
|
||||||
.SH COMPILATION
|
|
||||||
|
|
||||||
If an example does not compile (without warnings) when using \fI-std=c99\fP,
|
|
||||||
that is considered a documentation bug. Similarly, not handling errors or
|
|
||||||
leaking memory is also considered a documentation bug. Please inform us about
|
|
||||||
it on xcb@lists.freedesktop.org.
|
|
||||||
|
|
||||||
.SH CODING STYLE
|
|
||||||
|
|
||||||
Every example uses 4 spaces for indentation.
|
|
||||||
|
|
||||||
Comments are in asterisks, like /* this */.
|
|
||||||
|
|
||||||
No line is longer than 80 characters (including indentation).
|
|
||||||
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR xcb_connect (__libmansuffix__),
|
|
||||||
.BR xcb_get_property (__libmansuffix__),
|
|
||||||
.BR xcb_flush (__libmansuffix__)
|
|
||||||
.SH AUTHOR
|
|
||||||
Michael Stapelberg <michael+xcb at stapelberg dot de>
|
|
|
@ -1,165 +0,0 @@
|
||||||
.TH xcb-requests __libmansuffix__ __xorgversion__ "XCB examples"
|
|
||||||
.ad l
|
|
||||||
.SH NAME
|
|
||||||
xcb-requests \- about request manpages
|
|
||||||
.SH DESCRIPTION
|
|
||||||
Every request in X11, like \fIMapWindow\fP, corresponds to a number of
|
|
||||||
functions and data structures in XCB. For \fIMapWindow\fP, XCB provides the
|
|
||||||
function \fIxcb_map_window\fP, which fills the \fIxcb_map_window_request_t\fP
|
|
||||||
data structure and writes that to the X11 connection. Since the \fIMapWindow\fP
|
|
||||||
request does not have a reply, this is the most simple case.
|
|
||||||
|
|
||||||
.SH REPLIES
|
|
||||||
|
|
||||||
Many requests have replies. For each reply, XCB provides at least a
|
|
||||||
corresponding data structure and a function to return a pointer to a filled
|
|
||||||
data structure. Let's take the \fIInternAtom\fP request as an example: XCB
|
|
||||||
provides the \fIxcb_intern_atom_reply_t\fP data structure and
|
|
||||||
\fIxcb_intern_atom_reply\fP function. For replies which are more complex (for
|
|
||||||
example lists, such as in \fIxcb_list_fonts\fP), accessor functions are
|
|
||||||
provided.
|
|
||||||
|
|
||||||
.SH COOKIES
|
|
||||||
|
|
||||||
XCB returns a cookie for each request you send. This is an XCB-specific data
|
|
||||||
structure containing the sequence number with which the request was sent to the
|
|
||||||
X11 server. To get any reply, you have to provide that cookie (so that XCB
|
|
||||||
knows which of the waiting replies you want). Here is an example to illustrate
|
|
||||||
the use of cookies:
|
|
||||||
|
|
||||||
.nf
|
|
||||||
.sp
|
|
||||||
void my_example(xcb_connection *conn) {
|
|
||||||
xcb_intern_atom_cookie_t cookie;
|
|
||||||
xcb_intern_atom_reply_t *reply;
|
|
||||||
|
|
||||||
cookie = xcb_intern_atom(conn, 0, strlen("_NET_WM_NAME"), "_NET_WM_NAME");
|
|
||||||
/* ... do other work here if possible ... */
|
|
||||||
if ((reply = xcb_intern_atom_reply(conn, cookie, NULL))) {
|
|
||||||
printf("The _NET_WM_NAME atom has ID %u\\n", reply->atom);
|
|
||||||
}
|
|
||||||
free(reply);
|
|
||||||
}
|
|
||||||
.fi
|
|
||||||
|
|
||||||
.SH CHECKED VS. UNCHECKED
|
|
||||||
|
|
||||||
The checked and unchecked suffixes for functions determine which kind of error
|
|
||||||
handling is used for this specific request.
|
|
||||||
|
|
||||||
For requests which have no reply (for example \fIxcb_map_window\fP), errors
|
|
||||||
will be delivered to the event loop (you will receive an X11 event of type 0
|
|
||||||
when calling \fIxcb_poll_for_event\fP).
|
|
||||||
If you want to explicitly check for errors in a blocking fashion, call the
|
|
||||||
_checked version of the function (for example \fIxcb_map_window_checked\fP) and
|
|
||||||
use \fIxcb_request_check\fP.
|
|
||||||
|
|
||||||
For requests which have a reply (for example \fIxcb_intern_atom\fP), errors
|
|
||||||
will be checked when calling the reply function. To get errors in the event
|
|
||||||
loop instead, use the _unchecked version of the function (for example
|
|
||||||
\fIxcb_intern_atom_unchecked\fP).
|
|
||||||
|
|
||||||
Here is an example which illustrates the four different ways of handling errors:
|
|
||||||
|
|
||||||
.nf
|
|
||||||
.sp
|
|
||||||
/*
|
|
||||||
* Request without a reply, handling errors in the event loop (default)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void my_example(xcb_connection *conn, xcb_window_t window) {
|
|
||||||
/* This is a request without a reply. Errors will be delivered to the event
|
|
||||||
* loop. Getting an error to xcb_map_window most likely is a bug in our
|
|
||||||
* program, so we don't need to check for that in a blocking way. */
|
|
||||||
xcb_map_window(conn, window);
|
|
||||||
|
|
||||||
/* ... of course your event loop would not be in the same function ... */
|
|
||||||
while ((event = xcb_wait_for_event(conn)) != NULL) {
|
|
||||||
if (event->response_type == 0) {
|
|
||||||
fprintf("Received X11 error %d\\n", error->error_code);
|
|
||||||
free(event);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ... handle a normal event ... */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Request without a reply, handling errors directly
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void my_example(xcb_connection *conn, xcb_window_t deco, xcb_window_t window) {
|
|
||||||
/* A reparenting window manager wants to know whether a new window was
|
|
||||||
* successfully reparented. If not (because the window got destroyed
|
|
||||||
* already, for example), it does not make sense to map an empty window
|
|
||||||
* decoration at all, so we need to know this right now. */
|
|
||||||
xcb_void_cookie_t cookie = xcb_reparent_window_checked(conn, window,
|
|
||||||
deco, 0, 0);
|
|
||||||
xcb_generic_error_t *error;
|
|
||||||
if ((error = xcb_request_check(conn, cookie))) {
|
|
||||||
fprintf(stderr, "Could not reparent the window\\n");
|
|
||||||
free(error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ... do window manager stuff here ... */
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Request with a reply, handling errors directly (default)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void my_example(xcb_connection *conn, xcb_window_t window) {
|
|
||||||
xcb_intern_atom_cookie_t cookie;
|
|
||||||
xcb_intern_atom_reply_t *reply;
|
|
||||||
xcb_generic_error_t *error;
|
|
||||||
|
|
||||||
cookie = xcb_intern_atom(c, 0, strlen("_NET_WM_NAME"), "_NET_WM_NAME");
|
|
||||||
/* ... do other work here if possible ... */
|
|
||||||
if ((reply = xcb_intern_atom_reply(c, cookie, &error))) {
|
|
||||||
printf("The _NET_WM_NAME atom has ID %u\\n", reply->atom);
|
|
||||||
free(reply);
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, "X11 Error %d\\n", error->error_code);
|
|
||||||
free(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Request with a reply, handling errors in the event loop
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void my_example(xcb_connection *conn, xcb_window_t window) {
|
|
||||||
xcb_intern_atom_cookie_t cookie;
|
|
||||||
xcb_intern_atom_reply_t *reply;
|
|
||||||
|
|
||||||
cookie = xcb_intern_atom_unchecked(c, 0, strlen("_NET_WM_NAME"),
|
|
||||||
"_NET_WM_NAME");
|
|
||||||
/* ... do other work here if possible ... */
|
|
||||||
if ((reply = xcb_intern_atom_reply(c, cookie, NULL))) {
|
|
||||||
printf("The _NET_WM_NAME atom has ID %u\\n", reply->atom);
|
|
||||||
free(reply);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ... of course your event loop would not be in the same function ... */
|
|
||||||
while ((event = xcb_wait_for_event(conn)) != NULL) {
|
|
||||||
if (event->response_type == 0) {
|
|
||||||
fprintf("Received X11 error %d\\n", error->error_code);
|
|
||||||
free(event);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ... handle a normal event ... */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.fi
|
|
||||||
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR xcb_map_window (__libmansuffix__),
|
|
||||||
.BR xcb_intern_atom (__libmansuffix__),
|
|
||||||
.BR xcb_list_fonts (__libmansuffix__),
|
|
||||||
.BR xcb_poll_for_event (__libmansuffix__),
|
|
||||||
.BR xcb_request_check (__libmansuffix__)
|
|
||||||
.SH AUTHOR
|
|
||||||
Michael Stapelberg <michael+xcb at stapelberg dot de>
|
|
|
@ -1,13 +1,8 @@
|
||||||
bigreq.*
|
bigreq.*
|
||||||
composite.*
|
composite.*
|
||||||
damage.*
|
damage.*
|
||||||
dbe.*
|
|
||||||
dpms.*
|
dpms.*
|
||||||
dri2.*
|
|
||||||
dri3.*
|
|
||||||
ge.*
|
|
||||||
glx.*
|
glx.*
|
||||||
present.*
|
|
||||||
randr.*
|
randr.*
|
||||||
record.*
|
record.*
|
||||||
render.*
|
render.*
|
||||||
|
@ -21,10 +16,7 @@ xevie.*
|
||||||
xf86dri.*
|
xf86dri.*
|
||||||
xfixes.*
|
xfixes.*
|
||||||
xinerama.*
|
xinerama.*
|
||||||
xinput.*
|
|
||||||
xkb.*
|
|
||||||
xprint.*
|
xprint.*
|
||||||
xselinux.*
|
|
||||||
xtest.*
|
xtest.*
|
||||||
xv.*
|
xv.*
|
||||||
xvmc.*
|
xvmc.*
|
||||||
|
|
374
src/Makefile.am
374
src/Makefile.am
|
@ -1,15 +1,105 @@
|
||||||
lib_LTLIBRARIES = libxcb.la
|
lib_LTLIBRARIES = libxcb.la \
|
||||||
|
libxcb-xlib.la \
|
||||||
|
libxcb-composite.la \
|
||||||
|
libxcb-damage.la \
|
||||||
|
libxcb-dpms.la \
|
||||||
|
libxcb-glx.la \
|
||||||
|
libxcb-randr.la \
|
||||||
|
libxcb-record.la \
|
||||||
|
libxcb-render.la \
|
||||||
|
libxcb-res.la \
|
||||||
|
libxcb-screensaver.la \
|
||||||
|
libxcb-shape.la \
|
||||||
|
libxcb-shm.la \
|
||||||
|
libxcb-sync.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 = xproto.h \
|
||||||
|
bigreq.h \
|
||||||
|
composite.h \
|
||||||
|
damage.h \
|
||||||
|
dpms.h \
|
||||||
|
glx.h \
|
||||||
|
randr.h \
|
||||||
|
record.h \
|
||||||
|
render.h \
|
||||||
|
res.h \
|
||||||
|
screensaver.h \
|
||||||
|
shape.h \
|
||||||
|
shm.h \
|
||||||
|
sync.h \
|
||||||
|
xc_misc.h \
|
||||||
|
xevie.h \
|
||||||
|
xf86dri.h \
|
||||||
|
xfixes.h \
|
||||||
|
xinerama.h \
|
||||||
|
xprint.h \
|
||||||
|
xtest.h \
|
||||||
|
xv.h \
|
||||||
|
xvmc.h
|
||||||
EXTSOURCES = xproto.c \
|
EXTSOURCES = xproto.c \
|
||||||
bigreq.c \
|
bigreq.c \
|
||||||
xc_misc.c
|
composite.c \
|
||||||
|
damage.c \
|
||||||
|
dpms.c \
|
||||||
|
glx.c \
|
||||||
|
randr.c \
|
||||||
|
record.c \
|
||||||
|
render.c \
|
||||||
|
res.c \
|
||||||
|
screensaver.c \
|
||||||
|
shape.c \
|
||||||
|
shm.c \
|
||||||
|
sync.c \
|
||||||
|
xc_misc.c \
|
||||||
|
xevie.c \
|
||||||
|
xf86dri.c \
|
||||||
|
xfixes.c \
|
||||||
|
xinerama.c \
|
||||||
|
xprint.c \
|
||||||
|
xtest.c \
|
||||||
|
xv.c \
|
||||||
|
xvmc.c
|
||||||
|
EXTENSION_XML = xproto.xml \
|
||||||
|
bigreq.xml \
|
||||||
|
composite.xml \
|
||||||
|
damage.xml \
|
||||||
|
dpms.xml \
|
||||||
|
glx.xml \
|
||||||
|
randr.xml \
|
||||||
|
record.xml \
|
||||||
|
render.xml \
|
||||||
|
res.xml \
|
||||||
|
screensaver.xml \
|
||||||
|
shape.xml \
|
||||||
|
shm.xml \
|
||||||
|
sync.xml \
|
||||||
|
xc_misc.xml \
|
||||||
|
xevie.xml \
|
||||||
|
xf86dri.xml \
|
||||||
|
xfixes.xml \
|
||||||
|
xinerama.xml \
|
||||||
|
xprint.xml \
|
||||||
|
xtest.xml \
|
||||||
|
xvmc.xml \
|
||||||
|
xv.xml
|
||||||
|
|
||||||
AM_CFLAGS = $(BASE_CFLAGS) $(NEEDED_CFLAGS) $(XDMCP_CFLAGS)
|
xcbinclude_HEADERS = xcb.h xcbext.h xcbxlib.h $(EXTHEADERS)
|
||||||
|
noinst_HEADERS = xcbint.h
|
||||||
|
|
||||||
|
AM_CFLAGS = $(CWARNFLAGS) $(NEEDED_CFLAGS) $(XDMCP_CFLAGS)
|
||||||
libxcb_la_LIBADD = $(NEEDED_LIBS) $(XDMCP_LIBS)
|
libxcb_la_LIBADD = $(NEEDED_LIBS) $(XDMCP_LIBS)
|
||||||
libxcb_la_SOURCES = \
|
libxcb_la_SOURCES = \
|
||||||
xcb_conn.c xcb_out.c xcb_in.c xcb_ext.c xcb_xid.c \
|
xcb_conn.c xcb_out.c xcb_in.c xcb_ext.c xcb_xid.c \
|
||||||
xcb_list.c xcb_util.c xcb_auth.c c_client.py
|
xcb_list.c xcb_util.c xcb_auth.c c-client.xsl \
|
||||||
nodist_libxcb_la_SOURCES = xproto.c bigreq.c xc_misc.c
|
xproto.c bigreq.c xc_misc.c
|
||||||
|
|
||||||
# Explanation for -version-info:
|
# Explanation for -version-info:
|
||||||
# -version-info current:revision:age
|
# -version-info current:revision:age
|
||||||
|
@ -18,260 +108,116 @@ nodist_libxcb_la_SOURCES = xproto.c bigreq.c xc_misc.c
|
||||||
# * If you add an interface, increment current and age and set revision to 0.
|
# * If you add an interface, increment current and age and set revision to 0.
|
||||||
# * If you change or remove an interface, increment current and set revision
|
# * If you change or remove an interface, increment current and set revision
|
||||||
# and age to 0.
|
# and age to 0.
|
||||||
libxcb_la_LDFLAGS = -version-info 2:0:1 -no-undefined @lt_enable_auto_import@
|
libxcb_la_LDFLAGS = -version-info 1:0:0
|
||||||
|
|
||||||
|
BUILT_SOURCES = $(EXTSOURCES) $(EXTHEADERS)
|
||||||
|
CLEANFILES = $(EXTSOURCES) $(EXTHEADERS) $(EXTENSION_XML)
|
||||||
|
|
||||||
XCB_LIBS = libxcb.la
|
XCB_LIBS = libxcb.la
|
||||||
|
|
||||||
|
libxcb_xlib_la_LDFLAGS = -version-info 0:0:0
|
||||||
|
libxcb_xlib_la_LIBADD = $(XCB_LIBS)
|
||||||
|
libxcb_xlib_la_SOURCES = xcb_xlib.c
|
||||||
|
|
||||||
# FIXME: find a way to autogenerate this from the XML files.
|
# FIXME: find a way to autogenerate this from the XML files.
|
||||||
|
|
||||||
EXTSOURCES += composite.c
|
libxcb_composite_la_LDFLAGS = -version-info 0:0:0
|
||||||
if BUILD_COMPOSITE
|
|
||||||
lib_LTLIBRARIES += libxcb-composite.la
|
|
||||||
libxcb_composite_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_composite_la_LIBADD = $(XCB_LIBS)
|
libxcb_composite_la_LIBADD = $(XCB_LIBS)
|
||||||
nodist_libxcb_composite_la_SOURCES = composite.c composite.h
|
libxcb_composite_la_SOURCES = composite.c composite.h
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += damage.c
|
libxcb_damage_la_LDFLAGS = -version-info 0:0:0
|
||||||
if BUILD_DAMAGE
|
|
||||||
lib_LTLIBRARIES += libxcb-damage.la
|
|
||||||
libxcb_damage_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_damage_la_LIBADD = $(XCB_LIBS)
|
libxcb_damage_la_LIBADD = $(XCB_LIBS)
|
||||||
nodist_libxcb_damage_la_SOURCES = damage.c damage.h
|
libxcb_damage_la_SOURCES = damage.c damage.h
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += dbe.c
|
libxcb_dpms_la_LDFLAGS = -version-info 0:0:0
|
||||||
if BUILD_DBE
|
|
||||||
lib_LTLIBRARIES += libxcb-dbe.la
|
|
||||||
libxcb_dbe_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_dbe_la_LIBADD = $(XCB_LIBS)
|
|
||||||
nodist_libxcb_dbe_la_SOURCES = dbe.c dbe.h
|
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += dpms.c
|
|
||||||
if BUILD_DPMS
|
|
||||||
lib_LTLIBRARIES += libxcb-dpms.la
|
|
||||||
libxcb_dpms_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_dpms_la_LIBADD = $(XCB_LIBS)
|
libxcb_dpms_la_LIBADD = $(XCB_LIBS)
|
||||||
nodist_libxcb_dpms_la_SOURCES = dpms.c dpms.h
|
libxcb_dpms_la_SOURCES = dpms.c dpms.h
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += dri2.c
|
libxcb_glx_la_LDFLAGS = -version-info 0:0:0
|
||||||
if BUILD_DRI2
|
|
||||||
lib_LTLIBRARIES += libxcb-dri2.la
|
|
||||||
libxcb_dri2_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_dri2_la_LIBADD = $(XCB_LIBS)
|
|
||||||
nodist_libxcb_dri2_la_SOURCES = dri2.c dri2.h
|
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += dri3.c
|
|
||||||
if BUILD_DRI3
|
|
||||||
lib_LTLIBRARIES += libxcb-dri3.la
|
|
||||||
libxcb_dri3_la_LDFLAGS = -version-info 1:0:1 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_dri3_la_LIBADD = $(XCB_LIBS)
|
|
||||||
nodist_libxcb_dri3_la_SOURCES = dri3.c dri3.h
|
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += present.c
|
|
||||||
if BUILD_PRESENT
|
|
||||||
lib_LTLIBRARIES += libxcb-present.la
|
|
||||||
libxcb_present_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_present_la_LIBADD = $(XCB_LIBS)
|
|
||||||
nodist_libxcb_present_la_SOURCES = present.c present.h
|
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += glx.c
|
|
||||||
if BUILD_GLX
|
|
||||||
lib_LTLIBRARIES += libxcb-glx.la
|
|
||||||
libxcb_glx_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_glx_la_LIBADD = $(XCB_LIBS)
|
libxcb_glx_la_LIBADD = $(XCB_LIBS)
|
||||||
nodist_libxcb_glx_la_SOURCES = glx.c glx.h
|
libxcb_glx_la_SOURCES = glx.c glx.h
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += randr.c
|
libxcb_randr_la_LDFLAGS = -version-info 0:0:0
|
||||||
if BUILD_RANDR
|
|
||||||
lib_LTLIBRARIES += libxcb-randr.la
|
|
||||||
libxcb_randr_la_LDFLAGS = -version-info 1:0:1 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_randr_la_LIBADD = $(XCB_LIBS)
|
libxcb_randr_la_LIBADD = $(XCB_LIBS)
|
||||||
nodist_libxcb_randr_la_SOURCES = randr.c randr.h
|
libxcb_randr_la_SOURCES = randr.c randr.h
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += record.c
|
libxcb_record_la_LDFLAGS = -version-info 0:0:0
|
||||||
if BUILD_RECORD
|
|
||||||
lib_LTLIBRARIES += libxcb-record.la
|
|
||||||
libxcb_record_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_record_la_LIBADD = $(XCB_LIBS)
|
libxcb_record_la_LIBADD = $(XCB_LIBS)
|
||||||
nodist_libxcb_record_la_SOURCES = record.c record.h
|
libxcb_record_la_SOURCES = record.c record.h
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += render.c
|
libxcb_render_la_LDFLAGS = -version-info 0:0:0
|
||||||
if BUILD_RENDER
|
|
||||||
lib_LTLIBRARIES += libxcb-render.la
|
|
||||||
libxcb_render_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_render_la_LIBADD = $(XCB_LIBS)
|
libxcb_render_la_LIBADD = $(XCB_LIBS)
|
||||||
nodist_libxcb_render_la_SOURCES = render.c render.h
|
libxcb_render_la_SOURCES = render.c render.h
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += res.c
|
libxcb_res_la_LDFLAGS = -version-info 0:0:0
|
||||||
if BUILD_RESOURCE
|
|
||||||
lib_LTLIBRARIES += libxcb-res.la
|
|
||||||
libxcb_res_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_res_la_LIBADD = $(XCB_LIBS)
|
libxcb_res_la_LIBADD = $(XCB_LIBS)
|
||||||
nodist_libxcb_res_la_SOURCES = res.c res.h
|
libxcb_res_la_SOURCES = res.c res.h
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += screensaver.c
|
libxcb_screensaver_la_LDFLAGS = -version-info 0:0:0
|
||||||
if BUILD_SCREENSAVER
|
|
||||||
lib_LTLIBRARIES += libxcb-screensaver.la
|
|
||||||
libxcb_screensaver_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_screensaver_la_LIBADD = $(XCB_LIBS)
|
libxcb_screensaver_la_LIBADD = $(XCB_LIBS)
|
||||||
nodist_libxcb_screensaver_la_SOURCES = screensaver.c screensaver.h
|
libxcb_screensaver_la_SOURCES = screensaver.c screensaver.h
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += shape.c
|
libxcb_shape_la_LDFLAGS = -version-info 0:0:0
|
||||||
if BUILD_SHAPE
|
|
||||||
lib_LTLIBRARIES += libxcb-shape.la
|
|
||||||
libxcb_shape_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_shape_la_LIBADD = $(XCB_LIBS)
|
libxcb_shape_la_LIBADD = $(XCB_LIBS)
|
||||||
nodist_libxcb_shape_la_SOURCES = shape.c shape.h
|
libxcb_shape_la_SOURCES = shape.c shape.h
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += shm.c
|
libxcb_shm_la_LDFLAGS = -version-info 0:0:0
|
||||||
if BUILD_SHM
|
|
||||||
lib_LTLIBRARIES += libxcb-shm.la
|
|
||||||
libxcb_shm_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_shm_la_LIBADD = $(XCB_LIBS)
|
libxcb_shm_la_LIBADD = $(XCB_LIBS)
|
||||||
nodist_libxcb_shm_la_SOURCES = shm.c shm.h
|
libxcb_shm_la_SOURCES = shm.c shm.h
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += sync.c
|
libxcb_sync_la_LDFLAGS = -version-info 0:0:0
|
||||||
if BUILD_SYNC
|
|
||||||
lib_LTLIBRARIES += libxcb-sync.la
|
|
||||||
libxcb_sync_la_LDFLAGS = -version-info 1:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_sync_la_LIBADD = $(XCB_LIBS)
|
libxcb_sync_la_LIBADD = $(XCB_LIBS)
|
||||||
nodist_libxcb_sync_la_SOURCES = sync.c sync.h
|
libxcb_sync_la_SOURCES = sync.c sync.h
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += xevie.c
|
libxcb_xevie_la_LDFLAGS = -version-info 0:0:0
|
||||||
if BUILD_XEVIE
|
|
||||||
lib_LTLIBRARIES += libxcb-xevie.la
|
|
||||||
libxcb_xevie_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_xevie_la_LIBADD = $(XCB_LIBS)
|
libxcb_xevie_la_LIBADD = $(XCB_LIBS)
|
||||||
nodist_libxcb_xevie_la_SOURCES = xevie.c xevie.h
|
libxcb_xevie_la_SOURCES = xevie.c xevie.h
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += xf86dri.c
|
libxcb_xf86dri_la_LDFLAGS = -version-info 0:0:0
|
||||||
if BUILD_XFREE86_DRI
|
|
||||||
lib_LTLIBRARIES += libxcb-xf86dri.la
|
|
||||||
libxcb_xf86dri_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_xf86dri_la_LIBADD = $(XCB_LIBS)
|
libxcb_xf86dri_la_LIBADD = $(XCB_LIBS)
|
||||||
nodist_libxcb_xf86dri_la_SOURCES = xf86dri.c xf86dri.h
|
libxcb_xf86dri_la_SOURCES = xf86dri.c xf86dri.h
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += xfixes.c
|
libxcb_xfixes_la_LDFLAGS = -version-info 0:0:0
|
||||||
if BUILD_XFIXES
|
|
||||||
lib_LTLIBRARIES += libxcb-xfixes.la
|
|
||||||
libxcb_xfixes_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_xfixes_la_LIBADD = $(XCB_LIBS)
|
libxcb_xfixes_la_LIBADD = $(XCB_LIBS)
|
||||||
nodist_libxcb_xfixes_la_SOURCES = xfixes.c xfixes.h
|
libxcb_xfixes_la_SOURCES = xfixes.c xfixes.h
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += xinerama.c
|
libxcb_xprint_la_LDFLAGS = -version-info 0:0:0
|
||||||
if BUILD_XINERAMA
|
|
||||||
lib_LTLIBRARIES += libxcb-xinerama.la
|
|
||||||
libxcb_xinerama_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_xinerama_la_LIBADD = $(XCB_LIBS)
|
|
||||||
nodist_libxcb_xinerama_la_SOURCES = xinerama.c xinerama.h
|
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += xinput.c
|
|
||||||
if BUILD_XINPUT
|
|
||||||
lib_LTLIBRARIES += libxcb-xinput.la
|
|
||||||
libxcb_xinput_la_LDFLAGS = -version-info 1:0:1 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_xinput_la_LIBADD = $(XCB_LIBS)
|
|
||||||
nodist_libxcb_xinput_la_SOURCES = xinput.c xinput.h
|
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += xkb.c
|
|
||||||
if BUILD_XKB
|
|
||||||
lib_LTLIBRARIES += libxcb-xkb.la
|
|
||||||
libxcb_xkb_la_LDFLAGS = -version-info 1:0:0 -no-undefined
|
|
||||||
libxcb_xkb_la_LIBADD = $(XCB_LIBS)
|
|
||||||
nodist_libxcb_xkb_la_SOURCES = xkb.c xkb.h
|
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += xprint.c
|
|
||||||
if BUILD_XPRINT
|
|
||||||
lib_LTLIBRARIES += libxcb-xprint.la
|
|
||||||
libxcb_xprint_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_xprint_la_LIBADD = $(XCB_LIBS)
|
libxcb_xprint_la_LIBADD = $(XCB_LIBS)
|
||||||
nodist_libxcb_xprint_la_SOURCES = xprint.c xprint.h
|
libxcb_xprint_la_SOURCES = xprint.c xprint.h
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += xselinux.c
|
libxcb_xtest_la_LDFLAGS = -version-info 0:0:0
|
||||||
if BUILD_SELINUX
|
|
||||||
lib_LTLIBRARIES += libxcb-xselinux.la
|
|
||||||
libxcb_xselinux_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_xselinux_la_LIBADD = $(XCB_LIBS)
|
|
||||||
nodist_libxcb_xselinux_la_SOURCES = xselinux.c xselinux.h
|
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += xtest.c
|
|
||||||
if BUILD_XTEST
|
|
||||||
lib_LTLIBRARIES += libxcb-xtest.la
|
|
||||||
libxcb_xtest_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_xtest_la_LIBADD = $(XCB_LIBS)
|
libxcb_xtest_la_LIBADD = $(XCB_LIBS)
|
||||||
nodist_libxcb_xtest_la_SOURCES = xtest.c xtest.h
|
libxcb_xtest_la_SOURCES = xtest.c xtest.h
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += xv.c
|
libxcb_xv_la_LDFLAGS = -version-info 0:0:0
|
||||||
if BUILD_XV
|
|
||||||
lib_LTLIBRARIES += libxcb-xv.la
|
|
||||||
libxcb_xv_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_xv_la_LIBADD = $(XCB_LIBS)
|
libxcb_xv_la_LIBADD = $(XCB_LIBS)
|
||||||
nodist_libxcb_xv_la_SOURCES = xv.c xv.h
|
libxcb_xv_la_SOURCES = xv.c xv.h
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += xvmc.c
|
libxcb_xvmc_la_LDFLAGS = -version-info 0:0:0
|
||||||
if BUILD_XVMC
|
|
||||||
lib_LTLIBRARIES += libxcb-xvmc.la
|
|
||||||
libxcb_xvmc_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_xvmc_la_LIBADD = $(XCB_LIBS)
|
libxcb_xvmc_la_LIBADD = $(XCB_LIBS)
|
||||||
nodist_libxcb_xvmc_la_SOURCES = xvmc.c xvmc.h
|
libxcb_xvmc_la_SOURCES = xvmc.c xvmc.h
|
||||||
endif
|
|
||||||
|
|
||||||
EXTSOURCES += ge.c
|
libxcb_xinerama_la_LDFLAGS = -version-info 0:0:0
|
||||||
if BUILD_GE
|
libxcb_xinerama_la_LIBADD = $(XCB_LIBS)
|
||||||
lib_LTLIBRARIES += libxcb-ge.la
|
libxcb_xinerama_la_SOURCES = xinerama.c xinerama.h
|
||||||
libxcb_ge_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
|
|
||||||
libxcb_ge_la_LIBADD = $(XCB_LIBS)
|
|
||||||
nodist_libxcb_ge_la_SOURCES = ge.c ge.h
|
|
||||||
endif
|
|
||||||
|
|
||||||
EXTHEADERS=$(EXTSOURCES:.c=.h)
|
$(EXTHEADERS) $(EXTSOURCES): c-client.xsl
|
||||||
xcbinclude_HEADERS = xcb.h xcbext.h
|
|
||||||
if XCB_HAVE_WIN32
|
|
||||||
xcbinclude_HEADERS += xcb_windefs.h
|
|
||||||
endif
|
|
||||||
nodist_xcbinclude_HEADERS = $(EXTHEADERS)
|
|
||||||
noinst_HEADERS = xcbint.h
|
|
||||||
|
|
||||||
BUILT_MAN_PAGES = man/xcb_*
|
SUFFIXES = .xml
|
||||||
libmandir = $(LIB_MAN_DIR)
|
|
||||||
libman_DATA = $(BUILT_MAN_PAGES)
|
|
||||||
|
|
||||||
BUILT_SOURCES = $(EXTSOURCES) $(BUILT_MAN_PAGES)
|
.xml.h:
|
||||||
CLEANFILES = $(EXTSOURCES) $(EXTHEADERS) $(BUILT_MAN_PAGES)
|
@n=`dirname $*`; test -d $$n || (echo mkdir $$n; mkdir $$n)
|
||||||
|
$(XSLTPROC) --stringparam mode header \
|
||||||
|
--stringparam base-path $(XCBPROTO_XCBINCLUDEDIR)/ \
|
||||||
|
--stringparam extension-path $(XCBPROTO_XCBINCLUDEDIR)/ \
|
||||||
|
-o $@ $(srcdir)/c-client.xsl $<
|
||||||
|
|
||||||
C_CLIENT_PY_EXTRA_ARGS =
|
.xml.c:
|
||||||
if XCB_SERVERSIDE_SUPPORT
|
@n=`dirname $*`; test -d $$n || (echo mkdir $$n; mkdir $$n)
|
||||||
C_CLIENT_PY_EXTRA_ARGS += --server-side
|
$(XSLTPROC) --stringparam mode source \
|
||||||
endif
|
--stringparam base-path $(XCBPROTO_XCBINCLUDEDIR)/ \
|
||||||
|
--stringparam extension-path $(XCBPROTO_XCBINCLUDEDIR)/ \
|
||||||
|
-o $@ $(srcdir)/c-client.xsl $<
|
||||||
|
|
||||||
$(EXTSOURCES): c_client.py $(XCBPROTO_XCBINCLUDEDIR)/$(@:.c=.xml)
|
$(EXTENSION_XML):
|
||||||
$(AM_V_GEN)$(PYTHON) $(srcdir)/c_client.py -c "$(PACKAGE_STRING)" -l "$(XORG_MAN_PAGE)" \
|
$(LN_S) -f $(XCBPROTO_XCBINCLUDEDIR)/$@ $@
|
||||||
-s "$(LIB_MAN_SUFFIX)" -p $(XCBPROTO_XCBPYTHONDIR) \
|
|
||||||
$(C_CLIENT_PY_EXTRA_ARGS) \
|
|
||||||
$(XCBPROTO_XCBINCLUDEDIR)/$(@:.c=.xml)
|
|
||||||
|
|
||||||
$(BUILT_MAN_PAGES): $(EXTSOURCES)
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
3395
src/c_client.py
3395
src/c_client.py
File diff suppressed because it is too large
Load Diff
|
@ -1,2 +0,0 @@
|
||||||
*.[0-9]
|
|
||||||
*.[0-9]x
|
|
311
src/xcb.h
311
src/xcb.h
|
@ -29,13 +29,13 @@
|
||||||
#define __XCB_H__
|
#define __XCB_H__
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#if defined(__solaris__)
|
||||||
|
#include <inttypes.h>
|
||||||
#ifndef _WIN32
|
|
||||||
#include <sys/uio.h>
|
|
||||||
#else
|
#else
|
||||||
#include "xcb_windefs.h"
|
#include <stdint.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <sys/uio.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,36 +47,6 @@ extern "C" {
|
||||||
* @file xcb.h
|
* @file xcb.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __has_attribute
|
|
||||||
# define __has_attribute(x) 0 /* Compatibility with older compilers. */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* For the below checks, we currently assume that __GNUC__ indicates
|
|
||||||
* gcc 3.0 (released 2001) or later, as we require support for C99.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Supported in gcc 2.5 and later */
|
|
||||||
#if defined(__GNUC__) || __has_attribute(__const__)
|
|
||||||
#define XCB_CONST_FUNCTION __attribute__((__const__))
|
|
||||||
#else
|
|
||||||
#define XCB_CONST_FUNCTION XCB_PURE_FUNCTION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Supported in gcc 2.7 and later */
|
|
||||||
#if defined(__GNUC__) || __has_attribute(__packed__)
|
|
||||||
#define XCB_PACKED __attribute__((__packed__))
|
|
||||||
#else
|
|
||||||
#define XCB_PACKED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Supported in gcc 2.96 and later */
|
|
||||||
#if defined(__GNUC__) || __has_attribute(__pure__)
|
|
||||||
#define XCB_PURE_FUNCTION __attribute__((__pure__))
|
|
||||||
#else
|
|
||||||
#define XCB_PURE_FUNCTION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup XCB_Core_API XCB Core API
|
* @defgroup XCB_Core_API XCB Core API
|
||||||
* @brief Core API of the XCB library.
|
* @brief Core API of the XCB library.
|
||||||
|
@ -95,27 +65,6 @@ extern "C" {
|
||||||
/** X_TCP_PORT + display number = server port for TCP transport */
|
/** X_TCP_PORT + display number = server port for TCP transport */
|
||||||
#define X_TCP_PORT 6000
|
#define X_TCP_PORT 6000
|
||||||
|
|
||||||
/** xcb connection errors because of socket, pipe and other stream errors. */
|
|
||||||
#define XCB_CONN_ERROR 1
|
|
||||||
|
|
||||||
/** xcb connection shutdown because of extension not supported */
|
|
||||||
#define XCB_CONN_CLOSED_EXT_NOTSUPPORTED 2
|
|
||||||
|
|
||||||
/** malloc(), calloc() and realloc() error upon failure, for eg ENOMEM */
|
|
||||||
#define XCB_CONN_CLOSED_MEM_INSUFFICIENT 3
|
|
||||||
|
|
||||||
/** Connection closed, exceeding request length that server accepts. */
|
|
||||||
#define XCB_CONN_CLOSED_REQ_LEN_EXCEED 4
|
|
||||||
|
|
||||||
/** Connection closed, error during parsing display string. */
|
|
||||||
#define XCB_CONN_CLOSED_PARSE_ERR 5
|
|
||||||
|
|
||||||
/** Connection closed because the server does not have a screen matching the display. */
|
|
||||||
#define XCB_CONN_CLOSED_INVALID_SCREEN 6
|
|
||||||
|
|
||||||
/** Connection closed because some FD passing operation failed */
|
|
||||||
#define XCB_CONN_CLOSED_FDPASSING_FAILED 7
|
|
||||||
|
|
||||||
#define XCB_TYPE_PAD(T,I) (-(I) & (sizeof(T) > 4 ? 3 : sizeof(T) - 1))
|
#define XCB_TYPE_PAD(T,I) (-(I) & (sizeof(T) > 4 ? 3 : sizeof(T) - 1))
|
||||||
|
|
||||||
/* Opaque structures */
|
/* Opaque structures */
|
||||||
|
@ -166,38 +115,6 @@ typedef struct {
|
||||||
uint32_t full_sequence; /**< full sequence */
|
uint32_t full_sequence; /**< full sequence */
|
||||||
} xcb_generic_event_t;
|
} xcb_generic_event_t;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Raw Generic event.
|
|
||||||
*
|
|
||||||
* A generic event structure as used on the wire, i.e., without the full_sequence field
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
uint8_t response_type; /**< Type of the response */
|
|
||||||
uint8_t pad0; /**< Padding */
|
|
||||||
uint16_t sequence; /**< Sequence number */
|
|
||||||
uint32_t pad[7]; /**< Padding */
|
|
||||||
} xcb_raw_generic_event_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief GE event
|
|
||||||
*
|
|
||||||
* An event as sent by the XGE extension. The length field specifies the
|
|
||||||
* number of 4-byte blocks trailing the struct.
|
|
||||||
*
|
|
||||||
* @deprecated Since some fields in this struct have unfortunate names, it is
|
|
||||||
* recommended to use xcb_ge_generic_event_t instead.
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
uint8_t response_type; /**< Type of the response */
|
|
||||||
uint8_t pad0; /**< Padding */
|
|
||||||
uint16_t sequence; /**< Sequence number */
|
|
||||||
uint32_t length;
|
|
||||||
uint16_t event_type;
|
|
||||||
uint16_t pad1;
|
|
||||||
uint32_t pad[5]; /**< Padding */
|
|
||||||
uint32_t full_sequence; /**< full sequence */
|
|
||||||
} xcb_ge_event_t;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Generic error.
|
* @brief Generic error.
|
||||||
*
|
*
|
||||||
|
@ -207,11 +124,7 @@ typedef struct {
|
||||||
uint8_t response_type; /**< Type of the response */
|
uint8_t response_type; /**< Type of the response */
|
||||||
uint8_t error_code; /**< Error code */
|
uint8_t error_code; /**< Error code */
|
||||||
uint16_t sequence; /**< Sequence number */
|
uint16_t sequence; /**< Sequence number */
|
||||||
uint32_t resource_id; /** < Resource ID for requests with side effects only */
|
uint32_t pad[7]; /**< Padding */
|
||||||
uint16_t minor_code; /** < Minor opcode of the failed request */
|
|
||||||
uint8_t major_code; /** < Major opcode of the failed request */
|
|
||||||
uint8_t pad0;
|
|
||||||
uint32_t pad[5]; /**< Padding */
|
|
||||||
uint32_t full_sequence; /**< full sequence */
|
uint32_t full_sequence; /**< full sequence */
|
||||||
} xcb_generic_error_t;
|
} xcb_generic_error_t;
|
||||||
|
|
||||||
|
@ -261,7 +174,7 @@ typedef struct xcb_auth_info_t {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Forces any buffered output to be written to the server.
|
* @brief Forces any buffered output to be written to the server.
|
||||||
* @param c The connection to the X server.
|
* @param c: The connection to the X server.
|
||||||
* @return > @c 0 on success, <= @c 0 otherwise.
|
* @return > @c 0 on success, <= @c 0 otherwise.
|
||||||
*
|
*
|
||||||
* Forces any buffered output to be written to the server. Blocks
|
* Forces any buffered output to be written to the server. Blocks
|
||||||
|
@ -271,7 +184,7 @@ int xcb_flush(xcb_connection_t *c);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the maximum request length that this server accepts.
|
* @brief Returns the maximum request length that this server accepts.
|
||||||
* @param c The connection to the X server.
|
* @param c: The connection to the X server.
|
||||||
* @return The maximum request length field.
|
* @return The maximum request length field.
|
||||||
*
|
*
|
||||||
* In the absence of the BIG-REQUESTS extension, returns the
|
* In the absence of the BIG-REQUESTS extension, returns the
|
||||||
|
@ -288,7 +201,7 @@ uint32_t xcb_get_maximum_request_length(xcb_connection_t *c);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Prefetch the maximum request length without blocking.
|
* @brief Prefetch the maximum request length without blocking.
|
||||||
* @param c The connection to the X server.
|
* @param c: The connection to the X server.
|
||||||
*
|
*
|
||||||
* Without blocking, does as much work as possible toward computing
|
* Without blocking, does as much work as possible toward computing
|
||||||
* the maximum request length accepted by the X server.
|
* the maximum request length accepted by the X server.
|
||||||
|
@ -310,7 +223,7 @@ void xcb_prefetch_maximum_request_length(xcb_connection_t *c);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the next event or error from the server.
|
* @brief Returns the next event or error from the server.
|
||||||
* @param c The connection to the X server.
|
* @param c: The connection to the X server.
|
||||||
* @return The next event from the server.
|
* @return The next event from the server.
|
||||||
*
|
*
|
||||||
* Returns the next event or error from the server, or returns null in
|
* Returns the next event or error from the server, or returns null in
|
||||||
|
@ -321,7 +234,8 @@ xcb_generic_event_t *xcb_wait_for_event(xcb_connection_t *c);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the next event or error from the server.
|
* @brief Returns the next event or error from the server.
|
||||||
* @param c The connection to the X server.
|
* @param c: The connection to the X server.
|
||||||
|
* error status of the operation.
|
||||||
* @return The next event from the server.
|
* @return The next event from the server.
|
||||||
*
|
*
|
||||||
* Returns the next event or error from the server, if one is
|
* Returns the next event or error from the server, if one is
|
||||||
|
@ -332,58 +246,10 @@ xcb_generic_event_t *xcb_wait_for_event(xcb_connection_t *c);
|
||||||
*/
|
*/
|
||||||
xcb_generic_event_t *xcb_poll_for_event(xcb_connection_t *c);
|
xcb_generic_event_t *xcb_poll_for_event(xcb_connection_t *c);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns the next event without reading from the connection.
|
|
||||||
* @param c The connection to the X server.
|
|
||||||
* @return The next already queued event from the server.
|
|
||||||
*
|
|
||||||
* This is a version of xcb_poll_for_event that only examines the
|
|
||||||
* event queue for new events. The function doesn't try to read new
|
|
||||||
* events from the connection if no queued events are found.
|
|
||||||
*
|
|
||||||
* This function is useful for callers that know in advance that all
|
|
||||||
* interesting events have already been read from the connection. For
|
|
||||||
* example, callers might use xcb_wait_for_reply and be interested
|
|
||||||
* only of events that preceded a specific reply.
|
|
||||||
*/
|
|
||||||
xcb_generic_event_t *xcb_poll_for_queued_event(xcb_connection_t *c);
|
|
||||||
|
|
||||||
typedef struct xcb_special_event xcb_special_event_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns the next event from a special queue
|
|
||||||
*/
|
|
||||||
xcb_generic_event_t *xcb_poll_for_special_event(xcb_connection_t *c,
|
|
||||||
xcb_special_event_t *se);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns the next event from a special queue, blocking until one arrives
|
|
||||||
*/
|
|
||||||
xcb_generic_event_t *xcb_wait_for_special_event(xcb_connection_t *c,
|
|
||||||
xcb_special_event_t *se);
|
|
||||||
/**
|
|
||||||
* @typedef typedef struct xcb_extension_t xcb_extension_t
|
|
||||||
*/
|
|
||||||
typedef struct xcb_extension_t xcb_extension_t; /**< Opaque structure used as key for xcb_get_extension_data_t. */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Listen for a special event
|
|
||||||
*/
|
|
||||||
xcb_special_event_t *xcb_register_for_special_xge(xcb_connection_t *c,
|
|
||||||
xcb_extension_t *ext,
|
|
||||||
uint32_t eid,
|
|
||||||
uint32_t *stamp);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Stop listening for a special event
|
|
||||||
*/
|
|
||||||
void xcb_unregister_for_special_event(xcb_connection_t *c,
|
|
||||||
xcb_special_event_t *se);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return the error for a request, or NULL if none can ever arrive.
|
* @brief Return the error for a request, or NULL if none can ever arrive.
|
||||||
* @param c The connection to the X server.
|
* @param c: The connection to the X server.
|
||||||
* @param cookie The request cookie.
|
* @param cookie: The request cookie.
|
||||||
* @return The error for the request, or NULL if none can ever arrive.
|
* @return The error for the request, or NULL if none can ever arrive.
|
||||||
*
|
*
|
||||||
* The xcb_void_cookie_t cookie supplied to this function must have resulted
|
* The xcb_void_cookie_t cookie supplied to this function must have resulted
|
||||||
|
@ -398,49 +264,18 @@ void xcb_unregister_for_special_event(xcb_connection_t *c,
|
||||||
*/
|
*/
|
||||||
xcb_generic_error_t *xcb_request_check(xcb_connection_t *c, xcb_void_cookie_t cookie);
|
xcb_generic_error_t *xcb_request_check(xcb_connection_t *c, xcb_void_cookie_t cookie);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Discards the reply for a request.
|
|
||||||
* @param c The connection to the X server.
|
|
||||||
* @param sequence The request sequence number from a cookie.
|
|
||||||
*
|
|
||||||
* Discards the reply for a request. Additionally, any error generated
|
|
||||||
* by the request is also discarded (unless it was an _unchecked request
|
|
||||||
* and the error has already arrived).
|
|
||||||
*
|
|
||||||
* This function will not block even if the reply is not yet available.
|
|
||||||
*
|
|
||||||
* Note that the sequence really does have to come from an xcb cookie;
|
|
||||||
* this function is not designed to operate on socket-handoff replies.
|
|
||||||
*/
|
|
||||||
void xcb_discard_reply(xcb_connection_t *c, unsigned int sequence);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Discards the reply for a request, given by a 64bit sequence number
|
|
||||||
* @param c The connection to the X server.
|
|
||||||
* @param sequence 64-bit sequence number as returned by xcb_send_request64().
|
|
||||||
*
|
|
||||||
* Discards the reply for a request. Additionally, any error generated
|
|
||||||
* by the request is also discarded (unless it was an _unchecked request
|
|
||||||
* and the error has already arrived).
|
|
||||||
*
|
|
||||||
* This function will not block even if the reply is not yet available.
|
|
||||||
*
|
|
||||||
* Note that the sequence really does have to come from xcb_send_request64();
|
|
||||||
* the cookie sequence number is defined as "unsigned" int and therefore
|
|
||||||
* not 64-bit on all platforms.
|
|
||||||
* This function is not designed to operate on socket-handoff replies.
|
|
||||||
*
|
|
||||||
* Unlike its xcb_discard_reply() counterpart, the given sequence number is not
|
|
||||||
* automatically "widened" to 64-bit.
|
|
||||||
*/
|
|
||||||
void xcb_discard_reply64(xcb_connection_t *c, uint64_t sequence);
|
|
||||||
|
|
||||||
/* xcb_ext.c */
|
/* xcb_ext.c */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef typedef struct xcb_extension_t xcb_extension_t
|
||||||
|
*/
|
||||||
|
typedef struct xcb_extension_t xcb_extension_t; /**< Opaque structure used as key for xcb_get_extension_data_t. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Caches reply information from QueryExtension requests.
|
* @brief Caches reply information from QueryExtension requests.
|
||||||
* @param c The connection.
|
* @param c: The connection.
|
||||||
* @param ext The extension data.
|
* @param ext: The extension data.
|
||||||
* @return A pointer to the xcb_query_extension_reply_t for the extension.
|
* @return A pointer to the xcb_query_extension_reply_t for the extension.
|
||||||
*
|
*
|
||||||
* This function is the primary interface to the "extension cache",
|
* This function is the primary interface to the "extension cache",
|
||||||
|
@ -453,12 +288,12 @@ void xcb_discard_reply64(xcb_connection_t *c, uint64_t sequence);
|
||||||
* The result must not be freed. This storage is managed by the cache
|
* The result must not be freed. This storage is managed by the cache
|
||||||
* itself.
|
* itself.
|
||||||
*/
|
*/
|
||||||
const struct xcb_query_extension_reply_t *xcb_get_extension_data(xcb_connection_t *c, xcb_extension_t *ext);
|
const xcb_query_extension_reply_t *xcb_get_extension_data(xcb_connection_t *c, xcb_extension_t *ext);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Prefetch of extension data into the extension cache
|
* @brief Prefetch of extension data into the extension cache
|
||||||
* @param c The connection.
|
* @param c: The connection.
|
||||||
* @param ext The extension data.
|
* @param ext: The extension data.
|
||||||
*
|
*
|
||||||
* This function allows a "prefetch" of extension data into the
|
* This function allows a "prefetch" of extension data into the
|
||||||
* extension cache. Invoking the function may cause a call to
|
* extension cache. Invoking the function may cause a call to
|
||||||
|
@ -473,7 +308,7 @@ void xcb_prefetch_extension_data(xcb_connection_t *c, xcb_extension_t *ext);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Access the data returned by the server.
|
* @brief Access the data returned by the server.
|
||||||
* @param c The connection.
|
* @param c: The connection.
|
||||||
* @return A pointer to an xcb_setup_t structure.
|
* @return A pointer to an xcb_setup_t structure.
|
||||||
*
|
*
|
||||||
* Accessor for the data returned by the server when the xcb_connection_t
|
* Accessor for the data returned by the server when the xcb_connection_t
|
||||||
|
@ -489,45 +324,37 @@ void xcb_prefetch_extension_data(xcb_connection_t *c, xcb_extension_t *ext);
|
||||||
*
|
*
|
||||||
* The result must not be freed.
|
* The result must not be freed.
|
||||||
*/
|
*/
|
||||||
XCB_PURE_FUNCTION
|
const xcb_setup_t *xcb_get_setup(xcb_connection_t *c);
|
||||||
const struct xcb_setup_t *xcb_get_setup(xcb_connection_t *c);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Access the file descriptor of the connection.
|
* @brief Access the file descriptor of the connection.
|
||||||
* @param c The connection.
|
* @param c: The connection.
|
||||||
* @return The file descriptor.
|
* @return The file descriptor.
|
||||||
*
|
*
|
||||||
* Accessor for the file descriptor that was passed to the
|
* Accessor for the file descriptor that was passed to the
|
||||||
* xcb_connect_to_fd call that returned @p c.
|
* xcb_connect_to_fd call that returned @p c.
|
||||||
*/
|
*/
|
||||||
XCB_PURE_FUNCTION
|
|
||||||
int xcb_get_file_descriptor(xcb_connection_t *c);
|
int xcb_get_file_descriptor(xcb_connection_t *c);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Test whether the connection has shut down due to a fatal error.
|
* @brief Test whether the connection has shut down due to a fatal error.
|
||||||
* @param c The connection.
|
* @param c: The connection.
|
||||||
* @return > 0 if the connection is in an error state; 0 otherwise.
|
* @return 1 if the connection is in an error state; 0 otherwise.
|
||||||
*
|
*
|
||||||
* Some errors that occur in the context of an xcb_connection_t
|
* Some errors that occur in the context of an xcb_connection_t
|
||||||
* are unrecoverable. When such an error occurs, the
|
* are unrecoverable. When such an error occurs, the
|
||||||
* connection is shut down and further operations on the
|
* connection is shut down and further operations on the
|
||||||
* xcb_connection_t have no effect, but memory will not be freed until
|
* xcb_connection_t have no effect.
|
||||||
* xcb_disconnect() is called on the xcb_connection_t.
|
|
||||||
*
|
*
|
||||||
* @return XCB_CONN_ERROR, because of socket errors, pipe errors or other stream errors.
|
* @todo Other functions should document the conditions in
|
||||||
* @return XCB_CONN_CLOSED_EXT_NOTSUPPORTED, when extension not supported.
|
* which they shut down the connection.
|
||||||
* @return XCB_CONN_CLOSED_MEM_INSUFFICIENT, when memory not available.
|
|
||||||
* @return XCB_CONN_CLOSED_REQ_LEN_EXCEED, exceeding request length that server accepts.
|
|
||||||
* @return XCB_CONN_CLOSED_PARSE_ERR, error during parsing display string.
|
|
||||||
* @return XCB_CONN_CLOSED_INVALID_SCREEN, because the server does not have a screen matching the display.
|
|
||||||
*/
|
*/
|
||||||
XCB_PURE_FUNCTION
|
|
||||||
int xcb_connection_has_error(xcb_connection_t *c);
|
int xcb_connection_has_error(xcb_connection_t *c);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Connects to the X server.
|
* @brief Connects to the X server.
|
||||||
* @param fd The file descriptor.
|
* @param fd: The file descriptor.
|
||||||
* @param auth_info Authentication data.
|
* @param auth_info: Authentication data.
|
||||||
* @return A newly allocated xcb_connection_t structure.
|
* @return A newly allocated xcb_connection_t structure.
|
||||||
*
|
*
|
||||||
* Connects to an X server, given the open socket @p fd and the
|
* Connects to an X server, given the open socket @p fd and the
|
||||||
|
@ -535,20 +362,15 @@ int xcb_connection_has_error(xcb_connection_t *c);
|
||||||
* bidirectionally connected to an X server. If the connection
|
* bidirectionally connected to an X server. If the connection
|
||||||
* should be unauthenticated, @p auth_info must be @c
|
* should be unauthenticated, @p auth_info must be @c
|
||||||
* NULL.
|
* NULL.
|
||||||
*
|
|
||||||
* Always returns a non-NULL pointer to a xcb_connection_t, even on failure.
|
|
||||||
* Callers need to use xcb_connection_has_error() to check for failure.
|
|
||||||
* When finished, use xcb_disconnect() to close the connection and free
|
|
||||||
* the structure.
|
|
||||||
*/
|
*/
|
||||||
xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info);
|
xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Closes the connection.
|
* @brief Closes the connection.
|
||||||
* @param c The connection.
|
* @param c: The connection.
|
||||||
*
|
*
|
||||||
* Closes the file descriptor and frees all memory associated with the
|
* Closes the file descriptor and frees all memory associated with the
|
||||||
* connection @c c. If @p c is @c NULL, nothing is done.
|
* connection @c c.
|
||||||
*/
|
*/
|
||||||
void xcb_disconnect(xcb_connection_t *c);
|
void xcb_disconnect(xcb_connection_t *c);
|
||||||
|
|
||||||
|
@ -557,10 +379,10 @@ void xcb_disconnect(xcb_connection_t *c);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Parses a display string name in the form documented by X(7x).
|
* @brief Parses a display string name in the form documented by X(7x).
|
||||||
* @param name The name of the display.
|
* @param name: The name of the display.
|
||||||
* @param host A pointer to a malloc'd copy of the hostname.
|
* @param host: A pointer to a malloc'd copy of the hostname.
|
||||||
* @param display A pointer to the display number.
|
* @param display: A pointer to the display number.
|
||||||
* @param screen A pointer to the screen number.
|
* @param screen: A pointer to the screen number.
|
||||||
* @return 0 on failure, non 0 otherwise.
|
* @return 0 on failure, non 0 otherwise.
|
||||||
*
|
*
|
||||||
* Parses the display string name @p display_name in the form
|
* Parses the display string name @p display_name in the form
|
||||||
|
@ -576,8 +398,8 @@ int xcb_parse_display(const char *name, char **host, int *display, int *screen);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Connects to the X server.
|
* @brief Connects to the X server.
|
||||||
* @param displayname The name of the display.
|
* @param displayname: The name of the display.
|
||||||
* @param screenp A pointer to a preferred screen number.
|
* @param screenp: A pointer to a preferred screen number.
|
||||||
* @return A newly allocated xcb_connection_t structure.
|
* @return A newly allocated xcb_connection_t structure.
|
||||||
*
|
*
|
||||||
* Connects to the X server specified by @p displayname. If @p
|
* Connects to the X server specified by @p displayname. If @p
|
||||||
|
@ -585,30 +407,20 @@ int xcb_parse_display(const char *name, char **host, int *display, int *screen);
|
||||||
* variable. If a particular screen on that server is preferred, the
|
* variable. If a particular screen on that server is preferred, the
|
||||||
* int pointed to by @p screenp (if not @c NULL) will be set to that
|
* int pointed to by @p screenp (if not @c NULL) will be set to that
|
||||||
* screen; otherwise the screen will be set to 0.
|
* screen; otherwise the screen will be set to 0.
|
||||||
*
|
|
||||||
* Always returns a non-NULL pointer to a xcb_connection_t, even on failure.
|
|
||||||
* Callers need to use xcb_connection_has_error() to check for failure.
|
|
||||||
* When finished, use xcb_disconnect() to close the connection and free
|
|
||||||
* the structure.
|
|
||||||
*/
|
*/
|
||||||
xcb_connection_t *xcb_connect(const char *displayname, int *screenp);
|
xcb_connection_t *xcb_connect(const char *displayname, int *screenp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Connects to the X server, using an authorization information.
|
* @brief Connects to the X server, using an authorization information.
|
||||||
* @param display The name of the display.
|
* @param display: The name of the display.
|
||||||
* @param auth The authorization information.
|
* @param auth: The authorization information.
|
||||||
* @param screen A pointer to a preferred screen number.
|
* @param screen: A pointer to a preferred screen number.
|
||||||
* @return A newly allocated xcb_connection_t structure.
|
* @return A newly allocated xcb_connection_t structure.
|
||||||
*
|
*
|
||||||
* Connects to the X server specified by @p displayname, using the
|
* Connects to the X server specified by @p displayname, using the
|
||||||
* authorization @p auth. If a particular screen on that server is
|
* authorization @p auth. If a particular screen on that server is
|
||||||
* preferred, the int pointed to by @p screenp (if not @c NULL) will
|
* preferred, the int pointed to by @p screenp (if not @c NULL) will
|
||||||
* be set to that screen; otherwise @p screenp will be set to 0.
|
* be set to that screen; otherwise @p screenp will be set to 0.
|
||||||
*
|
|
||||||
* Always returns a non-NULL pointer to a xcb_connection_t, even on failure.
|
|
||||||
* Callers need to use xcb_connection_has_error() to check for failure.
|
|
||||||
* When finished, use xcb_disconnect() to close the connection and free
|
|
||||||
* the structure.
|
|
||||||
*/
|
*/
|
||||||
xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *display, xcb_auth_info_t *auth, int *screen);
|
xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *display, xcb_auth_info_t *auth, int *screen);
|
||||||
|
|
||||||
|
@ -617,8 +429,8 @@ xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *display, xcb
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Allocates an XID for a new object.
|
* @brief Allocates an XID for a new object.
|
||||||
* @param c The connection.
|
* @param c: The connection.
|
||||||
* @return A newly allocated XID, or -1 on failure.
|
* @return A newly allocated XID.
|
||||||
*
|
*
|
||||||
* Allocates an XID for a new object. Typically used just prior to
|
* Allocates an XID for a new object. Typically used just prior to
|
||||||
* various object creation functions, such as xcb_create_window.
|
* various object creation functions, such as xcb_create_window.
|
||||||
|
@ -626,35 +438,6 @@ xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *display, xcb
|
||||||
uint32_t xcb_generate_id(xcb_connection_t *c);
|
uint32_t xcb_generate_id(xcb_connection_t *c);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Obtain number of bytes read from the connection.
|
|
||||||
* @param c The connection
|
|
||||||
* @return Number of bytes read from the server.
|
|
||||||
*
|
|
||||||
* Returns cumulative number of bytes received from the connection.
|
|
||||||
*
|
|
||||||
* This retrieves the total number of bytes read from this connection,
|
|
||||||
* to be used for diagnostic/monitoring/informative purposes.
|
|
||||||
*/
|
|
||||||
|
|
||||||
uint64_t
|
|
||||||
xcb_total_read(xcb_connection_t *c);
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @brief Obtain number of bytes written to the connection.
|
|
||||||
* @param c The connection
|
|
||||||
* @return Number of bytes written to the server.
|
|
||||||
*
|
|
||||||
* Returns cumulative number of bytes sent to the connection.
|
|
||||||
*
|
|
||||||
* This retrieves the total number of bytes written to this connection,
|
|
||||||
* to be used for diagnostic/monitoring/informative purposes.
|
|
||||||
*/
|
|
||||||
|
|
||||||
uint64_t
|
|
||||||
xcb_total_written(xcb_connection_t *c);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
181
src/xcb_auth.c
181
src/xcb_auth.c
|
@ -25,35 +25,14 @@
|
||||||
|
|
||||||
/* Authorization systems for the X protocol. */
|
/* Authorization systems for the X protocol. */
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <X11/Xauth.h>
|
#include <X11/Xauth.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#ifdef __INTERIX
|
|
||||||
/* _don't_ ask. interix has INADDR_LOOPBACK in here. */
|
|
||||||
#include <rpc/types.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#ifdef HASXDMAUTH
|
|
||||||
/* We must include the wrapped windows.h before any system header which includes
|
|
||||||
it unwrapped, to avoid conflicts with types defined in X headers */
|
|
||||||
#include <X11/Xwindows.h>
|
|
||||||
#endif
|
|
||||||
#include "xcb_windefs.h"
|
|
||||||
#else
|
|
||||||
#include <sys/param.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
#endif /* _WIN32 */
|
#include <sys/param.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "xcb.h"
|
#include "xcb.h"
|
||||||
#include "xcbint.h"
|
#include "xcbint.h"
|
||||||
|
@ -70,21 +49,11 @@ enum auth_protos {
|
||||||
N_AUTH_PROTOS
|
N_AUTH_PROTOS
|
||||||
};
|
};
|
||||||
|
|
||||||
#define AUTH_PROTO_XDM_AUTHORIZATION "XDM-AUTHORIZATION-1"
|
static char *authnames[N_AUTH_PROTOS] = {
|
||||||
#define AUTH_PROTO_MIT_MAGIC_COOKIE "MIT-MAGIC-COOKIE-1"
|
|
||||||
|
|
||||||
static const char *authnames[N_AUTH_PROTOS] = {
|
|
||||||
#ifdef HASXDMAUTH
|
#ifdef HASXDMAUTH
|
||||||
AUTH_PROTO_XDM_AUTHORIZATION,
|
"XDM-AUTHORIZATION-1",
|
||||||
#endif
|
#endif
|
||||||
AUTH_PROTO_MIT_MAGIC_COOKIE,
|
"MIT-MAGIC-COOKIE-1",
|
||||||
};
|
|
||||||
|
|
||||||
static int authnameslen[N_AUTH_PROTOS] = {
|
|
||||||
#ifdef HASXDMAUTH
|
|
||||||
sizeof(AUTH_PROTO_XDM_AUTHORIZATION) - 1,
|
|
||||||
#endif
|
|
||||||
sizeof(AUTH_PROTO_MIT_MAGIC_COOKIE) - 1,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static size_t memdup(char **dst, void *src, size_t len)
|
static size_t memdup(char **dst, void *src, size_t len)
|
||||||
|
@ -99,9 +68,9 @@ static size_t memdup(char **dst, void *src, size_t len)
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int authname_match(enum auth_protos kind, char *name, size_t namelen)
|
static int authname_match(enum auth_protos kind, char *name, int namelen)
|
||||||
{
|
{
|
||||||
if(authnameslen[kind] != namelen)
|
if(strlen(authnames[kind]) != namelen)
|
||||||
return 0;
|
return 0;
|
||||||
if(memcmp(authnames[kind], name, namelen))
|
if(memcmp(authnames[kind], name, namelen))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -110,19 +79,20 @@ static int authname_match(enum auth_protos kind, char *name, size_t namelen)
|
||||||
|
|
||||||
#define SIN6_ADDR(s) (&((struct sockaddr_in6 *)s)->sin6_addr)
|
#define SIN6_ADDR(s) (&((struct sockaddr_in6 *)s)->sin6_addr)
|
||||||
|
|
||||||
static Xauth *get_authptr(struct sockaddr *sockname, int display)
|
static Xauth *get_authptr(struct sockaddr *sockname, unsigned int socknamelen,
|
||||||
|
int display)
|
||||||
{
|
{
|
||||||
char *addr = 0;
|
char *addr = 0;
|
||||||
int addrlen = 0;
|
int addrlen = 0;
|
||||||
unsigned short family;
|
unsigned short family;
|
||||||
char hostnamebuf[256]; /* big enough for max hostname */
|
char hostnamebuf[256]; /* big enough for max hostname */
|
||||||
char dispbuf[40]; /* big enough to hold more than 2^64 base 10 */
|
char dispbuf[40]; /* big enough to hold more than 2^64 base 10 */
|
||||||
int dispbuflen;
|
int authnamelens[N_AUTH_PROTOS];
|
||||||
|
int i;
|
||||||
|
|
||||||
family = FamilyLocal; /* 256 */
|
family = FamilyLocal; /* 256 */
|
||||||
switch(sockname->sa_family)
|
switch(sockname->sa_family)
|
||||||
{
|
{
|
||||||
#ifdef AF_INET6
|
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
addr = (char *) SIN6_ADDR(sockname);
|
addr = (char *) SIN6_ADDR(sockname);
|
||||||
addrlen = sizeof(*SIN6_ADDR(sockname));
|
addrlen = sizeof(*SIN6_ADDR(sockname));
|
||||||
|
@ -134,8 +104,6 @@ static Xauth *get_authptr(struct sockaddr *sockname, int display)
|
||||||
}
|
}
|
||||||
addr += 12;
|
addr += 12;
|
||||||
/* if v4-mapped, fall through. */
|
/* if v4-mapped, fall through. */
|
||||||
XCB_ALLOW_FALLTHRU
|
|
||||||
#endif
|
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
if(!addr)
|
if(!addr)
|
||||||
addr = (char *) &((struct sockaddr_in *)sockname)->sin_addr;
|
addr = (char *) &((struct sockaddr_in *)sockname)->sin_addr;
|
||||||
|
@ -149,11 +117,7 @@ static Xauth *get_authptr(struct sockaddr *sockname, int display)
|
||||||
return 0; /* cannot authenticate this family */
|
return 0; /* cannot authenticate this family */
|
||||||
}
|
}
|
||||||
|
|
||||||
dispbuflen = snprintf(dispbuf, sizeof(dispbuf), "%d", display);
|
snprintf(dispbuf, sizeof(dispbuf), "%d", display);
|
||||||
if(dispbuflen < 0)
|
|
||||||
return 0;
|
|
||||||
/* snprintf may have truncate our text */
|
|
||||||
dispbuflen = MIN(dispbuflen, sizeof(dispbuf) - 1);
|
|
||||||
|
|
||||||
if (family == FamilyLocal) {
|
if (family == FamilyLocal) {
|
||||||
if (gethostname(hostnamebuf, sizeof(hostnamebuf)) == -1)
|
if (gethostname(hostnamebuf, sizeof(hostnamebuf)) == -1)
|
||||||
|
@ -162,10 +126,12 @@ static Xauth *get_authptr(struct sockaddr *sockname, int display)
|
||||||
addrlen = strlen(addr);
|
addrlen = strlen(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < N_AUTH_PROTOS; i++)
|
||||||
|
authnamelens[i] = strlen(authnames[i]);
|
||||||
return XauGetBestAuthByAddr (family,
|
return XauGetBestAuthByAddr (family,
|
||||||
(unsigned short) addrlen, addr,
|
(unsigned short) addrlen, addr,
|
||||||
(unsigned short) dispbuflen, dispbuf,
|
(unsigned short) strlen(dispbuf), dispbuf,
|
||||||
N_AUTH_PROTOS, (char **)authnames, authnameslen);
|
N_AUTH_PROTOS, authnames, authnamelens);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HASXDMAUTH
|
#ifdef HASXDMAUTH
|
||||||
|
@ -213,13 +179,12 @@ static int compute_auth(xcb_auth_info_t *info, Xauth *authptr, struct sockaddr *
|
||||||
APPEND(info->data, j, si->sin_port);
|
APPEND(info->data, j, si->sin_port);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef AF_INET6
|
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
/*block*/ {
|
/*block*/ {
|
||||||
struct sockaddr_in6 *si6 = (struct sockaddr_in6 *) sockname;
|
struct sockaddr_in6 *si6 = (struct sockaddr_in6 *) sockname;
|
||||||
if(IN6_IS_ADDR_V4MAPPED(SIN6_ADDR(sockname)))
|
if(IN6_IS_ADDR_V4MAPPED(SIN6_ADDR(sockname)))
|
||||||
{
|
{
|
||||||
do_append(info->data, &j, &si6->sin6_addr.s6_addr[12], 4);
|
APPEND(info->data, j, si6->sin6_addr.s6_addr[12]);
|
||||||
APPEND(info->data, j, si6->sin6_port);
|
APPEND(info->data, j, si6->sin6_port);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -234,7 +199,6 @@ static int compute_auth(xcb_auth_info_t *info, Xauth *authptr, struct sockaddr *
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case AF_UNIX:
|
case AF_UNIX:
|
||||||
/*block*/ {
|
/*block*/ {
|
||||||
uint32_t fakeaddr = htonl(0xffffffff - next_nonce());
|
uint32_t fakeaddr = htonl(0xffffffff - next_nonce());
|
||||||
|
@ -264,125 +228,32 @@ static int compute_auth(xcb_auth_info_t *info, Xauth *authptr, struct sockaddr *
|
||||||
return 0; /* Unknown authorization type */
|
return 0; /* Unknown authorization type */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* `sockaddr_un.sun_path' typical size usually ranges between 92 and 108 */
|
|
||||||
#define INITIAL_SOCKNAME_SLACK 108
|
|
||||||
|
|
||||||
/* Return a dynamically allocated socket address structure according
|
|
||||||
to the value returned by either getpeername() or getsockname()
|
|
||||||
(according to POSIX, applications should not assume a particular
|
|
||||||
length for `sockaddr_un.sun_path') */
|
|
||||||
#ifdef _WIN32
|
|
||||||
static struct sockaddr *get_peer_sock_name(int(_stdcall *socket_func)(SOCKET,
|
|
||||||
struct sockaddr *,
|
|
||||||
socklen_t *),
|
|
||||||
int fd)
|
|
||||||
#else
|
|
||||||
static struct sockaddr *get_peer_sock_name(int (*socket_func)(int,
|
|
||||||
struct sockaddr *,
|
|
||||||
socklen_t *),
|
|
||||||
int fd)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
socklen_t socknamelen = sizeof(struct sockaddr) + INITIAL_SOCKNAME_SLACK;
|
|
||||||
socklen_t actual_socknamelen = socknamelen;
|
|
||||||
struct sockaddr *sockname = malloc(socknamelen);
|
|
||||||
|
|
||||||
if (sockname == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
/* Both getpeername() and getsockname() truncates sockname if
|
|
||||||
there is not enough space and set the required length in
|
|
||||||
actual_socknamelen */
|
|
||||||
if (socket_func(fd, sockname, &actual_socknamelen) == -1)
|
|
||||||
goto sock_or_realloc_error;
|
|
||||||
|
|
||||||
if (actual_socknamelen > socknamelen)
|
|
||||||
{
|
|
||||||
struct sockaddr *new_sockname = NULL;
|
|
||||||
socknamelen = actual_socknamelen;
|
|
||||||
|
|
||||||
if ((new_sockname = realloc(sockname, actual_socknamelen)) == NULL)
|
|
||||||
goto sock_or_realloc_error;
|
|
||||||
|
|
||||||
sockname = new_sockname;
|
|
||||||
|
|
||||||
if (socket_func(fd, sockname, &actual_socknamelen) == -1 ||
|
|
||||||
actual_socknamelen > socknamelen)
|
|
||||||
goto sock_or_realloc_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sockname;
|
|
||||||
|
|
||||||
sock_or_realloc_error:
|
|
||||||
free(sockname);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _xcb_get_auth_info(int fd, xcb_auth_info_t *info, int display)
|
int _xcb_get_auth_info(int fd, xcb_auth_info_t *info, int display)
|
||||||
{
|
{
|
||||||
/* code adapted from Xlib/ConnDis.c, xtrans/Xtranssocket.c,
|
/* code adapted from Xlib/ConnDis.c, xtrans/Xtranssocket.c,
|
||||||
xtrans/Xtransutils.c */
|
xtrans/Xtransutils.c */
|
||||||
struct sockaddr *sockname = NULL;
|
char sockbuf[sizeof(struct sockaddr) + MAXPATHLEN];
|
||||||
int gotsockname = 0;
|
unsigned int socknamelen = sizeof(sockbuf); /* need extra space */
|
||||||
|
struct sockaddr *sockname = (struct sockaddr *) &sockbuf;
|
||||||
Xauth *authptr = 0;
|
Xauth *authptr = 0;
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
|
||||||
/* Some systems like hpux or Hurd do not expose peer names
|
if (getpeername(fd, sockname, &socknamelen) == -1)
|
||||||
* for UNIX Domain Sockets, but this is irrelevant,
|
|
||||||
* since compute_auth() ignores the peer name in this
|
|
||||||
* case anyway.*/
|
|
||||||
if ((sockname = get_peer_sock_name(getpeername, fd)) == NULL)
|
|
||||||
{
|
|
||||||
if ((sockname = get_peer_sock_name(getsockname, fd)) == NULL)
|
|
||||||
return 0; /* can only authenticate sockets */
|
return 0; /* can only authenticate sockets */
|
||||||
if (sockname->sa_family != AF_UNIX)
|
|
||||||
{
|
|
||||||
free(sockname);
|
|
||||||
return 0; /* except for AF_UNIX, sockets should have peernames */
|
|
||||||
}
|
|
||||||
gotsockname = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
authptr = get_authptr(sockname, display);
|
authptr = get_authptr(sockname, socknamelen, display);
|
||||||
if (authptr == 0)
|
if (authptr == 0)
|
||||||
{
|
|
||||||
free(sockname);
|
|
||||||
return 0; /* cannot find good auth data */
|
return 0; /* cannot find good auth data */
|
||||||
}
|
|
||||||
|
|
||||||
info->namelen = memdup(&info->name, authptr->name, authptr->name_length);
|
info->namelen = memdup(&info->name, authptr->name, authptr->name_length);
|
||||||
if (!info->namelen)
|
if(info->namelen)
|
||||||
goto no_auth; /* out of memory */
|
|
||||||
|
|
||||||
if (!gotsockname)
|
|
||||||
{
|
|
||||||
free(sockname);
|
|
||||||
|
|
||||||
if ((sockname = get_peer_sock_name(getsockname, fd)) == NULL)
|
|
||||||
{
|
|
||||||
free(info->name);
|
|
||||||
goto no_auth; /* can only authenticate sockets */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = compute_auth(info, authptr, sockname);
|
ret = compute_auth(info, authptr, sockname);
|
||||||
if(!ret)
|
if(!ret)
|
||||||
{
|
{
|
||||||
free(info->name);
|
free(info->name);
|
||||||
goto no_auth; /* cannot build auth record */
|
|
||||||
}
|
|
||||||
|
|
||||||
free(sockname);
|
|
||||||
sockname = NULL;
|
|
||||||
|
|
||||||
XauDisposeAuth(authptr);
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
no_auth:
|
|
||||||
free(sockname);
|
|
||||||
|
|
||||||
info->name = 0;
|
info->name = 0;
|
||||||
info->namelen = 0;
|
info->namelen = 0;
|
||||||
|
}
|
||||||
XauDisposeAuth(authptr);
|
XauDisposeAuth(authptr);
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
386
src/xcb_conn.c
386
src/xcb_conn.c
|
@ -25,39 +25,18 @@
|
||||||
|
|
||||||
/* Connection management: the core of XCB. */
|
/* Connection management: the core of XCB. */
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <sys/select.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
#include "xcb.h"
|
#include "xcb.h"
|
||||||
#include "xcbint.h"
|
#include "xcbint.h"
|
||||||
#if USE_POLL
|
|
||||||
#include <poll.h>
|
|
||||||
#elif !defined _WIN32
|
|
||||||
#include <sys/select.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include "xcb_windefs.h"
|
|
||||||
#include <io.h>
|
|
||||||
#else
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#endif /* _WIN32 */
|
|
||||||
|
|
||||||
/* SHUT_RDWR is fairly recent and is not available on all platforms */
|
|
||||||
#if !defined(SHUT_RDWR)
|
|
||||||
#define SHUT_RDWR 2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t status;
|
uint8_t status;
|
||||||
|
@ -65,53 +44,10 @@ typedef struct {
|
||||||
uint16_t length;
|
uint16_t length;
|
||||||
} xcb_setup_generic_t;
|
} xcb_setup_generic_t;
|
||||||
|
|
||||||
static const xcb_setup_t xcb_error_setup = {
|
static const int error_connection = 1;
|
||||||
0, /* status: failed (but we wouldn't have a xcb_setup_t in this case) */
|
|
||||||
0, /* pad0 */
|
|
||||||
0, 0, /* protocol version, should be 11.0, but isn't */
|
|
||||||
0, /* length, invalid value */
|
|
||||||
0, /* release_number */
|
|
||||||
0, 0, /* resource_id_{base,mask} */
|
|
||||||
0, /* motion_buffer_size */
|
|
||||||
0, /* vendor_len */
|
|
||||||
0, /* maximum_request_length */
|
|
||||||
0, /* roots_len */
|
|
||||||
0, /* pixmap_formats_len */
|
|
||||||
0, /* image_byte_order */
|
|
||||||
0, /* bitmap_format_bit_order */
|
|
||||||
0, /* bitmap_format_scanline_unit */
|
|
||||||
0, /* bitmap_format_scanline_pad */
|
|
||||||
0, 0, /* {min,max}_keycode */
|
|
||||||
{ 0, 0, 0, 0 } /* pad1 */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Keep this list in sync with is_static_error_conn()! */
|
|
||||||
static const int xcb_con_error = XCB_CONN_ERROR;
|
|
||||||
static const int xcb_con_closed_mem_er = XCB_CONN_CLOSED_MEM_INSUFFICIENT;
|
|
||||||
static const int xcb_con_closed_parse_er = XCB_CONN_CLOSED_PARSE_ERR;
|
|
||||||
static const int xcb_con_closed_screen_er = XCB_CONN_CLOSED_INVALID_SCREEN;
|
|
||||||
|
|
||||||
static int is_static_error_conn(xcb_connection_t *c)
|
|
||||||
{
|
|
||||||
return c == (xcb_connection_t *) &xcb_con_error ||
|
|
||||||
c == (xcb_connection_t *) &xcb_con_closed_mem_er ||
|
|
||||||
c == (xcb_connection_t *) &xcb_con_closed_parse_er ||
|
|
||||||
c == (xcb_connection_t *) &xcb_con_closed_screen_er;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int set_fd_flags(const int fd)
|
static int set_fd_flags(const int fd)
|
||||||
{
|
{
|
||||||
/* Win32 doesn't have file descriptors and the fcntl function. This block sets the socket in non-blocking mode */
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
u_long iMode = 1; /* non-zero puts it in non-blocking mode, 0 in blocking mode */
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
ret = ioctlsocket(fd, FIONBIO, &iMode);
|
|
||||||
if(ret != 0)
|
|
||||||
return 0;
|
|
||||||
return 1;
|
|
||||||
#else
|
|
||||||
int flags = fcntl(fd, F_GETFL, 0);
|
int flags = fcntl(fd, F_GETFL, 0);
|
||||||
if(flags == -1)
|
if(flags == -1)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -121,7 +57,21 @@ static int set_fd_flags(const int fd)
|
||||||
if(fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
|
if(fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
|
||||||
return 0;
|
return 0;
|
||||||
return 1;
|
return 1;
|
||||||
#endif /* _WIN32 */
|
}
|
||||||
|
|
||||||
|
static int _xcb_xlib_init(_xcb_xlib *xlib)
|
||||||
|
{
|
||||||
|
xlib->lock = 0;
|
||||||
|
#ifndef NDEBUG
|
||||||
|
xlib->sloppy_lock = (getenv("LIBXCB_ALLOW_SLOPPY_LOCK") != 0);
|
||||||
|
#endif
|
||||||
|
pthread_cond_init(&xlib->cond, 0);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _xcb_xlib_destroy(_xcb_xlib *xlib)
|
||||||
|
{
|
||||||
|
pthread_cond_destroy(&xlib->cond);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int write_setup(xcb_connection_t *c, xcb_auth_info_t *auth_info)
|
static int write_setup(xcb_connection_t *c, xcb_auth_info_t *auth_info)
|
||||||
|
@ -130,7 +80,7 @@ static int write_setup(xcb_connection_t *c, xcb_auth_info_t *auth_info)
|
||||||
xcb_setup_request_t out;
|
xcb_setup_request_t out;
|
||||||
struct iovec parts[6];
|
struct iovec parts[6];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
static const uint32_t endian = 0x01020304;
|
int endian = 0x01020304;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
memset(&out, 0, sizeof(out));
|
memset(&out, 0, sizeof(out));
|
||||||
|
@ -160,18 +110,19 @@ static int write_setup(xcb_connection_t *c, xcb_auth_info_t *auth_info)
|
||||||
parts[count].iov_len = XCB_PAD(out.authorization_protocol_data_len);
|
parts[count].iov_len = XCB_PAD(out.authorization_protocol_data_len);
|
||||||
parts[count++].iov_base = (char *) pad;
|
parts[count++].iov_base = (char *) pad;
|
||||||
}
|
}
|
||||||
assert(count <= (int) (sizeof(parts) / sizeof(*parts)));
|
assert(count <= sizeof(parts) / sizeof(*parts));
|
||||||
|
|
||||||
pthread_mutex_lock(&c->iolock);
|
_xcb_lock_io(c);
|
||||||
ret = _xcb_out_send(c, parts, count);
|
{
|
||||||
pthread_mutex_unlock(&c->iolock);
|
struct iovec *parts_ptr = parts;
|
||||||
|
ret = _xcb_out_send(c, &parts_ptr, &count);
|
||||||
|
}
|
||||||
|
_xcb_unlock_io(c);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int read_setup(xcb_connection_t *c)
|
static int read_setup(xcb_connection_t *c)
|
||||||
{
|
{
|
||||||
const char newline = '\n';
|
|
||||||
|
|
||||||
/* Read the server response */
|
/* Read the server response */
|
||||||
c->setup = malloc(sizeof(xcb_setup_generic_t));
|
c->setup = malloc(sizeof(xcb_setup_generic_t));
|
||||||
if(!c->setup)
|
if(!c->setup)
|
||||||
|
@ -197,7 +148,6 @@ static int read_setup(xcb_connection_t *c)
|
||||||
{
|
{
|
||||||
xcb_setup_failed_t *setup = (xcb_setup_failed_t *) c->setup;
|
xcb_setup_failed_t *setup = (xcb_setup_failed_t *) c->setup;
|
||||||
write(STDERR_FILENO, xcb_setup_failed_reason(setup), xcb_setup_failed_reason_length(setup));
|
write(STDERR_FILENO, xcb_setup_failed_reason(setup), xcb_setup_failed_reason_length(setup));
|
||||||
write(STDERR_FILENO, &newline, 1);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +155,6 @@ static int read_setup(xcb_connection_t *c)
|
||||||
{
|
{
|
||||||
xcb_setup_authenticate_t *setup = (xcb_setup_authenticate_t *) c->setup;
|
xcb_setup_authenticate_t *setup = (xcb_setup_authenticate_t *) c->setup;
|
||||||
write(STDERR_FILENO, xcb_setup_authenticate_reason(setup), xcb_setup_authenticate_reason_length(setup));
|
write(STDERR_FILENO, xcb_setup_authenticate_reason(setup), xcb_setup_authenticate_reason_length(setup));
|
||||||
write(STDERR_FILENO, &newline, 1);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,114 +165,31 @@ static int read_setup(xcb_connection_t *c)
|
||||||
/* precondition: there must be something for us to write. */
|
/* precondition: there must be something for us to write. */
|
||||||
static int write_vec(xcb_connection_t *c, struct iovec **vector, int *count)
|
static int write_vec(xcb_connection_t *c, struct iovec **vector, int *count)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
|
||||||
int n;
|
int n;
|
||||||
#endif
|
|
||||||
|
|
||||||
assert(!c->out.queue_len);
|
assert(!c->out.queue_len);
|
||||||
|
n = writev(c->fd, *vector, *count);
|
||||||
#ifdef _WIN32
|
|
||||||
/* Could use the WSASend win32 function for scatter/gather i/o but setting up the WSABUF struct from
|
|
||||||
an iovec would require more work and I'm not sure of the benefit....works for now */
|
|
||||||
while (*count)
|
|
||||||
{
|
|
||||||
struct iovec *vec = *vector;
|
|
||||||
if (vec->iov_len)
|
|
||||||
{
|
|
||||||
int ret = send(c->fd, vec->iov_base, vec->iov_len, 0);
|
|
||||||
if (ret == SOCKET_ERROR)
|
|
||||||
{
|
|
||||||
int err = WSAGetLastError();
|
|
||||||
if (err == WSAEWOULDBLOCK)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ret <= 0)
|
|
||||||
{
|
|
||||||
_xcb_conn_shutdown(c, XCB_CONN_ERROR);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
c->out.total_written += ret;
|
|
||||||
vec->iov_len -= ret;
|
|
||||||
vec->iov_base = (char *)vec->iov_base + ret;
|
|
||||||
}
|
|
||||||
if (vec->iov_len == 0) {
|
|
||||||
(*vector)++;
|
|
||||||
(*count)--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!*count)
|
|
||||||
*vector = 0;
|
|
||||||
|
|
||||||
#else
|
|
||||||
n = *count;
|
|
||||||
if (n > IOV_MAX)
|
|
||||||
n = IOV_MAX;
|
|
||||||
|
|
||||||
#if HAVE_SENDMSG
|
|
||||||
if (c->out.out_fd.nfd) {
|
|
||||||
union {
|
|
||||||
struct cmsghdr cmsghdr;
|
|
||||||
char buf[CMSG_SPACE(XCB_MAX_PASS_FD * sizeof(int))];
|
|
||||||
} cmsgbuf;
|
|
||||||
struct msghdr msg = {
|
|
||||||
.msg_name = NULL,
|
|
||||||
.msg_namelen = 0,
|
|
||||||
.msg_iov = *vector,
|
|
||||||
.msg_iovlen = n,
|
|
||||||
.msg_control = cmsgbuf.buf,
|
|
||||||
.msg_controllen = CMSG_LEN(c->out.out_fd.nfd * sizeof (int)),
|
|
||||||
};
|
|
||||||
int i;
|
|
||||||
struct cmsghdr *hdr = CMSG_FIRSTHDR(&msg);
|
|
||||||
|
|
||||||
hdr->cmsg_len = msg.msg_controllen;
|
|
||||||
hdr->cmsg_level = SOL_SOCKET;
|
|
||||||
hdr->cmsg_type = SCM_RIGHTS;
|
|
||||||
memcpy(CMSG_DATA(hdr), c->out.out_fd.fd, c->out.out_fd.nfd * sizeof (int));
|
|
||||||
|
|
||||||
n = sendmsg(c->fd, &msg, 0);
|
|
||||||
if(n < 0 && errno == EAGAIN)
|
if(n < 0 && errno == EAGAIN)
|
||||||
return 1;
|
return 1;
|
||||||
for (i = 0; i < c->out.out_fd.nfd; i++)
|
|
||||||
close(c->out.out_fd.fd[i]);
|
|
||||||
c->out.out_fd.nfd = 0;
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
n = writev(c->fd, *vector, n);
|
|
||||||
if(n < 0 && errno == EAGAIN)
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(n <= 0)
|
if(n <= 0)
|
||||||
{
|
{
|
||||||
_xcb_conn_shutdown(c, XCB_CONN_ERROR);
|
_xcb_conn_shutdown(c);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
c->out.total_written += n;
|
|
||||||
for(; *count; --*count, ++*vector)
|
for(; *count; --*count, ++*vector)
|
||||||
{
|
{
|
||||||
int cur = (*vector)->iov_len;
|
int cur = (*vector)->iov_len;
|
||||||
if(cur > n)
|
if(cur > n)
|
||||||
cur = n;
|
cur = n;
|
||||||
if(cur) {
|
|
||||||
(*vector)->iov_len -= cur;
|
(*vector)->iov_len -= cur;
|
||||||
(*vector)->iov_base = (char *) (*vector)->iov_base + cur;
|
(*vector)->iov_base = (char *) (*vector)->iov_base + cur;
|
||||||
n -= cur;
|
n -= cur;
|
||||||
}
|
|
||||||
if((*vector)->iov_len)
|
if((*vector)->iov_len)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(!*count)
|
if(!*count)
|
||||||
*vector = 0;
|
*vector = 0;
|
||||||
assert(n == 0);
|
assert(n == 0);
|
||||||
|
|
||||||
#endif /* _WIN32 */
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,15 +197,15 @@ static int write_vec(xcb_connection_t *c, struct iovec **vector, int *count)
|
||||||
|
|
||||||
const xcb_setup_t *xcb_get_setup(xcb_connection_t *c)
|
const xcb_setup_t *xcb_get_setup(xcb_connection_t *c)
|
||||||
{
|
{
|
||||||
if(is_static_error_conn(c))
|
if(c->has_error)
|
||||||
return &xcb_error_setup;
|
return 0;
|
||||||
/* doesn't need locking because it's never written to. */
|
/* doesn't need locking because it's never written to. */
|
||||||
return c->setup;
|
return c->setup;
|
||||||
}
|
}
|
||||||
|
|
||||||
int xcb_get_file_descriptor(xcb_connection_t *c)
|
int xcb_get_file_descriptor(xcb_connection_t *c)
|
||||||
{
|
{
|
||||||
if(is_static_error_conn(c))
|
if(c->has_error)
|
||||||
return -1;
|
return -1;
|
||||||
/* doesn't need locking because it's never written to. */
|
/* doesn't need locking because it's never written to. */
|
||||||
return c->fd;
|
return c->fd;
|
||||||
|
@ -355,31 +221,16 @@ xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info)
|
||||||
{
|
{
|
||||||
xcb_connection_t* c;
|
xcb_connection_t* c;
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
#ifndef USE_POLL
|
|
||||||
if(fd >= FD_SETSIZE) /* would overflow in FD_SET */
|
|
||||||
{
|
|
||||||
close(fd);
|
|
||||||
return _xcb_conn_ret_error(XCB_CONN_ERROR);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* !_WIN32*/
|
|
||||||
|
|
||||||
c = calloc(1, sizeof(xcb_connection_t));
|
c = calloc(1, sizeof(xcb_connection_t));
|
||||||
if(!c) {
|
if(!c)
|
||||||
#ifdef _WIN32
|
return (xcb_connection_t *) &error_connection;
|
||||||
closesocket(fd);
|
|
||||||
#else
|
|
||||||
close(fd);
|
|
||||||
#endif
|
|
||||||
return _xcb_conn_ret_error(XCB_CONN_CLOSED_MEM_INSUFFICIENT) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
c->fd = fd;
|
c->fd = fd;
|
||||||
|
|
||||||
if(!(
|
if(!(
|
||||||
set_fd_flags(fd) &&
|
set_fd_flags(fd) &&
|
||||||
pthread_mutex_init(&c->iolock, 0) == 0 &&
|
pthread_mutex_init(&c->iolock, 0) == 0 &&
|
||||||
|
_xcb_xlib_init(&c->xlib) &&
|
||||||
_xcb_in_init(&c->in) &&
|
_xcb_in_init(&c->in) &&
|
||||||
_xcb_out_init(&c->out) &&
|
_xcb_out_init(&c->out) &&
|
||||||
write_setup(c, auth_info) &&
|
write_setup(c, auth_info) &&
|
||||||
|
@ -389,7 +240,7 @@ xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info)
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
xcb_disconnect(c);
|
xcb_disconnect(c);
|
||||||
return _xcb_conn_ret_error(XCB_CONN_ERROR);
|
return (xcb_connection_t *) &error_connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
|
@ -397,20 +248,14 @@ xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info)
|
||||||
|
|
||||||
void xcb_disconnect(xcb_connection_t *c)
|
void xcb_disconnect(xcb_connection_t *c)
|
||||||
{
|
{
|
||||||
if(c == NULL || is_static_error_conn(c))
|
if(c->has_error)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
free(c->setup);
|
free(c->setup);
|
||||||
|
|
||||||
/* disallow further sends and receives */
|
|
||||||
shutdown(c->fd, SHUT_RDWR);
|
|
||||||
#ifdef _WIN32
|
|
||||||
closesocket(c->fd);
|
|
||||||
#else
|
|
||||||
close(c->fd);
|
close(c->fd);
|
||||||
#endif
|
|
||||||
|
|
||||||
pthread_mutex_destroy(&c->iolock);
|
pthread_mutex_destroy(&c->iolock);
|
||||||
|
_xcb_xlib_destroy(&c->xlib);
|
||||||
_xcb_in_destroy(&c->in);
|
_xcb_in_destroy(&c->in);
|
||||||
_xcb_out_destroy(&c->out);
|
_xcb_out_destroy(&c->out);
|
||||||
|
|
||||||
|
@ -418,138 +263,100 @@ void xcb_disconnect(xcb_connection_t *c)
|
||||||
_xcb_xid_destroy(c);
|
_xcb_xid_destroy(c);
|
||||||
|
|
||||||
free(c);
|
free(c);
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
WSACleanup();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Private interface */
|
/* Private interface */
|
||||||
|
|
||||||
void _xcb_conn_shutdown(xcb_connection_t *c, int err)
|
void _xcb_conn_shutdown(xcb_connection_t *c)
|
||||||
{
|
{
|
||||||
c->has_error = err;
|
c->has_error = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return connection error state.
|
void _xcb_lock_io(xcb_connection_t *c)
|
||||||
* To make thread-safe, I need a seperate static
|
|
||||||
* variable for every possible error.
|
|
||||||
* has_error is the first field in xcb_connection_t, so just
|
|
||||||
* return a casted int here; checking has_error (and only
|
|
||||||
* has_error) will be safe.
|
|
||||||
*/
|
|
||||||
xcb_connection_t *_xcb_conn_ret_error(int err)
|
|
||||||
{
|
{
|
||||||
|
pthread_mutex_lock(&c->iolock);
|
||||||
|
while(c->xlib.lock)
|
||||||
|
{
|
||||||
|
if(pthread_equal(c->xlib.thread, pthread_self()))
|
||||||
|
break;
|
||||||
|
pthread_cond_wait(&c->xlib.cond, &c->iolock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch(err)
|
void _xcb_unlock_io(xcb_connection_t *c)
|
||||||
|
{
|
||||||
|
pthread_mutex_unlock(&c->iolock);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _xcb_wait_io(xcb_connection_t *c, pthread_cond_t *cond)
|
||||||
|
{
|
||||||
|
int xlib_locked = c->xlib.lock;
|
||||||
|
if(xlib_locked)
|
||||||
{
|
{
|
||||||
case XCB_CONN_CLOSED_MEM_INSUFFICIENT:
|
c->xlib.lock = 0;
|
||||||
{
|
pthread_cond_broadcast(&c->xlib.cond);
|
||||||
return (xcb_connection_t *) &xcb_con_closed_mem_er;
|
|
||||||
}
|
}
|
||||||
case XCB_CONN_CLOSED_PARSE_ERR:
|
pthread_cond_wait(cond, &c->iolock);
|
||||||
|
if(xlib_locked)
|
||||||
{
|
{
|
||||||
return (xcb_connection_t *) &xcb_con_closed_parse_er;
|
while(c->xlib.lock)
|
||||||
}
|
pthread_cond_wait(&c->xlib.cond, &c->iolock);
|
||||||
case XCB_CONN_CLOSED_INVALID_SCREEN:
|
c->xlib.lock = 1;
|
||||||
{
|
c->xlib.thread = pthread_self();
|
||||||
return (xcb_connection_t *) &xcb_con_closed_screen_er;
|
|
||||||
}
|
|
||||||
case XCB_CONN_ERROR:
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
return (xcb_connection_t *) &xcb_con_error;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vector, int *count)
|
int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vector, int *count)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret, xlib_locked;
|
||||||
#if USE_POLL
|
|
||||||
struct pollfd fd;
|
|
||||||
#else
|
|
||||||
fd_set rfds, wfds;
|
fd_set rfds, wfds;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If the thing I should be doing is already being done, wait for it. */
|
/* If the thing I should be doing is already being done, wait for it. */
|
||||||
if(count ? c->out.writing : c->in.reading)
|
if(count ? c->out.writing : c->in.reading)
|
||||||
{
|
{
|
||||||
pthread_cond_wait(cond, &c->iolock);
|
_xcb_wait_io(c, cond);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USE_POLL
|
|
||||||
memset(&fd, 0, sizeof(fd));
|
|
||||||
fd.fd = c->fd;
|
|
||||||
fd.events = POLLIN;
|
|
||||||
#else
|
|
||||||
FD_ZERO(&rfds);
|
FD_ZERO(&rfds);
|
||||||
FD_SET(c->fd, &rfds);
|
FD_SET(c->fd, &rfds);
|
||||||
#endif
|
|
||||||
++c->in.reading;
|
++c->in.reading;
|
||||||
|
|
||||||
#if USE_POLL
|
|
||||||
if(count)
|
|
||||||
{
|
|
||||||
fd.events |= POLLOUT;
|
|
||||||
++c->out.writing;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
FD_ZERO(&wfds);
|
FD_ZERO(&wfds);
|
||||||
if(count)
|
if(count)
|
||||||
{
|
{
|
||||||
FD_SET(c->fd, &wfds);
|
FD_SET(c->fd, &wfds);
|
||||||
++c->out.writing;
|
++c->out.writing;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
pthread_mutex_unlock(&c->iolock);
|
xlib_locked = c->xlib.lock;
|
||||||
do {
|
if(xlib_locked)
|
||||||
#if USE_POLL
|
|
||||||
ret = poll(&fd, 1, -1);
|
|
||||||
/* If poll() returns an event we didn't expect, such as POLLNVAL, treat
|
|
||||||
* it as if it failed. */
|
|
||||||
if(ret >= 0 && (fd.revents & ~fd.events))
|
|
||||||
{
|
{
|
||||||
ret = -1;
|
c->xlib.lock = 0;
|
||||||
break;
|
pthread_cond_broadcast(&c->xlib.cond);
|
||||||
}
|
}
|
||||||
#else
|
_xcb_unlock_io(c);
|
||||||
|
do {
|
||||||
ret = select(c->fd + 1, &rfds, &wfds, 0, 0);
|
ret = select(c->fd + 1, &rfds, &wfds, 0, 0);
|
||||||
#endif
|
|
||||||
} while (ret == -1 && errno == EINTR);
|
} while (ret == -1 && errno == EINTR);
|
||||||
if(ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
_xcb_conn_shutdown(c, XCB_CONN_ERROR);
|
_xcb_conn_shutdown(c);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
pthread_mutex_lock(&c->iolock);
|
_xcb_lock_io(c);
|
||||||
|
if(xlib_locked)
|
||||||
|
{
|
||||||
|
c->xlib.lock = 1;
|
||||||
|
c->xlib.thread = pthread_self();
|
||||||
|
}
|
||||||
|
|
||||||
if(ret)
|
if(ret)
|
||||||
{
|
{
|
||||||
/* The code allows two threads to call select()/poll() at the same time.
|
if(FD_ISSET(c->fd, &rfds))
|
||||||
* First thread just wants to read, a second thread wants to write, too.
|
|
||||||
* We have to make sure that we don't steal the reading thread's reply
|
|
||||||
* and let it get stuck in select()/poll().
|
|
||||||
* So a thread may read if either:
|
|
||||||
* - There is no other thread that wants to read (the above situation
|
|
||||||
* did not occur).
|
|
||||||
* - It is the reading thread (above situation occurred).
|
|
||||||
*/
|
|
||||||
int may_read = c->in.reading == 1 || !count;
|
|
||||||
#if USE_POLL
|
|
||||||
if(may_read && (fd.revents & POLLIN) != 0)
|
|
||||||
#else
|
|
||||||
if(may_read && FD_ISSET(c->fd, &rfds))
|
|
||||||
#endif
|
|
||||||
ret = ret && _xcb_in_read(c);
|
ret = ret && _xcb_in_read(c);
|
||||||
|
|
||||||
#if USE_POLL
|
|
||||||
if((fd.revents & POLLOUT) != 0)
|
|
||||||
#else
|
|
||||||
if(FD_ISSET(c->fd, &wfds))
|
if(FD_ISSET(c->fd, &wfds))
|
||||||
#endif
|
|
||||||
ret = ret && write_vec(c, vector, count);
|
ret = ret && write_vec(c, vector, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -559,30 +366,3 @@ int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vec
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t xcb_total_read(xcb_connection_t *c)
|
|
||||||
{
|
|
||||||
uint64_t n;
|
|
||||||
|
|
||||||
if (xcb_connection_has_error(c))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
pthread_mutex_lock(&c->iolock);
|
|
||||||
n = c->in.total_read;
|
|
||||||
pthread_mutex_unlock(&c->iolock);
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t xcb_total_written(xcb_connection_t *c)
|
|
||||||
{
|
|
||||||
uint64_t n;
|
|
||||||
|
|
||||||
if (xcb_connection_has_error(c))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
pthread_mutex_lock(&c->iolock);
|
|
||||||
n = c->out.total_written;
|
|
||||||
pthread_mutex_unlock(&c->iolock);
|
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
|
@ -25,10 +25,6 @@
|
||||||
|
|
||||||
/* A cache for QueryExtension results. */
|
/* A cache for QueryExtension results. */
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -44,11 +40,11 @@ typedef struct lazyreply {
|
||||||
} value;
|
} value;
|
||||||
} lazyreply;
|
} lazyreply;
|
||||||
|
|
||||||
static lazyreply *get_index(xcb_connection_t *c, int idx)
|
static lazyreply *get_index(xcb_connection_t *c, int index)
|
||||||
{
|
{
|
||||||
if(idx > c->ext.extensions_size)
|
if(index > c->ext.extensions_size)
|
||||||
{
|
{
|
||||||
int new_size = idx << 1;
|
int new_size = index << 1;
|
||||||
lazyreply *new_extensions = realloc(c->ext.extensions, sizeof(lazyreply) * new_size);
|
lazyreply *new_extensions = realloc(c->ext.extensions, sizeof(lazyreply) * new_size);
|
||||||
if(!new_extensions)
|
if(!new_extensions)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -56,7 +52,7 @@ static lazyreply *get_index(xcb_connection_t *c, int idx)
|
||||||
c->ext.extensions = new_extensions;
|
c->ext.extensions = new_extensions;
|
||||||
c->ext.extensions_size = new_size;
|
c->ext.extensions_size = new_size;
|
||||||
}
|
}
|
||||||
return c->ext.extensions + idx - 1;
|
return c->ext.extensions + index - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static lazyreply *get_lazyreply(xcb_connection_t *c, xcb_extension_t *ext)
|
static lazyreply *get_lazyreply(xcb_connection_t *c, xcb_extension_t *ext)
|
||||||
|
|
774
src/xcb_in.c
774
src/xcb_in.c
File diff suppressed because it is too large
Load Diff
|
@ -25,10 +25,6 @@
|
||||||
|
|
||||||
/* A generic implementation of a list of void-pointers. */
|
/* A generic implementation of a list of void-pointers. */
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "xcb.h"
|
#include "xcb.h"
|
||||||
|
@ -36,7 +32,7 @@
|
||||||
|
|
||||||
typedef struct node {
|
typedef struct node {
|
||||||
struct node *next;
|
struct node *next;
|
||||||
uint64_t key;
|
unsigned int key;
|
||||||
void *data;
|
void *data;
|
||||||
} node;
|
} node;
|
||||||
|
|
||||||
|
@ -47,7 +43,7 @@ struct _xcb_map {
|
||||||
|
|
||||||
/* Private interface */
|
/* Private interface */
|
||||||
|
|
||||||
_xcb_map *_xcb_map_new(void)
|
_xcb_map *_xcb_map_new()
|
||||||
{
|
{
|
||||||
_xcb_map *list;
|
_xcb_map *list;
|
||||||
list = malloc(sizeof(_xcb_map));
|
list = malloc(sizeof(_xcb_map));
|
||||||
|
@ -73,7 +69,7 @@ void _xcb_map_delete(_xcb_map *list, xcb_list_free_func_t do_free)
|
||||||
free(list);
|
free(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
int _xcb_map_put(_xcb_map *list, uint64_t key, void *data)
|
int _xcb_map_put(_xcb_map *list, unsigned int key, void *data)
|
||||||
{
|
{
|
||||||
node *cur = malloc(sizeof(node));
|
node *cur = malloc(sizeof(node));
|
||||||
if(!cur)
|
if(!cur)
|
||||||
|
@ -86,7 +82,7 @@ int _xcb_map_put(_xcb_map *list, uint64_t key, void *data)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *_xcb_map_remove(_xcb_map *list, uint64_t key)
|
void *_xcb_map_remove(_xcb_map *list, unsigned int key)
|
||||||
{
|
{
|
||||||
node **cur;
|
node **cur;
|
||||||
for(cur = &list->head; *cur; cur = &(*cur)->next)
|
for(cur = &list->head; *cur; cur = &(*cur)->next)
|
||||||
|
|
336
src/xcb_out.c
336
src/xcb_out.c
|
@ -25,17 +25,9 @@
|
||||||
|
|
||||||
/* Stuff that sends stuff to the server. */
|
/* Stuff that sends stuff to the server. */
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifdef _WIN32
|
|
||||||
#include <io.h>
|
|
||||||
#else
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "xcb.h"
|
#include "xcb.h"
|
||||||
|
@ -43,17 +35,8 @@
|
||||||
#include "xcbint.h"
|
#include "xcbint.h"
|
||||||
#include "bigreq.h"
|
#include "bigreq.h"
|
||||||
|
|
||||||
static inline void send_request(xcb_connection_t *c, int isvoid, enum workarounds workaround, int flags, struct iovec *vector, int count)
|
static int write_block(xcb_connection_t *c, struct iovec *vector, int count)
|
||||||
{
|
{
|
||||||
if(c->has_error)
|
|
||||||
return;
|
|
||||||
|
|
||||||
++c->out.request;
|
|
||||||
if(!isvoid)
|
|
||||||
c->in.request_expected = c->out.request;
|
|
||||||
if(workaround != WORKAROUND_NONE || flags != 0)
|
|
||||||
_xcb_in_expect_reply(c, c->out.request, workaround, flags);
|
|
||||||
|
|
||||||
while(count && c->out.queue_len + vector[0].iov_len <= sizeof(c->out.queue))
|
while(count && c->out.queue_len + vector[0].iov_len <= sizeof(c->out.queue))
|
||||||
{
|
{
|
||||||
memcpy(c->out.queue + c->out.queue_len, vector[0].iov_base, vector[0].iov_len);
|
memcpy(c->out.queue + c->out.queue_len, vector[0].iov_base, vector[0].iov_len);
|
||||||
|
@ -63,75 +46,13 @@ static inline void send_request(xcb_connection_t *c, int isvoid, enum workaround
|
||||||
++vector, --count;
|
++vector, --count;
|
||||||
}
|
}
|
||||||
if(!count)
|
if(!count)
|
||||||
return;
|
return 1;
|
||||||
|
|
||||||
--vector, ++count;
|
--vector, ++count;
|
||||||
vector[0].iov_base = c->out.queue;
|
vector[0].iov_base = c->out.queue;
|
||||||
vector[0].iov_len = c->out.queue_len;
|
vector[0].iov_len = c->out.queue_len;
|
||||||
c->out.queue_len = 0;
|
c->out.queue_len = 0;
|
||||||
_xcb_out_send(c, vector, count);
|
return _xcb_out_send(c, &vector, &count);
|
||||||
}
|
|
||||||
|
|
||||||
static void send_sync(xcb_connection_t *c)
|
|
||||||
{
|
|
||||||
static const union {
|
|
||||||
struct {
|
|
||||||
uint8_t major;
|
|
||||||
uint8_t pad;
|
|
||||||
uint16_t len;
|
|
||||||
} fields;
|
|
||||||
uint32_t packet;
|
|
||||||
} sync_req = { { /* GetInputFocus */ 43, 0, 1 } };
|
|
||||||
struct iovec vector[2];
|
|
||||||
vector[1].iov_base = (char *) &sync_req;
|
|
||||||
vector[1].iov_len = sizeof(sync_req);
|
|
||||||
send_request(c, 0, WORKAROUND_NONE, XCB_REQUEST_DISCARD_REPLY, vector + 1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void get_socket_back(xcb_connection_t *c)
|
|
||||||
{
|
|
||||||
while(c->out.return_socket && c->out.socket_moving)
|
|
||||||
pthread_cond_wait(&c->out.socket_cond, &c->iolock);
|
|
||||||
if(!c->out.return_socket)
|
|
||||||
return;
|
|
||||||
|
|
||||||
c->out.socket_moving = 1;
|
|
||||||
pthread_mutex_unlock(&c->iolock);
|
|
||||||
c->out.return_socket(c->out.socket_closure);
|
|
||||||
pthread_mutex_lock(&c->iolock);
|
|
||||||
c->out.socket_moving = 0;
|
|
||||||
|
|
||||||
pthread_cond_broadcast(&c->out.socket_cond);
|
|
||||||
c->out.return_socket = 0;
|
|
||||||
c->out.socket_closure = 0;
|
|
||||||
_xcb_in_replies_done(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void prepare_socket_request(xcb_connection_t *c)
|
|
||||||
{
|
|
||||||
/* We're about to append data to out.queue, so we need to
|
|
||||||
* atomically test for an external socket owner *and* some other
|
|
||||||
* thread currently writing.
|
|
||||||
*
|
|
||||||
* If we have an external socket owner, we have to get the socket back
|
|
||||||
* before we can use it again.
|
|
||||||
*
|
|
||||||
* If some other thread is writing to the socket, we assume it's
|
|
||||||
* writing from out.queue, and so we can't stick data there.
|
|
||||||
*
|
|
||||||
* We satisfy this condition by first calling get_socket_back
|
|
||||||
* (which may drop the lock, but will return when XCB owns the
|
|
||||||
* socket again) and then checking for another writing thread and
|
|
||||||
* escaping the loop if we're ready to go.
|
|
||||||
*/
|
|
||||||
for (;;) {
|
|
||||||
if(c->has_error)
|
|
||||||
return;
|
|
||||||
get_socket_back(c);
|
|
||||||
if (!c->out.writing)
|
|
||||||
break;
|
|
||||||
pthread_cond_wait(&c->out.cond, &c->iolock);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Public interface */
|
/* Public interface */
|
||||||
|
@ -181,59 +102,23 @@ uint32_t xcb_get_maximum_request_length(xcb_connection_t *c)
|
||||||
return c->out.maximum_request_length.value;
|
return c->out.maximum_request_length.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void close_fds(int *fds, unsigned int num_fds)
|
unsigned int xcb_send_request(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *req)
|
||||||
{
|
{
|
||||||
for (unsigned int index = 0; index < num_fds; index++)
|
static const union {
|
||||||
close(fds[index]);
|
struct {
|
||||||
}
|
uint8_t major;
|
||||||
|
uint8_t pad;
|
||||||
static void send_fds(xcb_connection_t *c, int *fds, unsigned int num_fds)
|
uint16_t len;
|
||||||
{
|
} fields;
|
||||||
#if HAVE_SENDMSG
|
uint32_t packet;
|
||||||
/* Calling _xcb_out_flush_to() can drop the iolock and wait on a condition
|
} sync = { { /* GetInputFocus */ 43, 0, 1 } };
|
||||||
* variable if another thread is currently writing (c->out.writing > 0).
|
unsigned int request;
|
||||||
* This call waits for writers to be done and thus _xcb_out_flush_to() will
|
uint32_t prefix[3] = { 0 };
|
||||||
* do the work itself (in which case we are a writer and
|
|
||||||
* prepare_socket_request() will wait for us to be done if another threads
|
|
||||||
* tries to send fds, too). Thanks to this, we can atomically write out FDs.
|
|
||||||
*/
|
|
||||||
prepare_socket_request(c);
|
|
||||||
|
|
||||||
while (num_fds > 0) {
|
|
||||||
while (c->out.out_fd.nfd == XCB_MAX_PASS_FD && !c->has_error) {
|
|
||||||
/* XXX: if c->out.writing > 0, this releases the iolock and
|
|
||||||
* potentially allows other threads to interfere with their own fds.
|
|
||||||
*/
|
|
||||||
_xcb_out_flush_to(c, c->out.request);
|
|
||||||
|
|
||||||
if (c->out.out_fd.nfd == XCB_MAX_PASS_FD) {
|
|
||||||
/* We need some request to send FDs with */
|
|
||||||
_xcb_out_send_sync(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (c->has_error)
|
|
||||||
break;
|
|
||||||
|
|
||||||
c->out.out_fd.fd[c->out.out_fd.nfd++] = fds[0];
|
|
||||||
fds++;
|
|
||||||
num_fds--;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
close_fds(fds, num_fds);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t xcb_send_request_with_fds64(xcb_connection_t *c, int flags, struct iovec *vector,
|
|
||||||
const xcb_protocol_request_t *req, unsigned int num_fds, int *fds)
|
|
||||||
{
|
|
||||||
uint64_t request;
|
|
||||||
uint32_t prefix[2];
|
|
||||||
int veclen = req->count;
|
int veclen = req->count;
|
||||||
enum workarounds workaround = WORKAROUND_NONE;
|
enum workarounds workaround = WORKAROUND_NONE;
|
||||||
|
|
||||||
if(c->has_error) {
|
if(c->has_error)
|
||||||
close_fds(fds, num_fds);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
assert(c != 0);
|
assert(c != 0);
|
||||||
assert(vector != 0);
|
assert(vector != 0);
|
||||||
|
@ -242,7 +127,7 @@ uint64_t xcb_send_request_with_fds64(xcb_connection_t *c, int flags, struct iove
|
||||||
if(!(flags & XCB_REQUEST_RAW))
|
if(!(flags & XCB_REQUEST_RAW))
|
||||||
{
|
{
|
||||||
static const char pad[3];
|
static const char pad[3];
|
||||||
unsigned int i;
|
int i;
|
||||||
uint16_t shortlen = 0;
|
uint16_t shortlen = 0;
|
||||||
size_t longlen = 0;
|
size_t longlen = 0;
|
||||||
assert(vector[0].iov_len >= 4);
|
assert(vector[0].iov_len >= 4);
|
||||||
|
@ -252,8 +137,7 @@ uint64_t xcb_send_request_with_fds64(xcb_connection_t *c, int flags, struct iove
|
||||||
const xcb_query_extension_reply_t *extension = xcb_get_extension_data(c, req->ext);
|
const xcb_query_extension_reply_t *extension = xcb_get_extension_data(c, req->ext);
|
||||||
if(!(extension && extension->present))
|
if(!(extension && extension->present))
|
||||||
{
|
{
|
||||||
close_fds(fds, num_fds);
|
_xcb_conn_shutdown(c);
|
||||||
_xcb_conn_shutdown(c, XCB_CONN_CLOSED_EXT_NOTSUPPORTED);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
((uint8_t *) vector[0].iov_base)[0] = extension->major_opcode;
|
((uint8_t *) vector[0].iov_base)[0] = extension->major_opcode;
|
||||||
|
@ -283,23 +167,14 @@ uint64_t xcb_send_request_with_fds64(xcb_connection_t *c, int flags, struct iove
|
||||||
}
|
}
|
||||||
else if(longlen > xcb_get_maximum_request_length(c))
|
else if(longlen > xcb_get_maximum_request_length(c))
|
||||||
{
|
{
|
||||||
close_fds(fds, num_fds);
|
_xcb_conn_shutdown(c);
|
||||||
_xcb_conn_shutdown(c, XCB_CONN_CLOSED_REQ_LEN_EXCEED);
|
|
||||||
return 0; /* server can't take this; maybe need BIGREQUESTS? */
|
return 0; /* server can't take this; maybe need BIGREQUESTS? */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set the length field. */
|
/* set the length field. */
|
||||||
((uint16_t *) vector[0].iov_base)[1] = shortlen;
|
((uint16_t *) vector[0].iov_base)[1] = shortlen;
|
||||||
if(!shortlen)
|
if(!shortlen)
|
||||||
{
|
prefix[2] = ++longlen;
|
||||||
prefix[0] = ((uint32_t *) vector[0].iov_base)[0];
|
|
||||||
prefix[1] = ++longlen;
|
|
||||||
vector[0].iov_base = (uint32_t *) vector[0].iov_base + 1;
|
|
||||||
vector[0].iov_len -= sizeof(uint32_t);
|
|
||||||
--vector, ++veclen;
|
|
||||||
vector[0].iov_base = prefix;
|
|
||||||
vector[0].iov_len = sizeof(prefix);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
flags &= ~XCB_REQUEST_RAW;
|
flags &= ~XCB_REQUEST_RAW;
|
||||||
|
|
||||||
|
@ -312,120 +187,62 @@ uint64_t xcb_send_request_with_fds64(xcb_connection_t *c, int flags, struct iove
|
||||||
workaround = WORKAROUND_GLX_GET_FB_CONFIGS_BUG;
|
workaround = WORKAROUND_GLX_GET_FB_CONFIGS_BUG;
|
||||||
|
|
||||||
/* get a sequence number and arrange for delivery. */
|
/* get a sequence number and arrange for delivery. */
|
||||||
pthread_mutex_lock(&c->iolock);
|
_xcb_lock_io(c);
|
||||||
|
/* wait for other writing threads to get out of my way. */
|
||||||
|
while(c->out.writing)
|
||||||
|
_xcb_wait_io(c, &c->out.cond);
|
||||||
|
|
||||||
/* send FDs before establishing a good request number, because this might
|
request = ++c->out.request;
|
||||||
* call send_sync(), too
|
/* send GetInputFocus (sync) when 64k-2 requests have been sent without
|
||||||
*/
|
|
||||||
send_fds(c, fds, num_fds);
|
|
||||||
|
|
||||||
prepare_socket_request(c);
|
|
||||||
|
|
||||||
/* send GetInputFocus (sync_req) when 64k-2 requests have been sent without
|
|
||||||
* a reply.
|
* a reply.
|
||||||
* Also send sync_req (could use NoOp) at 32-bit wrap to avoid having
|
* Also send sync (could use NoOp) at 32-bit wrap to avoid having
|
||||||
* applications see sequence 0 as that is used to indicate
|
* applications see sequence 0 as that is used to indicate
|
||||||
* an error in sending the request
|
* an error in sending the request */
|
||||||
*/
|
while((req->isvoid &&
|
||||||
|
c->out.request == c->in.request_expected + (1 << 16) - 1) ||
|
||||||
while ((req->isvoid && c->out.request == c->in.request_expected + (1 << 16) - 2) ||
|
request == 0)
|
||||||
(unsigned int) (c->out.request + 1) == 0)
|
|
||||||
{
|
{
|
||||||
send_sync(c);
|
prefix[0] = sync.packet;
|
||||||
prepare_socket_request(c);
|
_xcb_in_expect_reply(c, request, WORKAROUND_NONE, XCB_REQUEST_DISCARD_REPLY);
|
||||||
|
c->in.request_expected = c->out.request;
|
||||||
|
request = ++c->out.request;
|
||||||
}
|
}
|
||||||
|
|
||||||
send_request(c, req->isvoid, workaround, flags, vector, veclen);
|
if(workaround != WORKAROUND_NONE || flags != 0)
|
||||||
request = c->has_error ? 0 : c->out.request;
|
_xcb_in_expect_reply(c, request, workaround, flags);
|
||||||
pthread_mutex_unlock(&c->iolock);
|
if(!req->isvoid)
|
||||||
|
c->in.request_expected = c->out.request;
|
||||||
|
|
||||||
|
if(prefix[0] || prefix[2])
|
||||||
|
{
|
||||||
|
--vector, ++veclen;
|
||||||
|
if(prefix[2])
|
||||||
|
{
|
||||||
|
prefix[1] = ((uint32_t *) vector[1].iov_base)[0];
|
||||||
|
vector[1].iov_base = (uint32_t *) vector[1].iov_base + 1;
|
||||||
|
vector[1].iov_len -= sizeof(uint32_t);
|
||||||
|
}
|
||||||
|
vector[0].iov_len = sizeof(uint32_t) * (prefix[0] ? 1 : 0 | prefix[2] ? 2 : 0);
|
||||||
|
vector[0].iov_base = prefix + !prefix[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!write_block(c, vector, veclen))
|
||||||
|
{
|
||||||
|
_xcb_conn_shutdown(c);
|
||||||
|
request = 0;
|
||||||
|
}
|
||||||
|
_xcb_unlock_io(c);
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* request number are actually uint64_t internally but keep API compat with unsigned int */
|
|
||||||
unsigned int xcb_send_request_with_fds(xcb_connection_t *c, int flags, struct iovec *vector,
|
|
||||||
const xcb_protocol_request_t *req, unsigned int num_fds, int *fds)
|
|
||||||
{
|
|
||||||
return xcb_send_request_with_fds64(c, flags, vector, req, num_fds, fds);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t xcb_send_request64(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *req)
|
|
||||||
{
|
|
||||||
return xcb_send_request_with_fds64(c, flags, vector, req, 0, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* request number are actually uint64_t internally but keep API compat with unsigned int */
|
|
||||||
unsigned int xcb_send_request(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *req)
|
|
||||||
{
|
|
||||||
return xcb_send_request64(c, flags, vector, req);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
xcb_send_fd(xcb_connection_t *c, int fd)
|
|
||||||
{
|
|
||||||
int fds[1] = { fd };
|
|
||||||
|
|
||||||
if (c->has_error) {
|
|
||||||
close(fd);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
pthread_mutex_lock(&c->iolock);
|
|
||||||
send_fds(c, &fds[0], 1);
|
|
||||||
pthread_mutex_unlock(&c->iolock);
|
|
||||||
}
|
|
||||||
|
|
||||||
int xcb_take_socket(xcb_connection_t *c, void (*return_socket)(void *closure), void *closure, int flags, uint64_t *sent)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
if(c->has_error)
|
|
||||||
return 0;
|
|
||||||
pthread_mutex_lock(&c->iolock);
|
|
||||||
get_socket_back(c);
|
|
||||||
|
|
||||||
/* _xcb_out_flush may drop the iolock allowing other threads to
|
|
||||||
* write requests, so keep flushing until we're done
|
|
||||||
*/
|
|
||||||
do
|
|
||||||
ret = _xcb_out_flush_to(c, c->out.request);
|
|
||||||
while (ret && c->out.request != c->out.request_written);
|
|
||||||
if(ret)
|
|
||||||
{
|
|
||||||
c->out.return_socket = return_socket;
|
|
||||||
c->out.socket_closure = closure;
|
|
||||||
if(flags) {
|
|
||||||
/* c->out.request + 1 will be the first request sent by the external
|
|
||||||
* socket owner. If the socket is returned before this request is sent
|
|
||||||
* it will be detected in _xcb_in_replies_done and this pending_reply
|
|
||||||
* will be discarded.
|
|
||||||
*/
|
|
||||||
_xcb_in_expect_reply(c, c->out.request + 1, WORKAROUND_EXTERNAL_SOCKET_OWNER, flags);
|
|
||||||
}
|
|
||||||
assert(c->out.request == c->out.request_written);
|
|
||||||
*sent = c->out.request;
|
|
||||||
}
|
|
||||||
pthread_mutex_unlock(&c->iolock);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int xcb_writev(xcb_connection_t *c, struct iovec *vector, int count, uint64_t requests)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
if(c->has_error)
|
|
||||||
return 0;
|
|
||||||
pthread_mutex_lock(&c->iolock);
|
|
||||||
c->out.request += requests;
|
|
||||||
ret = _xcb_out_send(c, vector, count);
|
|
||||||
pthread_mutex_unlock(&c->iolock);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int xcb_flush(xcb_connection_t *c)
|
int xcb_flush(xcb_connection_t *c)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
if(c->has_error)
|
if(c->has_error)
|
||||||
return 0;
|
return 0;
|
||||||
pthread_mutex_lock(&c->iolock);
|
_xcb_lock_io(c);
|
||||||
ret = _xcb_out_flush_to(c, c->out.request);
|
ret = _xcb_out_flush_to(c, c->out.request);
|
||||||
pthread_mutex_unlock(&c->iolock);
|
_xcb_unlock_io(c);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,12 +250,6 @@ int xcb_flush(xcb_connection_t *c)
|
||||||
|
|
||||||
int _xcb_out_init(_xcb_out *out)
|
int _xcb_out_init(_xcb_out *out)
|
||||||
{
|
{
|
||||||
if(pthread_cond_init(&out->socket_cond, 0))
|
|
||||||
return 0;
|
|
||||||
out->return_socket = 0;
|
|
||||||
out->socket_closure = 0;
|
|
||||||
out->socket_moving = 0;
|
|
||||||
|
|
||||||
if(pthread_cond_init(&out->cond, 0))
|
if(pthread_cond_init(&out->cond, 0))
|
||||||
return 0;
|
return 0;
|
||||||
out->writing = 0;
|
out->writing = 0;
|
||||||
|
@ -447,7 +258,6 @@ int _xcb_out_init(_xcb_out *out)
|
||||||
|
|
||||||
out->request = 0;
|
out->request = 0;
|
||||||
out->request_written = 0;
|
out->request_written = 0;
|
||||||
out->request_expected_written = 0;
|
|
||||||
|
|
||||||
if(pthread_mutex_init(&out->reqlenlock, 0))
|
if(pthread_mutex_init(&out->reqlenlock, 0))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -458,44 +268,36 @@ int _xcb_out_init(_xcb_out *out)
|
||||||
|
|
||||||
void _xcb_out_destroy(_xcb_out *out)
|
void _xcb_out_destroy(_xcb_out *out)
|
||||||
{
|
{
|
||||||
pthread_mutex_destroy(&out->reqlenlock);
|
|
||||||
pthread_cond_destroy(&out->cond);
|
pthread_cond_destroy(&out->cond);
|
||||||
pthread_cond_destroy(&out->socket_cond);
|
pthread_mutex_destroy(&out->reqlenlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
int _xcb_out_send(xcb_connection_t *c, struct iovec *vector, int count)
|
int _xcb_out_send(xcb_connection_t *c, struct iovec **vector, int *count)
|
||||||
{
|
{
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
while(ret && count)
|
while(ret && *count)
|
||||||
ret = _xcb_conn_wait(c, &c->out.cond, &vector, &count);
|
ret = _xcb_conn_wait(c, &c->out.cond, vector, count);
|
||||||
c->out.request_written = c->out.request;
|
c->out.request_written = c->out.request;
|
||||||
c->out.request_expected_written = c->in.request_expected;
|
|
||||||
pthread_cond_broadcast(&c->out.cond);
|
pthread_cond_broadcast(&c->out.cond);
|
||||||
_xcb_in_wake_up_next_reader(c);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _xcb_out_send_sync(xcb_connection_t *c)
|
int _xcb_out_flush_to(xcb_connection_t *c, unsigned int request)
|
||||||
{
|
|
||||||
prepare_socket_request(c);
|
|
||||||
send_sync(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
int _xcb_out_flush_to(xcb_connection_t *c, uint64_t request)
|
|
||||||
{
|
{
|
||||||
assert(XCB_SEQUENCE_COMPARE(request, <=, c->out.request));
|
assert(XCB_SEQUENCE_COMPARE(request, <=, c->out.request));
|
||||||
if(XCB_SEQUENCE_COMPARE(c->out.request_written, >=, request))
|
if(XCB_SEQUENCE_COMPARE(c->out.request_written, >=, request))
|
||||||
return 1;
|
return 1;
|
||||||
if(c->out.queue_len)
|
if(c->out.queue_len)
|
||||||
{
|
{
|
||||||
struct iovec vec;
|
struct iovec vec, *vec_ptr = &vec;
|
||||||
|
int count = 1;
|
||||||
vec.iov_base = c->out.queue;
|
vec.iov_base = c->out.queue;
|
||||||
vec.iov_len = c->out.queue_len;
|
vec.iov_len = c->out.queue_len;
|
||||||
c->out.queue_len = 0;
|
c->out.queue_len = 0;
|
||||||
return _xcb_out_send(c, &vec, 1);
|
return _xcb_out_send(c, &vec_ptr, &count);
|
||||||
}
|
}
|
||||||
while(c->out.writing)
|
while(c->out.writing)
|
||||||
pthread_cond_wait(&c->out.cond, &c->iolock);
|
_xcb_wait_io(c, &c->out.cond);
|
||||||
assert(XCB_SEQUENCE_COMPARE(c->out.request_written, >=, request));
|
assert(XCB_SEQUENCE_COMPARE(c->out.request_written, >=, request));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
506
src/xcb_util.c
506
src/xcb_util.c
|
@ -25,136 +25,34 @@
|
||||||
|
|
||||||
/* Utility functions implementable using only public APIs. */
|
/* Utility functions implementable using only public APIs. */
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <limits.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include "xcb_windefs.h"
|
|
||||||
#else
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <netinet/tcp.h>
|
#ifdef DNETCONN
|
||||||
#include <fcntl.h>
|
#include <netdnet/dnetdb.h>
|
||||||
|
#include <netdnet/dn.h>
|
||||||
|
#endif
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#endif /* _WIN32 */
|
#include <errno.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "xcb.h"
|
#include "xcb.h"
|
||||||
#include "xcbext.h"
|
#include "xcbext.h"
|
||||||
#include "xcbint.h"
|
#include "xcbint.h"
|
||||||
|
|
||||||
#if defined(HAVE_TSOL_LABEL_H) && defined(HAVE_IS_SYSTEM_LABELED)
|
static const int error_connection = 1;
|
||||||
# include <tsol/label.h>
|
|
||||||
# include <sys/stat.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <sys/stat.h>
|
|
||||||
|
|
||||||
#ifndef __has_builtin
|
|
||||||
# define __has_builtin(x) 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int xcb_popcount(uint32_t mask)
|
int xcb_popcount(uint32_t mask)
|
||||||
{
|
{
|
||||||
#if __has_builtin(__builtin_popcount)
|
|
||||||
return __builtin_popcount(mask);
|
|
||||||
#else
|
|
||||||
/*
|
|
||||||
* Count the number of bits set to 1 in a 32-bit word.
|
|
||||||
* Algorithm from MIT AI Lab Memo 239: "HAKMEM", ITEM 169.
|
|
||||||
* https://dspace.mit.edu/handle/1721.1/6086
|
|
||||||
*/
|
|
||||||
uint32_t y;
|
uint32_t y;
|
||||||
y = (mask >> 1) & 033333333333;
|
y = (mask >> 1) & 033333333333;
|
||||||
y = mask - y - ((y >> 1) & 033333333333);
|
y = mask - y - ((y >> 1) & 033333333333);
|
||||||
return ((y + (y >> 3)) & 030707070707) % 077;
|
return ((y + (y >> 3)) & 030707070707) % 077;
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
int xcb_sumof(uint8_t *list, int len)
|
|
||||||
{
|
|
||||||
int i, s = 0;
|
|
||||||
for(i=0; i<len; i++) {
|
|
||||||
s += *list;
|
|
||||||
list++;
|
|
||||||
}
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return true and parse if name matches <path to socket>[.<screen>]
|
|
||||||
* Upon success:
|
|
||||||
* host = <path to socket>
|
|
||||||
* protocol = "unix"
|
|
||||||
* display = 0
|
|
||||||
* screen = <screen>
|
|
||||||
*/
|
|
||||||
static int _xcb_parse_display_path_to_socket(const char *name, char **host, char **protocol,
|
|
||||||
int *displayp, int *screenp)
|
|
||||||
{
|
|
||||||
struct stat sbuf;
|
|
||||||
/* In addition to the AF_UNIX path, there may be a screen number.
|
|
||||||
* The trailing \0 is already accounted in the size of sun_path. */
|
|
||||||
char path[sizeof(((struct sockaddr_un*)0)->sun_path) + 1 + 10];
|
|
||||||
size_t len;
|
|
||||||
int _screen = 0, res;
|
|
||||||
|
|
||||||
len = strlen(name);
|
|
||||||
if (len >= sizeof(path))
|
|
||||||
return 0;
|
|
||||||
memcpy(path, name, len + 1);
|
|
||||||
res = stat(path, &sbuf);
|
|
||||||
if (0 != res) {
|
|
||||||
unsigned long lscreen;
|
|
||||||
char *dot, *endptr;
|
|
||||||
if (res != -1 || (errno != ENOENT && errno != ENOTDIR))
|
|
||||||
return 0;
|
|
||||||
dot = strrchr(path, '.');
|
|
||||||
if (!dot || dot[1] < '1' || dot[1] > '9')
|
|
||||||
return 0;
|
|
||||||
*dot = '\0';
|
|
||||||
errno = 0;
|
|
||||||
lscreen = strtoul(dot + 1, &endptr, 10);
|
|
||||||
if (lscreen > INT_MAX || !endptr || *endptr || errno)
|
|
||||||
return 0;
|
|
||||||
if (0 != stat(path, &sbuf))
|
|
||||||
return 0;
|
|
||||||
_screen = (int)lscreen;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (host) {
|
|
||||||
*host = strdup(path);
|
|
||||||
if (!*host)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (protocol) {
|
|
||||||
*protocol = strdup("unix");
|
|
||||||
if (!*protocol) {
|
|
||||||
if (host)
|
|
||||||
free(*host);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (displayp)
|
|
||||||
*displayp = 0;
|
|
||||||
|
|
||||||
if (screenp)
|
|
||||||
*screenp = _screen;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _xcb_parse_display(const char *name, char **host, char **protocol,
|
static int _xcb_parse_display(const char *name, char **host, char **protocol,
|
||||||
|
@ -162,21 +60,11 @@ static int _xcb_parse_display(const char *name, char **host, char **protocol,
|
||||||
{
|
{
|
||||||
int len, display, screen;
|
int len, display, screen;
|
||||||
char *slash, *colon, *dot, *end;
|
char *slash, *colon, *dot, *end;
|
||||||
|
|
||||||
if(!name || !*name)
|
if(!name || !*name)
|
||||||
name = getenv("DISPLAY");
|
name = getenv("DISPLAY");
|
||||||
if(!name)
|
if(!name)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* First check for <path to socket>[.<screen>] */
|
|
||||||
if (name[0] == '/')
|
|
||||||
return _xcb_parse_display_path_to_socket(name, host, protocol, displayp, screenp);
|
|
||||||
|
|
||||||
if (strncmp(name, "unix:", 5) == 0)
|
|
||||||
return _xcb_parse_display_path_to_socket(name + 5, host, protocol, displayp, screenp);
|
|
||||||
|
|
||||||
slash = strrchr(name, '/');
|
slash = strrchr(name, '/');
|
||||||
|
|
||||||
if (slash) {
|
if (slash) {
|
||||||
len = slash - name;
|
len = slash - name;
|
||||||
if (protocol) {
|
if (protocol) {
|
||||||
|
@ -193,43 +81,35 @@ static int _xcb_parse_display(const char *name, char **host, char **protocol,
|
||||||
|
|
||||||
colon = strrchr(name, ':');
|
colon = strrchr(name, ':');
|
||||||
if(!colon)
|
if(!colon)
|
||||||
goto error_out;
|
return 0;
|
||||||
len = colon - name;
|
len = colon - name;
|
||||||
++colon;
|
++colon;
|
||||||
display = strtoul(colon, &dot, 10);
|
display = strtoul(colon, &dot, 10);
|
||||||
if(dot == colon)
|
if(dot == colon)
|
||||||
goto error_out;
|
return 0;
|
||||||
if(*dot == '\0')
|
if(*dot == '\0')
|
||||||
screen = 0;
|
screen = 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(*dot != '.')
|
if(*dot != '.')
|
||||||
goto error_out;
|
return 0;
|
||||||
++dot;
|
++dot;
|
||||||
screen = strtoul(dot, &end, 10);
|
screen = strtoul(dot, &end, 10);
|
||||||
if(end == dot || *end != '\0')
|
if(end == dot || *end != '\0')
|
||||||
goto error_out;
|
return 0;
|
||||||
}
|
}
|
||||||
/* At this point, the display string is fully parsed and valid, but
|
/* At this point, the display string is fully parsed and valid, but
|
||||||
* the caller's memory is untouched. */
|
* the caller's memory is untouched. */
|
||||||
|
|
||||||
*host = malloc(len + 1);
|
*host = malloc(len + 1);
|
||||||
if(!*host)
|
if(!*host)
|
||||||
goto error_out;
|
return 0;
|
||||||
memcpy(*host, name, len);
|
memcpy(*host, name, len);
|
||||||
(*host)[len] = '\0';
|
(*host)[len] = '\0';
|
||||||
*displayp = display;
|
*displayp = display;
|
||||||
if(screenp)
|
if(screenp)
|
||||||
*screenp = screen;
|
*screenp = screen;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
error_out:
|
|
||||||
if (protocol) {
|
|
||||||
free(*protocol);
|
|
||||||
*protocol = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int xcb_parse_display(const char *name, char **host, int *displayp,
|
int xcb_parse_display(const char *name, char **host, int *displayp,
|
||||||
|
@ -238,164 +118,104 @@ int xcb_parse_display(const char *name, char **host, int *displayp,
|
||||||
return _xcb_parse_display(name, host, NULL, displayp, screenp);
|
return _xcb_parse_display(name, host, NULL, displayp, screenp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _xcb_open_tcp(const char *host, char *protocol, const unsigned short port);
|
static int _xcb_open_tcp(char *host, char *protocol, const unsigned short port);
|
||||||
#ifndef _WIN32
|
|
||||||
static int _xcb_open_unix(char *protocol, const char *file);
|
static int _xcb_open_unix(char *protocol, const char *file);
|
||||||
#endif /* !WIN32 */
|
#ifdef DNETCONN
|
||||||
#ifdef HAVE_ABSTRACT_SOCKETS
|
static int _xcb_open_decnet(const char *host, char *protocol, const unsigned short port);
|
||||||
static int _xcb_open_abstract(char *protocol, const char *file, size_t filelen);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int _xcb_open(const char *host, char *protocol, const int display)
|
static int _xcb_open(char *host, char *protocol, const int display)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
#ifdef __hpux
|
static const char base[] = "/tmp/.X11-unix/X";
|
||||||
static const char unix_base[] = "/usr/spool/sockets/X11/";
|
char file[sizeof(base) + 20];
|
||||||
#else
|
|
||||||
static const char unix_base[] = "/tmp/.X11-unix/X";
|
|
||||||
#endif
|
|
||||||
const char *base = unix_base;
|
|
||||||
size_t filelen;
|
|
||||||
char *file = NULL;
|
|
||||||
int actual_filelen;
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
if(*host)
|
||||||
if (protocol && strcmp("unix", protocol) == 0 && host && host[0] == '/') {
|
|
||||||
/* Full path to socket provided, ignore everything else */
|
|
||||||
filelen = strlen(host) + 1;
|
|
||||||
if (filelen > INT_MAX)
|
|
||||||
return -1;
|
|
||||||
file = malloc(filelen);
|
|
||||||
if (file == NULL)
|
|
||||||
return -1;
|
|
||||||
memcpy(file, host, filelen);
|
|
||||||
actual_filelen = (int)(filelen - 1);
|
|
||||||
} else {
|
|
||||||
#endif
|
|
||||||
/* If protocol or host is "unix", fall through to Unix socket code below */
|
|
||||||
if ((!protocol || (strcmp("unix",protocol) != 0)) &&
|
|
||||||
(*host != '\0') && (strcmp("unix",host) != 0))
|
|
||||||
{
|
{
|
||||||
|
#ifdef DNETCONN
|
||||||
|
/* 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')
|
||||||
|
{
|
||||||
|
*colon = '\0';
|
||||||
|
return _xcb_open_decnet(host, protocol, display);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
if (protocol
|
||||||
|
|| strcmp("unix",host)) { /* follow the old unix: rule */
|
||||||
|
|
||||||
/* display specifies TCP */
|
/* display specifies TCP */
|
||||||
unsigned short port = X_TCP_PORT + display;
|
unsigned short port = X_TCP_PORT + display;
|
||||||
return _xcb_open_tcp(host, protocol, port);
|
return _xcb_open_tcp(host, protocol, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
#if defined(HAVE_TSOL_LABEL_H) && defined(HAVE_IS_SYSTEM_LABELED)
|
|
||||||
/* Check special path for Unix sockets under Solaris Trusted Extensions */
|
|
||||||
if (is_system_labeled())
|
|
||||||
{
|
|
||||||
const char *tsol_base = "/var/tsol/doors/.X11-unix/X";
|
|
||||||
char tsol_socket[PATH_MAX];
|
|
||||||
struct stat sbuf;
|
|
||||||
|
|
||||||
snprintf(tsol_socket, sizeof(tsol_socket), "%s%d", tsol_base, display);
|
|
||||||
|
|
||||||
if (stat(tsol_socket, &sbuf) == 0)
|
|
||||||
base = tsol_base;
|
|
||||||
else if (errno != ENOENT)
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
filelen = strlen(base) + 1 + sizeof(display) * 3 + 1;
|
|
||||||
file = malloc(filelen);
|
|
||||||
if(file == NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* display specifies Unix socket */
|
/* display specifies Unix socket */
|
||||||
actual_filelen = snprintf(file, filelen, "%s%d", base, display);
|
snprintf(file, sizeof(file), "%s%d", base, display);
|
||||||
|
return _xcb_open_unix(protocol, file);
|
||||||
|
|
||||||
if(actual_filelen < 0)
|
|
||||||
{
|
|
||||||
free(file);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
/* snprintf may truncate the file */
|
|
||||||
filelen = MIN(actual_filelen, filelen - 1);
|
|
||||||
#ifdef HAVE_ABSTRACT_SOCKETS
|
|
||||||
fd = _xcb_open_abstract(protocol, file, filelen);
|
|
||||||
if (fd >= 0 || (errno != ENOENT && errno != ECONNREFUSED))
|
|
||||||
{
|
|
||||||
free(file);
|
|
||||||
return fd;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
fd = _xcb_open_unix(protocol, file);
|
|
||||||
free(file);
|
|
||||||
|
|
||||||
if (fd < 0 && !protocol && *host == '\0') {
|
|
||||||
unsigned short port = X_TCP_PORT + display;
|
|
||||||
fd = _xcb_open_tcp(host, protocol, port);
|
|
||||||
}
|
|
||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
#endif /* !_WIN32 */
|
|
||||||
return -1; /* if control reaches here then something has gone wrong */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _xcb_socket(int family, int type, int proto)
|
#ifdef DNETCONN
|
||||||
|
static int _xcb_open_decnet(const char *host, const char *protocol, const unsigned short port)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
struct sockaddr_dn addr;
|
||||||
|
struct accessdata_dn accessdata;
|
||||||
|
struct nodeent *nodeaddr = getnodebyname(host);
|
||||||
|
|
||||||
#ifdef SOCK_CLOEXEC
|
if(!nodeaddr)
|
||||||
fd = socket(family, type | SOCK_CLOEXEC, proto);
|
return -1;
|
||||||
if (fd == -1 && errno == EINVAL)
|
if (protocol && strcmp("dnet",protocol))
|
||||||
#endif
|
return -1;
|
||||||
{
|
addr.sdn_family = AF_DECnet;
|
||||||
fd = socket(family, type, proto);
|
|
||||||
#ifndef _WIN32
|
|
||||||
if (fd >= 0)
|
|
||||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
addr.sdn_add.a_len = nodeaddr->n_length;
|
||||||
|
memcpy(addr.sdn_add.a_addr, nodeaddr->n_addr, addr.sdn_add.a_len);
|
||||||
|
|
||||||
static int _xcb_do_connect(int fd, const struct sockaddr* addr, int addrlen) {
|
sprintf((char *)addr.sdn_objname, "X$X%d", port);
|
||||||
int on = 1;
|
addr.sdn_objnamel = strlen((char *)addr.sdn_objname);
|
||||||
|
addr.sdn_objnum = 0;
|
||||||
|
|
||||||
if(fd < 0)
|
fd = socket(PF_DECnet, SOCK_STREAM, 0);
|
||||||
|
if(fd == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
|
memset(&accessdata, 0, sizeof(accessdata));
|
||||||
setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on));
|
sprintf((char*)accessdata.acc_acc, "%d", getuid());
|
||||||
|
accessdata.acc_accl = strlen((char *)accessdata.acc_acc);
|
||||||
|
setsockopt(fd, DNPROTO_NSP, SO_CONACCESS, &accessdata, sizeof(accessdata));
|
||||||
|
|
||||||
return connect(fd, addr, addrlen);
|
if(connect(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1)
|
||||||
|
return -1;
|
||||||
|
return fd;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int _xcb_open_tcp(const char *host, char *protocol, const unsigned short port)
|
static int _xcb_open_tcp(char *host, char *protocol, const unsigned short port)
|
||||||
{
|
{
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
#if HAVE_GETADDRINFO
|
struct addrinfo hints = { 0
|
||||||
struct addrinfo hints;
|
#ifdef AI_ADDRCONFIG
|
||||||
|
| AI_ADDRCONFIG
|
||||||
|
#endif
|
||||||
|
#ifdef AI_NUMERICSERV
|
||||||
|
| AI_NUMERICSERV
|
||||||
|
#endif
|
||||||
|
, AF_UNSPEC, SOCK_STREAM };
|
||||||
char service[6]; /* "65535" with the trailing '\0' */
|
char service[6]; /* "65535" with the trailing '\0' */
|
||||||
struct addrinfo *results, *addr;
|
struct addrinfo *results, *addr;
|
||||||
char *bracket;
|
char *bracket;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (protocol && strcmp("tcp",protocol) && strcmp("inet",protocol)
|
if (protocol && strcmp("tcp",protocol))
|
||||||
#ifdef AF_INET6
|
|
||||||
&& strcmp("inet6",protocol)
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (*host == '\0')
|
|
||||||
host = "localhost";
|
|
||||||
|
|
||||||
#if HAVE_GETADDRINFO
|
|
||||||
memset(&hints, 0, sizeof(hints));
|
|
||||||
#ifdef AI_NUMERICSERV
|
|
||||||
hints.ai_flags |= AI_NUMERICSERV;
|
|
||||||
#endif
|
|
||||||
hints.ai_family = AF_UNSPEC;
|
|
||||||
hints.ai_socktype = SOCK_STREAM;
|
|
||||||
|
|
||||||
#ifdef AF_INET6
|
|
||||||
/* Allow IPv6 addresses enclosed in brackets. */
|
/* Allow IPv6 addresses enclosed in brackets. */
|
||||||
if(host[0] == '[' && (bracket = strrchr(host, ']')) && bracket[1] == '\0')
|
if(host[0] == '[' && (bracket = strrchr(host, ']')) && bracket[1] == '\0')
|
||||||
{
|
{
|
||||||
|
@ -404,7 +224,6 @@ static int _xcb_open_tcp(const char *host, char *protocol, const unsigned short
|
||||||
hints.ai_flags |= AI_NUMERICHOST;
|
hints.ai_flags |= AI_NUMERICHOST;
|
||||||
hints.ai_family = AF_INET6;
|
hints.ai_family = AF_INET6;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
snprintf(service, sizeof(service), "%hu", port);
|
snprintf(service, sizeof(service), "%hu", port);
|
||||||
if(getaddrinfo(host, service, &hints, &results))
|
if(getaddrinfo(host, service, &hints, &results))
|
||||||
|
@ -413,174 +232,71 @@ static int _xcb_open_tcp(const char *host, char *protocol, const unsigned short
|
||||||
|
|
||||||
for(addr = results; addr; addr = addr->ai_next)
|
for(addr = results; addr; addr = addr->ai_next)
|
||||||
{
|
{
|
||||||
fd = _xcb_socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
|
fd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
|
||||||
if (_xcb_do_connect(fd, addr->ai_addr, addr->ai_addrlen) >= 0)
|
if(fd >= 0 && connect(fd, addr->ai_addr, addr->ai_addrlen) >= 0)
|
||||||
break;
|
break;
|
||||||
#ifdef _WIN32
|
|
||||||
closesocket(fd);
|
|
||||||
#else
|
|
||||||
close(fd);
|
|
||||||
#endif
|
|
||||||
fd = -1;
|
fd = -1;
|
||||||
}
|
}
|
||||||
freeaddrinfo(results);
|
freeaddrinfo(results);
|
||||||
return fd;
|
return fd;
|
||||||
#else
|
|
||||||
{
|
|
||||||
struct hostent* _h;
|
|
||||||
struct sockaddr_in _s;
|
|
||||||
struct in_addr ** _c;
|
|
||||||
|
|
||||||
if((_h = gethostbyname(host)) == NULL)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
_c = (struct in_addr**)_h->h_addr_list;
|
|
||||||
fd = -1;
|
|
||||||
|
|
||||||
while(*_c) {
|
|
||||||
_s.sin_family = AF_INET;
|
|
||||||
_s.sin_port = htons(port);
|
|
||||||
_s.sin_addr = *(*_c);
|
|
||||||
|
|
||||||
fd = _xcb_socket(_s.sin_family, SOCK_STREAM, 0);
|
|
||||||
if(_xcb_do_connect(fd, (struct sockaddr*)&_s, sizeof(_s)) >= 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
closesocket(fd);
|
|
||||||
#else
|
|
||||||
close(fd);
|
|
||||||
#endif
|
|
||||||
fd = -1;
|
|
||||||
++_c;
|
|
||||||
}
|
|
||||||
|
|
||||||
return fd;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
static int _xcb_open_unix(char *protocol, const char *file)
|
static int _xcb_open_unix(char *protocol, const char *file)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
struct sockaddr_un addr;
|
struct sockaddr_un addr = { AF_UNIX };
|
||||||
socklen_t len = sizeof(int);
|
|
||||||
int val;
|
|
||||||
|
|
||||||
if (protocol && strcmp("unix",protocol))
|
if (protocol && strcmp("unix",protocol))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
strcpy(addr.sun_path, file);
|
strcpy(addr.sun_path, file);
|
||||||
addr.sun_family = AF_UNIX;
|
|
||||||
#ifdef HAVE_SOCKADDR_SUN_LEN
|
fd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||||
addr.sun_len = SUN_LEN(&addr);
|
|
||||||
#endif
|
|
||||||
fd = _xcb_socket(AF_UNIX, SOCK_STREAM, 0);
|
|
||||||
if(fd == -1)
|
if(fd == -1)
|
||||||
return -1;
|
return -1;
|
||||||
if(getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) == 0 && val < 64 * 1024)
|
if(connect(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1)
|
||||||
{
|
|
||||||
val = 64 * 1024;
|
|
||||||
setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, sizeof(int));
|
|
||||||
}
|
|
||||||
if(connect(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1) {
|
|
||||||
close(fd);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
#endif /* !_WIN32 */
|
|
||||||
|
|
||||||
#ifdef HAVE_ABSTRACT_SOCKETS
|
|
||||||
static int _xcb_open_abstract(char *protocol, const char *file, size_t filelen)
|
|
||||||
{
|
|
||||||
int fd;
|
|
||||||
struct sockaddr_un addr = {0};
|
|
||||||
socklen_t namelen;
|
|
||||||
|
|
||||||
if (protocol && strcmp("unix",protocol))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
strcpy(addr.sun_path + 1, file);
|
|
||||||
addr.sun_family = AF_UNIX;
|
|
||||||
namelen = offsetof(struct sockaddr_un, sun_path) + 1 + filelen;
|
|
||||||
#ifdef HAVE_SOCKADDR_SUN_LEN
|
|
||||||
addr.sun_len = 1 + filelen;
|
|
||||||
#endif
|
|
||||||
fd = _xcb_socket(AF_UNIX, SOCK_STREAM, 0);
|
|
||||||
if (fd == -1)
|
|
||||||
return -1;
|
|
||||||
if (connect(fd, (struct sockaddr *) &addr, namelen) == -1) {
|
|
||||||
close(fd);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return fd;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
xcb_connection_t *xcb_connect(const char *displayname, int *screenp)
|
xcb_connection_t *xcb_connect(const char *displayname, int *screenp)
|
||||||
{
|
{
|
||||||
return xcb_connect_to_display_with_auth_info(displayname, NULL, screenp);
|
int fd, display = 0;
|
||||||
|
char *host;
|
||||||
|
char *protocol;
|
||||||
|
xcb_connection_t *c;
|
||||||
|
xcb_auth_info_t auth;
|
||||||
|
|
||||||
|
if(!_xcb_parse_display(displayname, &host, &protocol, &display, screenp))
|
||||||
|
return (xcb_connection_t *) &error_connection;
|
||||||
|
fd = _xcb_open(host, protocol, display);
|
||||||
|
free(host);
|
||||||
|
if(fd == -1)
|
||||||
|
return (xcb_connection_t *) &error_connection;
|
||||||
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *displayname, xcb_auth_info_t *auth, int *screenp)
|
xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *displayname, xcb_auth_info_t *auth, int *screenp)
|
||||||
{
|
{
|
||||||
int fd, display = 0;
|
int fd, display = 0;
|
||||||
char *host = NULL;
|
char *host;
|
||||||
char *protocol = NULL;
|
char *protocol;
|
||||||
xcb_auth_info_t ourauth;
|
|
||||||
xcb_connection_t *c;
|
|
||||||
|
|
||||||
int parsed = _xcb_parse_display(displayname, &host, &protocol, &display, screenp);
|
|
||||||
|
|
||||||
if(!parsed) {
|
|
||||||
c = _xcb_conn_ret_error(XCB_CONN_CLOSED_PARSE_ERR);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
WSADATA wsaData;
|
|
||||||
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) {
|
|
||||||
c = _xcb_conn_ret_error(XCB_CONN_ERROR);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
if(!_xcb_parse_display(displayname, &host, &protocol, &display, screenp))
|
||||||
|
return (xcb_connection_t *) &error_connection;
|
||||||
fd = _xcb_open(host, protocol, display);
|
fd = _xcb_open(host, protocol, display);
|
||||||
|
|
||||||
if(fd == -1) {
|
|
||||||
c = _xcb_conn_ret_error(XCB_CONN_ERROR);
|
|
||||||
#ifdef _WIN32
|
|
||||||
WSACleanup();
|
|
||||||
#endif
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(auth) {
|
|
||||||
c = xcb_connect_to_fd(fd, auth);
|
|
||||||
}
|
|
||||||
else if(_xcb_get_auth_info(fd, &ourauth, display))
|
|
||||||
{
|
|
||||||
c = xcb_connect_to_fd(fd, &ourauth);
|
|
||||||
free(ourauth.name);
|
|
||||||
free(ourauth.data);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
c = xcb_connect_to_fd(fd, 0);
|
|
||||||
|
|
||||||
if(c->has_error)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
/* Make sure requested screen number is in bounds for this server */
|
|
||||||
if((screenp != NULL) && (*screenp >= (int) c->setup->roots_len)) {
|
|
||||||
xcb_disconnect(c);
|
|
||||||
c = _xcb_conn_ret_error(XCB_CONN_CLOSED_INVALID_SCREEN);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
out:
|
|
||||||
free(host);
|
free(host);
|
||||||
free(protocol);
|
if(fd == -1)
|
||||||
return c;
|
return (xcb_connection_t *) &error_connection;
|
||||||
|
|
||||||
|
return xcb_connect_to_fd(fd, auth);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2001-2008 Bart Massey and Jamey Sharp.
|
/* Copyright (C) 2001-2004 Bart Massey and Jamey Sharp.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
@ -25,11 +25,6 @@
|
||||||
|
|
||||||
/* XID allocators. */
|
/* XID allocators. */
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "xcb.h"
|
#include "xcb.h"
|
||||||
#include "xcbext.h"
|
#include "xcbext.h"
|
||||||
|
@ -44,40 +39,21 @@ uint32_t xcb_generate_id(xcb_connection_t *c)
|
||||||
if(c->has_error)
|
if(c->has_error)
|
||||||
return -1;
|
return -1;
|
||||||
pthread_mutex_lock(&c->xid.lock);
|
pthread_mutex_lock(&c->xid.lock);
|
||||||
if(c->xid.last >= c->xid.max - c->xid.inc + 1)
|
if(c->xid.last == c->xid.max)
|
||||||
{
|
{
|
||||||
xcb_xc_misc_get_xid_range_reply_t *range;
|
xcb_xc_misc_get_xid_range_reply_t *range;
|
||||||
assert(c->xid.last == c->xid.max);
|
range = xcb_xc_misc_get_xid_range_reply(c, xcb_xc_misc_get_xid_range(c), 0);
|
||||||
if (c->xid.last == 0) {
|
if(!range)
|
||||||
/* finish setting up initial range */
|
|
||||||
c->xid.max = c->setup->resource_id_mask;
|
|
||||||
} else {
|
|
||||||
/* check for extension */
|
|
||||||
const xcb_query_extension_reply_t *xc_misc_reply =
|
|
||||||
xcb_get_extension_data(c, &xcb_xc_misc_id);
|
|
||||||
if (!xc_misc_reply || !xc_misc_reply->present) {
|
|
||||||
pthread_mutex_unlock(&c->xid.lock);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
/* get new range */
|
|
||||||
range = xcb_xc_misc_get_xid_range_reply(c,
|
|
||||||
xcb_xc_misc_get_xid_range(c), 0);
|
|
||||||
/* XXX The latter disjunct is what the server returns
|
|
||||||
when it is out of XIDs. Sweet. */
|
|
||||||
if(!range || (range->start_id == 0 && range->count == 1))
|
|
||||||
{
|
{
|
||||||
pthread_mutex_unlock(&c->xid.lock);
|
pthread_mutex_unlock(&c->xid.lock);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
assert(range->count > 0 && range->start_id > 0);
|
|
||||||
c->xid.last = range->start_id;
|
c->xid.last = range->start_id;
|
||||||
c->xid.max = range->start_id + (range->count - 1) * c->xid.inc;
|
c->xid.max = range->start_id + (range->count - 1) * c->xid.inc;
|
||||||
free(range);
|
free(range);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
c->xid.last += c->xid.inc;
|
|
||||||
}
|
|
||||||
ret = c->xid.last | c->xid.base;
|
ret = c->xid.last | c->xid.base;
|
||||||
|
c->xid.last += c->xid.inc;
|
||||||
pthread_mutex_unlock(&c->xid.lock);
|
pthread_mutex_unlock(&c->xid.lock);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -89,8 +65,8 @@ int _xcb_xid_init(xcb_connection_t *c)
|
||||||
if(pthread_mutex_init(&c->xid.lock, 0))
|
if(pthread_mutex_init(&c->xid.lock, 0))
|
||||||
return 0;
|
return 0;
|
||||||
c->xid.last = 0;
|
c->xid.last = 0;
|
||||||
c->xid.max = 0;
|
|
||||||
c->xid.base = c->setup->resource_id_base;
|
c->xid.base = c->setup->resource_id_base;
|
||||||
|
c->xid.max = c->setup->resource_id_mask;
|
||||||
c->xid.inc = c->setup->resource_id_mask & -(c->setup->resource_id_mask);
|
c->xid.inc = c->setup->resource_id_mask & -(c->setup->resource_id_mask);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
/* 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"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_BACKTRACE
|
||||||
|
#include <execinfo.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void xcb_xlib_printbt(void)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_BACKTRACE
|
||||||
|
void *array[20];
|
||||||
|
int size;
|
||||||
|
char **strings;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
size = backtrace(array, 20);
|
||||||
|
strings = backtrace_symbols(array, size);
|
||||||
|
|
||||||
|
fprintf(stderr, "Locking assertion failure. Backtrace:\n");
|
||||||
|
|
||||||
|
for (i = 0; i < size; ++i)
|
||||||
|
fprintf(stderr, "#%i %s\n", i, strings[i]);
|
||||||
|
|
||||||
|
free(strings);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
#define xcb_assert(c,x) do { if (!(x)) { xcb_xlib_printbt(); if (!(c)->xlib.sloppy_lock) assert(x); } } while(0)
|
||||||
|
#else
|
||||||
|
#define xcb_assert(c,x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
unsigned int xcb_get_request_sent(xcb_connection_t *c)
|
||||||
|
{
|
||||||
|
if(c->has_error)
|
||||||
|
return 0;
|
||||||
|
return c->out.request;
|
||||||
|
}
|
||||||
|
|
||||||
|
void xcb_xlib_lock(xcb_connection_t *c)
|
||||||
|
{
|
||||||
|
_xcb_lock_io(c);
|
||||||
|
xcb_assert(c, !c->xlib.lock);
|
||||||
|
c->xlib.lock = 1;
|
||||||
|
c->xlib.thread = pthread_self();
|
||||||
|
_xcb_unlock_io(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
void xcb_xlib_unlock(xcb_connection_t *c)
|
||||||
|
{
|
||||||
|
_xcb_lock_io(c);
|
||||||
|
xcb_assert(c, c->xlib.lock);
|
||||||
|
xcb_assert(c, pthread_equal(c->xlib.thread, pthread_self()));
|
||||||
|
c->xlib.lock = 0;
|
||||||
|
pthread_cond_broadcast(&c->xlib.cond);
|
||||||
|
_xcb_unlock_io(c);
|
||||||
|
}
|
250
src/xcbext.h
250
src/xcbext.h
|
@ -54,270 +54,22 @@ typedef struct {
|
||||||
enum xcb_send_request_flags_t {
|
enum xcb_send_request_flags_t {
|
||||||
XCB_REQUEST_CHECKED = 1 << 0,
|
XCB_REQUEST_CHECKED = 1 << 0,
|
||||||
XCB_REQUEST_RAW = 1 << 1,
|
XCB_REQUEST_RAW = 1 << 1,
|
||||||
XCB_REQUEST_DISCARD_REPLY = 1 << 2,
|
XCB_REQUEST_DISCARD_REPLY = 1 << 2
|
||||||
XCB_REQUEST_REPLY_FDS = 1 << 3
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Send a request to the server.
|
|
||||||
* @param c The connection to the X server.
|
|
||||||
* @param flags A combination of flags from the xcb_send_request_flags_t enumeration.
|
|
||||||
* @param vector Data to send; must have two iovecs before start for internal use.
|
|
||||||
* @param request Information about the request to be sent.
|
|
||||||
* @return The request's sequence number on success, 0 otherwise.
|
|
||||||
*
|
|
||||||
* This function sends a new request to the X server. The data of the request is
|
|
||||||
* given as an array of @c iovecs in the @p vector argument. The length of that
|
|
||||||
* array and the necessary management information are given in the @p request
|
|
||||||
* argument.
|
|
||||||
*
|
|
||||||
* When this function returns, the request might or might not be sent already.
|
|
||||||
* Use xcb_flush() to make sure that it really was sent.
|
|
||||||
*
|
|
||||||
* Please note that this function is not the preferred way for sending requests.
|
|
||||||
* It's better to use the generated wrapper functions.
|
|
||||||
*
|
|
||||||
* Please note that xcb might use index -1 and -2 of the @p vector array internally,
|
|
||||||
* so they must be valid!
|
|
||||||
*/
|
|
||||||
unsigned int xcb_send_request(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *request);
|
unsigned int xcb_send_request(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *request);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Send a request to the server.
|
|
||||||
* @param c The connection to the X server.
|
|
||||||
* @param flags A combination of flags from the xcb_send_request_flags_t enumeration.
|
|
||||||
* @param vector Data to send; must have two iovecs before start for internal use.
|
|
||||||
* @param request Information about the request to be sent.
|
|
||||||
* @param num_fds Number of additional file descriptors to send to the server
|
|
||||||
* @param fds Additional file descriptors that should be send to the server.
|
|
||||||
* @return The request's sequence number on success, 0 otherwise.
|
|
||||||
*
|
|
||||||
* This function sends a new request to the X server. The data of the request is
|
|
||||||
* given as an array of @c iovecs in the @p vector argument. The length of that
|
|
||||||
* array and the necessary management information are given in the @p request
|
|
||||||
* argument.
|
|
||||||
*
|
|
||||||
* If @p num_fds is non-zero, @p fds points to an array of file descriptors that
|
|
||||||
* will be sent to the X server along with this request. After this function
|
|
||||||
* returns, all file descriptors sent are owned by xcb and will be closed
|
|
||||||
* eventually.
|
|
||||||
*
|
|
||||||
* When this function returns, the request might or might not be sent already.
|
|
||||||
* Use xcb_flush() to make sure that it really was sent.
|
|
||||||
*
|
|
||||||
* Please note that this function is not the preferred way for sending requests.
|
|
||||||
*
|
|
||||||
* Please note that xcb might use index -1 and -2 of the @p vector array internally,
|
|
||||||
* so they must be valid!
|
|
||||||
*/
|
|
||||||
unsigned int xcb_send_request_with_fds(xcb_connection_t *c, int flags, struct iovec *vector,
|
|
||||||
const xcb_protocol_request_t *request, unsigned int num_fds, int *fds);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Send a request to the server, with 64-bit sequence number returned.
|
|
||||||
* @param c The connection to the X server.
|
|
||||||
* @param flags A combination of flags from the xcb_send_request_flags_t enumeration.
|
|
||||||
* @param vector Data to send; must have two iovecs before start for internal use.
|
|
||||||
* @param request Information about the request to be sent.
|
|
||||||
* @return The request's sequence number on success, 0 otherwise.
|
|
||||||
*
|
|
||||||
* This function sends a new request to the X server. The data of the request is
|
|
||||||
* given as an array of @c iovecs in the @p vector argument. The length of that
|
|
||||||
* array and the necessary management information are given in the @p request
|
|
||||||
* argument.
|
|
||||||
*
|
|
||||||
* When this function returns, the request might or might not be sent already.
|
|
||||||
* Use xcb_flush() to make sure that it really was sent.
|
|
||||||
*
|
|
||||||
* Please note that this function is not the preferred way for sending requests.
|
|
||||||
* It's better to use the generated wrapper functions.
|
|
||||||
*
|
|
||||||
* Please note that xcb might use index -1 and -2 of the @p vector array internally,
|
|
||||||
* so they must be valid!
|
|
||||||
*/
|
|
||||||
uint64_t xcb_send_request64(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *request);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Send a request to the server, with 64-bit sequence number returned.
|
|
||||||
* @param c The connection to the X server.
|
|
||||||
* @param flags A combination of flags from the xcb_send_request_flags_t enumeration.
|
|
||||||
* @param vector Data to send; must have two iovecs before start for internal use.
|
|
||||||
* @param request Information about the request to be sent.
|
|
||||||
* @param num_fds Number of additional file descriptors to send to the server
|
|
||||||
* @param fds Additional file descriptors that should be send to the server.
|
|
||||||
* @return The request's sequence number on success, 0 otherwise.
|
|
||||||
*
|
|
||||||
* This function sends a new request to the X server. The data of the request is
|
|
||||||
* given as an array of @c iovecs in the @p vector argument. The length of that
|
|
||||||
* array and the necessary management information are given in the @p request
|
|
||||||
* argument.
|
|
||||||
*
|
|
||||||
* If @p num_fds is non-zero, @p fds points to an array of file descriptors that
|
|
||||||
* will be sent to the X server along with this request. After this function
|
|
||||||
* returns, all file descriptors sent are owned by xcb and will be closed
|
|
||||||
* eventually.
|
|
||||||
*
|
|
||||||
* When this function returns, the request might or might not be sent already.
|
|
||||||
* Use xcb_flush() to make sure that it really was sent.
|
|
||||||
*
|
|
||||||
* Please note that this function is not the preferred way for sending requests.
|
|
||||||
* It's better to use the generated wrapper functions.
|
|
||||||
*
|
|
||||||
* Please note that xcb might use index -1 and -2 of the @p vector array internally,
|
|
||||||
* so they must be valid!
|
|
||||||
*/
|
|
||||||
uint64_t xcb_send_request_with_fds64(xcb_connection_t *c, int flags, struct iovec *vector,
|
|
||||||
const xcb_protocol_request_t *request, unsigned int num_fds, int *fds);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Send a file descriptor to the server in the next call to xcb_send_request.
|
|
||||||
* @param c The connection to the X server.
|
|
||||||
* @param fd The file descriptor to send.
|
|
||||||
*
|
|
||||||
* After this function returns, the file descriptor given is owned by xcb and
|
|
||||||
* will be closed eventually.
|
|
||||||
*
|
|
||||||
* @deprecated This function cannot be used in a thread-safe way. Two threads
|
|
||||||
* that run xcb_send_fd(); xcb_send_request(); could mix up their file
|
|
||||||
* descriptors. Instead, xcb_send_request_with_fds() should be used.
|
|
||||||
*/
|
|
||||||
void xcb_send_fd(xcb_connection_t *c, int fd);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Take over the write side of the socket
|
|
||||||
* @param c The connection to the X server.
|
|
||||||
* @param return_socket Callback function that will be called when xcb wants
|
|
||||||
* to use the socket again.
|
|
||||||
* @param closure Argument to the callback function.
|
|
||||||
* @param flags A combination of flags from the xcb_send_request_flags_t enumeration.
|
|
||||||
* @param sent Location to the sequence number of the last sequence request.
|
|
||||||
* Must not be NULL.
|
|
||||||
* @return 1 on success, else 0.
|
|
||||||
*
|
|
||||||
* xcb_take_socket allows external code to ask XCB for permission to
|
|
||||||
* take over the write side of the socket and send raw data with
|
|
||||||
* xcb_writev. xcb_take_socket provides the sequence number of the last
|
|
||||||
* request XCB sent. The caller of xcb_take_socket must supply a
|
|
||||||
* callback which XCB can call when it wants the write side of the
|
|
||||||
* socket back to make a request. This callback synchronizes with the
|
|
||||||
* external socket owner and flushes any output queues if appropriate.
|
|
||||||
* If you are sending requests which won't cause a reply, please note the
|
|
||||||
* comment for xcb_writev which explains some sequence number wrap issues.
|
|
||||||
*
|
|
||||||
* All replies that are generated while the socket is owned externally have
|
|
||||||
* @p flags applied to them. For example, use XCB_REQUEST_CHECK if you don't
|
|
||||||
* want errors to go to xcb's normal error handling, but instead having to be
|
|
||||||
* picked up via xcb_wait_for_reply(), xcb_poll_for_reply() or
|
|
||||||
* xcb_request_check().
|
|
||||||
*/
|
|
||||||
int xcb_take_socket(xcb_connection_t *c, void (*return_socket)(void *closure), void *closure, int flags, uint64_t *sent);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Send raw data to the X server.
|
|
||||||
* @param c The connection to the X server.
|
|
||||||
* @param vector Array of data to be sent.
|
|
||||||
* @param count Number of entries in @p vector.
|
|
||||||
* @param requests Number of requests that are being sent.
|
|
||||||
* @return 1 on success, else 0.
|
|
||||||
*
|
|
||||||
* You must own the write-side of the socket (you've called
|
|
||||||
* xcb_take_socket, and haven't returned from return_socket yet) to call
|
|
||||||
* xcb_writev. Also, the iovec must have at least 1 byte of data in it.
|
|
||||||
* You have to make sure that xcb can detect sequence number wraps correctly.
|
|
||||||
* This means that the first request you send after xcb_take_socket must cause a
|
|
||||||
* reply (e.g. just insert a GetInputFocus request). After every (1 << 16) - 1
|
|
||||||
* requests without a reply, you have to insert a request which will cause a
|
|
||||||
* reply. You can again use GetInputFocus for this. You do not have to wait for
|
|
||||||
* any of the GetInputFocus replies, but can instead handle them via
|
|
||||||
* xcb_discard_reply().
|
|
||||||
*/
|
|
||||||
int xcb_writev(xcb_connection_t *c, struct iovec *vector, int count, uint64_t requests);
|
|
||||||
|
|
||||||
|
|
||||||
/* xcb_in.c */
|
/* xcb_in.c */
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Wait for the reply of a given request.
|
|
||||||
* @param c The connection to the X server.
|
|
||||||
* @param request Sequence number of the request as returned by xcb_send_request().
|
|
||||||
* @param e Location to store errors in, or NULL. Ignored for unchecked requests.
|
|
||||||
*
|
|
||||||
* Returns the reply to the given request or returns null in the event of
|
|
||||||
* errors. Blocks until the reply or error for the request arrives, or an I/O
|
|
||||||
* error occurs.
|
|
||||||
*/
|
|
||||||
void *xcb_wait_for_reply(xcb_connection_t *c, unsigned int request, xcb_generic_error_t **e);
|
void *xcb_wait_for_reply(xcb_connection_t *c, unsigned int request, xcb_generic_error_t **e);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Wait for the reply of a given request, with 64-bit sequence number
|
|
||||||
* @param c The connection to the X server.
|
|
||||||
* @param request 64-bit sequence number of the request as returned by xcb_send_request64().
|
|
||||||
* @param e Location to store errors in, or NULL. Ignored for unchecked requests.
|
|
||||||
*
|
|
||||||
* Returns the reply to the given request or returns null in the event of
|
|
||||||
* errors. Blocks until the reply or error for the request arrives, or an I/O
|
|
||||||
* error occurs.
|
|
||||||
*
|
|
||||||
* Unlike its xcb_wait_for_reply() counterpart, the given sequence number is not
|
|
||||||
* automatically "widened" to 64-bit.
|
|
||||||
*/
|
|
||||||
void *xcb_wait_for_reply64(xcb_connection_t *c, uint64_t request, xcb_generic_error_t **e);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Poll for the reply of a given request.
|
|
||||||
* @param c The connection to the X server.
|
|
||||||
* @param request Sequence number of the request as returned by xcb_send_request().
|
|
||||||
* @param reply Location to store the reply in, must not be NULL.
|
|
||||||
* @param error Location to store errors in, or NULL. Ignored for unchecked requests.
|
|
||||||
* @return 1 when the reply to the request was returned, else 0.
|
|
||||||
*
|
|
||||||
* Checks if the reply to the given request already received. Does not block.
|
|
||||||
*/
|
|
||||||
int xcb_poll_for_reply(xcb_connection_t *c, unsigned int request, void **reply, xcb_generic_error_t **error);
|
int xcb_poll_for_reply(xcb_connection_t *c, unsigned int request, void **reply, xcb_generic_error_t **error);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Poll for the reply of a given request, with 64-bit sequence number.
|
|
||||||
* @param c The connection to the X server.
|
|
||||||
* @param request 64-bit sequence number of the request as returned by xcb_send_request().
|
|
||||||
* @param reply Location to store the reply in, must not be NULL.
|
|
||||||
* @param error Location to store errors in, or NULL. Ignored for unchecked requests.
|
|
||||||
* @return 1 when the reply to the request was returned, else 0.
|
|
||||||
*
|
|
||||||
* Checks if the reply to the given request already received. Does not block.
|
|
||||||
*
|
|
||||||
* Unlike its xcb_poll_for_reply() counterpart, the given sequence number is not
|
|
||||||
* automatically "widened" to 64-bit.
|
|
||||||
*/
|
|
||||||
int xcb_poll_for_reply64(xcb_connection_t *c, uint64_t request, void **reply, xcb_generic_error_t **error);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Don't use this, only needed by the generated code.
|
|
||||||
* @param c The connection to the X server.
|
|
||||||
* @param reply A reply that was received from the server
|
|
||||||
* @param replylen The size of the reply.
|
|
||||||
* @return Pointer to the location where received file descriptors are stored.
|
|
||||||
*/
|
|
||||||
XCB_CONST_FUNCTION
|
|
||||||
int *xcb_get_reply_fds(xcb_connection_t *c, void *reply, size_t replylen);
|
|
||||||
|
|
||||||
|
|
||||||
/* xcb_util.c */
|
/* xcb_util.c */
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mask The mask to check
|
|
||||||
* @return The number of set bits in the mask
|
|
||||||
*/
|
|
||||||
XCB_CONST_FUNCTION
|
|
||||||
int xcb_popcount(uint32_t mask);
|
int xcb_popcount(uint32_t mask);
|
||||||
|
|
||||||
/**
|
|
||||||
* @param list The base of an array
|
|
||||||
* @param len The length of the array
|
|
||||||
* @return The sum of all entries in the array.
|
|
||||||
*/
|
|
||||||
XCB_PURE_FUNCTION
|
|
||||||
int xcb_sumof(uint8_t *list, int len);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
102
src/xcbint.h
102
src/xcbint.h
|
@ -38,20 +38,9 @@
|
||||||
#pragma GCC visibility push(hidden)
|
#pragma GCC visibility push(hidden)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __has_attribute
|
|
||||||
# define __has_attribute(x) 0 /* Compatibility with older compilers. */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if __has_attribute(fallthrough)
|
|
||||||
# define XCB_ALLOW_FALLTHRU __attribute__ ((fallthrough));
|
|
||||||
#else
|
|
||||||
# define XCB_ALLOW_FALLTHRU /* FALLTHRU */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum workarounds {
|
enum workarounds {
|
||||||
WORKAROUND_NONE,
|
WORKAROUND_NONE,
|
||||||
WORKAROUND_GLX_GET_FB_CONFIGS_BUG,
|
WORKAROUND_GLX_GET_FB_CONFIGS_BUG
|
||||||
WORKAROUND_EXTERNAL_SOCKET_OWNER
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum lazy_reply_tag
|
enum lazy_reply_tag
|
||||||
|
@ -63,17 +52,7 @@ enum lazy_reply_tag
|
||||||
|
|
||||||
#define XCB_PAD(i) (-(i) & 3)
|
#define XCB_PAD(i) (-(i) & 3)
|
||||||
|
|
||||||
#define XCB_SEQUENCE_COMPARE(a,op,b) ((int64_t) ((a) - (b)) op 0)
|
#define XCB_SEQUENCE_COMPARE(a,op,b) ((int) ((a) - (b)) op 0)
|
||||||
|
|
||||||
#ifndef offsetof
|
|
||||||
#define offsetof(type,member) ((size_t) &((type *)0)->member)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef MIN
|
|
||||||
#define MIN(x,y) ((x) < (y) ? (x) : (y))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define container_of(pointer,type,member) ((type *)(((char *)(pointer)) - offsetof(type, member)))
|
|
||||||
|
|
||||||
/* xcb_list.c */
|
/* xcb_list.c */
|
||||||
|
|
||||||
|
@ -83,38 +62,21 @@ typedef struct _xcb_map _xcb_map;
|
||||||
|
|
||||||
_xcb_map *_xcb_map_new(void);
|
_xcb_map *_xcb_map_new(void);
|
||||||
void _xcb_map_delete(_xcb_map *q, xcb_list_free_func_t do_free);
|
void _xcb_map_delete(_xcb_map *q, xcb_list_free_func_t do_free);
|
||||||
int _xcb_map_put(_xcb_map *q, uint64_t key, void *data);
|
int _xcb_map_put(_xcb_map *q, unsigned int key, void *data);
|
||||||
void *_xcb_map_remove(_xcb_map *q, uint64_t key);
|
void *_xcb_map_remove(_xcb_map *q, unsigned int key);
|
||||||
|
|
||||||
|
|
||||||
/* xcb_out.c */
|
/* xcb_out.c */
|
||||||
|
|
||||||
#if HAVE_SENDMSG
|
|
||||||
#define XCB_MAX_PASS_FD 16
|
|
||||||
|
|
||||||
typedef struct _xcb_fd {
|
|
||||||
int fd[XCB_MAX_PASS_FD];
|
|
||||||
int nfd;
|
|
||||||
int ifd;
|
|
||||||
} _xcb_fd;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct _xcb_out {
|
typedef struct _xcb_out {
|
||||||
pthread_cond_t cond;
|
pthread_cond_t cond;
|
||||||
int writing;
|
int writing;
|
||||||
|
|
||||||
pthread_cond_t socket_cond;
|
char queue[4096];
|
||||||
void (*return_socket)(void *closure);
|
|
||||||
void *socket_closure;
|
|
||||||
int socket_moving;
|
|
||||||
|
|
||||||
char queue[XCB_QUEUE_BUFFER_SIZE];
|
|
||||||
int queue_len;
|
int queue_len;
|
||||||
|
|
||||||
uint64_t request;
|
unsigned int request;
|
||||||
uint64_t request_written;
|
unsigned int request_written;
|
||||||
uint64_t request_expected_written;
|
|
||||||
uint64_t total_written;
|
|
||||||
|
|
||||||
pthread_mutex_t reqlenlock;
|
pthread_mutex_t reqlenlock;
|
||||||
enum lazy_reply_tag maximum_request_length_tag;
|
enum lazy_reply_tag maximum_request_length_tag;
|
||||||
|
@ -122,17 +84,13 @@ typedef struct _xcb_out {
|
||||||
xcb_big_requests_enable_cookie_t cookie;
|
xcb_big_requests_enable_cookie_t cookie;
|
||||||
uint32_t value;
|
uint32_t value;
|
||||||
} maximum_request_length;
|
} maximum_request_length;
|
||||||
#if HAVE_SENDMSG
|
|
||||||
_xcb_fd out_fd;
|
|
||||||
#endif
|
|
||||||
} _xcb_out;
|
} _xcb_out;
|
||||||
|
|
||||||
int _xcb_out_init(_xcb_out *out);
|
int _xcb_out_init(_xcb_out *out);
|
||||||
void _xcb_out_destroy(_xcb_out *out);
|
void _xcb_out_destroy(_xcb_out *out);
|
||||||
|
|
||||||
int _xcb_out_send(xcb_connection_t *c, struct iovec *vector, int count);
|
int _xcb_out_send(xcb_connection_t *c, struct iovec **vector, int *count);
|
||||||
void _xcb_out_send_sync(xcb_connection_t *c);
|
int _xcb_out_flush_to(xcb_connection_t *c, unsigned int request);
|
||||||
int _xcb_out_flush_to(xcb_connection_t *c, uint64_t request);
|
|
||||||
|
|
||||||
|
|
||||||
/* xcb_in.c */
|
/* xcb_in.c */
|
||||||
|
@ -144,10 +102,9 @@ typedef struct _xcb_in {
|
||||||
char queue[4096];
|
char queue[4096];
|
||||||
int queue_len;
|
int queue_len;
|
||||||
|
|
||||||
uint64_t request_expected;
|
unsigned int request_expected;
|
||||||
uint64_t request_read;
|
unsigned int request_read;
|
||||||
uint64_t request_completed;
|
unsigned int request_completed;
|
||||||
uint64_t total_read;
|
|
||||||
struct reply_list *current_reply;
|
struct reply_list *current_reply;
|
||||||
struct reply_list **current_reply_tail;
|
struct reply_list **current_reply_tail;
|
||||||
|
|
||||||
|
@ -155,28 +112,30 @@ typedef struct _xcb_in {
|
||||||
struct event_list *events;
|
struct event_list *events;
|
||||||
struct event_list **events_tail;
|
struct event_list **events_tail;
|
||||||
struct reader_list *readers;
|
struct reader_list *readers;
|
||||||
struct special_list *special_waiters;
|
|
||||||
|
|
||||||
struct pending_reply *pending_replies;
|
struct pending_reply *pending_replies;
|
||||||
struct pending_reply **pending_replies_tail;
|
struct pending_reply **pending_replies_tail;
|
||||||
#if HAVE_SENDMSG
|
|
||||||
_xcb_fd in_fd;
|
|
||||||
#endif
|
|
||||||
struct xcb_special_event *special_events;
|
|
||||||
} _xcb_in;
|
} _xcb_in;
|
||||||
|
|
||||||
int _xcb_in_init(_xcb_in *in);
|
int _xcb_in_init(_xcb_in *in);
|
||||||
void _xcb_in_destroy(_xcb_in *in);
|
void _xcb_in_destroy(_xcb_in *in);
|
||||||
|
|
||||||
void _xcb_in_wake_up_next_reader(xcb_connection_t *c);
|
int _xcb_in_expect_reply(xcb_connection_t *c, unsigned int request, enum workarounds workaround, int flags);
|
||||||
|
|
||||||
int _xcb_in_expect_reply(xcb_connection_t *c, uint64_t request, enum workarounds workaround, int flags);
|
|
||||||
void _xcb_in_replies_done(xcb_connection_t *c);
|
|
||||||
|
|
||||||
int _xcb_in_read(xcb_connection_t *c);
|
int _xcb_in_read(xcb_connection_t *c);
|
||||||
int _xcb_in_read_block(xcb_connection_t *c, void *buf, int nread);
|
int _xcb_in_read_block(xcb_connection_t *c, void *buf, int nread);
|
||||||
|
|
||||||
|
|
||||||
|
/* xcb_xlib.c */
|
||||||
|
|
||||||
|
typedef struct _xcb_xlib {
|
||||||
|
int lock;
|
||||||
|
int sloppy_lock;
|
||||||
|
pthread_t thread;
|
||||||
|
pthread_cond_t cond;
|
||||||
|
} _xcb_xlib;
|
||||||
|
|
||||||
|
|
||||||
/* xcb_xid.c */
|
/* xcb_xid.c */
|
||||||
|
|
||||||
typedef struct _xcb_xid {
|
typedef struct _xcb_xid {
|
||||||
|
@ -206,7 +165,6 @@ void _xcb_ext_destroy(xcb_connection_t *c);
|
||||||
/* xcb_conn.c */
|
/* xcb_conn.c */
|
||||||
|
|
||||||
struct xcb_connection_t {
|
struct xcb_connection_t {
|
||||||
/* This must be the first field; see _xcb_conn_ret_error(). */
|
|
||||||
int has_error;
|
int has_error;
|
||||||
|
|
||||||
/* constant data */
|
/* constant data */
|
||||||
|
@ -215,6 +173,7 @@ struct xcb_connection_t {
|
||||||
|
|
||||||
/* I/O data */
|
/* I/O data */
|
||||||
pthread_mutex_t iolock;
|
pthread_mutex_t iolock;
|
||||||
|
_xcb_xlib xlib;
|
||||||
_xcb_in in;
|
_xcb_in in;
|
||||||
_xcb_out out;
|
_xcb_out out;
|
||||||
|
|
||||||
|
@ -223,11 +182,8 @@ struct xcb_connection_t {
|
||||||
_xcb_xid xid;
|
_xcb_xid xid;
|
||||||
};
|
};
|
||||||
|
|
||||||
void _xcb_conn_shutdown(xcb_connection_t *c, int err);
|
void _xcb_conn_shutdown(xcb_connection_t *c);
|
||||||
|
void _xcb_wait_io(xcb_connection_t *c, pthread_cond_t *cond);
|
||||||
XCB_CONST_FUNCTION
|
|
||||||
xcb_connection_t *_xcb_conn_ret_error(int err);
|
|
||||||
|
|
||||||
int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vector, int *count);
|
int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vector, int *count);
|
||||||
|
|
||||||
|
|
||||||
|
@ -239,4 +195,10 @@ int _xcb_get_auth_info(int fd, xcb_auth_info_t *info, int display);
|
||||||
#pragma GCC visibility pop
|
#pragma GCC visibility pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* xcb_conn.c symbols visible to xcb-xlib */
|
||||||
|
|
||||||
|
void _xcb_lock_io(xcb_connection_t *c);
|
||||||
|
void _xcb_unlock_io(xcb_connection_t *c);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
/* Copyright (C) 2009 Jatin Golani.
|
/*
|
||||||
|
* Copyright (C) 2005 Bart Massey and Jamey Sharp.
|
||||||
|
* All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
@ -23,23 +25,20 @@
|
||||||
* authorization from the authors.
|
* 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 _XCB_WINDEFS_H
|
#ifndef __XCBXLIB_H
|
||||||
#define _XCB_WINDEFS_H
|
#define __XCBXLIB_H
|
||||||
|
|
||||||
|
#include <pthread.h>
|
||||||
|
#include "xcb.h"
|
||||||
|
|
||||||
|
/* The caller of this function must hold the xlib lock, using the lock
|
||||||
|
* functions below. */
|
||||||
|
unsigned int xcb_get_request_sent(xcb_connection_t *c);
|
||||||
|
|
||||||
|
void xcb_xlib_lock(xcb_connection_t *c);
|
||||||
|
void xcb_xlib_unlock(xcb_connection_t *c);
|
||||||
|
|
||||||
#ifndef WINVER
|
|
||||||
#define WINVER 0x0501 /* required for getaddrinfo/freeaddrinfo defined only for WinXP and above */
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <winsock2.h>
|
|
||||||
#include <ws2tcpip.h>
|
|
||||||
#include <windef.h>
|
|
||||||
|
|
||||||
struct iovec {
|
|
||||||
void *iov_base; /* Pointer to data. */
|
|
||||||
int iov_len; /* Length of data. */
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef unsigned int in_addr_t;
|
|
||||||
|
|
||||||
#endif /* xcb_windefs.h */
|
|
|
@ -1,6 +1,3 @@
|
||||||
CheckLog.html
|
CheckLog.html
|
||||||
CheckLog_xcb.xml
|
CheckLog_xcb.xml
|
||||||
check_all
|
check_all
|
||||||
check_all.log
|
|
||||||
check_all.trs
|
|
||||||
test-suite.log
|
|
||||||
|
|
|
@ -12,9 +12,12 @@ TESTS = check_all
|
||||||
check_PROGRAMS = check_all
|
check_PROGRAMS = check_all
|
||||||
check_all_SOURCES = check_all.c check_suites.h check_public.c
|
check_all_SOURCES = check_all.c check_suites.h check_public.c
|
||||||
|
|
||||||
check-local: check-TESTS
|
all-local::
|
||||||
|
$(RM) CheckLog*.xml
|
||||||
|
|
||||||
|
check-local:
|
||||||
$(RM) CheckLog.html
|
$(RM) CheckLog.html
|
||||||
if test x$(HTML_CHECK_RESULT) = xyes; then \
|
if test x$(HTML_CHECK_RESULT) = xtrue; then \
|
||||||
$(XSLTPROC) $(srcdir)/CheckLog.xsl CheckLog*.xml > CheckLog.html; \
|
$(XSLTPROC) $(srcdir)/CheckLog.xsl CheckLog*.xml > CheckLog.html; \
|
||||||
else \
|
else \
|
||||||
touch CheckLog.html; \
|
touch CheckLog.html; \
|
||||||
|
|
|
@ -1,19 +1,10 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "check_suites.h"
|
#include "check_suites.h"
|
||||||
|
|
||||||
#if CHECK_MAJOR_VERSION == 0 && CHECK_MINOR_VERSION < 13
|
|
||||||
void suite_add_test(Suite *s, TFun tf, const char *name)
|
void suite_add_test(Suite *s, TFun tf, const char *name)
|
||||||
#else
|
|
||||||
void suite_add_test(Suite *s, const TTest *tt, const char *name)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
TCase *tc = tcase_create(name);
|
TCase *tc = tcase_create(name);
|
||||||
|
|
||||||
#if CHECK_MAJOR_VERSION == 0 && CHECK_MINOR_VERSION < 13
|
|
||||||
tcase_add_test(tc, tf);
|
tcase_add_test(tc, tf);
|
||||||
#else
|
|
||||||
tcase_add_test(tc, tt);
|
|
||||||
#endif
|
|
||||||
suite_add_tcase(s, tc);
|
suite_add_tcase(s, tc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
#include <check.h>
|
#include <check.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifdef __unix__
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
#include "check_suites.h"
|
#include "check_suites.h"
|
||||||
#include "xcb.h"
|
#include "xcb.h"
|
||||||
#include "xcbext.h"
|
#include "xcbext.h"
|
||||||
|
@ -16,10 +12,6 @@ typedef enum test_type_t {
|
||||||
} test_type_t;
|
} test_type_t;
|
||||||
static const char *const test_string[] = { "", "via $DISPLAY " };
|
static const char *const test_string[] = { "", "via $DISPLAY " };
|
||||||
|
|
||||||
/* putenv(3) takes a pointer to a writable string that it adds directly
|
|
||||||
to the environment, so it must be in persistent memory, not on the stack */
|
|
||||||
static char display_env[] = "DISPLAY=";
|
|
||||||
|
|
||||||
static void parse_display_pass(const char *name, const char *host, const int display, const int screen)
|
static void parse_display_pass(const char *name, const char *host, const int display, const int screen)
|
||||||
{
|
{
|
||||||
int success;
|
int success;
|
||||||
|
@ -33,7 +25,7 @@ static void parse_display_pass(const char *name, const char *host, const int dis
|
||||||
if(test_type == TEST_ARGUMENT)
|
if(test_type == TEST_ARGUMENT)
|
||||||
{
|
{
|
||||||
argument = name;
|
argument = name;
|
||||||
putenv(display_env);
|
putenv("DISPLAY=");
|
||||||
}
|
}
|
||||||
else if(test_type == TEST_ENVIRONMENT)
|
else if(test_type == TEST_ENVIRONMENT)
|
||||||
{
|
{
|
||||||
|
@ -45,20 +37,20 @@ static void parse_display_pass(const char *name, const char *host, const int dis
|
||||||
got_display = got_screen = -42;
|
got_display = got_screen = -42;
|
||||||
mark_point();
|
mark_point();
|
||||||
success = xcb_parse_display(argument, &got_host, &got_display, &got_screen);
|
success = xcb_parse_display(argument, &got_host, &got_display, &got_screen);
|
||||||
ck_assert_msg(success, "unexpected parse failure %sfor '%s'", test_string[test_type], name);
|
fail_unless(success, "unexpected parse failure %sfor '%s'", test_string[test_type], name);
|
||||||
ck_assert_msg(strcmp(host, got_host) == 0, "parse %sproduced unexpected hostname '%s' for '%s': expected '%s'", test_string[test_type], got_host, name, host);
|
fail_unless(strcmp(host, got_host) == 0, "parse %sproduced unexpected hostname '%s' for '%s': expected '%s'", test_string[test_type], got_host, name, host);
|
||||||
ck_assert_msg(display == got_display, "parse %sproduced unexpected display '%d' for '%s': expected '%d'", test_string[test_type], got_display, name, display);
|
fail_unless(display == got_display, "parse %sproduced unexpected display '%d' for '%s': expected '%d'", test_string[test_type], got_display, name, display);
|
||||||
ck_assert_msg(screen == got_screen, "parse %sproduced unexpected screen '%d' for '%s': expected '%d'", test_string[test_type], got_screen, name, screen);
|
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_host = (char *) -1;
|
||||||
got_display = got_screen = -42;
|
got_display = got_screen = -42;
|
||||||
mark_point();
|
mark_point();
|
||||||
success = xcb_parse_display(argument, &got_host, &got_display, 0);
|
success = xcb_parse_display(argument, &got_host, &got_display, 0);
|
||||||
ck_assert_msg(success, "unexpected screenless parse failure %sfor '%s'", test_string[test_type], name);
|
fail_unless(success, "unexpected screenless parse failure %sfor '%s'", test_string[test_type], name);
|
||||||
ck_assert_msg(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(strcmp(host, got_host) == 0, "screenless parse %sproduced unexpected hostname '%s' for '%s': expected '%s'", test_string[test_type], got_host, name, host);
|
||||||
ck_assert_msg(display == got_display, "screenless parse %sproduced unexpected display '%d' for '%s': expected '%d'", test_string[test_type], got_display, name, display);
|
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_env);
|
putenv("DISPLAY=");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parse_display_fail(const char *name)
|
static void parse_display_fail(const char *name)
|
||||||
|
@ -74,7 +66,7 @@ static void parse_display_fail(const char *name)
|
||||||
if(test_type == TEST_ARGUMENT)
|
if(test_type == TEST_ARGUMENT)
|
||||||
{
|
{
|
||||||
argument = name;
|
argument = name;
|
||||||
putenv(display_env);
|
putenv("DISPLAY=");
|
||||||
}
|
}
|
||||||
else if(test_type == TEST_ENVIRONMENT)
|
else if(test_type == TEST_ENVIRONMENT)
|
||||||
{
|
{
|
||||||
|
@ -87,55 +79,24 @@ static void parse_display_fail(const char *name)
|
||||||
got_display = got_screen = -42;
|
got_display = got_screen = -42;
|
||||||
mark_point();
|
mark_point();
|
||||||
success = xcb_parse_display(argument, &got_host, &got_display, &got_screen);
|
success = xcb_parse_display(argument, &got_host, &got_display, &got_screen);
|
||||||
ck_assert_msg(!success, "unexpected parse success %sfor '%s'", test_string[test_type], name);
|
fail_unless(!success, "unexpected parse success %sfor '%s'", test_string[test_type], name);
|
||||||
ck_assert_msg(got_host == (char *) -1, "host changed on parse failure %sfor '%s': got %p", test_string[test_type], name, got_host);
|
fail_unless(got_host == (char *) -1, "host changed on parse failure %sfor '%s': got %p", test_string[test_type], name, got_host);
|
||||||
ck_assert_msg(got_display == -42, "display changed on parse failure %sfor '%s': got %d", test_string[test_type], name, got_display);
|
fail_unless(got_display == -42, "display changed on parse failure %sfor '%s': got %d", test_string[test_type], name, got_display);
|
||||||
ck_assert_msg(got_screen == -42, "screen changed on parse failure %sfor '%s': got %d", test_string[test_type], name, got_screen);
|
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_host = (char *) -1;
|
||||||
got_display = got_screen = -42;
|
got_display = got_screen = -42;
|
||||||
mark_point();
|
mark_point();
|
||||||
success = xcb_parse_display(argument, &got_host, &got_display, 0);
|
success = xcb_parse_display(argument, &got_host, &got_display, 0);
|
||||||
ck_assert_msg(!success, "unexpected screenless parse success %sfor '%s'", test_string[test_type], name);
|
fail_unless(!success, "unexpected screenless parse success %sfor '%s'", test_string[test_type], name);
|
||||||
ck_assert_msg(got_host == (char *) -1, "host changed on parse failure %sfor '%s': got %p", test_string[test_type], name, got_host);
|
fail_unless(got_host == (char *) -1, "host changed on parse failure %sfor '%s': got %p", test_string[test_type], name, got_host);
|
||||||
ck_assert_msg(got_display == -42, "display changed on parse failure %sfor '%s': got %d", test_string[test_type], name, got_display);
|
fail_unless(got_display == -42, "display changed on parse failure %sfor '%s': got %d", test_string[test_type], name, got_display);
|
||||||
}
|
}
|
||||||
putenv(display_env);
|
putenv("DISPLAY=");
|
||||||
}
|
}
|
||||||
|
|
||||||
START_TEST(parse_display_unix)
|
START_TEST(parse_display_unix)
|
||||||
{
|
{
|
||||||
#ifdef __unix__
|
|
||||||
char buf[sizeof "/tmp/xcb-test.XXXXXXX"];
|
|
||||||
char buf2[sizeof(buf) + 7];
|
|
||||||
int r, v;
|
|
||||||
memcpy(buf, "/tmp/xcb-test.XXXXXXX", sizeof buf);
|
|
||||||
v = mkstemp(buf);
|
|
||||||
ck_assert_msg(v >= 0, "cannot create temporary file");
|
|
||||||
parse_display_pass(buf, buf, 0, 0);
|
|
||||||
r = snprintf(buf2, sizeof buf2, "unix:%s", buf);
|
|
||||||
if (r < 5 || r >= (int)sizeof buf2) {
|
|
||||||
ck_assert_msg(0, "snprintf() failed (return value %d)", r);
|
|
||||||
unlink(buf);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
parse_display_pass(buf2, buf, 0, 0);
|
|
||||||
r = snprintf(buf2, sizeof buf2, "unix:%s.1", buf);
|
|
||||||
if (r < 7 || r >= (int)sizeof buf2) {
|
|
||||||
ck_assert_msg(0, "snprintf() failed (return value %d)", r);
|
|
||||||
unlink(buf);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
parse_display_pass(buf2, buf, 0, 1);
|
|
||||||
r = snprintf(buf2, sizeof buf2, "%s.1", buf);
|
|
||||||
if (r < 2 || r >= (int)sizeof buf2) {
|
|
||||||
ck_assert_msg(0, "snprintf() failed (return value %d)", r);
|
|
||||||
unlink(buf);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
parse_display_pass(buf2, buf, 0, 1);
|
|
||||||
unlink(buf);
|
|
||||||
#endif
|
|
||||||
parse_display_pass(":0", "", 0, 0);
|
parse_display_pass(":0", "", 0, 0);
|
||||||
parse_display_pass(":1", "", 1, 0);
|
parse_display_pass(":1", "", 1, 0);
|
||||||
parse_display_pass(":0.1", "", 0, 1);
|
parse_display_pass(":0.1", "", 0, 1);
|
||||||
|
@ -222,7 +183,7 @@ END_TEST
|
||||||
|
|
||||||
static void popcount_eq(uint32_t bits, int count)
|
static void popcount_eq(uint32_t bits, int count)
|
||||||
{
|
{
|
||||||
ck_assert_msg(xcb_popcount(bits) == count, "unexpected popcount(%08x) != %d", bits, count);
|
fail_unless(xcb_popcount(bits) == count, "unexpected popcount(%08x) != %d", bits, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
START_TEST(popcount)
|
START_TEST(popcount)
|
||||||
|
@ -245,7 +206,7 @@ END_TEST
|
||||||
Suite *public_suite(void)
|
Suite *public_suite(void)
|
||||||
{
|
{
|
||||||
Suite *s = suite_create("Public API");
|
Suite *s = suite_create("Public API");
|
||||||
putenv(display_env);
|
putenv("DISPLAY=");
|
||||||
suite_add_test(s, parse_display_unix, "xcb_parse_display unix");
|
suite_add_test(s, parse_display_unix, "xcb_parse_display unix");
|
||||||
suite_add_test(s, parse_display_ip, "xcb_parse_display ip");
|
suite_add_test(s, parse_display_ip, "xcb_parse_display ip");
|
||||||
suite_add_test(s, parse_display_ipv4, "xcb_parse_display ipv4");
|
suite_add_test(s, parse_display_ipv4, "xcb_parse_display ipv4");
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
#include <check.h>
|
#include <check.h>
|
||||||
|
|
||||||
#if CHECK_MAJOR_VERSION == 0 && CHECK_MINOR_VERSION < 13
|
|
||||||
void suite_add_test(Suite *s, TFun tf, const char *name);
|
void suite_add_test(Suite *s, TFun tf, const char *name);
|
||||||
#else
|
|
||||||
void suite_add_test(Suite *s, const TTest *tt, const char *name);
|
|
||||||
#endif
|
|
||||||
Suite *public_suite(void);
|
Suite *public_suite(void);
|
||||||
|
|
|
@ -6,6 +6,6 @@ includedir=@includedir@
|
||||||
Name: XCB Composite
|
Name: XCB Composite
|
||||||
Description: XCB Composite Extension
|
Description: XCB Composite Extension
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Requires.private: xcb xcb-xfixes
|
Requires: xcb xcb-xfixes
|
||||||
Libs: -L${libdir} -lxcb-composite
|
Libs: -L${libdir} -lxcb-composite
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -6,6 +6,6 @@ includedir=@includedir@
|
||||||
Name: XCB Damage
|
Name: XCB Damage
|
||||||
Description: XCB Damage Extension
|
Description: XCB Damage Extension
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Requires.private: xcb xcb-xfixes
|
Requires: xcb xcb-xfixes
|
||||||
Libs: -L${libdir} -lxcb-damage
|
Libs: -L${libdir} -lxcb-damage
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
libdir=@libdir@
|
|
||||||
includedir=@includedir@
|
|
||||||
|
|
||||||
Name: XCB Dbe
|
|
||||||
Description: XCB Double Buffer Extension
|
|
||||||
Version: @PACKAGE_VERSION@
|
|
||||||
Requires.private: xcb
|
|
||||||
Libs: -L${libdir} -lxcb-dbe
|
|
||||||
Cflags: -I${includedir}
|
|
|
@ -6,6 +6,6 @@ includedir=@includedir@
|
||||||
Name: XCB DPMS
|
Name: XCB DPMS
|
||||||
Description: XCB DPMS Extension
|
Description: XCB DPMS Extension
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Requires.private: xcb
|
Requires: xcb
|
||||||
Libs: -L${libdir} -lxcb-dpms
|
Libs: -L${libdir} -lxcb-dpms
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
libdir=@libdir@
|
|
||||||
includedir=@includedir@
|
|
||||||
|
|
||||||
Name: XCB DRI3
|
|
||||||
Description: XCB DRI3 Extension
|
|
||||||
Version: @PACKAGE_VERSION@
|
|
||||||
Requires.private: xcb
|
|
||||||
Libs: -L${libdir} -lxcb-dri3
|
|
||||||
Cflags: -I${includedir}
|
|
11
xcb-ge.pc.in
11
xcb-ge.pc.in
|
@ -1,11 +0,0 @@
|
||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
libdir=@libdir@
|
|
||||||
includedir=@includedir@
|
|
||||||
|
|
||||||
Name: XCB GenericEvent
|
|
||||||
Description: XCB GenericEvent Extension
|
|
||||||
Version: @PACKAGE_VERSION@
|
|
||||||
Requires.private: xcb
|
|
||||||
Libs: -L${libdir} -lxcb-ge
|
|
||||||
Cflags: -I${includedir}
|
|
|
@ -6,6 +6,6 @@ includedir=@includedir@
|
||||||
Name: XCB GLX
|
Name: XCB GLX
|
||||||
Description: XCB GLX Extension
|
Description: XCB GLX Extension
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Requires.private: xcb
|
Requires: xcb
|
||||||
Libs: -L${libdir} -lxcb-glx
|
Libs: -L${libdir} -lxcb-glx
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
libdir=@libdir@
|
|
||||||
includedir=@includedir@
|
|
||||||
|
|
||||||
Name: XCB Present
|
|
||||||
Description: XCB Present Extension
|
|
||||||
Version: @PACKAGE_VERSION@
|
|
||||||
Requires.private: xcb xcb-randr xcb-xfixes xcb-sync xcb-dri3
|
|
||||||
Libs: -L${libdir} -lxcb-present
|
|
||||||
Cflags: -I${includedir}
|
|
|
@ -6,6 +6,6 @@ includedir=@includedir@
|
||||||
Name: XCB RandR
|
Name: XCB RandR
|
||||||
Description: XCB RandR Extension
|
Description: XCB RandR Extension
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Requires.private: xcb xcb-render
|
Requires: xcb
|
||||||
Libs: -L${libdir} -lxcb-randr
|
Libs: -L${libdir} -lxcb-randr
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -6,6 +6,6 @@ includedir=@includedir@
|
||||||
Name: XCB Record
|
Name: XCB Record
|
||||||
Description: XCB Record Extension
|
Description: XCB Record Extension
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Requires.private: xcb
|
Requires: xcb
|
||||||
Libs: -L${libdir} -lxcb-record
|
Libs: -L${libdir} -lxcb-record
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -6,6 +6,6 @@ includedir=@includedir@
|
||||||
Name: XCB Render
|
Name: XCB Render
|
||||||
Description: XCB Render Extension
|
Description: XCB Render Extension
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Requires.private: xcb
|
Requires: xcb
|
||||||
Libs: -L${libdir} -lxcb-render
|
Libs: -L${libdir} -lxcb-render
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -6,6 +6,6 @@ includedir=@includedir@
|
||||||
Name: XCB Res
|
Name: XCB Res
|
||||||
Description: XCB X-Resource Extension
|
Description: XCB X-Resource Extension
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Requires.private: xcb
|
Requires: xcb
|
||||||
Libs: -L${libdir} -lxcb-res
|
Libs: -L${libdir} -lxcb-res
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -6,6 +6,6 @@ includedir=@includedir@
|
||||||
Name: XCB Screensaver
|
Name: XCB Screensaver
|
||||||
Description: XCB Screensaver Extension
|
Description: XCB Screensaver Extension
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Requires.private: xcb
|
Requires: xcb
|
||||||
Libs: -L${libdir} -lxcb-screensaver
|
Libs: -L${libdir} -lxcb-screensaver
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -6,6 +6,6 @@ includedir=@includedir@
|
||||||
Name: XCB Shape
|
Name: XCB Shape
|
||||||
Description: XCB Shape Extension
|
Description: XCB Shape Extension
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Requires.private: xcb
|
Requires: xcb
|
||||||
Libs: -L${libdir} -lxcb-shape
|
Libs: -L${libdir} -lxcb-shape
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -6,6 +6,6 @@ includedir=@includedir@
|
||||||
Name: XCB Shm
|
Name: XCB Shm
|
||||||
Description: XCB Shm Extension
|
Description: XCB Shm Extension
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Requires.private: xcb
|
Requires: xcb
|
||||||
Libs: -L${libdir} -lxcb-shm
|
Libs: -L${libdir} -lxcb-shm
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -6,6 +6,6 @@ includedir=@includedir@
|
||||||
Name: XCB Sync
|
Name: XCB Sync
|
||||||
Description: XCB Sync Extension
|
Description: XCB Sync Extension
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Requires.private: xcb
|
Requires: xcb
|
||||||
Libs: -L${libdir} -lxcb-sync
|
Libs: -L${libdir} -lxcb-sync
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -6,6 +6,6 @@ includedir=@includedir@
|
||||||
Name: XCB Xevie
|
Name: XCB Xevie
|
||||||
Description: XCB Xevie Extension
|
Description: XCB Xevie Extension
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Requires.private: xcb
|
Requires: xcb
|
||||||
Libs: -L${libdir} -lxcb-xevie
|
Libs: -L${libdir} -lxcb-xevie
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -6,6 +6,6 @@ includedir=@includedir@
|
||||||
Name: XCB XFree86-DRI
|
Name: XCB XFree86-DRI
|
||||||
Description: XCB XFree86-DRI Extension
|
Description: XCB XFree86-DRI Extension
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Requires.private: xcb
|
Requires: xcb
|
||||||
Libs: -L${libdir} -lxcb-xf86dri
|
Libs: -L${libdir} -lxcb-xf86dri
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -6,6 +6,6 @@ includedir=@includedir@
|
||||||
Name: XCB XFixes
|
Name: XCB XFixes
|
||||||
Description: XCB XFixes Extension
|
Description: XCB XFixes Extension
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Requires.private: xcb xcb-render xcb-shape
|
Requires: xcb xcb-render xcb-shape
|
||||||
Libs: -L${libdir} -lxcb-xfixes
|
Libs: -L${libdir} -lxcb-xfixes
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -6,6 +6,6 @@ includedir=@includedir@
|
||||||
Name: XCB Xinerama
|
Name: XCB Xinerama
|
||||||
Description: XCB Xinerama Extension
|
Description: XCB Xinerama Extension
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Requires.private: xcb
|
Requires: xcb
|
||||||
Libs: -L${libdir} -lxcb-xinerama
|
Libs: -L${libdir} -lxcb-xinerama
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
libdir=@libdir@
|
|
||||||
includedir=@includedir@
|
|
||||||
|
|
||||||
Name: XCB XInput
|
|
||||||
Description: XCB XInput Extension (EXPERIMENTAL)
|
|
||||||
Version: @PACKAGE_VERSION@
|
|
||||||
Requires.private: xcb xcb-xfixes
|
|
||||||
Libs: -L${libdir} -lxcb-xinput
|
|
||||||
Cflags: -I${includedir}
|
|
|
@ -1,11 +0,0 @@
|
||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
libdir=@libdir@
|
|
||||||
includedir=@includedir@
|
|
||||||
|
|
||||||
Name: XCB XKB
|
|
||||||
Description: XCB Keyboard Extension (EXPERIMENTAL)
|
|
||||||
Version: @PACKAGE_VERSION@
|
|
||||||
Requires.private: xcb
|
|
||||||
Libs: -L${libdir} -lxcb-xkb
|
|
||||||
Cflags: -I${includedir}
|
|
|
@ -3,9 +3,9 @@ exec_prefix=@exec_prefix@
|
||||||
libdir=@libdir@
|
libdir=@libdir@
|
||||||
includedir=@includedir@
|
includedir=@includedir@
|
||||||
|
|
||||||
Name: XCB DRI2
|
Name: XCB Xlib
|
||||||
Description: XCB DRI2 Extension
|
Description: XCB Xlib support functions
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Requires.private: xcb
|
Requires: xcb
|
||||||
Libs: -L${libdir} -lxcb-dri2
|
Libs: -L${libdir} -lxcb-xlib
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
|
@ -6,6 +6,6 @@ includedir=@includedir@
|
||||||
Name: XCB Xprint
|
Name: XCB Xprint
|
||||||
Description: XCB Xprint Extension
|
Description: XCB Xprint Extension
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Requires.private: xcb
|
Requires: xcb
|
||||||
Libs: -L${libdir} -lxcb-xprint
|
Libs: -L${libdir} -lxcb-xprint
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
libdir=@libdir@
|
|
||||||
includedir=@includedir@
|
|
||||||
|
|
||||||
Name: XCB SELinux
|
|
||||||
Description: XCB SELinux Extension
|
|
||||||
Version: @PACKAGE_VERSION@
|
|
||||||
Requires.private: xcb
|
|
||||||
Libs: -L${libdir} -lxcb-xselinux
|
|
||||||
Cflags: -I${includedir}
|
|
|
@ -6,6 +6,6 @@ includedir=@includedir@
|
||||||
Name: XCB XTEST
|
Name: XCB XTEST
|
||||||
Description: XCB XTEST Extension
|
Description: XCB XTEST Extension
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Requires.private: xcb
|
Requires: xcb
|
||||||
Libs: -L${libdir} -lxcb-xtest
|
Libs: -L${libdir} -lxcb-xtest
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -6,6 +6,6 @@ includedir=@includedir@
|
||||||
Name: XCB Xv
|
Name: XCB Xv
|
||||||
Description: XCB Xv Extension
|
Description: XCB Xv Extension
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Requires.private: xcb xcb-shm
|
Requires: xcb xcb-shm
|
||||||
Libs: -L${libdir} -lxcb-xv
|
Libs: -L${libdir} -lxcb-xv
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -6,6 +6,6 @@ includedir=@includedir@
|
||||||
Name: XCB XvMC
|
Name: XCB XvMC
|
||||||
Description: XCB XvMC Extension
|
Description: XCB XvMC Extension
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Requires.private: xcb xcb-xv
|
Requires: xcb xcb-xv
|
||||||
Libs: -L${libdir} -lxcb-xvmc
|
Libs: -L${libdir} -lxcb-xvmc
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -2,7 +2,6 @@ prefix=@prefix@
|
||||||
exec_prefix=@exec_prefix@
|
exec_prefix=@exec_prefix@
|
||||||
libdir=@libdir@
|
libdir=@libdir@
|
||||||
includedir=@includedir@
|
includedir=@includedir@
|
||||||
xcbproto_version=@XCBPROTO_VERSION@
|
|
||||||
|
|
||||||
Name: XCB
|
Name: XCB
|
||||||
Description: X-protocol C Binding
|
Description: X-protocol C Binding
|
||||||
|
|
Loading…
Reference in New Issue