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

Apparently I forgot to push these months ago.
This commit is contained in:
Jamey Sharp 2011-03-13 09:18:24 -07:00
commit 2edfd5c375
12 changed files with 1579 additions and 142 deletions

View File

@ -58,6 +58,9 @@ 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

View File

@ -15,6 +15,7 @@ AM_CONDITIONAL(HAVE_CHECK, test x$HAVE_CHECK = xyes)
AC_CONFIG_HEADERS([src/config.h])
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_PROG_CC
@ -72,12 +73,21 @@ AC_HEADER_STDC
AC_SEARCH_LIBS(getaddrinfo, socket)
AC_SEARCH_LIBS(connect, socket)
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],
AC_HELP_STRING([--with-queue-size=SIZE],
@ -121,8 +131,23 @@ AC_PREREQ([2.59c], [], [AC_SUBST([htmldir], [m4_ifset([AC_PACKAGE_TARNAME],
XCB_CHECK_DOXYGEN()
case $host_os in
# darwin has poll() but can't be used to poll character devices (atleast through SnowLeopard)
darwin*) ;;
# darwin through Snow Leopard has poll() but can't be used to poll character devices.
darwin@<:@789@:>@*|darwin10*) ;;
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
case $_ac_xorg_macosx_version_min in
10.@<:@0123456@:>@|10.@<:@0123456@:>@.*) ;;
*)
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])], )
;;
@ -146,6 +171,7 @@ XCB_EXTENSION(XFixes, "yes")
XCB_EXTENSION(XFree86-DRI, "yes")
XCB_EXTENSION(Xinerama, "yes")
XCB_EXTENSION(XInput, "no")
XCB_EXTENSION(XKB, "no")
XCB_EXTENSION(Xprint, "yes")
XCB_EXTENSION(SELinux, "no")
XCB_EXTENSION(XTest, "yes")
@ -189,6 +215,7 @@ xcb-xf86dri.pc
xcb-xfixes.pc
xcb-xinerama.pc
xcb-xinput.pc
xcb-xkb.pc
xcb-xprint.pc
xcb-xselinux.pc
xcb-xtest.pc

49
doc/xkb_internals Normal file
View File

@ -0,0 +1,49 @@
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.

38
doc/xkb_issues Normal file
View File

@ -0,0 +1,38 @@
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
src/.gitignore vendored
View File

@ -18,6 +18,7 @@ xf86dri.*
xfixes.*
xinerama.*
xinput.*
xkb.*
xprint.*
xselinux.*
xtest.*

View File

@ -18,7 +18,7 @@ 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 change or remove an interface, increment current and set revision
# and age to 0.
libxcb_la_LDFLAGS = -version-info 2:0:1 -no-undefined
libxcb_la_LDFLAGS = -version-info 2:0:1 -no-undefined @lt_enable_auto_import@
XCB_LIBS = libxcb.la
@ -27,7 +27,7 @@ XCB_LIBS = libxcb.la
EXTSOURCES += composite.c
if BUILD_COMPOSITE
lib_LTLIBRARIES += libxcb-composite.la
libxcb_composite_la_LDFLAGS = -version-info 0:0:0 -no-undefined
libxcb_composite_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
libxcb_composite_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_composite_la_SOURCES = composite.c composite.h
endif
@ -35,7 +35,7 @@ endif
EXTSOURCES += damage.c
if BUILD_DAMAGE
lib_LTLIBRARIES += libxcb-damage.la
libxcb_damage_la_LDFLAGS = -version-info 0:0:0 -no-undefined
libxcb_damage_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
libxcb_damage_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_damage_la_SOURCES = damage.c damage.h
endif
@ -43,7 +43,7 @@ endif
EXTSOURCES += dpms.c
if BUILD_DPMS
lib_LTLIBRARIES += libxcb-dpms.la
libxcb_dpms_la_LDFLAGS = -version-info 0:0:0 -no-undefined
libxcb_dpms_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
libxcb_dpms_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_dpms_la_SOURCES = dpms.c dpms.h
endif
@ -51,7 +51,7 @@ endif
EXTSOURCES += dri2.c
if BUILD_DRI2
lib_LTLIBRARIES += libxcb-dri2.la
libxcb_dri2_la_LDFLAGS = -version-info 0:0:0 -no-undefined
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
@ -59,7 +59,7 @@ endif
EXTSOURCES += glx.c
if BUILD_GLX
lib_LTLIBRARIES += libxcb-glx.la
libxcb_glx_la_LDFLAGS = -version-info 0:0:0 -no-undefined
libxcb_glx_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
libxcb_glx_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_glx_la_SOURCES = glx.c glx.h
endif
@ -67,7 +67,7 @@ endif
EXTSOURCES += randr.c
if BUILD_RANDR
lib_LTLIBRARIES += libxcb-randr.la
libxcb_randr_la_LDFLAGS = -version-info 1:0:1 -no-undefined
libxcb_randr_la_LDFLAGS = -version-info 1:0:1 -no-undefined @lt_enable_auto_import@
libxcb_randr_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_randr_la_SOURCES = randr.c randr.h
endif
@ -75,7 +75,7 @@ endif
EXTSOURCES += record.c
if BUILD_RECORD
lib_LTLIBRARIES += libxcb-record.la
libxcb_record_la_LDFLAGS = -version-info 0:0:0 -no-undefined
libxcb_record_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
libxcb_record_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_record_la_SOURCES = record.c record.h
endif
@ -83,7 +83,7 @@ endif
EXTSOURCES += render.c
if BUILD_RENDER
lib_LTLIBRARIES += libxcb-render.la
libxcb_render_la_LDFLAGS = -version-info 0:0:0 -no-undefined
libxcb_render_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
libxcb_render_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_render_la_SOURCES = render.c render.h
endif
@ -91,7 +91,7 @@ endif
EXTSOURCES += res.c
if BUILD_RESOURCE
lib_LTLIBRARIES += libxcb-res.la
libxcb_res_la_LDFLAGS = -version-info 0:0:0 -no-undefined
libxcb_res_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
libxcb_res_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_res_la_SOURCES = res.c res.h
endif
@ -99,7 +99,7 @@ endif
EXTSOURCES += screensaver.c
if BUILD_SCREENSAVER
lib_LTLIBRARIES += libxcb-screensaver.la
libxcb_screensaver_la_LDFLAGS = -version-info 0:0:0 -no-undefined
libxcb_screensaver_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
libxcb_screensaver_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_screensaver_la_SOURCES = screensaver.c screensaver.h
endif
@ -107,7 +107,7 @@ endif
EXTSOURCES += shape.c
if BUILD_SHAPE
lib_LTLIBRARIES += libxcb-shape.la
libxcb_shape_la_LDFLAGS = -version-info 0:0:0 -no-undefined
libxcb_shape_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
libxcb_shape_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_shape_la_SOURCES = shape.c shape.h
endif
@ -115,7 +115,7 @@ endif
EXTSOURCES += shm.c
if BUILD_SHM
lib_LTLIBRARIES += libxcb-shm.la
libxcb_shm_la_LDFLAGS = -version-info 0:0:0 -no-undefined
libxcb_shm_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
libxcb_shm_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_shm_la_SOURCES = shm.c shm.h
endif
@ -123,7 +123,7 @@ endif
EXTSOURCES += sync.c
if BUILD_SYNC
lib_LTLIBRARIES += libxcb-sync.la
libxcb_sync_la_LDFLAGS = -version-info 0:0:0 -no-undefined
libxcb_sync_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
libxcb_sync_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_sync_la_SOURCES = sync.c sync.h
endif
@ -131,7 +131,7 @@ endif
EXTSOURCES += xevie.c
if BUILD_XEVIE
lib_LTLIBRARIES += libxcb-xevie.la
libxcb_xevie_la_LDFLAGS = -version-info 0:0:0 -no-undefined
libxcb_xevie_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
libxcb_xevie_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_xevie_la_SOURCES = xevie.c xevie.h
endif
@ -139,7 +139,7 @@ endif
EXTSOURCES += xf86dri.c
if BUILD_XFREE86_DRI
lib_LTLIBRARIES += libxcb-xf86dri.la
libxcb_xf86dri_la_LDFLAGS = -version-info 0:0:0 -no-undefined
libxcb_xf86dri_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
libxcb_xf86dri_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_xf86dri_la_SOURCES = xf86dri.c xf86dri.h
endif
@ -147,7 +147,7 @@ endif
EXTSOURCES += xfixes.c
if BUILD_XFIXES
lib_LTLIBRARIES += libxcb-xfixes.la
libxcb_xfixes_la_LDFLAGS = -version-info 0:0:0 -no-undefined
libxcb_xfixes_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
libxcb_xfixes_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_xfixes_la_SOURCES = xfixes.c xfixes.h
endif
@ -155,7 +155,7 @@ endif
EXTSOURCES += xinerama.c
if BUILD_XINERAMA
lib_LTLIBRARIES += libxcb-xinerama.la
libxcb_xinerama_la_LDFLAGS = -version-info 0:0:0 -no-undefined
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
@ -163,15 +163,23 @@ endif
EXTSOURCES += xinput.c
if BUILD_XINPUT
lib_LTLIBRARIES += libxcb-xinput.la
libxcb_xinput_la_LDFLAGS = -version-info 0:0:0 -no-undefined
libxcb_xinput_la_LDFLAGS = -version-info 0:0:0 -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 0: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
libxcb_xprint_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
libxcb_xprint_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_xprint_la_SOURCES = xprint.c xprint.h
endif
@ -179,7 +187,7 @@ endif
EXTSOURCES += xselinux.c
if BUILD_SELINUX
lib_LTLIBRARIES += libxcb-xselinux.la
libxcb_xselinux_la_LDFLAGS = -version-info 0:0:0 -no-undefined
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
@ -187,7 +195,7 @@ endif
EXTSOURCES += xtest.c
if BUILD_XTEST
lib_LTLIBRARIES += libxcb-xtest.la
libxcb_xtest_la_LDFLAGS = -version-info 0:0:0 -no-undefined
libxcb_xtest_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
libxcb_xtest_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_xtest_la_SOURCES = xtest.c xtest.h
endif
@ -195,7 +203,7 @@ endif
EXTSOURCES += xv.c
if BUILD_XV
lib_LTLIBRARIES += libxcb-xv.la
libxcb_xv_la_LDFLAGS = -version-info 0:0:0 -no-undefined
libxcb_xv_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
libxcb_xv_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_xv_la_SOURCES = xv.c xv.h
endif
@ -203,7 +211,7 @@ endif
EXTSOURCES += xvmc.c
if BUILD_XVMC
lib_LTLIBRARIES += libxcb-xvmc.la
libxcb_xvmc_la_LDFLAGS = -version-info 0:0:0 -no-undefined
libxcb_xvmc_la_LDFLAGS = -version-info 0:0:0 -no-undefined @lt_enable_auto_import@
libxcb_xvmc_la_LIBADD = $(XCB_LIBS)
nodist_libxcb_xvmc_la_SOURCES = xvmc.c xvmc.h
endif
@ -211,6 +219,9 @@ endif
EXTHEADERS=$(EXTSOURCES:.c=.h)
xcbinclude_HEADERS = xcb.h xcbext.h
if XCB_HAVE_WIN32
xcbinclude_HEADERS += xcb_windefs.h
endif
nodist_xcbinclude_HEADERS = $(EXTHEADERS)
noinst_HEADERS = xcbint.h

1490
src/c_client.py Executable file → Normal file

File diff suppressed because it is too large Load Diff

View File

@ -327,10 +327,15 @@ int _xcb_get_auth_info(int fd, xcb_auth_info_t *info, int display)
if (!info->namelen)
goto no_auth; /* out of memory */
if (!gotsockname && (sockname = get_peer_sock_name(getsockname, fd)) == NULL)
if (!gotsockname)
{
free(info->name);
goto no_auth; /* can only authenticate sockets */
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);

View File

@ -257,6 +257,7 @@ xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info)
{
xcb_connection_t* c;
#ifndef _WIN32
#ifndef USE_POLL
if(fd >= FD_SETSIZE) /* would overflow in FD_SET */
{
@ -264,6 +265,7 @@ xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info)
return (xcb_connection_t *) &error_connection;
}
#endif
#endif /* !_WIN32*/
c = calloc(1, sizeof(xcb_connection_t));
if(!c) {

View File

@ -62,6 +62,16 @@ int xcb_popcount(uint32_t mask)
return ((y + (y >> 3)) & 030707070707) % 077;
}
int xcb_sumof(uint8_t *list, int len)
{
int i, s = 0;
for(i=0; i<len; i++) {
s += *list;
list++;
}
return s;
}
static int _xcb_parse_display(const char *name, char **host, char **protocol,
int *displayp, int *screenp)
{

View File

@ -65,15 +65,22 @@ unsigned int xcb_send_request(xcb_connection_t *c, int flags, struct iovec *vect
* 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, flushes any output queues if appropriate, and
* then returns the sequence number of the last request sent over the
* socket. */
* 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.
* */
int xcb_take_socket(xcb_connection_t *c, void (*return_socket)(void *closure), void *closure, int flags, uint64_t *sent);
/* 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);
@ -86,6 +93,7 @@ int xcb_poll_for_reply(xcb_connection_t *c, unsigned int request, void **reply,
/* xcb_util.c */
int xcb_popcount(uint32_t mask);
int xcb_sumof(uint8_t *list, int len);
#ifdef __cplusplus
}

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

@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: XCB XKB
Description: XCB Keyboard Extension (EXPERIMENTAL)
Version: @PACKAGE_VERSION@
Requires: xcb
Libs: -L${libdir} -lxcb-xkb
Cflags: -I${includedir}