Commit Graph

44 Commits

Author SHA1 Message Date
Christoph Reimann 8c2707773b added xcb_sumof() with restriction to uint8_t 2010-07-13 19:56:44 +02:00
Jeremy Huddleston 3f79628bec xcb_open: Improve protocol/host parsing
Support scenarios where host is not set and protocol is.  eg:

DISPLAY=tcp/:0

as well as the "inet" and "inet6" alias for "tcp" for compatability
with Xlib

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2010-05-14 14:28:53 -07:00
Arnaud Fontaine 5e86cb0566 Fix GCC error on undeclared variable when not using abstract socket
This is a regression found by tinderbox in previous commit:

xcb_util.c: In function '_xcb_open':
xcb_util.c:213: error: 'fd' undeclared (first use in this function)
2010-04-30 18:49:18 +01:00
Arnaud Fontaine a546d00091 Get rid of PATH_MAX and MAXPATHLEN
There could be no upper limit on the length of a path according
to POSIX, therefore these macros may not be defined at all on
some systems (such as GNU Hurd).

Signed-off-by: Arnaud Fontaine <arnau@debian.org>
Reviewed-by: Peter Harris <pharris@opentext.com>
2010-04-30 14:47:16 +02:00
Jeremy Huddleston d068572173 Use limits.h instead of syslimits.h
Regression found by tinderbox in 89b3485dad

xcb_util.c:31:27: error: sys/syslimits.h: No such file or directory
xcb_util.c: In function '_xcb_open':
xcb_util.c:148: error: 'PATH_MAX' undeclared (first use in this function)

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-04-23 21:57:26 -07:00
Jeremy Huddleston 89b3485dad Reworked launchd support to work better with _xcb_parse_display
Fixes: http://xquartz.macosforge.org/trac/ticket/390

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-04-23 17:29:25 -07:00
Rémi Denis-Courmont 53a9834e4c Open the X11 socket with close-on-exec flag
This saves the X11 connection from leaking into children processes.
On Linux, this is fully thread-safe using SOCK_CLOEXEC. On other
systems, there is a small race condition.

Signed-off-by: Julien Danjou <julien@danjou.info>
2010-02-17 10:09:43 +01:00
Adam Jackson 1cf2a87def setsockopt(SO_KEEPALIVE) on TCP display connections.
This matches xtrans behaviour in SocketINETConnect, and makes it so apps
don't hang forever if their display dies.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2009-12-02 14:31:56 -05:00
elupus ee89850e68 Disable Nagle on TCP socket
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-05-26 16:14:48 +02:00
Julien Danjou ca978a9dae util: remove useless strlen calls from decnet opening
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-10 09:59:49 +02:00
Julien Danjou cc19143141 util: merge common code for xcb_connect
Many code was duplicated between xcb_connect_to_display_with_auth_info
and xcb_connect(). We merge both, since the difference is just about the
xcb_auth_info_t pointer being supplied, or not.

Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-10 09:59:49 +02:00
Julien Danjou 8797e053b2 util: open_abstract gets filelen as parameters
That saves us from a couple of strlen() calls.

Signed-off-by: Julien Danjou <julien@danjou.info>
2009-04-10 09:59:49 +02:00
Jeremy Huddleston f896ae8c53 Shutup compiler warning about unused variable... 2008-11-23 17:25:21 -08:00
Jeremy Huddleston d79621b25b Apple: Apple launchd cleanup
Added --with-launchd option instead of just using __APPLE__
Fixed opening launchd fd when displayname=NULL
2008-11-23 17:23:17 -08:00
Jeremy Huddleston 9b79ae49f7 Apple: Enable support for launchd DISPLAY socket 2008-11-23 16:18:25 -08:00
Julien Cristau 25e59ccc0d Add support for the abstract socket namespace under Linux
Based on same in Xtrans.

Signed-off-by: Julien Danjou <julien@danjou.info>
2008-09-09 14:44:54 +02:00
Julien Cristau f3f8738436 Fix some fd leaks in _xcb_open_*()
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-09-09 14:44:54 +02:00
Julien Danjou bcf662c1b4 Initialize all fields of addrinfo
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-28 14:35:54 +02:00
Julien Danjou baf31b1bf2 Use ifdef instead of if for defined value
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-28 13:51:38 +02:00
Petr Salinger a9d15a0845 fix FreeBSD support
The GNU/kFreeBSD (and BSDs in general) have a different
layout of struct sockaddr, sockaddr_in, sockaddr_un ...

The first member do not have to be "sa_family",
they also have "sa_len" field.

Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-07 17:57:37 +02:00
Bart Massey 9bf8329b50 make IPv6 optional 2007-11-24 14:53:54 -08:00
Egbert Eich 09045eaac3 Allow unix:<screen> style display names again.
https://bugzilla.novell.com/show_bug.cgi?id=289007
This notion is used in a lot of scripts.
2007-07-19 17:00:18 +02:00
Jamey Sharp 3360d0c79e NetBSD doesn't have AI_ADDRCONFIG: use it only if it's available. 2006-11-24 13:24:05 -08:00
Josh Triplett 3de6ab7b78 Replace uses of "long" with uint32_t, and similar; fixes 64-bit bugs 2006-11-21 20:29:34 -08:00
Josh Triplett d6abe93b06 Refactor auth code to get display number from xcb_connect
Change xcb_connect to pass the display number to _xcb_get_auth_info, which
passes it to get_authptr.  This allows get_authptr to stop hacking the display
number out of the sockaddrs of various address families, such as
port - X_TCP_PORT, or the number after the last X in the UNIX socket path. This
also removes a portability bug introduced during the IPv6 changes: relying on
'\0'-termination of the UNIX socket path in a sockaddr_un.

Commit by Jamey Sharp and Josh Triplett.
2006-11-20 23:28:03 -08:00
Josh Triplett 4a928de402 Only use AI_NUMERICSERV if defined. 2006-11-20 22:26:40 -08:00
Josh Triplett 48776ce233 Support displays with IPv6 addresses or hosts which resolve to IPv6 addresses
xcb_parse_display already correctly handled IPv6 displays.  Now, _xcb_open_tcp
uses getaddrinfo, and correctly connects to IPv6 displays.  Displays can use
bare IPv6 addresses, square-bracketed IPv6 addresses, or hostnames which
resolve to IPv6 addresses.

Since IPv6 addresses may include colons, including at the end, revise the
DECnet display parsing code to avoid triggering on IPv6 addresses.

Authorization may not work with IPv6 connections yet.

This commit brought to you by the (display) number ::1:1.1, the letter X,
the Gobby collaborative editor, Josh Triplett, and Jamey Sharp.
2006-11-20 17:54:34 -08:00
Josh Triplett a3bd6f4760 The Great XCB Renaming
Rename API to follow a new naming convention:
* XCB_CONSTANTS_UPPERCASE_WITH_UNDERSCORES
* xcb_functions_lowercase_with_underscores
* xcb_types_lowercase_with_underscores_and_suffix_t
* expand all abbreviations like "req", "rep", and "iter"

Word boundaries for the names in the protocol descriptions fall:
* Wherever the protocol descriptions already have an underscore
* Between a lowercase letter and a subsequent uppercase letter
* Before the last uppercase letter in a string of uppercase letters followed
  by a lowercase letter (such as in LSBFirst between LSB and First)
* Before and after a string of digits (with exceptions for sized types like
  xcb_char2b_t and xcb_glx_float32_t to match the stdint.h convention)

Also fix up some particular naming issues:
* Rename shape_op and shape_kind to drop the "shape_" prefix, since otherwise
  these types end up as xcb_shape_shape_{op,kind}_t.
* Remove leading underscores from enums in the GLX protocol description,
  previously needed to ensure a word separator, but now redundant.

This renaming breaks code written for the previous API naming convention.  The
scripts in XCB's tools directory will convert code written for the old API to
use the new API; they work well enough that we used them to convert the
non-program-generated code in XCB, and when run on the old program-generated
code, they almost exactly reproduce the new program-generated code (modulo
whitespace and bugs in the old code generator).

Authors: Vincent Torri, Thomas Hunger, Josh Triplett
2006-09-23 12:22:22 -07:00
Jamey Sharp 0aa96bfc7a Convert connection functions to return error objects. 2006-09-21 15:17:18 -07:00
Jamey Sharp 0d7fb3afdd Remove deprecated public API functions in preparation for 1.0 release. Xlib-specific deprecation remains. 2006-09-12 13:25:49 -07:00
Eric Anholt b3a2f83f1e Restore netinet/in.h include that was removed in the DECnet commit. 2006-07-28 15:29:05 -07:00
Ian Osgood 829188cdd6 Deprecate XCBSync, move to XCBAuxSync. 2006-05-30 11:54:25 -07:00
Jamey Sharp dd932e025b Rename ConnSetup* to Setup*, Setup*Rep to Setup*, and SetupSuccess* to Setup*. Provide deprecated backwards-compatability functions and typedefs for the old names, to be removed before 1.0. 2006-04-26 23:19:16 -07:00
Patrick Caulfield bb8cf58015 Add support for DECnet. Still needs configure-script options to enable. 2006-04-24 08:29:18 -07:00
Eric Anholt 66a88ed0e5 Remove unnecessary include. Noticed by jamey. 2006-04-09 19:19:12 -07:00
Ian Osgood be1302b6ef Remove last deprecation warning. 2006-03-13 10:36:13 -08:00
Ian Osgood d8de2c7c2a Merge branch 'master' of git+ssh://iano@git.freedesktop.org/git/xcb 2006-03-12 23:03:24 -08:00
Ian Osgood e7576738c3 Restructure to remove most deprecation warnings. 2006-03-12 23:02:45 -08:00
Jamey Sharp 5cdc02e344 Portability fixes. Should help DragonFly and Solaris, and should not hurt anything else. Tested only on linux so far though. 2006-03-11 20:32:04 -08:00
Jamey Sharp bae98d3604 Move _xcb_set_fd_flags to xcb_conn.c and make it static. xcb_util.c now has only public functions. 2006-02-24 01:50:48 -08:00
Jamey Sharp 67b2649dc4 Move _xcb_read_block to xcb_in.c and make it static. Change calls in xcb_conn.c to _xcb_in_read_block instead. 2006-02-24 01:40:45 -08:00
Jamey Sharp 3f8d0bd532 Move _xcb_readn to xcb_in.c and make it static. Minor change to _xcb_read_block to not depend on _xcb_readn. 2006-02-24 00:48:18 -08:00
Jamey Sharp 55c1842686 Move _xcb_write and _xcb_writev to xcb_out.c and make them static, since only _xcb_out_write calls them. 2006-02-23 12:48:27 -08:00
Josh Triplett 47ceed7861 Remove xcl and CVSROOT. 2006-02-18 16:49:41 -08:00