platform/upstream/libxcb.git
11 years agoInitialize automake earlier (bugfix for #66413)
Daniel Martin [Wed, 24 Jul 2013 10:51:04 +0000 (12:51 +0200)]
Initialize automake earlier (bugfix for #66413)

This fixes:
    https://bugs.freedesktop.org/show_bug.cgi?id=66413
    Bug 66413 - libxcb 1.9.1: Fails to build on Arch Linux: \
        /home/<user>/install-sh: No such file or directory

Without that patch the search path for `install-sh` will become $HOME
and the `install` target will fail, when DESTDIR doesn't exist in
advance. (occured with automake 1.14 and autoconf 2.69)

Initial patch by: Alain Kalker <a.c.kalker@gmail.com>
Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
Tested-By: Ran Benita <ran234@gmail.com>
11 years agoMake xsltproc optional
Daniel Martin [Mon, 31 Dec 2012 10:57:49 +0000 (11:57 +0100)]
Make xsltproc optional

Fix Bug 23863 - xcb still checks for xsltproc:
    https://bugs.freedesktop.org/show_bug.cgi?id=23863

xsltproc is used to generate the optional html page for `check` results,
only. So, it's not a hard build dependency.

Additionally, use yes/no instead of true/false in the HTML_CHECK_RESULT
variable for consistent output after a configure run.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
11 years agoc_client.py: Do not create pointers in unions
Daniel Martin [Fri, 28 Dec 2012 22:25:16 +0000 (23:25 +0100)]
c_client.py: Do not create pointers in unions

Do not create pointers in unions for fields of variadic length.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Ran Benita <ran234@gmail.com>
11 years agoc_client.py: Always initialize xcb_align_to
Daniel Martin [Wed, 9 Jan 2013 11:52:15 +0000 (12:52 +0100)]
c_client.py: Always initialize xcb_align_to

to get rid of:
    warning: 'xcb_align_to' may be used uninitialized in this function

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Peter Harris <pharris@opentext.com>
11 years agoDefine _xcb_map_new with explicit void arg list instead of empty one
Alan Coopersmith [Sun, 4 Aug 2013 03:25:23 +0000 (20:25 -0700)]
Define _xcb_map_new with explicit void arg list instead of empty one

Fixes Solaris Studio compiler warning:
"xcb_list.c", line 50: warning: old style function definition

and gcc warning:
xcb_list.c: In function '_xcb_map_new':
xcb_list.c:50:11: warning: old-style function definition [-Wold-style-definition]

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
11 years agoEnable warnings for pre-C89 style definitions for gcc & Solaris Studio
Alan Coopersmith [Sun, 4 Aug 2013 03:22:25 +0000 (20:22 -0700)]
Enable warnings for pre-C89 style definitions for gcc & Solaris Studio

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
11 years agoBuild xcb-xkb by default
Michael Stapelberg [Mon, 5 Aug 2013 20:14:18 +0000 (22:14 +0200)]
Build xcb-xkb by default

There have not been any big issues with xcb-xkb recently.

Also, Wayland is using xcb-xkb actively, making distributions compile
libxcb with xkb support anyway, so let’s reflect reality :).

Reviewed-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Daniel Martin <consume.noise@gmail.com>
11 years agoc_client.py: Inject full_sequence into GE events
Daniel Martin [Sat, 8 Jun 2013 09:20:39 +0000 (11:20 +0200)]
c_client.py: Inject full_sequence into GE events

The generic event structure xcb_ge_event_t has the full_sequence field
at the 32byte boundary. That's why we've to inject this field into GE
events while generating the structure for them. Otherwise we would read
garbage (the internal full_sequence) when accessing normal event fields
there.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Peter Harris <pharris@opentext.com>
11 years agoFix "indention" typos in xcb-examples.3 man page
Alan Coopersmith [Tue, 9 Jul 2013 00:54:35 +0000 (17:54 -0700)]
Fix "indention" typos in xcb-examples.3 man page

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
11 years agoUpdate Makefile.am for newer automake
Marc Deslauriers [Wed, 5 Jun 2013 20:38:00 +0000 (16:38 -0400)]
Update Makefile.am for newer automake

Debian Bug #710344

Reviewed-by: Daniel Martin <consume.noise@gmail.com>
11 years agofix deadlock with xcb_take_socket/return_socket v3
Christian König [Wed, 15 May 2013 09:21:36 +0000 (11:21 +0200)]
fix deadlock with xcb_take_socket/return_socket v3

To prevent different threads from stealing the socket from each other the
caller of "xcb_take_socket" must hold a lock that is also acquired in
"return_socket". Unfortunately xcb tries to prevent calling return_socket
from multiple threads and this can lead to a deadlock situation.

A simple example:
- X11 has taken the socket
- Thread A has locked the display.
- Thread B does xcb_no_operation() and thus ends up in libX11's return_socket(),
  waiting for the display lock.
- Thread A calls e.g. xcb_no_operation(), too, ends up in return_socket() and
  because socket_moving == 1, ends up waiting for thread B
=> Deadlock

This patch allows calling return_socket from different threads at the same time
an so resolves the deadlock situation.

Partially fixes: https://bugs.freedesktop.org/show_bug.cgi?id=20708

v2: fixes additional pthread_cond_wait dependencies,
    rework comments and patch description

v3: separate pthread_cond_wait dependencies and unrelated whitespace
    change into their own patch, use unsigned for socket_seq

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
11 years agointeger overflow in read_packet() [CVE-2013-2064]
Alan Coopersmith [Thu, 2 May 2013 00:59:31 +0000 (17:59 -0700)]
integer overflow in read_packet() [CVE-2013-2064]

Ensure that when calculating the size of the incoming response from the
Xserver, we don't overflow the integer used in the calculations when we
multiply the int32_t length by 4 and add it to the default response size.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
11 years agoc_client.py: Handle multiple expr. in a bitcase
Daniel Martin [Mon, 13 May 2013 21:33:04 +0000 (23:33 +0200)]
c_client.py: Handle multiple expr. in a bitcase

Adopt a change from xcbgen. With that modification the expression in a
bitcase became a list of expressions to support multiple <enumref> in a
<bitcase>.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Signed-off-by: Peter Harris <pharris@opentext.com>
11 years agowhitespace fix in xcb_take_socket
Christian König [Wed, 15 May 2013 09:21:35 +0000 (11:21 +0200)]
whitespace fix in xcb_take_socket

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Jamey Sharp <jamey@minilop.net>
11 years agoautogen.sh: Implement GNOME Build API
Colin Walters [Wed, 4 Jan 2012 22:37:06 +0000 (17:37 -0500)]
autogen.sh: Implement GNOME Build API

http://people.gnome.org/~walters/docs/build-api.txt

Signed-off-by: Adam Jackson <ajax@redhat.com>
11 years agoc_client.py: Fix python-3 invalid except statement
Chí-Thanh Christopher Nguyễn [Wed, 10 Oct 2012 23:14:12 +0000 (01:14 +0200)]
c_client.py: Fix python-3 invalid except statement

Replace except statement with a PEP-3110 compliant one. This fixes a regression
introduced by c3deeaf714630531d693a6a902b8dabf791858b1
https://bugs.freedesktop.org/show_bug.cgi?id=55690

Reviewed-by: Peter Harris <pharris@opentext.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
11 years agoc-client.py: Fix python-3 AttributeError: 'dict' object has no attribute 'iteritems'
Chí-Thanh Christopher Nguyễn [Wed, 10 Oct 2012 23:14:11 +0000 (01:14 +0200)]
c-client.py: Fix python-3 AttributeError: 'dict' object has no attribute 'iteritems'

This fixes a regression introduced by ea71d7d7e3f5d8189b80747678e9ca9a417b1d37
https://bugs.freedesktop.org/show_bug.cgi?id=55690

Reviewed-by: Peter Harris <pharris@opentext.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
12 years agoRelease libxcb 1.9 1.9
Uli Schlachter [Fri, 5 Oct 2012 12:53:37 +0000 (14:53 +0200)]
Release libxcb 1.9

Signed-off-by: Uli Schlachter <psychon@znc.in>
12 years agoInclude static man pages in "make dist"
Uli Schlachter [Fri, 5 Oct 2012 09:23:26 +0000 (11:23 +0200)]
Include static man pages in "make dist"

This was found by distcheck. It tried to install src/man/xcb-examples.3 and
src/man/xcb-requests.3, but those files weren't in the distribution.

Fix this by explicitly telling automake to distribute those files.

Signed-off-by: Uli Schlachter <psychon@znc.in>
12 years agoFix a multi-thread deadlock
Uli Schlachter [Mon, 24 Sep 2012 20:07:51 +0000 (22:07 +0200)]
Fix a multi-thread deadlock

This fixes a deadlock which was seen in-the-wild with wine.

It could happen that two threads tried to read from the socket at the same time
and one of the thread got stuck inside of poll()/select().

The fix works by making sure that the writing thread doesn't steal the reading
thread's reply.

Debugged-by: Erich Hoover <ehoover@mines.edu>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54671
Signed-off-by: Uli Schlachter <psychon@znc.in>
12 years agoAdd a .gitignore for src/man/
Uli Schlachter [Mon, 24 Sep 2012 20:07:30 +0000 (22:07 +0200)]
Add a .gitignore for src/man/

Signed-off-by: Uli Schlachter <psychon@znc.in>
12 years agoAllow xcb_send_request with >MAX_IOV iovecs
Peter Harris [Thu, 16 Aug 2012 15:59:14 +0000 (11:59 -0400)]
Allow xcb_send_request with >MAX_IOV iovecs

This allows an application to do a scatter/gather operation on a large
image buffer to avoid the extra memcpy.

Use autoconf to use UIO_MAXIOV where IOV_MAX is not available (and the
POSIX minimum of 16 where neither are available).

Reviewed-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Peter Harris <pharris@opentext.com>
12 years agoReturn connection failure if display string specifies non-existent screen
Alan Coopersmith [Sat, 25 Aug 2012 20:53:37 +0000 (13:53 -0700)]
Return connection failure if display string specifies non-existent screen

Matches the behaviour of Xlib - if you set DISPLAY to :0.1 but only have
one screen, closes connection and returns error.

This introduces a new connection error code:
XCB_CONN_CLOSED_INVALID_SCREEN

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
12 years agoAdd AC_USE_SYSTEM_EXTENSIONS to allow use of more system functionality
Alan Coopersmith [Sat, 25 Aug 2012 06:35:41 +0000 (23:35 -0700)]
Add AC_USE_SYSTEM_EXTENSIONS to allow use of more system functionality

Copied from libX11 configure.ac

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
12 years agoAlways include "config.h" at the start of all C source files.
Alan Coopersmith [Sat, 25 Aug 2012 06:32:32 +0000 (23:32 -0700)]
Always include "config.h" at the start of all C source files.

Allows configure to set defines such as _POSIX_SOURCE in config.h
that affect functions exposed by system headers and get consistent
results across all the source files.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
12 years agoFix "sppported" typo in doxygen comment for XCB_CONN_CLOSED_EXT_NOTSUPPORTED
Alan Coopersmith [Sat, 25 Aug 2012 19:33:35 +0000 (12:33 -0700)]
Fix "sppported" typo in doxygen comment for XCB_CONN_CLOSED_EXT_NOTSUPPORTED

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
12 years agoc_client: Fix parallel-make issue creating 'man' directory
Colin Walters [Mon, 13 Aug 2012 19:32:31 +0000 (15:32 -0400)]
c_client: Fix parallel-make issue creating 'man' directory

With make -j, it was possible to hit a race condition in the code to
make the 'man' directory.

Signed-off-by: Julien Danjou <julien@danjou.info>
12 years agoxcb_connect: launchd: Don't fall back on tcp if $DISPLAY is a path to a launchd socket
Jeremy Huddleston [Sun, 22 Apr 2012 05:42:51 +0000 (22:42 -0700)]
xcb_connect: launchd: Don't fall back on tcp if $DISPLAY is a path to a launchd socket

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
12 years agoMove static man to man
Julien Danjou [Tue, 27 Mar 2012 10:10:59 +0000 (12:10 +0200)]
Move static man to man

Signed-off-by: Julien Danjou <julien@danjou.info>
12 years agoDo not list manpages, use a wildcard
Julien Danjou [Tue, 27 Mar 2012 10:10:15 +0000 (12:10 +0200)]
Do not list manpages, use a wildcard

Signed-off-by: Julien Danjou <julien@danjou.info>
12 years agoSplit manpage list in two (static/built)
Julien Danjou [Tue, 27 Mar 2012 10:06:54 +0000 (12:06 +0200)]
Split manpage list in two (static/built)

Signed-off-by: Julien Danjou <julien@danjou.info>
12 years agoAllow undocumented code to be built
Julien Danjou [Mon, 26 Mar 2012 16:29:35 +0000 (18:29 +0200)]
Allow undocumented code to be built

Signed-off-by: Julien Danjou <julien@danjou.info>
12 years agoc_client.py: generate manpages
Michael Stapelberg [Sun, 27 Nov 2011 10:38:26 +0000 (10:38 +0000)]
c_client.py: generate manpages

Signed-off-by: Julien Danjou <julien@danjou.info>
12 years agoRelease libxcb 1.8.1 1.8.1
Julien Danjou [Fri, 9 Mar 2012 14:38:56 +0000 (15:38 +0100)]
Release libxcb 1.8.1

Signed-off-by: Julien Danjou <julien@danjou.info>
12 years agoFix a busy loop on BSD and Mac OS
Uli Schlachter [Thu, 1 Mar 2012 19:26:39 +0000 (20:26 +0100)]
Fix a busy loop on BSD and Mac OS

On FreeBSD MSG_WAITALL on a non-blocking socket fails immediately if less bytes
than were asked for are available. This is different than the behavior on linux
where as many bytes as are available are returned in this case. Other OS
apparently follow the FreeBSD behavior.

_xcb_in_read() is used to fill xcb's read buffer, thus this function will call
recv() with a big length argument (xcb's read buffer is by default 16 KiB
large). That many bytes are highly unlikely to be available in the kernel
buffer.

This means that _xcb_in_read() always failed on FreeBSD. Since the socket was
still signaled as readable by poll(), this bug even resulted in a busy loop.

The same issue is present in read_block(), but here it is slightly different.
read_block() is called when we read the first few bytes of an event or a reply,
so that we already know its length. This means that we should be able to use
MSG_WAITALL here, because we know how many bytes there have to be.

However, that function could busy loop, too, when only the first few bytes of
the packet were sent while the rest is stuck somewhere on the way to us. Thus,
MSG_WAITALL should be removed here, too.

Thanks to Christoph Egger from Debian for noticing the problem, doing all the
necessary debugging and figuring out what the problem was! This patch is 99%
from debian. Thanks for all the work.

This bug was introduced in commit 2dcf8b025be88a25d4333abdc28d425b88238d96.

This commit also reverts commit 9061ee45b8dbe5431c23e3f628089d703ccad0b1.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=45776

Signed-off-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
12 years agodarwin: Use read(2) rather than recv(2)
Jeremy Huddleston [Thu, 8 Mar 2012 08:50:13 +0000 (00:50 -0800)]
darwin: Use read(2) rather than recv(2)

2dcf8b025be88a25d4333abdc28d425b88238d96 was causing some regressions on
darwin, so go back to using read(2) there until I have time to investigate
further.

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
12 years agoFallback to TCP if no protocol is specified and the UNIX connection fails
Julien Cristau [Sun, 19 Feb 2012 12:43:54 +0000 (13:43 +0100)]
Fallback to TCP if no protocol is specified and the UNIX connection fails

Signed-off-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Jamey Sharp <jamey@minilop.net>
12 years agoAdd xkb_internals and xkb_issues to EXTRA_DIST.
Arnaud Fontaine [Wed, 25 Jan 2012 08:18:20 +0000 (17:18 +0900)]
Add xkb_internals and xkb_issues to EXTRA_DIST.

12 years agoUpdate use of error_connection under WIN32 to _xcb_conn_ret_error()
Jon TURNEY [Tue, 17 Jan 2012 20:59:56 +0000 (20:59 +0000)]
Update use of error_connection under WIN32 to _xcb_conn_ret_error()

Unfortunately, commit 31b57676 adding WSACleanup/WSAShutdown on Win32 adds a new use
of error_connection, which was removed in commit 769acff0, applied 5 minutes earlier.

src/xcb_util.c: In function 'xcb_connect_to_display_with_auth_info':
src/xcb_util.c:433:39: error: 'error_connection' undeclared (first use in this function)

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Arvind Umrao <arvind.umrao@oracle.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
12 years agoFix build of xcb_auth.c with XDMCP on WIN32
Jon TURNEY [Wed, 18 Jan 2012 14:11:07 +0000 (14:11 +0000)]
Fix build of xcb_auth.c with XDMCP on WIN32

Fix a redefinition problem which shows up when building for _WIN32 and
libXdmcp is installed, so HASXDMAUTH is enabled

It seems this is a special place in xcb as it uses other X11 library headers here

If HASXDMAUTH is defined, include the wrapped windows.h before any header which
includes it unwrapped, to avoid conflicts with types defined in X headers

We need to include config.h and check HASXDMAUTH to avoid an unconditional dependency
on x11proto headers

In file included from install/include/X11/Xdmcp.h:19:0,
                 from git/xcb/libxcb/src/xcb_auth.c:52:
install/include/X11/Xmd.h:120:14: error: conflicting types for 'INT32'
/usr/i686-pc-mingw32/sys-root/mingw/include/basetsd.h:54:13: note: previous declaration of 'INT32' was here
install/include/X11/Xmd.h:143:15: error: conflicting types for 'BOOL'
/usr/i686-pc-mingw32/sys-root/mingw/include/windef.h:234:17: note: previous declaration of 'BOOL' was here

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
12 years agoRevert "Fix include order with Xdmcp on WIN32"
Jeremy Huddleston [Wed, 18 Jan 2012 07:55:23 +0000 (23:55 -0800)]
Revert "Fix include order with Xdmcp on WIN32"

This reverts commit 0e9246def562be97cc816f824f702233a826ec56.

This change caused build failures because <X11/Xdmcp.h> was never
included under any circumstance.  This is because the check for
HASXDMAUTH was moved before the inclusion of config.h (via xcbint.h)
which defined it.

Found-by: Tinderbox
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
12 years agoBump xcb-proto requirement
Julien Danjou [Thu, 12 Jan 2012 09:25:07 +0000 (10:25 +0100)]
Bump xcb-proto requirement

We are now unable to build xcb-proto before 1.7.

Signed-off-by: Julien Danjou <julien@danjou.info>
12 years agoRelease libxcb 1.8 1.8
Julien Danjou [Wed, 11 Jan 2012 17:27:38 +0000 (18:27 +0100)]
Release libxcb 1.8

Signed-off-by: Julien Danjou <julien@danjou.info>
12 years agoUse WSAStartup()/WSACleanup() on WIN32
Ryan Pavlik [Wed, 11 Jan 2012 17:06:50 +0000 (18:06 +0100)]
Use WSAStartup()/WSACleanup() on WIN32

The alternative is to use these in every WIN32 application which uses xcb. Doing
it this way should be safe, as, according to MSDN, "There must be a call to
WSACleanup for each successful call to WSAStartup. Only the final WSACleanup
function call performs the actual cleanup. The preceding calls simply decrement
an internal reference count"

(We should probably also include ws2_32 in Libs.private for libxcb, as anything
which links with libxcb will also need that, but there seems to be some pkg-config
issues to resolve first...)

v2: Check for errors so WSAStartup()/WSACleanup() uses are balanced
v3: Use same indentation style as surrounding code

Reviewed-by: Peter Harris <pharris@opentext.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
12 years agoFix include order with Xdmcp on WIN32
Ryan Pavlik [Thu, 5 Jan 2012 20:57:53 +0000 (20:57 +0000)]
Fix include order with Xdmcp on WIN32

Fix a redefinition problem due to include order which shows up when
building for _WIN32 and libXdmcp is installed, so HASXDMAUTH is enabled

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Peter Harris <pharris@opentext.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
12 years agoFix WIN32 compilation after commit 163c47bdc0d32785d831e4c93fea9ab7e023446b
Jon TURNEY [Thu, 5 Jan 2012 20:57:52 +0000 (20:57 +0000)]
Fix WIN32 compilation after commit 163c47bdc0d32785d831e4c93fea9ab7e023446b

WIN32 does not have arpa/inet.h, so do not try to include it unless _WIN32 is
not defined

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Peter Harris <pharris@opentext.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
12 years agoAdded more error states and removed global error_connection
Arvind Umrao [Fri, 4 Nov 2011 10:12:05 +0000 (15:42 +0530)]
Added more error states and removed global error_connection

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=41443
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=42304

I have added more xcb connection error states at xcb.h header.
Also I have removed global error_connection variable, and added
an interface that returns connection error state.

TBD:
I will segregate errors states in a separate header file and try to
provide more precise error states, in future. Also I will give patch
for libX11, in that patch xcb_connection_t::has_error will be passed
to default io handler of libX11. This value can then be used for
displaying error messages.

Reviewed-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Reviewed-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Arvind Umrao <arvind.umrao@oracle.com>
12 years agoMake xcb_take_socket keep flushing until idle
Keith Packard [Thu, 1 Dec 2011 10:28:51 +0000 (10:28 +0000)]
Make xcb_take_socket keep flushing until idle

_xcb_out_flush_to will drop the iolock in pthread_cond_wait allowing
other threads to queue new requests. When this happened,
there would be requests queued for the socket after _xcb_out_flush_to
returned, and xcb_take_socket would throw an assert.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=29875
Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
13 years agoFix a dead-lock due to xcb_poll_for_reply
Uli Schlachter [Thu, 25 Aug 2011 12:18:16 +0000 (14:18 +0200)]
Fix a dead-lock due to xcb_poll_for_reply

Imagine two threads:

Thread#1: for(;;) { xcb_get_input_focus_reply(c, xcb_get_input_focus(c), 0); }

Thread#2: for(;;) { xcb_poll_for_event(c); }

Since xcb_poll_for_event() calls _xcb_in_read() directly without synchronizing
with any other readers, this causes two threads to end up calling recv() at the
same time. We now have a race because any of these two threads could get read
the GetInputFocus reply.

If thread#2 reads this reply, it will be put in the appropriate queue and
thread#1 will still be stuck in recv(), although its reply was already received.
If no other reply or event causes this thread to wake up, the process deadlocks.

To fix this, we have to make sure that there is only ever one thread reading
from the connection. The obvious solution is to check in poll_for_next_event()
if another thread is already reading (in which case c->in.reading != 0) and not
to read from the wire in this case.

This solution is actually correct if we assume that the other thread is blocked
in poll() which means there isn't any data which can be read. Since we already
checked that there is no event in the queue this means that
poll_for_next_event() didn't find any event to return.

There might be a small race here where the other thread already determined that
there is data to read, but it still has to wait for c->iolock. However, this
means that the next poll_for_next_event() will be able to read the event, so
this shouldn't cause any problems.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=40372

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Peter Harris <pharris@opentext.com>
13 years agoKeep ALIGNOF definition out of the public namespace.
Jamey Sharp [Wed, 24 Aug 2011 15:52:02 +0000 (08:52 -0700)]
Keep ALIGNOF definition out of the public namespace.

Uli's patch is an excellent solution; I just want to keep the new
ALIGNOF macro hidden from XCB's users, as they don't need it to call
XCB.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
13 years agoSupport pre-IPv6 systems (without getaddrinfo)
Markus Duft [Wed, 24 Aug 2011 14:49:06 +0000 (10:49 -0400)]
Support pre-IPv6 systems (without getaddrinfo)

Some of these systems (eg. Interix on XP) are still in use.

Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Peter Harris <pharris@opentext.com>
13 years agoCompute alignment correctly
Uli Schlachter [Wed, 24 Aug 2011 10:47:16 +0000 (12:47 +0200)]
Compute alignment correctly

The code previously assumed that everything has to be aligned to a 4 byte
boundary. This assumption is wrong as e.g. the STR struct from xproto shows.

Instead, each type has to be aligned to its natural alignment. So a char doesn't
need any alignment, a INT16 gets aligned to a 2-byte-boundary and a INT32 gets
the old 4 byte alignment.

I'm not 100% sure that this commit is correct, but some quick tests with awesome
and cairo-xcb went well.

This commit causes lots of dead assignments to xcb_align_to since only the last
field's alignment is actually used, but this simplified this patch a lot.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=34037

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Peter Harris <pharris@opentext.com>
13 years agoDrop AI_ADDRCONFIG when resolving TCP addresses
Michael Stapelberg [Thu, 18 Aug 2011 19:38:28 +0000 (21:38 +0200)]
Drop AI_ADDRCONFIG when resolving TCP addresses

When a system is completely offline (no interface has an IP address but 'lo'),
xcb could not connect to localhost via TCP, e.g. connections with
DISPLAY=127.0.0.1:0 fail.

AI_ADDRCONFIG will only return IPv4 addresses if the system has an IPv4
address configured (likewise for IPv6). This also takes place when
resolving localhost (or 127.0.0.0/8 or ::1). Also, as per RFC 3493,
loopback addresses are not considered as valid addresses when
determining whether to return IPv4 or IPv6 addresses.

As per mailing-list discussion on the xcb list started with message
20110813215405.5818a0c1@x200, the AI_ADDRCONFIG flag is there for historical
reasons:

    In the old days, the "default on-link" assumption in IPv6 made the flag vey
    much indispensable for dual-stack hosts on IPv4-only networks. Without it,
    there would be long timeouts trying non-existent IPv6 connectivity. Nowadays,
    this assumption has been flagged as historic bad practice by IETF, and hosts
    should have been updated to not make it anymore.

    Then AI_ADDRCONFIG became mostly cosmetic: it avoids phony "Protocol family
    not supported" or "Host unreachable" errors while trying to connect to a dual-
    stack mode from a host with no support for source address selection.

    Nowadays, on up-to-date systems, this flag is completely useless. Then again,
    I understood only the very latest MacOS release is "up-to-date" with this
    definition.

13 years agoInsert, not append explicit xcbgen dir python path
James Jones [Thu, 12 May 2011 06:22:22 +0000 (23:22 -0700)]
Insert, not append explicit xcbgen dir python path

If a the path to the xcb python generate libs is
explicitly specified to c_client.py, insert it in
the python path list just after the local dir entry,
rather than appending it to the existing paths.
This keeps a global/distro install of xcb from
overriding a local build of the xcb proto files.

Signed-off-by: James Jones <jajones@nvidia.com>
Signed-off-by: Jamey Sharp <jamey@minilop.net>
13 years agoAdd support for building with Python 3
David Coles [Sat, 9 Apr 2011 00:47:05 +0000 (17:47 -0700)]
Add support for building with Python 3

Python 3 introduces some language changes that cause issues when running
c_client.py. This also breaks compatibility with Python 2.5 since it does not
support the "as" statement in try/except blocks and does not have reduce() in
the functools package.

The main changes are:
* try/except blocks require `except ... as ...:` to resolve syntactical ambiguity
* map() and filter() return iterators rather than lists in Python 3
* reduce() is now in functools package (and not built-in in Python 3)
* Dictionaries don't have a has_key() method in Python 3
* None and int types can't be directly compared in Python 3
* print() is a statement in Python 3

See http://diveintopython3.org/porting-code-to-python-3-with-2to3.html and
PEP-3110 for details.

Verified on Python 2.6.5 and 3.1.3.

Signed-off-by: David Coles <dcoles@gaikai.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
13 years agoRevert "Introduce xcb_wait_for_event_until, for consuming responses in wire-order."
Jamey Sharp [Tue, 12 Apr 2011 20:09:23 +0000 (13:09 -0700)]
Revert "Introduce xcb_wait_for_event_until, for consuming responses in wire-order."

This function was intended to allow libX11 to fix a multi-threaded hang,
but the corresponding libX11 patch caused single-threaded apps to spin
sometimes. Since I've retracted that patch, this patch has no users and
shouldn't go into a release unless/until that changes.

This reverts commit 2415c11dec5e5adb0c17f98aa52fbb371a4f8f23.

Conflicts:

src/xcb.h
src/xcb_in.c

Signed-off-by: Jamey Sharp <jamey@minilop.net>
13 years agoIntroduce a variant of xcb_poll_for_event for examining event queue.
Rami Ylimäki [Tue, 22 Mar 2011 12:33:23 +0000 (14:33 +0200)]
Introduce a variant of xcb_poll_for_event for examining event queue.

In some circumstances using xcb_poll_for_event is suboptimal because
it checks the connection for new events. This may lead to a lot of
failed nonblocking read system calls.

Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Signed-off-by: Jamey Sharp <jamey@minilop.net>
13 years agoIf protocol is "unix", use a Unix domain socket, not TCP
Alan Coopersmith [Tue, 5 Apr 2011 04:36:47 +0000 (21:36 -0700)]
If protocol is "unix", use a Unix domain socket, not TCP

Fixes fallback to local connections from Xlib's XOpenDisplay(), which
will try with protocol "unix" if a hostname is specified and tcp fails
(as it usually will now that most OS'es ship with -nolisten tcp enabled).

Also fixes explicitly specifying DISPLAY as "unix/foo:0", which Xlib
previously accepted for Unix domain sockets.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
13 years agoMake launchd code in xcb_util.c match surrounding code indent levels
Alan Coopersmith [Tue, 5 Apr 2011 04:28:00 +0000 (21:28 -0700)]
Make launchd code in xcb_util.c match surrounding code indent levels

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
13 years agoHandle XGE events with the "send event" flag
Carlos Garnacho [Tue, 5 Oct 2010 16:03:22 +0000 (18:03 +0200)]
Handle XGE events with the "send event" flag

This patch is necessary so xcb reads the payload after the message
for GenericEvents with the 0x80 flag turned on.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Jamey Sharp <jamey@minilop.net>
13 years agoAdd #include <sys/socket.h> to xcb_conn.c
Alan Coopersmith [Tue, 5 Apr 2011 03:20:16 +0000 (20:20 -0700)]
Add #include <sys/socket.h> to xcb_conn.c

Solves compiler warning on Solaris:
"xcb_conn.c", line 304: warning: implicit function declaration: shutdown

Also provides system definition of SHUT_RDWR on Solaris 11.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
13 years agoRemove unused DECnet code
Alan Coopersmith [Tue, 5 Apr 2011 03:12:56 +0000 (20:12 -0700)]
Remove unused DECnet code

"unifdef -UDNETCONN src/xcb_util.c" plus re-indenting code that was
formerly in the else clause after a DECnet check.

DECnet support has been removed from most of the X.Org code base for
several years, and it appears DNETCONN was never defined in XCB.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
13 years agoUse special path to sockets when running under Solaris Trusted Extensions
Alan Coopersmith [Mon, 4 Apr 2011 23:32:45 +0000 (16:32 -0700)]
Use special path to sockets when running under Solaris Trusted Extensions

Solaris Trusted Extensions puts the endpoints for the X server's Unix
domain sockets in a special directory shared from the global zone to
each of the labeled zones, since each labeled zone has a separate /tmp.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Harris <pharris@opentext.com>
13 years agoPrevent theoretical double free and leak on get_peer_sock_name.
Rami Ylimäki [Wed, 23 Mar 2011 15:47:50 +0000 (17:47 +0200)]
Prevent theoretical double free and leak on get_peer_sock_name.

Variable new_sockname will leak and sockname will be double freed if
both of the cases shown below are true.

1. realloc succeeds and doesn't return the original pointer
2. calling socket_func fails

Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Signed-off-by: Erkki Seppälä <erkki.seppala@vincit.fi>
Reviewed-by: Arnaud Fontaine <arnau@debian.org>
Signed-off-by: Peter Harris <pharris@opentext.com>
13 years agoDelete the old c-client.xsl.
Jamey Sharp [Sun, 20 Mar 2011 03:04:55 +0000 (20:04 -0700)]
Delete the old c-client.xsl.

It hasn't been used since libxcb 1.1.90.1, released in 2008.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
13 years agoIntroduce xcb_wait_for_event_until, for consuming responses in wire-order.
Jamey Sharp [Sat, 19 Mar 2011 03:56:07 +0000 (20:56 -0700)]
Introduce xcb_wait_for_event_until, for consuming responses in wire-order.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Josh Triplett <josh@freedesktop.org>
13 years agoDequeue readers that can't receive any new responses.
Jamey Sharp [Sat, 19 Mar 2011 00:36:32 +0000 (17:36 -0700)]
Dequeue readers that can't receive any new responses.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Josh Triplett <josh@freedesktop.org>
13 years agoFactor reader_list management out of wait_for_reply.
Jamey Sharp [Fri, 18 Mar 2011 22:37:34 +0000 (15:37 -0700)]
Factor reader_list management out of wait_for_reply.

Later patches will insert reader_list entries from other entry points.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Josh Triplett <josh@freedesktop.org>
13 years agoEnable AM_SILENT_RULES on automake 1.11 or newer.
Jamey Sharp [Sat, 19 Mar 2011 01:18:41 +0000 (18:18 -0700)]
Enable AM_SILENT_RULES on automake 1.11 or newer.

This incantation is supposed to be a no-op on earlier automake versions.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Josh Triplett <josh@freedesktop.org>
13 years agoPrevent reply waiters from being blocked.
Rami Ylimäki [Wed, 13 Oct 2010 14:48:13 +0000 (17:48 +0300)]
Prevent reply waiters from being blocked.

It's possible to call xcb_wait_for_reply more than once for a single
request. In this case we are nice and let reply waiters continue so
that they can notice that the reply is not available
anymore. Otherwise an event waiter could just signal the reply waiter
that got its reply to continue but leave a waiter for an earlier reply
blocked.

Below is an example sequence for reproducing this problem.

thread #1 (XNextEvent)
  - waits for events
thread #2 (XSync)
  - executes request #2
  - waits for reply #2
thread #1
  - reads reply #2
  - signals waiter of reply #2 to continue
  - waits for events
thread #2
  - handles reply #2
thread #3 (XCloseDisplay)
  - executes request #3
  - waits for reply #2
thread #1
  - reads reply #3
  - nobody is waiting for reply #3 so don't signal
  - wait for events

Of course it may be questionable to wait for a reply twice, but XCB
should be smart enough to let clients continue if they choose to do
so.

Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Signed-off-by: Jamey Sharp <jamey@minilop.net>
13 years agoInclude XKB in ./configure's summary output.
Jamey Sharp [Sun, 13 Mar 2011 16:41:10 +0000 (09:41 -0700)]
Include XKB in ./configure's summary output.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
13 years agoMerge branch 'master' of git+ssh://git.freedesktop.org/git/xcb/libxcb
Jamey Sharp [Sun, 13 Mar 2011 16:18:24 +0000 (09:18 -0700)]
Merge branch 'master' of git+ssh://git.freedesktop.org/git/xcb/libxcb

Apparently I forgot to push these months ago.

13 years agodarwin: Don't use poll() when expected to run on darwin10 and prior
Jeremy Huddleston [Fri, 4 Mar 2011 20:41:55 +0000 (12:41 -0800)]
darwin: Don't use poll() when expected to run on darwin10 and prior

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
13 years agoDon't try to sizeof(void)
Peter Harris [Thu, 23 Dec 2010 18:32:17 +0000 (13:32 -0500)]
Don't try to sizeof(void)

sizeof(void) is a gcc extension, and not portable.

Xorg Bugzilla 31959
http://bugs.freedesktop.org/show_bug.cgi?id=31959
http://lists.freedesktop.org/archives/xcb/2010-May/006039.html

Signed-off-by: Peter Harris <pharris@opentext.com>
Tested-by: Cyril Brulebois <kibi@debian.org>
13 years agofix Windows build and installation
Vincent Torri [Sun, 28 Nov 2010 13:02:40 +0000 (14:02 +0100)]
fix Windows build and installation

13 years agoMerge branch 'master' of git://anongit.freedesktop.org/~peterh/libxcb
Peter Harris [Thu, 23 Dec 2010 18:04:40 +0000 (13:04 -0500)]
Merge branch 'master' of git://anongit.freedesktop.org/~peterh/libxcb

13 years agoDon't validate FD_SETSIZE on Win32
Jeetu Golani [Sun, 12 Dec 2010 21:48:41 +0000 (16:48 -0500)]
Don't validate FD_SETSIZE on Win32

Windows' file handles have never been small or consecutive, so Windows'
select has always been implemented the same way as everyone else's poll.

On Windows, FD_SETSIZE is the size of the poll array, not the maximum
SOCKET number.

Signed-off-by: Peter Harris <git@peter.is-a-geek.org>
13 years agoxcb_take_socket: Document sequence wrap requirements
Uli Schlachter [Wed, 17 Nov 2010 19:26:11 +0000 (20:26 +0100)]
xcb_take_socket: Document sequence wrap requirements

If lots of requests are send without one causing a reply, xcb can get confused
about the current sequence number of a reply. Document the requirements of an
external socket owner to avoid this problem.

The return_socket callback for xcb_take_socket() originally was supposed to
return the last sequence number used, but the version committed to libxcb never
actually had this signature. This fixes the function's documentation not to
mention this non-existent return value.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
13 years agoxcb_auth: Fix memory leak in _xcb_get_auth_info.
Nick Bowler [Thu, 11 Nov 2010 01:49:41 +0000 (20:49 -0500)]
xcb_auth: Fix memory leak in _xcb_get_auth_info.

If the initial get_peer_sock_name(getpeername ...) succeeds, the
pointer to allocated memory is overwritten by the later call to
get_peer_sock_name(getsockname ...).  Fix that up by freeing
the allocated memory before overwriting the pointer.

Signed-off-by: Nick Bowler <nbowler@draconx.ca>
Signed-off-by: Julien Danjou <julien@danjou.info>
14 years agoxcb_in: Use 64-bit sequence numbers internally everywhere.
Jamey Sharp [Sun, 10 Oct 2010 00:13:45 +0000 (17:13 -0700)]
xcb_in: Use 64-bit sequence numbers internally everywhere.

Widen sequence numbers on entry to those public APIs that still take
32-bit sequence numbers.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
14 years agoxcb_discard_reply: Simplify by re-using poll_for_reply helper.
Jamey Sharp [Sat, 9 Oct 2010 20:19:05 +0000 (13:19 -0700)]
xcb_discard_reply: Simplify by re-using poll_for_reply helper.

If you discard a sequence number that has multiple responses already
read, this will do more allocations than necessary. But nobody cares
about ListFontsWithInfo.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
14 years agoxcb_request_check: Hold the I/O lock while deciding to sync.
Jamey Sharp [Sat, 9 Oct 2010 19:32:05 +0000 (12:32 -0700)]
xcb_request_check: Hold the I/O lock while deciding to sync.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
14 years agoxcb_send_request: Send all requests using a common internal send_request.
Jamey Sharp [Sat, 9 Oct 2010 11:08:18 +0000 (04:08 -0700)]
xcb_send_request: Send all requests using a common internal send_request.

This simplifies the critical section of xcb_send_request and fixes a
couple of subtle bugs:

- It's possible for xcb_send_request to need to issue two sync requests
  before it can issue the real request. Previously, we counted sequence
  numbers as if both were issued, but only one went out on the wire.

- The test for whether to sync at 32-bit sequence number wrap has been
  incorrect since we switched to 64-bit sequence numbers internally.

This change means that if the output queue was already full and the
current request is bigger than the output queue, XCB will do one more
write syscall than it did before. But syncs are rare and small requests
are the norm, so this shouldn't be a measurable difference.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
14 years agoFix _unserialize of reply headers
Peter Harris [Thu, 23 Sep 2010 03:15:38 +0000 (23:15 -0400)]
Fix _unserialize of reply headers

This cleans up a number of warnings, and passes the sequence number
through correctly.

Signed-off-by: Peter Harris <pharris@opentext.com>
14 years agoClean up a couple of warnings in xprint
Peter Harris [Thu, 23 Sep 2010 02:32:34 +0000 (22:32 -0400)]
Clean up a couple of warnings in xprint

Signed-off-by: Peter Harris <pharris@opentext.com>
14 years agoMake *_unserialize safe to use on buffers in-place
Peter Harris [Thu, 23 Sep 2010 01:16:51 +0000 (21:16 -0400)]
Make *_unserialize safe to use on buffers in-place

By calling memmove instead of memcpy, and walking the buffer backward
from the end, *_unserialize is safe to use in-place.

Signed-off-by: Peter Harris <pharris@opentext.com>
14 years agoFix memory leak in _sizeof implemented with _unserialize
Peter Harris [Fri, 10 Sep 2010 19:51:56 +0000 (15:51 -0400)]
Fix memory leak in _sizeof implemented with _unserialize

Signed-off-by: Peter Harris <pharris@opentext.com>
14 years agoDon't emit out-of-module sizeof definitions
Peter Harris [Wed, 8 Sep 2010 19:57:00 +0000 (15:57 -0400)]
Don't emit out-of-module sizeof definitions

Signed-off-by: Peter Harris <pharris@opentext.com>
14 years agoAllow disconnecting connections that are in error state.
Josh Triplett [Sun, 19 Sep 2010 18:38:06 +0000 (20:38 +0200)]
Allow disconnecting connections that are in error state.

In support of this, consolidate the two static error_connection
definitions into one so we don't try to free the static out-of-memory
error_connection.

Commit by Josh Triplett and Jamey Sharp.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Jamey Sharp <jamey@minilop.net>
14 years agoAdd xkb.* to gitignore
Peter Harris [Fri, 10 Sep 2010 19:53:13 +0000 (15:53 -0400)]
Add xkb.* to gitignore

Signed-off-by: Peter Harris <pharris@opentext.com>
14 years agoMerge branch 'gsoc2010' of git://anongit.freedesktop.org/~chr/libxcb
Peter Harris [Wed, 8 Sep 2010 18:41:52 +0000 (14:41 -0400)]
Merge branch 'gsoc2010' of git://anongit.freedesktop.org/~chr/libxcb

14 years ago_xcb_conn_wait: Shut down the connection on unexpected poll() events.
Jamey Sharp [Sat, 4 Sep 2010 17:17:21 +0000 (10:17 -0700)]
_xcb_conn_wait: Shut down the connection on unexpected poll() events.

If a client calls close(2) on the connection's file descriptor and then
flushes writes, libxcb causes a hang in the client.

Any flush eventually calls _xcb_out_send() with has the following loop:
   while(ret && *count)
       ret = _xcb_conn_wait(c, &c->out.cond, vector, count);

_xcb_conn_wait(), if built with USE_POLL, gets the POLLNVAL error. It only
checks for POLLIN and POLLOUT though, ignoring the error. Return value is 1,
count is unmodified, leaving us with an endless loop and a client hang.

XTS testcase Xlib3/XConnectionNumber triggers this bug. It creates a display
connection, closes its file descriptor, tries to send a no-op, and then expects
an error.
http://cgit.freedesktop.org/xorg/test/xts/tree/xts5/Xlib3/XConnectionNumber.m

If poll returned POLLHUP or POLLERR, we might see the same result.

If poll returns any event we didn't ask for, this patch causes
_xcb_conn_shutdown() to be invoked and an error returned. This matches the
behaviour if select(2) is used instead of poll(2): select(2) returns -1 and
EBADF for an already closed file descriptor.

I believe this fix both is safe and will handle any similar error. POSIX says
that the only bits poll is permitted to set in revents are those bits that were
set in events, plus POLLHUP, POLLERR, and POLLNVAL. So if we see any flags we
didn't ask for then something has gone wrong.

Patch inspired by earlier proposals from Peter Hutterer and Aaron
Plattner--thanks!

Reported-by: Peter Hutterer <peter.hutterer@who-t.net>
Reported-by: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Aaron Plattner <aplattner@nvidia.com>
Cc: Peter Hutterer <peter.hutterer@who-t.net>
Cc: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Peter Harris <pharris@opentext.com>
14 years agoMerge branch 'master' of git://github.com/topcat/xcb-win32
Peter Harris [Tue, 31 Aug 2010 22:33:36 +0000 (18:33 -0400)]
Merge branch 'master' of git://github.com/topcat/xcb-win32

Conflicts:
src/xcb_conn.c
src/xcb_util.c

Signed-off-by: Peter Harris <pharris@opentext.com>
14 years agoxcb_disconnect: call shutdown() to force a disconnect
Aaron Plattner [Tue, 17 Aug 2010 15:04:41 +0000 (08:04 -0700)]
xcb_disconnect: call shutdown() to force a disconnect

Fixes the X Test Suite's XCloseDisplay-6 test, which has this (admittedly
ridiculous) behavior:

 1. Create a window w.
 2. Open two display connections, dpy1, and dpy2.
 3. Grab the server using dpy1.
 4. Fork.
 5 (child). XSetProperty on w using dpy2.
 5 (parent). Verify that no event was recieved on dpy1.
 6 (parent). XCloseDisplay(dpy1).
 6 (child). Verify that an event was received on dpy2.

It was failing because at step 6 (child), the server had not actually ungrabbed
yet because the file descriptor for dpy1 was still open in the child process.

Shutting down the socket during XCloseDisplay matches the behavior of non-XCB
Xlib, which calls shutdown() from _X11TransSocketDisconnect.

Thanks to Julien Cristau for noticing this.

Signed-off-by: Aaron Plattner <aplattner at nvidia.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Peter Harris <pharris@opentext.com>
14 years agoxcb_request_check: Sync even if an event was read for this sequence.
Jamey Sharp [Tue, 24 Aug 2010 16:17:38 +0000 (09:17 -0700)]
xcb_request_check: Sync even if an event was read for this sequence.

This fixes the test case I have so far for Havoc's report that
xcb_request_check hangs.

Rationale: Since we have a void cookie, request_expected can't have been
set equal to this sequence number when the request was sent; it can only
have become equal due to the arrival of an event or error. If it became
equal due to an event then we still need to sync. If it became equal due
to an error, then request_completed will have been updated, which means
we correctly won't sync.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=29599

However, Havoc reports that he can still reproduce the problem, so we
may be revisiting this later.

Reported-by: Havoc Pennington <hp@pobox.com>
Signed-off-by: Jamey Sharp <jamey@minilop.net>
14 years agosmall fix to get rid of some compiler warnings
Christoph Reimann [Mon, 16 Aug 2010 18:24:40 +0000 (20:24 +0200)]
small fix to get rid of some compiler warnings
also added very basic documentation for xkb

14 years agosmall fix in the xkb pkg file
Christoph Reimann [Mon, 16 Aug 2010 16:22:42 +0000 (18:22 +0200)]
small fix in the xkb pkg file

14 years agoadded accessors for special cases
Christoph Reimann [Mon, 16 Aug 2010 16:19:16 +0000 (18:19 +0200)]
added accessors for special cases
major bugfixes include: rewrite of prefix related functions, merge of serialize/unserialize/... generators, extended field name resolution

14 years agoRelease libxcb 1.7 1.7
Julien Danjou [Fri, 13 Aug 2010 11:46:37 +0000 (13:46 +0200)]
Release libxcb 1.7

Signed-off-by: Julien Danjou <julien@danjou.info>
14 years agospecial case 'intermixed variable and fixed size fields': fixed reply side, needs...
Christoph Reimann [Sun, 8 Aug 2010 19:25:13 +0000 (21:25 +0200)]
special case 'intermixed variable and fixed size fields': fixed reply side, needs testing