summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2014-08-25xcb_get_setup(): Never return NULLUli Schlachter1-1/+21
The documentation doesn't mention it and it's unlikely that a lot of code out there handles this case correctly. So, instead of returning NULL, let xcb_get_setup() return a pointer to a static, invalid, all-zero setup information structure. Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-08-25Make some functions also work on error connectionsUli Schlachter1-2/+2
There is no technical reason why xcb_get_setup() and xcb_get_file_descriptor() shouldn't work on non-static error connections. They cannot be used for many useful things, but at least they work. This works around bugs in lots of programs out there which assume that xcb_get_setup() does not return NULL and which just happily dereference the results. Since xcb_connect() never returns NULL, it's a bit weird that xcb_get_setup() can do so. xcb_get_file_descriptor() is just modified since this can be done here equally easily and because the fd isn't closed until the final xcb_disconnect() on the error connection. Non-static error connections are connections which entered an error state after xcb_connect() succeeded. If something goes wrong in establishing a connection, xcb_connect() will return a static error connection which doesn't have the fields used here. Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-08-20support switch case in the generatorChristian Linhart1-22/+33
The implementation is rather simple: When a <case> is used instead of a <bitcase> then operator "==" is used instead of "&" in the if-condition. So it creates a series of "if" statements (instead of a switch-case statement in C ) In practice this does not matter because a good optimizing compiler will create the same code as for a switch-case. With this simple implementation we get additional flexibility in the following forms: * a case value may appear in multiple case branches. for example: case C1 will be selected by values 1, 4, or 5 case C2 will be selected by values 3, 4, or 7 * mixing of bitcase and case is possible (this will usually make no sense but there may be protocol specs where this is needed) details of the impl: * replaced "is_bitcase" with "is_case_or_bitcase" in all places so that cases are treated like bitcases. * In function "_c_serialize_helper_switch": write operator "==" instead of operator "&" if it is a case.
2014-08-06Disable Xevie and Xprint by defaultDaniel Martin1-2/+2
Both extensions have been dropped from the X-Server in 2008: http://cgit.freedesktop.org/xorg/xserver/commit/?id=1c8bd31 http://cgit.freedesktop.org/xorg/xserver/commit/?id=f4036f6 Don't build them by default. Reviewed-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Daniel Martin <consume.noise@gmail.com> Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-08-06help text: do not report the insanly long list of Warning flags.Gaetan Nadon1-1/+0
Originally there was just one. Now that XCB has been integrated with X and uses the same compiler flags, it is a different story. Used CFLAGS: CPPFLAGS............: CFLAGS..............: -g -O2 Warning CFLAGS......: -Wall -Wpointer-arith AND SO ON FOR 8 lines... It completely defaces the otherwise excellent output. Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Gaetan Nadon <memsize@videotron.ca> Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-08-06Add ChangeLog and INSTALL using xorg macrosGaetan Nadon3-229/+14
Same as all other X modules. The one in libxcb git is removed. Those files are created during 'make dist' Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Gaetan Nadon <memsize@videotron.ca> Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-08-06sendmsg: remove --enable-sendfds as it is superceeded by --enable-dri3Gaetan Nadon1-12/+6
DRI3 requires sendmsg support which is auto-detected. A builder can enable or disable dri3 feature. If sendmsg function is not available, dri3 cannot be enabled. This reverts af8067cbf4856 which was done at a time where --enable-dri3 had not been added yet. Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Gaetan Nadon <memsize@videotron.ca> Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-08-06config: issue an error if DRI3 is requested, but sendfds is not availableGaetan Nadon1-0/+5
When a user issues the --enable-dri3 option and sendfds is not available on the system, the configuration will abort with an error message. Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Gaetan Nadon <memsize@videotron.ca> Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-08-06config: default option for enable-dri3 is not implementedGaetan Nadon2-29/+41
The first symptom is the help text: --enable-dri3 Build XCB DRI3 Extension (default: "$sendfds") The implementation variable $sendfds leaked into the user interface. Testing the various user inputs: <nothing> DRI3 is enabled PASS --enable-dri3 DRI3 is enabled PASS --enable-dri3=yes DRI3 is enabled PASS --enable-dri3=no DRI3 is disabled PASS --disable-dri3 DRI3 is disabled PASS --enable-dri3=$sendfds DRI3 is disabled FAIL This patch implements the usual idiom for features that are enabled by default if the various conditions are met (sendfds is available). New help text: --enable-dri3 Build XCB DRI3 Extension (default: auto) With the additional user input: --enable-dri3=auto which is equivalent to providing no input at all. Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Gaetan Nadon <memsize@videotron.ca> Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-08-01Release libxcb 1.111.11Uli Schlachter2-1/+19
2014-08-01Bump xcb-proto requirement to 1.11Uli Schlachter1-1/+1
This is needed for the new direct_imports field that we need from xcb-proto. Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-07-28xcb.h: add 'struct' before xcb_setup_t, xcb_query_extension_reply_tAlexander Mezin1-2/+2
These structs are typedef'ed in xproto.h, so in xcb.h these types (without 'struct') are actually undefined. GCC reports this as error when building precompiled header. Signed-off-by: Alexander Mezin <mezin.alexander@gmail.com> Reviewed-by: Peter Harris <pharris@opentext.com>
2014-07-28c_client.py: remove more trailing space from generated filesRan Benita1-5/+5
Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Reviewed-by: Daniel Martin <consume.noise@gmail.com>
2014-07-28c_client.py: remove trailing whitespace from generated filesRan Benita1-4/+4
Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Daniel Martin <consume.noise@gmail.com>
2014-07-28c_client.py: remove useless generated commentsRan Benita1-124/+0
They are bloated, don't add anything over the signature, in some cases duplicate the doxygen comments, and are not integrated with the <doc> tags in any way. Remove them and cut the generated LOC by half. Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Daniel Martin <consume.noise@gmail.com>
2014-07-28c_client.py: make the man page output deterministicRan Benita1-3/+3
Some parts of the man pages (SEE ALSO and ERRORS) are generated by iterating a Python dict. But the iteration order in a dict is random, so each build the output is ordered differently. Avoid that by iterating in sorted order. Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Daniel Martin <consume.noise@gmail.com>
2014-07-28c_client.py: prefix all monkey-patched fields with c_Ran Benita1-50/+50
The script adds many fields to the objects coming from xcbgen. To distinguish them, a c_ prefix is used, but for some it was missing. Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Daniel Martin <consume.noise@gmail.com>
2014-07-28c_client.py: remove trailing whitespaceRan Benita1-169/+169
These are extra annoying in python code. Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Daniel Martin <consume.noise@gmail.com>
2014-07-28c_client.py: remove useless 'today' variableRan Benita1-2/+0
Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Daniel Martin <consume.noise@gmail.com>
2014-07-11Fix typos & awkward wording in tutorialAlan Coopersmith1-12/+12
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-06-14bug#79986: include system headers earlyMichael Haubenwallner1-3/+4
AIX <sys/poll.h> does redefine 'events' to 'reqevents' eventually. To not have this cause compilation errors, need to include the local header files after any system header file. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-06-14Document failure modes of xcb_connect*() functionsAlan Coopersmith1-1/+17
Documentation was previously unclear that these always return a non-NULL pointer, and that callers need to check it for error values, instead of checking for a NULL return value. Triggered by having to dig through code to answer a user's question on the #xcb irc channel, since neither of us found it covered in the docs. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Uli Schlachter <psychon@znc.in>
2014-06-10Handle <pad align="n" /> between listsDaniel Martin1-6/+32
Without this patch we end up with invalid C code if we've a <pad align="n" /> between two variadic lists. Check for such a condition and take the alignment pad into account. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79808 Signed-off-by: Daniel Martin <consume.noise@gmail.com> Signed-off-by: Peter Harris <pharris@opentext.com>
2014-04-10xcb_open: Improve abstraction for launchd secure socketsJeremy Huddleston Sequoia1-20/+75
This changes away from hard-coding the /tmp/launch-* path to now supporting a generic <path to unix socket>[.<screen>] format for $DISPLAY. Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2014-04-10xcb_open: Minor code cleanup for better readabilityJeremy Huddleston Sequoia1-8/+9
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com> Reviewed-by: Uli Schlachter <psychon@znc.in>
2014-03-30Ensure xcb owns socket and no other threads are writing before send_requestKeith Packard1-17/+40
send_request may only write to out.queue if no other thread is busy writing to the network (as that thread may be writing from out.queue). send_request may only allocate request sequence numbers if XCB owns the socket. Therefore, send_request must make sure that both conditions are true when it holds iolock, which can only be done by looping until both conditions are true without having dropped the lock waiting for the second condition. We choose to get the socket back from Xlib first as get_socket_back has a complicated test and checking for other threads writing is a simple in-lined check. This also changes the sequence number checks (64k requests with no reply, 4M request wrapping) to ensure that both conditions are true before queueing the request. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Uli Schlachter <psychon@znc.in>
2014-03-22Update .pc file Requires lines to express full dependenciesKeith Packard3-3/+3
Some xcb libraries depend on others; make these dependencies explicit in the .pc files that are installed. This change was generated automatically by running 'check-pc-requires -fix' Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-22Validate .pc file Requires linesKeith Packard2-1/+77
This walks through the .pc.in files and makes sure all of the Requires lines express sufficient dependency information. Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-22Only #include directly referenced module header filesKeith Packard1-1/+1
This avoids having the nested header files also included at the top level, which is more efficient. Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-21Add doxygen documentation to functions in xcbext.hUli Schlachter1-4/+103
Signed-off-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Josh Triplett <josh@joshtriplett.org>
2014-03-21Make xcb_disconnect(NULL) safeUli Schlachter2-2/+2
Code can be simplified if the deallocation functions can always be called in cleanup code. So if you have some code that does several things that can go wrong, one of which is xcb_connect(), after this change, the xcb_connection_t* variable can be initialized to NULL and xcb_disconnect() can always be called on the connection object. References: http://lists.freedesktop.org/archives/xcb/2013-September/008659.html Signed-off-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Julien Cristau <jcristau@debian.org>
2014-03-21xcb_disconnect(): Fix leak with error connectionsUli Schlachter1-1/+10
There are two kind of error connections in XCB. First, if something goes wrong while the connection is being set up, _xcb_conn_ret_error() is used to return a static connection in an error state. If something goes wrong later, _xcb_conn_shutdown() is used to set c->has_error. This is important, because the static object that _xcb_conn_ret_error() returns must not be freed, while the dynamically allocated objects that go through _xcb_conn_shutdown() must obviously be properly deallocated. This used to work correctly, but in 769acff0da8, xcb_disconnect() was made to ignore all connections in an error state completely. Fix this by only ignoring the few static error connections that we have. This was tested with the following hack: xcb_connection_t *c = xcb_connect(NULL, NULL); close(xcb_get_file_descriptor(c)); xcb_discard_reply(c, xcb_get_input_focus(c).sequence); xcb_flush(c); xcb_disconnect(c); Valgrind confirms that xcb has a memory leak before this patch that this patch indeed fixes. Signed-off-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Julien Cristau <jcristau@debian.org>
2014-03-21Remove tabs and trailing whitespacesUli Schlachter7-74/+73
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-02-19Add comments about how _xcb_conn_ret_error() worksRan Benita2-0/+4
If xcb_connect() fails, it doesn't return NULL. Instead, it always returns an xcb_connection_t*, and the user should check for errors with the xcb_connection_has_error() function. What this function does is check if conn->has_error contains a non-zero error code, and returns it. If an error did occur, xcb doesn't actually return a full xcb_connection_t though, it just returns (xcb_connection_t *) error_code. Since the 'has_error' field is the first, it is still possible to check conn->has_error. That last trick was not immediately obvious to me, so add some guiding comments. This also ensures no one obliviously rearranges the struct. Signed-off-by: Ran Benita <ran234@gmail.com> Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-01-30generated man pages: use xorg footer and no hard coded extensionGaetan Nadon3-25/+34
The section number is no longer hard-coded The left footer is now "X Version 11". The center footer is the package name with the version, "libxcb 1.9" The three values above are provided through xorg-macros. They are passed-in to the python c_client code. Example of footer (last line, above dotted line) [...] AUTHOR Generated from xproto.xml. Contact xcb@lists.freedesktop.org for cor‐ rections and improvements. X Version 11 libxcb 1.9 xcb_send_event(3) ------------------------------------------------------------------------------ Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2014-01-30generated man pages: build without hard coded extensionGaetan Nadon1-5/+6
The automake MAN primary requires a hard coded extension to build man pages. Let's avoid that as the extension number may vary by platform. Take advantage of the fact that the man directory only contains man pages. Wildcards are not supported by Automake but it happens to work sufficiently well here. Normally xorg build man pages by converting a source .man file to a target file with the extension number. That would be too many files in this case. Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2014-01-30man: build static man pages using xorg patternsGaetan Nadon8-16/+32
The section number is no longer hard-coded, supplied by xorg-macros. The left footer is now "X Version 11". The center footer is the package name with the version, "libxcb 1.9" The man directory is a sibbling to the doc directory. One can build or clean the man pages without disturbing the library code. Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2014-01-30autoconf: replace all tabs with spacesGaetan Nadon1-55/+55
Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2014-01-30autoconf: use default xorg configuration for doxygen documentationGaetan Nadon3-92/+12
No content or form changes for the xcb manual or tutorial. Only the configuration user visible bits change. Xcb will now have the same configuration options as the 30 other xorg modules. Xorg classifies documentation as "user", "developer" or "specifications". The xcb manual falls under the "developer" category. Developers docs are never installed under $prefix. A builder can selectively turn on/off any or all of the categories. He can also selectively turn on/off any of the many tools used to generate documentation such as doxygen, xmlto, etc... Each tool has an environment variable defined such as DOXYGEN. Other features are available, the user interface and the functionality is the same on all modules. --with-doxygen=FILE is replaced with DOXYGEN env variable --disable-build-docs is replaced with --disable-devel-docs The new interface displayed with ./configure --help: --enable-devel-docs Enable building the developer documentation (default: yes) --with-doxygen Use doxygen to regenerate documentation (default: auto) DOXYGEN Path to doxygen command DOT Path to the dot graphics utility The dot tool checking has been added to util-macros in version 1.18. Refer to the table of existing docs in xorg. XCB will be added for the doxygen generated API manual. Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2014-01-30autoconf: fix warning by replacing deprecated AC_HELP_STRINGGaetan Nadon1-1/+1
Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2014-01-30autoconf: require libtool minimum level 2.2Gaetan Nadon1-2/+2
This is the updated minimum level as referenced in: http://www.x.org/wiki/Building_the_X_Window_System/#index2h3 Libtool version 2 has been used for several years now. There should be no surprises. Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2014-01-30autoconf: comment and layout the initialization sectionGaetan Nadon1-9/+7
No functional changes. Trying to make it clearer. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2014-01-30autoconf: AC_INIT: add bug urlGaetan Nadon1-3/+3
Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2014-01-30autoconf: use the warning variables from xorgGaetan Nadon2-13/+2
The BASE_CFLAGS variable contains only warnings, just like the XCB version of CWARNFLAGS. This will result in no changes in the binaries produced. Xorg was missing -fd for SUNCC so it has been added to util-macros v 1.18. Do not get confused with the xorg deprecated CWARNFLAGS variable which contains an option that is not a warning, -fno-strict-aliasing. This option, should it be needed, can be added using the XORG_TESTSET_CFLAG macro. Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2014-01-30autoconf: use XORG_DEFAULT_OPTIONSGaetan Nadon1-2/+6
XCB has been part of X.Org for a while now. This patch will harmonize the XCB configuration, using xorg-macros series of macros. It is already used in the XCB utils packages and is needed to build xcb-proto. The XORG_DEFAULT_OPTIONS already includes the statement for the silent rules. The AC_PROG_CC statement is removed so as not to override AC_PROG_CC_C99 in XORG_DEFAULT_OPTIONS. The effective change is that xcb now uses c99 as requested. Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2014-01-21Support <pad align="n" />Peter Harris1-10/+18
Reviewed-By: Ran Benita <ran234@gmail.com> Signed-off-by: Peter Harris <pharris@opentext.com>
2014-01-03Force XCB event structures with 64-bit extended fields to be packed.Kenneth Graunke2-3/+11
With the advent of the Present extension, some events (such as PresentCompleteNotify) now use native 64-bit types on the wire. For XGE events, we insert an extra "uint32_t full_sequence" field immediately after the first 32 bytes of data. Normally, this causes the subsequent fields to be shifted over by 4 bytes, and the structure to grow in size by 4 bytes. Everything works fine. However, if event contains 64-bit extended fields, this may result in the compiler adding an extra 4 bytes of padding so that those fields remain aligned on 64-bit boundaries. This causes the structure to grow by 8 bytes, not 4. Unfortunately, XCB doesn't realize this, and always believes that the length only increased by 4. read_packet() then fails to malloc enough memory to hold the event, and the event processing code uses the wrong offsets. To fix this, mark any event structures containing 64-bit extended fields with __attribute__((__packed__)). v2: Use any(...) instead of True in (...), as suggested by Daniel Martin. v3 (Alan Coopersmith): Fix build with Solaris Studio 12.3 by moving the attribute to after the structure definition. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Keith Packard <keithp@keithp.com> [v1] Reviewed-by: Josh Triplett <josh@joshtriplett.org> [v1] Reviewed-by: Daniel Martin <consume.noise@gmail.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-12-22Release libxcb 1.101.10Uli Schlachter2-2/+2
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-12-14Add NEWS for 1.10Julien Cristau1-3/+18
Signed-off-by: Julien Cristau <jcristau@debian.org>
2013-12-14Add NEWS entries for releases 1.9.1 to 1.9.3Uli Schlachter1-1/+23
libxcb 1.9.1 was released from a branch and thus its NEWS entries never made it into the master branch. The other releases didn't update NEWS. Signed-off-by: Uli Schlachter <psychon@znc.in> Signed-off-by: Julien Cristau <jcristau@debian.org>