From 5cfbe97cd797d8f78ece208bb5114704b83d8aab Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 13 Jan 2012 16:54:57 +0100 Subject: libxtrans libXdmcp libxcb mesa xserver git update 13 jan 2012 --- libxcb/NEWS | 891 ++++--- libxcb/configure.ac | 4 +- libxcb/src/xcb.h | 24 +- libxcb/src/xcb_auth.c | 9 +- libxcb/src/xcb_conn.c | 851 +++--- libxcb/src/xcb_in.c | 14 +- libxcb/src/xcb_out.c | 750 +++--- libxcb/src/xcb_util.c | 19 +- libxcb/src/xcbint.h | 7 +- libxcb/xcb-proto/NEWS | 34 +- libxcb/xcb-proto/configure.ac | 2 +- libxcb/xcb-proto/src/xkb.xml | 5549 ++++++++++++++++++++------------------- libxcb/xcb-proto/src/xproto.xml | 7 +- 13 files changed, 4155 insertions(+), 4006 deletions(-) (limited to 'libxcb') diff --git a/libxcb/NEWS b/libxcb/NEWS index eaa31e885..bb4b47d68 100644 --- a/libxcb/NEWS +++ b/libxcb/NEWS @@ -1,423 +1,468 @@ -Release 1.7 (2010-08-13) -======================== -- Always wake up readers after writing -- Get rid of PATH_MAX and MAXPATHLEN -- Add ~ operator support in code generator -- xcb_open: Improve protocol/host parsing -- xcb_connect_to_display_with_auth_info: Fix memory leak -- Report which extensions are being built - -Release 1.6 (2010-04-09) -======================== -- darwin: xnu doesn't support poll on ttys on the master side -- Fix descriptor leak on memory error path -- Support xcb_discard_reply -- Open the X11 socket with close-on-exec flag -- Fix authentication on hpux and Hurd - -Release 1.5 (2009-12-03) -======================== -- setsockopt(SO_KEEPALIVE) on TCP display connections -- Add DRI2 support -- Fix check dependency -- Cygwin build fix: Add -no-undefined to libtool flags - -Release 1.4 (2009-07-15) -======================== -* Add majorCode, minorCode and resourceID fields to X generic error -* Fix precedence bug: wrong length for big-requests preceded by sync -* Fix libxcb-randr version info - -Release 1.3 (2009-05-29) -======================== -* Copy full IPv4 mapping (Bug #20665) -* Fix XID allocation -* Use poll() instead of select() when available -* Fix local socket connection on Hurd -* Fix XDM-AUTHORIZATION-1 -* Disable Nagle on TCP socket - -Release 1.2 (2009-02-17) -======================== -* Stop packaging auto-generated C files into tarball. - -Release 1.1.93 (2008-12-11) -=========================== -Enhancements: -* Apple: Enable support for launchd DISPLAY socket -* Treat XIDs the same as other cardinal values. - -Release 1.1.92 (2008-11-01) -=========================== -Enhancements: -* Added small fix to support trailing fixed fields; also warning for non-pad fixed fields -* Fixed overly aggressive warning about fixed field following variable -* Added generation of extern "C" for compatibility with C++ -* Remove libxcb-xlib and xcbxlib.h. -* Inline _xcb_lock_io, _xcb_unlock_io, and _xcb_wait_io. -* Track 64-bit sequence numbers internally. -* Use sequence number ranges in pending replies -* Remove duplicate XCB_EXTENSION calls for Composite extension -* Factorize m4 macros and add one to set X extensions -* Allow compile-time setting for XCB queue buffer size -* Support handing off socket write permission to external code. -* Add support for the abstract socket namespace under Linux - -Bug fixes: -* Fix tiny memory leak in read_packet -* Fix some fd leaks in _xcb_open_*() - -Release 1.1 (2007-11-04) -======================== - -This release requires xcb-proto 1.1, due to the addition of the -extension-multiword attribute to the XML schema. - -This release contains several important bug fixes, summarized below. It -also contains a patch much like Novell's libxcb-sloppy-lock.diff. -Rationale from the commit message follows. The patch and this rationale -were authored by Jamey Sharp , with agreement from -Josh Triplett . - - I strongly opposed proposals like this one for a long time. - Originally I had a very good reason: libX11, when compiled to use - XCB, would crash soon after a locking correctness violation, so it - was better to have an informative assert failure than a mystifying - crash soon after. - - It took some time for me to realize that I'd changed the libX11 - implementation (for unrelated reasons) so that it could survive most - invalid locking situations, as long as it wasn't actually being used - from multiple threads concurrently. - - The other thing that has changed is that most of the code with - incorrect locking has now been fixed. The value of the assert is - accordingly lower. - - However, remaining broken callers do need to be fixed. That's why - libXCB will still noisily print a stacktrace (if possible) on each - assertion failure, even when assert isn't actually invoked to - abort() the program; and that's why aborting is still default. This - environment variable is provided only for use as a temporary - workaround for broken applications. - -Enhancements: -* Print a backtrace, if possible, on locking assertion failures. -* Skip abort() on locking assertions if LIBXCB_ALLOW_SLOPPY_LOCK is set. -* xcb_poll_for_event: Return already-read events before reading again. -* Output a configuration summary at the end of ./configure. - -Bug fixes: -* Don't hold the xlib-xcb lock while sleeping: that allows deadlock. -* Allow unix: style display names again. -* Bug #9119: test xcb_popcount -* Fix unit tests for FreeBSD -* NetBSD doesn't have AI_ADDRCONFIG: use it only if it's available. -* Require libXau >= 0.99.2; earlier versions have a broken .pc file -* Use substitition variables in xcb-xinerama.pc.in -* Update autogen.sh to one that does objdir != srcdir -* Add tools/* and autogen.sh to EXTRA_DIST. -* Doxygen can now be fully disabled if desired. - -Documentation improvements: -* Many fixes and updates to the tutorial. -* Iterators, requests, and replies get partial Doxygen documentation. - - -Release 1.0 (2006-11-23) -======================== - -The "Thanksgiving" release: We feel thankful to have it released. Five years -have passed since XCB's initial commit on September 3rd, 2001: - - -* Support IPv6. XCB now supports displays with IPv6 addresses, with or without - enclosing square brackets, or with hosts which resolve to IPv6 addresses, by - using getaddrinfo instead of gethostbyname, and by including support for - authentication for such connections. This allows such displays as "::1:1.1". - -* XCB now uses the libpthread-stubs, to properly support optional use of - pthreads even on platforms which do not have all the necessary pthread stubs - in libc or otherwise available by default. - -* Switch from the old AM_PATH_CHECK macro to pkg-config. check 0.9.4 is now - required to build XCB's unit tests. The version that we were requiring was - not actually new enough to let our unit tests compile, and the AM_PATH_CHECK - macro is now considered deprecated. We know that versions of check using - pkg-config are new enough to work, and the check dependency was optional - anyway, so we've dropped support for older versions. - -* Provide a xcb_prefetch_maximum_request_length counterpart to - xcb_get_maximum_request_length. - -* Fix Bug #5958: zero out padding bytes in requests. - -* 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. - -* Remove --with-opt and --with-debug options from configure.ac; configure - supports the use of custom CFLAGS, so please use that instead. - -* Reove support for the tag in protocol descriptions, since they - no longer use it, and since new protocol descriptions should not need it - either. - -* xcb-proto has no libraries or headers, so don't use XCBPROTO_CFLAGS or - XCBPROTO_LIBS. - -* XCB builds which use xdmcp now include it in Requires.private, to support - static linking. - -* Replace "long" with uint32_t when used for a 32-bit quantity - -* Various enhancements to the generation of documentation with Doxygen: - * Check for doxygen in configure.ac - * Fix some Doxygen warnings. - * Install documentation. - * Handle out-of-tree builds, with srcdir != builddir. xcb.doxygen now gets - generated from xcb.doxygen.in, so that it can use top_builddir and - top_srcdir to find source and to output documentation. - * Fill in PROJECT_NUMBER from @VERSION@, now that we have it readily - available via autoconf. - - -Release 1.0 RC3 (2006-11-02) -============================ - -Note: Version 0.9.4 of the test suite tool "check" provides a broken -version of the AM_PATH_CHECK macro, which causes autoconf to fail due to -insufficient quoting on the macro names it prints in its deprecation -message. We have written a patch to fix this problem, available at: - -Version 0.9.4-2 of the Debian package for check includes this patch. -Users of other distributions who want to re-autotool libxcb will need to -apply this patch, use an older version of check, or wait for a fixed -upstream version. This bug does not affect users who use the distributed -tarballs and do not re-autotool. - -* Add library support for xcb-xinerama, using new protocol description - from xcb-proto. -* In the generated protocol code, define and use constants for opcode - numbers rather than hard-coding them. -* In the API conversion script, match only XCB-namespaced XID generators - when converting to xcb_generate_id. -* Quit treating xproto specially in Makefile.am: handle it like all the - extensions. -* Generate Doxygen documentation comments in the protocol stubs, and - provide a Doxygen config file for building HTML documentation for XCB. -* Add note to xcbxlib.h that nothing except Xlib/XCB should use it. -* Extend test suite to test xcb_parse_display with NULL argument and - display in $DISPLAY. - - -Release 1.0 RC2 (2006-10-07) -============================ - -API changes ------------ - -In our announcement of XCB 1.0 RC1, we proposed two API changes for -community feedback: - - We would greatly appreciate API review in this final release - candidate period. We've had some limited feedback that our attempts - to impose static type safety on XIDs in C pose more a hindrance than - a help, so we would appreciate discussion over whether this - constitutes a "serious issue with the API". Some question also - remains of whether xcb_poll_for_event should have the out-parameter - 'error', now that XCB has a more uniform mechanism for reporting - connection errors. Speak now on these points or leave us alone. ;-) - -Since we've received feedback agreeing with our proposed changes, and no -objections or requests to keep the existing API, we made both changes -and bumped the soname to libxcb.so.1.0.0 in preparation for the release -of XCB 1.0. - -* Remove XID wrapper structures and replace them with uint32_t typedefs. - XID union types like xcb_drawable_t and xcb_fontable_t also become - uint32_t typedefs. The API conversion script now replaces xcb_*_new - with calls directly to xcb_generate_id. This change makes - xcb_generate_id part of the client API rather than the extension API, - so move xcb_generate_id from xcbext.h to xcb.h. - -* Remove the 'int *error' out-parameter for xcb_poll_for_event. - xcb_poll_for_event now shuts down the xcb_connection_t on fatal - errors; use xcb_connection_has_error to check. - -The Xlib-specific API in libxcb-xlib also changed: - -* Stop exposing the XCB IO lock for Xlib's benefit, by removing - xcb_get_io_lock from the Xlib-specific XCB API; instead, libxcb-xlib - now provides xcb_xlib_lock and xcb_xlib_unlock. - -Code generation changes ------------------------ - -* The code generator no longer implicitly imports xproto for extensions. - xcb-proto 1.0 RC2 includes the corresponding change to explicitly - import xproto in extensions that need it - -* The generated protocol headers now declare "struct foo", "union foo" - or "enum foo", not just the typedef "foo" of an unnamed - struct/union/enum type. - -Bug Fixes ---------- - -* Make Plan 7 'checked' requests work correctly. - -Documentation improvements --------------------------- - -* Document xcb_generate_id. - -* Tutorial enhancements. - - -Release 1.0 RC1 (2006-09-25) -============================ - -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 - -In addition to the API renaming, the library SONAMEs have changed to -libxcb.so and libxcb-extname.so. The library major version remains at 0, -to become version 1 before 1.0 is released; the SONAME lowercasing means -that this will not conflict with XCB 0.9 libraries. - -The header files have moved from /usr/include/X11/XCB/ to -/usr/include/xcb/. The XML-XCB protocol descriptions have moved to -/usr/share/xcb, with extension descriptions no longer relegated to an -extensions/ subdirectory. The API conversion script api_conv.pl will fix -references to the header files, and packages using pkg-config will -automatically use the new library names. - -Error handling Plan 7 ---------------------- - -All request functions now come in an "unchecked" and "checked" variant. -The checked variant allows callers to handle errors inline where they -obtain the reply, or by calling xcb_request_check for requests with no -reply. The unchecked variant uses the event queue for errors. Requests -with replies default to checked, because the caller must already make a -function call to retrieve the reply and can see the error at that time; -the unchecked variant uses the suffix _unchecked. Requests without -replies default to unchecked, because the caller will not necessarily -expect to handle a response, and the checked variant uses the suffix -_checked. - -Connection error handling -------------------------- - -Fatal connection errors now put the xcb_connection_t object into an -error state, at which point all further operations on that connection -will fail. Callers can use the new xcb_connection_has_error function to -check for this state in a connection. Functions that return a -connection, such as the xcb_connect function, may instead return an -xcb_connection_t already in an error state. - -In the future we expect to add additional API for getting more -information about the error condition that caused the connection to get -into an error state. - -Smaller API changes -------------------- - -All functions that have been marked 'deprecated' up to now have been -removed for this release. After XCB 1.0 is released, functions marked -'deprecated' will be preserved until the end of time to maintain -compatibility. - -XCB no longer provides a sync function. Most callers of this function -should use xcb_flush instead, which usually provides the intended -functionality and does not require a round-trip to the server. If you -really need this functionality, either use xcb_get_input_focus like sync -used to do, or use the xcb_aux_sync function from the xcb-aux library in -xcb-util. However, note that we do not consider the libraries in -xcb-util remotely stable yet. - -XCB no longer provides xcb_[extension_name]_init functions for each -extension. These functions previously caused XCB to issue and process a -QueryExtension request. Callers should now directly call -xcb_get_extension_data on the xcb_[extension_name]_id, or use -xcb_prefetch_extension_data if they do not need to force a round-trip -immediately. - -The compatibility functions in xcbxlib.h, provided solely for use by -Xlib/XCB, now exist in a separate library libxcb-xlib. We don't want to -have to change the libxcb soname if we later change or remove the Xlib -compatibility functions, and nothing except Xlib/XCB should ever use -them. (Applications which use Xlib/XCB do not need this library either; -Xlib/XCB only uses it internally.) - -The descriptions of several extensions have been updated to match the -latest versions implemented in the X.org X server. - -GIT Repository split --------------------- - -Previously, several XCB-related projects all existed under the umbrella -of a single monolithic GIT repository with per-project subdirectories. -We have split this repository into individual per-project repositories. - -Josh Triplett and Jamey Sharp wrote a tool called git-split to -accomplish this repository split. git-split reconstructs the history of -a sub-project previously stored in a subdirectory of a larger -repository. It constructs new commit objects based on the existing tree -objects for the subtree in each commit, and discards commits which do -not affect the history of the sub-project, as well as merges made -unnecessary due to these discarded commits. - -We would like to acknowledge the work of the gobby team in creating a -collaborative editor which greatly aided the development of git-split -(as well as these release notes). - -Build and implementation fixes ------------------------------- - -XCB no longer needs proto/x11 from X.org; the XCB header xproto.h -provides the definitions from X.h, named according to XCB conventions. - -XCB should now build with non-GNU implementations of Make. - -XCB properly handles 32-bit wrap of sequence numbers, and thus now -supports issuing more than 2**32 requests in one connection. - -Fixed bugs #7001, #7261. +Release 1.8 (2012-01-11) +======================== +- xcb_disconnect: call shutdown() to force a disconnect +- Use special path to sockets when running under Solaris Trusted Extensions +- Remove unused DECnet code +- Add #include to xcb_conn.c +- Make launchd code in xcb_util.c match surrounding code indent levels +- If protocol is "unix", use a Unix domain socket, not TCP +- Added more error states and removed global error_connection +- Handle XGE events with the "send event" flag +- added xcb_sumof() with restriction to uint8_t +- xkb: updated configure.ac/Makefile.am +- xkb: added pkg config file +- special case 'intermixed variable and fixed size fields': fixed reply side, needs testing +- added accessors for special cases +- Add support for building with Python 3 +- Insert, not append explicit xcbgen dir python path +- xcb_request_check: Sync even if an event was read for this sequence. +- _xcb_conn_wait: Shut down the connection on unexpected poll() events. +- xcb_send_request: Send all requests using a common internal send_request. +- xcb_request_check: Hold the I/O lock while deciding to sync. +- xcb_discard_reply: Simplify by re-using poll_for_reply helper. +- xcb_in: Use 64-bit sequence numbers internally everywhere. +- Enable AM_SILENT_RULES on automake 1.11 or newer. +- Factor reader_list management out of wait_for_reply. +- Dequeue readers that can't receive any new responses. +- Delete the old c-client.xsl. +- Keep ALIGNOF definition out of the public namespace. +- darwin: Don't use poll() when expected to run on darwin10 and prior +- Add Win32 +- Allow disconnecting connections that are in error state. +- Make xcb_take_socket keep flushing until idle +- Support pre-IPv6 systems (without getaddrinfo) +- Drop AI_ADDRCONFIG when resolving TCP addresses +- xcb_auth: Fix memory leak in _xcb_get_auth_info. +- Don't emit out-of-module sizeof definitions +- Clean up a couple of warnings in xprint +- Prevent reply waiters from being blocked. +- Prevent theoretical double free and leak on get_peer_sock_name. +- Introduce a variant of xcb_poll_for_event for examining event queue. +- xcb_take_socket: Document sequence wrap requirements +- Compute alignment correctly +- Fix a dead-lock due to xcb_poll_for_reply + + +Release 1.7 (2010-08-13) +======================== +- Always wake up readers after writing +- Get rid of PATH_MAX and MAXPATHLEN +- Add ~ operator support in code generator +- xcb_open: Improve protocol/host parsing +- xcb_connect_to_display_with_auth_info: Fix memory leak +- Report which extensions are being built + +Release 1.6 (2010-04-09) +======================== +- darwin: xnu doesn't support poll on ttys on the master side +- Fix descriptor leak on memory error path +- Support xcb_discard_reply +- Open the X11 socket with close-on-exec flag +- Fix authentication on hpux and Hurd + +Release 1.5 (2009-12-03) +======================== +- setsockopt(SO_KEEPALIVE) on TCP display connections +- Add DRI2 support +- Fix check dependency +- Cygwin build fix: Add -no-undefined to libtool flags + +Release 1.4 (2009-07-15) +======================== +* Add majorCode, minorCode and resourceID fields to X generic error +* Fix precedence bug: wrong length for big-requests preceded by sync +* Fix libxcb-randr version info + +Release 1.3 (2009-05-29) +======================== +* Copy full IPv4 mapping (Bug #20665) +* Fix XID allocation +* Use poll() instead of select() when available +* Fix local socket connection on Hurd +* Fix XDM-AUTHORIZATION-1 +* Disable Nagle on TCP socket + +Release 1.2 (2009-02-17) +======================== +* Stop packaging auto-generated C files into tarball. + +Release 1.1.93 (2008-12-11) +=========================== +Enhancements: +* Apple: Enable support for launchd DISPLAY socket +* Treat XIDs the same as other cardinal values. + +Release 1.1.92 (2008-11-01) +=========================== +Enhancements: +* Added small fix to support trailing fixed fields; also warning for non-pad fixed fields +* Fixed overly aggressive warning about fixed field following variable +* Added generation of extern "C" for compatibility with C++ +* Remove libxcb-xlib and xcbxlib.h. +* Inline _xcb_lock_io, _xcb_unlock_io, and _xcb_wait_io. +* Track 64-bit sequence numbers internally. +* Use sequence number ranges in pending replies +* Remove duplicate XCB_EXTENSION calls for Composite extension +* Factorize m4 macros and add one to set X extensions +* Allow compile-time setting for XCB queue buffer size +* Support handing off socket write permission to external code. +* Add support for the abstract socket namespace under Linux + +Bug fixes: +* Fix tiny memory leak in read_packet +* Fix some fd leaks in _xcb_open_*() + +Release 1.1 (2007-11-04) +======================== + +This release requires xcb-proto 1.1, due to the addition of the +extension-multiword attribute to the XML schema. + +This release contains several important bug fixes, summarized below. It +also contains a patch much like Novell's libxcb-sloppy-lock.diff. +Rationale from the commit message follows. The patch and this rationale +were authored by Jamey Sharp , with agreement from +Josh Triplett . + + I strongly opposed proposals like this one for a long time. + Originally I had a very good reason: libX11, when compiled to use + XCB, would crash soon after a locking correctness violation, so it + was better to have an informative assert failure than a mystifying + crash soon after. + + It took some time for me to realize that I'd changed the libX11 + implementation (for unrelated reasons) so that it could survive most + invalid locking situations, as long as it wasn't actually being used + from multiple threads concurrently. + + The other thing that has changed is that most of the code with + incorrect locking has now been fixed. The value of the assert is + accordingly lower. + + However, remaining broken callers do need to be fixed. That's why + libXCB will still noisily print a stacktrace (if possible) on each + assertion failure, even when assert isn't actually invoked to + abort() the program; and that's why aborting is still default. This + environment variable is provided only for use as a temporary + workaround for broken applications. + +Enhancements: +* Print a backtrace, if possible, on locking assertion failures. +* Skip abort() on locking assertions if LIBXCB_ALLOW_SLOPPY_LOCK is set. +* xcb_poll_for_event: Return already-read events before reading again. +* Output a configuration summary at the end of ./configure. + +Bug fixes: +* Don't hold the xlib-xcb lock while sleeping: that allows deadlock. +* Allow unix: style display names again. +* Bug #9119: test xcb_popcount +* Fix unit tests for FreeBSD +* NetBSD doesn't have AI_ADDRCONFIG: use it only if it's available. +* Require libXau >= 0.99.2; earlier versions have a broken .pc file +* Use substitition variables in xcb-xinerama.pc.in +* Update autogen.sh to one that does objdir != srcdir +* Add tools/* and autogen.sh to EXTRA_DIST. +* Doxygen can now be fully disabled if desired. + +Documentation improvements: +* Many fixes and updates to the tutorial. +* Iterators, requests, and replies get partial Doxygen documentation. + + +Release 1.0 (2006-11-23) +======================== + +The "Thanksgiving" release: We feel thankful to have it released. Five years +have passed since XCB's initial commit on September 3rd, 2001: + + +* Support IPv6. XCB now supports displays with IPv6 addresses, with or without + enclosing square brackets, or with hosts which resolve to IPv6 addresses, by + using getaddrinfo instead of gethostbyname, and by including support for + authentication for such connections. This allows such displays as "::1:1.1". + +* XCB now uses the libpthread-stubs, to properly support optional use of + pthreads even on platforms which do not have all the necessary pthread stubs + in libc or otherwise available by default. + +* Switch from the old AM_PATH_CHECK macro to pkg-config. check 0.9.4 is now + required to build XCB's unit tests. The version that we were requiring was + not actually new enough to let our unit tests compile, and the AM_PATH_CHECK + macro is now considered deprecated. We know that versions of check using + pkg-config are new enough to work, and the check dependency was optional + anyway, so we've dropped support for older versions. + +* Provide a xcb_prefetch_maximum_request_length counterpart to + xcb_get_maximum_request_length. + +* Fix Bug #5958: zero out padding bytes in requests. + +* 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. + +* Remove --with-opt and --with-debug options from configure.ac; configure + supports the use of custom CFLAGS, so please use that instead. + +* Reove support for the tag in protocol descriptions, since they + no longer use it, and since new protocol descriptions should not need it + either. + +* xcb-proto has no libraries or headers, so don't use XCBPROTO_CFLAGS or + XCBPROTO_LIBS. + +* XCB builds which use xdmcp now include it in Requires.private, to support + static linking. + +* Replace "long" with uint32_t when used for a 32-bit quantity + +* Various enhancements to the generation of documentation with Doxygen: + * Check for doxygen in configure.ac + * Fix some Doxygen warnings. + * Install documentation. + * Handle out-of-tree builds, with srcdir != builddir. xcb.doxygen now gets + generated from xcb.doxygen.in, so that it can use top_builddir and + top_srcdir to find source and to output documentation. + * Fill in PROJECT_NUMBER from @VERSION@, now that we have it readily + available via autoconf. + + +Release 1.0 RC3 (2006-11-02) +============================ + +Note: Version 0.9.4 of the test suite tool "check" provides a broken +version of the AM_PATH_CHECK macro, which causes autoconf to fail due to +insufficient quoting on the macro names it prints in its deprecation +message. We have written a patch to fix this problem, available at: + +Version 0.9.4-2 of the Debian package for check includes this patch. +Users of other distributions who want to re-autotool libxcb will need to +apply this patch, use an older version of check, or wait for a fixed +upstream version. This bug does not affect users who use the distributed +tarballs and do not re-autotool. + +* Add library support for xcb-xinerama, using new protocol description + from xcb-proto. +* In the generated protocol code, define and use constants for opcode + numbers rather than hard-coding them. +* In the API conversion script, match only XCB-namespaced XID generators + when converting to xcb_generate_id. +* Quit treating xproto specially in Makefile.am: handle it like all the + extensions. +* Generate Doxygen documentation comments in the protocol stubs, and + provide a Doxygen config file for building HTML documentation for XCB. +* Add note to xcbxlib.h that nothing except Xlib/XCB should use it. +* Extend test suite to test xcb_parse_display with NULL argument and + display in $DISPLAY. + + +Release 1.0 RC2 (2006-10-07) +============================ + +API changes +----------- + +In our announcement of XCB 1.0 RC1, we proposed two API changes for +community feedback: + + We would greatly appreciate API review in this final release + candidate period. We've had some limited feedback that our attempts + to impose static type safety on XIDs in C pose more a hindrance than + a help, so we would appreciate discussion over whether this + constitutes a "serious issue with the API". Some question also + remains of whether xcb_poll_for_event should have the out-parameter + 'error', now that XCB has a more uniform mechanism for reporting + connection errors. Speak now on these points or leave us alone. ;-) + +Since we've received feedback agreeing with our proposed changes, and no +objections or requests to keep the existing API, we made both changes +and bumped the soname to libxcb.so.1.0.0 in preparation for the release +of XCB 1.0. + +* Remove XID wrapper structures and replace them with uint32_t typedefs. + XID union types like xcb_drawable_t and xcb_fontable_t also become + uint32_t typedefs. The API conversion script now replaces xcb_*_new + with calls directly to xcb_generate_id. This change makes + xcb_generate_id part of the client API rather than the extension API, + so move xcb_generate_id from xcbext.h to xcb.h. + +* Remove the 'int *error' out-parameter for xcb_poll_for_event. + xcb_poll_for_event now shuts down the xcb_connection_t on fatal + errors; use xcb_connection_has_error to check. + +The Xlib-specific API in libxcb-xlib also changed: + +* Stop exposing the XCB IO lock for Xlib's benefit, by removing + xcb_get_io_lock from the Xlib-specific XCB API; instead, libxcb-xlib + now provides xcb_xlib_lock and xcb_xlib_unlock. + +Code generation changes +----------------------- + +* The code generator no longer implicitly imports xproto for extensions. + xcb-proto 1.0 RC2 includes the corresponding change to explicitly + import xproto in extensions that need it + +* The generated protocol headers now declare "struct foo", "union foo" + or "enum foo", not just the typedef "foo" of an unnamed + struct/union/enum type. + +Bug Fixes +--------- + +* Make Plan 7 'checked' requests work correctly. + +Documentation improvements +-------------------------- + +* Document xcb_generate_id. + +* Tutorial enhancements. + + +Release 1.0 RC1 (2006-09-25) +============================ + +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 + +In addition to the API renaming, the library SONAMEs have changed to +libxcb.so and libxcb-extname.so. The library major version remains at 0, +to become version 1 before 1.0 is released; the SONAME lowercasing means +that this will not conflict with XCB 0.9 libraries. + +The header files have moved from /usr/include/X11/XCB/ to +/usr/include/xcb/. The XML-XCB protocol descriptions have moved to +/usr/share/xcb, with extension descriptions no longer relegated to an +extensions/ subdirectory. The API conversion script api_conv.pl will fix +references to the header files, and packages using pkg-config will +automatically use the new library names. + +Error handling Plan 7 +--------------------- + +All request functions now come in an "unchecked" and "checked" variant. +The checked variant allows callers to handle errors inline where they +obtain the reply, or by calling xcb_request_check for requests with no +reply. The unchecked variant uses the event queue for errors. Requests +with replies default to checked, because the caller must already make a +function call to retrieve the reply and can see the error at that time; +the unchecked variant uses the suffix _unchecked. Requests without +replies default to unchecked, because the caller will not necessarily +expect to handle a response, and the checked variant uses the suffix +_checked. + +Connection error handling +------------------------- + +Fatal connection errors now put the xcb_connection_t object into an +error state, at which point all further operations on that connection +will fail. Callers can use the new xcb_connection_has_error function to +check for this state in a connection. Functions that return a +connection, such as the xcb_connect function, may instead return an +xcb_connection_t already in an error state. + +In the future we expect to add additional API for getting more +information about the error condition that caused the connection to get +into an error state. + +Smaller API changes +------------------- + +All functions that have been marked 'deprecated' up to now have been +removed for this release. After XCB 1.0 is released, functions marked +'deprecated' will be preserved until the end of time to maintain +compatibility. + +XCB no longer provides a sync function. Most callers of this function +should use xcb_flush instead, which usually provides the intended +functionality and does not require a round-trip to the server. If you +really need this functionality, either use xcb_get_input_focus like sync +used to do, or use the xcb_aux_sync function from the xcb-aux library in +xcb-util. However, note that we do not consider the libraries in +xcb-util remotely stable yet. + +XCB no longer provides xcb_[extension_name]_init functions for each +extension. These functions previously caused XCB to issue and process a +QueryExtension request. Callers should now directly call +xcb_get_extension_data on the xcb_[extension_name]_id, or use +xcb_prefetch_extension_data if they do not need to force a round-trip +immediately. + +The compatibility functions in xcbxlib.h, provided solely for use by +Xlib/XCB, now exist in a separate library libxcb-xlib. We don't want to +have to change the libxcb soname if we later change or remove the Xlib +compatibility functions, and nothing except Xlib/XCB should ever use +them. (Applications which use Xlib/XCB do not need this library either; +Xlib/XCB only uses it internally.) + +The descriptions of several extensions have been updated to match the +latest versions implemented in the X.org X server. + +GIT Repository split +-------------------- + +Previously, several XCB-related projects all existed under the umbrella +of a single monolithic GIT repository with per-project subdirectories. +We have split this repository into individual per-project repositories. + +Josh Triplett and Jamey Sharp wrote a tool called git-split to +accomplish this repository split. git-split reconstructs the history of +a sub-project previously stored in a subdirectory of a larger +repository. It constructs new commit objects based on the existing tree +objects for the subtree in each commit, and discards commits which do +not affect the history of the sub-project, as well as merges made +unnecessary due to these discarded commits. + +We would like to acknowledge the work of the gobby team in creating a +collaborative editor which greatly aided the development of git-split +(as well as these release notes). + +Build and implementation fixes +------------------------------ + +XCB no longer needs proto/x11 from X.org; the XCB header xproto.h +provides the definitions from X.h, named according to XCB conventions. + +XCB should now build with non-GNU implementations of Make. + +XCB properly handles 32-bit wrap of sequence numbers, and thus now +supports issuing more than 2**32 requests in one connection. + +Fixed bugs #7001, #7261. diff --git a/libxcb/configure.ac b/libxcb/configure.ac index cba9dbdad..9abaffced 100644 --- a/libxcb/configure.ac +++ b/libxcb/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ(2.57) AC_INIT([libxcb], - 1.7, + 1.8, [xcb@lists.freedesktop.org]) AC_CONFIG_SRCDIR([xcb.pc.in]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) @@ -34,7 +34,7 @@ fi AC_SUBST(HTML_CHECK_RESULT) # Checks for pkg-config packages -PKG_CHECK_MODULES(XCBPROTO, xcb-proto >= 1.6) +PKG_CHECK_MODULES(XCBPROTO, xcb-proto >= 1.7) NEEDED="pthread-stubs xau >= 0.99.2" PKG_CHECK_MODULES(NEEDED, $NEEDED) diff --git a/libxcb/src/xcb.h b/libxcb/src/xcb.h index 3ee7965d2..44f650ad7 100644 --- a/libxcb/src/xcb.h +++ b/libxcb/src/xcb.h @@ -69,6 +69,21 @@ extern "C" { /** X_TCP_PORT + display number = server port for TCP transport */ #define X_TCP_PORT 6000 +/** xcb connection errors because of socket, pipe and other stream errors. */ +#define XCB_CONN_ERROR 1 + +/** xcb connection shutdown because of extension not sppported */ +#define XCB_CONN_CLOSED_EXT_NOTSUPPORTED 2 + +/** malloc(), calloc() and realloc() error upon failure, for eg ENOMEM */ +#define XCB_CONN_CLOSED_MEM_INSUFFICIENT 3 + +/** Connection closed, exceeding request length that server accepts. */ +#define XCB_CONN_CLOSED_REQ_LEN_EXCEED 4 + +/** Connection closed, error during parsing display string. */ +#define XCB_CONN_CLOSED_PARSE_ERR 5 + #define XCB_TYPE_PAD(T,I) (-(I) & (sizeof(T) > 4 ? 3 : sizeof(T) - 1)) /* Opaque structures */ @@ -396,15 +411,18 @@ int xcb_get_file_descriptor(xcb_connection_t *c); /** * @brief Test whether the connection has shut down due to a fatal error. * @param c: The connection. - * @return 1 if the connection is in an error state; 0 otherwise. + * @return > 0 if the connection is in an error state; 0 otherwise. * * Some errors that occur in the context of an xcb_connection_t * are unrecoverable. When such an error occurs, the * connection is shut down and further operations on the * xcb_connection_t have no effect. * - * @todo Other functions should document the conditions in - * which they shut down the connection. + * @return XCB_CONN_ERROR, because of socket errors, pipe errors or other stream errors. + * @return XCB_CONN_CLOSED_EXT_NOTSUPPORTED, when extension not supported. + * @return XCB_CONN_CLOSED_MEM_INSUFFICIENT, when memory not available. + * @return XCB_CONN_CLOSED_REQ_LEN_EXCEED, exceeding request length that server accepts. + * @return XCB_CONN_CLOSED_PARSE_ERR, error during parsing display string. */ int xcb_connection_has_error(xcb_connection_t *c); diff --git a/libxcb/src/xcb_auth.c b/libxcb/src/xcb_auth.c index 859ab8a76..ea4ad8f6a 100644 --- a/libxcb/src/xcb_auth.c +++ b/libxcb/src/xcb_auth.c @@ -30,16 +30,20 @@ #include #include #include -#include #ifdef __INTERIX /* _don't_ ask. interix has INADDR_LOOPBACK in here. */ #include #endif +#ifdef HASXDMAUTH +#include +#endif + #ifdef _WIN32 #include "xcb_windefs.h" #else +#include #include #include #include @@ -48,9 +52,6 @@ #include "xcb.h" #include "xcbint.h" -#ifdef HASXDMAUTH -#include -#endif enum auth_protos { #ifdef HASXDMAUTH diff --git a/libxcb/src/xcb_conn.c b/libxcb/src/xcb_conn.c index 84a9917d6..725502af6 100644 --- a/libxcb/src/xcb_conn.c +++ b/libxcb/src/xcb_conn.c @@ -1,410 +1,441 @@ -/* Copyright (C) 2001-2004 Bart Massey and Jamey Sharp. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the names of the authors or their - * institutions shall not be used in advertising or otherwise to promote the - * sale, use or other dealings in this Software without prior written - * authorization from the authors. - */ - -/* Connection management: the core of XCB. */ - -#include -#include -#include -#include -#include -#include -#include - -#include "xcb.h" -#include "xcbint.h" -#if USE_POLL -#include -#elif !defined _WIN32 -#include -#endif - -#ifdef _WIN32 -#include "xcb_windefs.h" -#else -#include -#include -#endif /* _WIN32 */ - -/* SHUT_RDWR is fairly recent and is not available on all platforms */ -#if !defined(SHUT_RDWR) -#define SHUT_RDWR 2 -#endif - -typedef struct { - uint8_t status; - uint8_t pad0[5]; - uint16_t length; -} xcb_setup_generic_t; - -const int error_connection = 1; - -static int set_fd_flags(const int fd) -{ -/* Win32 doesn't have file descriptors and the fcntl function. This block sets the socket in non-blocking mode */ - -#ifdef _WIN32 - u_long iMode = 1; /* non-zero puts it in non-blocking mode, 0 in blocking mode */ - int ret = 0; - - ret = ioctlsocket(fd, FIONBIO, &iMode); - if(ret != 0) - return 0; - return 1; -#else - int flags = fcntl(fd, F_GETFL, 0); - if(flags == -1) - return 0; - flags |= O_NONBLOCK; - if(fcntl(fd, F_SETFL, flags) == -1) - return 0; - if(fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) - return 0; - return 1; -#endif /* _WIN32 */ -} - -static int write_setup(xcb_connection_t *c, xcb_auth_info_t *auth_info) -{ - static const char pad[3]; - xcb_setup_request_t out; - struct iovec parts[6]; - int count = 0; - static const uint32_t endian = 0x01020304; - int ret; - - memset(&out, 0, sizeof(out)); - - /* B = 0x42 = MSB first, l = 0x6c = LSB first */ - if(htonl(endian) == endian) - out.byte_order = 0x42; - else - out.byte_order = 0x6c; - out.protocol_major_version = X_PROTOCOL; - out.protocol_minor_version = X_PROTOCOL_REVISION; - out.authorization_protocol_name_len = 0; - out.authorization_protocol_data_len = 0; - parts[count].iov_len = sizeof(xcb_setup_request_t); - parts[count++].iov_base = &out; - parts[count].iov_len = XCB_PAD(sizeof(xcb_setup_request_t)); - parts[count++].iov_base = (char *) pad; - - if(auth_info) - { - parts[count].iov_len = out.authorization_protocol_name_len = auth_info->namelen; - parts[count++].iov_base = auth_info->name; - parts[count].iov_len = XCB_PAD(out.authorization_protocol_name_len); - parts[count++].iov_base = (char *) pad; - parts[count].iov_len = out.authorization_protocol_data_len = auth_info->datalen; - parts[count++].iov_base = auth_info->data; - parts[count].iov_len = XCB_PAD(out.authorization_protocol_data_len); - parts[count++].iov_base = (char *) pad; - } - assert(count <= (int) (sizeof(parts) / sizeof(*parts))); - - pthread_mutex_lock(&c->iolock); - ret = _xcb_out_send(c, parts, count); - pthread_mutex_unlock(&c->iolock); - return ret; -} - -static int read_setup(xcb_connection_t *c) -{ - /* Read the server response */ - c->setup = malloc(sizeof(xcb_setup_generic_t)); - if(!c->setup) - return 0; - - if(_xcb_in_read_block(c, c->setup, sizeof(xcb_setup_generic_t)) != sizeof(xcb_setup_generic_t)) - return 0; - - { - void *tmp = realloc(c->setup, c->setup->length * 4 + sizeof(xcb_setup_generic_t)); - if(!tmp) - return 0; - c->setup = tmp; - } - - if(_xcb_in_read_block(c, (char *) c->setup + sizeof(xcb_setup_generic_t), c->setup->length * 4) <= 0) - return 0; - - /* 0 = failed, 2 = authenticate, 1 = success */ - switch(c->setup->status) - { - case 0: /* failed */ - { - xcb_setup_failed_t *setup = (xcb_setup_failed_t *) c->setup; - write(STDERR_FILENO, xcb_setup_failed_reason(setup), xcb_setup_failed_reason_length(setup)); - return 0; - } - - case 2: /* authenticate */ - { - xcb_setup_authenticate_t *setup = (xcb_setup_authenticate_t *) c->setup; - write(STDERR_FILENO, xcb_setup_authenticate_reason(setup), xcb_setup_authenticate_reason_length(setup)); - return 0; - } - } - - return 1; -} - -/* precondition: there must be something for us to write. */ -static int write_vec(xcb_connection_t *c, struct iovec **vector, int *count) -{ - int n; - assert(!c->out.queue_len); - -#ifdef _WIN32 - int i = 0; - int ret = 0,err = 0; - struct iovec *vec; - n = 0; - - /* Could use the WSASend win32 function for scatter/gather i/o but setting up the WSABUF struct from - an iovec would require more work and I'm not sure of the benefit....works for now */ - vec = *vector; - while(i < *count) - { - ret = send(c->fd,vec->iov_base,vec->iov_len,0); - if(ret == SOCKET_ERROR) - { - err = WSAGetLastError(); - if(err == WSAEWOULDBLOCK) - { - return 1; - } - } - n += ret; - *vec++; - i++; - } -#else - n = writev(c->fd, *vector, *count); - if(n < 0 && errno == EAGAIN) - return 1; -#endif /* _WIN32 */ - - if(n <= 0) - { - _xcb_conn_shutdown(c); - return 0; - } - - for(; *count; --*count, ++*vector) - { - int cur = (*vector)->iov_len; - if(cur > n) - cur = n; - (*vector)->iov_len -= cur; - (*vector)->iov_base = (char *) (*vector)->iov_base + cur; - n -= cur; - if((*vector)->iov_len) - break; - } - if(!*count) - *vector = 0; - assert(n == 0); - return 1; -} - -/* Public interface */ - -const xcb_setup_t *xcb_get_setup(xcb_connection_t *c) -{ - if(c->has_error) - return 0; - /* doesn't need locking because it's never written to. */ - return c->setup; -} - -int xcb_get_file_descriptor(xcb_connection_t *c) -{ - if(c->has_error) - return -1; - /* doesn't need locking because it's never written to. */ - return c->fd; -} - -int xcb_connection_has_error(xcb_connection_t *c) -{ - /* doesn't need locking because it's read and written atomically. */ - return c->has_error; -} - -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 */ - { - close(fd); - return (xcb_connection_t *) &error_connection; - } -#endif -#endif /* !_WIN32*/ - - c = calloc(1, sizeof(xcb_connection_t)); - if(!c) { - close(fd); - return (xcb_connection_t *) &error_connection; - } - - c->fd = fd; - - if(!( - set_fd_flags(fd) && - pthread_mutex_init(&c->iolock, 0) == 0 && - _xcb_in_init(&c->in) && - _xcb_out_init(&c->out) && - write_setup(c, auth_info) && - read_setup(c) && - _xcb_ext_init(c) && - _xcb_xid_init(c) - )) - { - xcb_disconnect(c); - return (xcb_connection_t *) &error_connection; - } - - return c; -} - -void xcb_disconnect(xcb_connection_t *c) -{ - if(c == (xcb_connection_t *) &error_connection) - return; - - free(c->setup); - - /* disallow further sends and receives */ - shutdown(c->fd, SHUT_RDWR); - close(c->fd); - - pthread_mutex_destroy(&c->iolock); - _xcb_in_destroy(&c->in); - _xcb_out_destroy(&c->out); - - _xcb_ext_destroy(c); - _xcb_xid_destroy(c); - - free(c); -} - -/* Private interface */ - -void _xcb_conn_shutdown(xcb_connection_t *c) -{ - c->has_error = 1; -} - -int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vector, int *count) -{ - int ret; -#if USE_POLL - struct pollfd fd; -#else - fd_set rfds, wfds; -#endif - - /* If the thing I should be doing is already being done, wait for it. */ - if(count ? c->out.writing : c->in.reading) - { - pthread_cond_wait(cond, &c->iolock); - return 1; - } - -#if USE_POLL - memset(&fd, 0, sizeof(fd)); - fd.fd = c->fd; - fd.events = POLLIN; -#else - FD_ZERO(&rfds); - FD_SET(c->fd, &rfds); -#endif - ++c->in.reading; - -#if USE_POLL - if(count) - { - fd.events |= POLLOUT; - ++c->out.writing; - } -#else - FD_ZERO(&wfds); - if(count) - { - FD_SET(c->fd, &wfds); - ++c->out.writing; - } -#endif - - pthread_mutex_unlock(&c->iolock); - do { -#if USE_POLL - ret = poll(&fd, 1, -1); - /* If poll() returns an event we didn't expect, such as POLLNVAL, treat - * it as if it failed. */ - if(ret >= 0 && (fd.revents & ~fd.events)) - { - ret = -1; - break; - } -#else - ret = select(c->fd + 1, &rfds, &wfds, 0, 0); -#endif - } while (ret == -1 && errno == EINTR); - if(ret < 0) - { - _xcb_conn_shutdown(c); - ret = 0; - } - pthread_mutex_lock(&c->iolock); - - if(ret) - { -#if USE_POLL - if((fd.revents & POLLIN) == POLLIN) -#else - if(FD_ISSET(c->fd, &rfds)) -#endif - ret = ret && _xcb_in_read(c); - -#if USE_POLL - if((fd.revents & POLLOUT) == POLLOUT) -#else - if(FD_ISSET(c->fd, &wfds)) -#endif - ret = ret && write_vec(c, vector, count); - } - - if(count) - --c->out.writing; - --c->in.reading; - - return ret; -} +/* Copyright (C) 2001-2004 Bart Massey and Jamey Sharp. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the names of the authors or their + * institutions shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the authors. + */ + +/* Connection management: the core of XCB. */ + +#include +#include +#include +#include +#include +#include +#include + +#include "xcb.h" +#include "xcbint.h" +#if USE_POLL +#include +#elif !defined _WIN32 +#include +#endif + +#ifdef _WIN32 +#include "xcb_windefs.h" +#else +#include +#include +#endif /* _WIN32 */ + +/* SHUT_RDWR is fairly recent and is not available on all platforms */ +#if !defined(SHUT_RDWR) +#define SHUT_RDWR 2 +#endif + +typedef struct { + uint8_t status; + uint8_t pad0[5]; + uint16_t length; +} xcb_setup_generic_t; + +static const int xcb_con_error = XCB_CONN_ERROR; +static const int xcb_con_closed_mem_er = XCB_CONN_CLOSED_MEM_INSUFFICIENT; +static const int xcb_con_closed_parse_er = XCB_CONN_CLOSED_PARSE_ERR; + +static int set_fd_flags(const int fd) +{ +/* Win32 doesn't have file descriptors and the fcntl function. This block sets the socket in non-blocking mode */ + +#ifdef _WIN32 + u_long iMode = 1; /* non-zero puts it in non-blocking mode, 0 in blocking mode */ + int ret = 0; + + ret = ioctlsocket(fd, FIONBIO, &iMode); + if(ret != 0) + return 0; + return 1; +#else + int flags = fcntl(fd, F_GETFL, 0); + if(flags == -1) + return 0; + flags |= O_NONBLOCK; + if(fcntl(fd, F_SETFL, flags) == -1) + return 0; + if(fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) + return 0; + return 1; +#endif /* _WIN32 */ +} + +static int write_setup(xcb_connection_t *c, xcb_auth_info_t *auth_info) +{ + static const char pad[3]; + xcb_setup_request_t out; + struct iovec parts[6]; + int count = 0; + static const uint32_t endian = 0x01020304; + int ret; + + memset(&out, 0, sizeof(out)); + + /* B = 0x42 = MSB first, l = 0x6c = LSB first */ + if(htonl(endian) == endian) + out.byte_order = 0x42; + else + out.byte_order = 0x6c; + out.protocol_major_version = X_PROTOCOL; + out.protocol_minor_version = X_PROTOCOL_REVISION; + out.authorization_protocol_name_len = 0; + out.authorization_protocol_data_len = 0; + parts[count].iov_len = sizeof(xcb_setup_request_t); + parts[count++].iov_base = &out; + parts[count].iov_len = XCB_PAD(sizeof(xcb_setup_request_t)); + parts[count++].iov_base = (char *) pad; + + if(auth_info) + { + parts[count].iov_len = out.authorization_protocol_name_len = auth_info->namelen; + parts[count++].iov_base = auth_info->name; + parts[count].iov_len = XCB_PAD(out.authorization_protocol_name_len); + parts[count++].iov_base = (char *) pad; + parts[count].iov_len = out.authorization_protocol_data_len = auth_info->datalen; + parts[count++].iov_base = auth_info->data; + parts[count].iov_len = XCB_PAD(out.authorization_protocol_data_len); + parts[count++].iov_base = (char *) pad; + } + assert(count <= (int) (sizeof(parts) / sizeof(*parts))); + + pthread_mutex_lock(&c->iolock); + ret = _xcb_out_send(c, parts, count); + pthread_mutex_unlock(&c->iolock); + return ret; +} + +static int read_setup(xcb_connection_t *c) +{ + /* Read the server response */ + c->setup = malloc(sizeof(xcb_setup_generic_t)); + if(!c->setup) + return 0; + + if(_xcb_in_read_block(c, c->setup, sizeof(xcb_setup_generic_t)) != sizeof(xcb_setup_generic_t)) + return 0; + + { + void *tmp = realloc(c->setup, c->setup->length * 4 + sizeof(xcb_setup_generic_t)); + if(!tmp) + return 0; + c->setup = tmp; + } + + if(_xcb_in_read_block(c, (char *) c->setup + sizeof(xcb_setup_generic_t), c->setup->length * 4) <= 0) + return 0; + + /* 0 = failed, 2 = authenticate, 1 = success */ + switch(c->setup->status) + { + case 0: /* failed */ + { + xcb_setup_failed_t *setup = (xcb_setup_failed_t *) c->setup; + write(STDERR_FILENO, xcb_setup_failed_reason(setup), xcb_setup_failed_reason_length(setup)); + return 0; + } + + case 2: /* authenticate */ + { + xcb_setup_authenticate_t *setup = (xcb_setup_authenticate_t *) c->setup; + write(STDERR_FILENO, xcb_setup_authenticate_reason(setup), xcb_setup_authenticate_reason_length(setup)); + return 0; + } + } + + return 1; +} + +/* precondition: there must be something for us to write. */ +static int write_vec(xcb_connection_t *c, struct iovec **vector, int *count) +{ + int n; + assert(!c->out.queue_len); + +#ifdef _WIN32 + int i = 0; + int ret = 0,err = 0; + struct iovec *vec; + n = 0; + + /* Could use the WSASend win32 function for scatter/gather i/o but setting up the WSABUF struct from + an iovec would require more work and I'm not sure of the benefit....works for now */ + vec = *vector; + while(i < *count) + { + ret = send(c->fd,vec->iov_base,vec->iov_len,0); + if(ret == SOCKET_ERROR) + { + err = WSAGetLastError(); + if(err == WSAEWOULDBLOCK) + { + return 1; + } + } + n += ret; + *vec++; + i++; + } +#else + n = writev(c->fd, *vector, *count); + if(n < 0 && errno == EAGAIN) + return 1; +#endif /* _WIN32 */ + + if(n <= 0) + { + _xcb_conn_shutdown(c, XCB_CONN_ERROR); + return 0; + } + + for(; *count; --*count, ++*vector) + { + int cur = (*vector)->iov_len; + if(cur > n) + cur = n; + (*vector)->iov_len -= cur; + (*vector)->iov_base = (char *) (*vector)->iov_base + cur; + n -= cur; + if((*vector)->iov_len) + break; + } + if(!*count) + *vector = 0; + assert(n == 0); + return 1; +} + +/* Public interface */ + +const xcb_setup_t *xcb_get_setup(xcb_connection_t *c) +{ + if(c->has_error) + return 0; + /* doesn't need locking because it's never written to. */ + return c->setup; +} + +int xcb_get_file_descriptor(xcb_connection_t *c) +{ + if(c->has_error) + return -1; + /* doesn't need locking because it's never written to. */ + return c->fd; +} + +int xcb_connection_has_error(xcb_connection_t *c) +{ + /* doesn't need locking because it's read and written atomically. */ + return c->has_error; +} + +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 */ + { + close(fd); + return _xcb_conn_ret_error(XCB_CONN_ERROR); + } +#endif +#endif /* !_WIN32*/ + + c = calloc(1, sizeof(xcb_connection_t)); + if(!c) { + close(fd); + return _xcb_conn_ret_error(XCB_CONN_CLOSED_MEM_INSUFFICIENT) ; + } + + c->fd = fd; + + if(!( + set_fd_flags(fd) && + pthread_mutex_init(&c->iolock, 0) == 0 && + _xcb_in_init(&c->in) && + _xcb_out_init(&c->out) && + write_setup(c, auth_info) && + read_setup(c) && + _xcb_ext_init(c) && + _xcb_xid_init(c) + )) + { + xcb_disconnect(c); + return _xcb_conn_ret_error(XCB_CONN_ERROR); + } + + return c; +} + +void xcb_disconnect(xcb_connection_t *c) +{ + if(c->has_error) + return; + + free(c->setup); + + /* disallow further sends and receives */ + shutdown(c->fd, SHUT_RDWR); + close(c->fd); + + pthread_mutex_destroy(&c->iolock); + _xcb_in_destroy(&c->in); + _xcb_out_destroy(&c->out); + + _xcb_ext_destroy(c); + _xcb_xid_destroy(c); + + free(c); + +#ifdef _WIN32 + WSACleanup(); +#endif +} + +/* Private interface */ + +void _xcb_conn_shutdown(xcb_connection_t *c, int err) +{ + c->has_error = err; +} + +/* Return connection error state. + * To make thread-safe, I need a seperate static + * variable for every possible error. + */ +xcb_connection_t *_xcb_conn_ret_error(int err) +{ + + switch(err) + { + case XCB_CONN_CLOSED_MEM_INSUFFICIENT: + { + return (xcb_connection_t *) &xcb_con_closed_mem_er; + } + case XCB_CONN_CLOSED_PARSE_ERR: + { + return (xcb_connection_t *) &xcb_con_closed_parse_er; + } + case XCB_CONN_ERROR: + default: + { + return (xcb_connection_t *) &xcb_con_error; + } + } +} + +int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vector, int *count) +{ + int ret; +#if USE_POLL + struct pollfd fd; +#else + fd_set rfds, wfds; +#endif + + /* If the thing I should be doing is already being done, wait for it. */ + if(count ? c->out.writing : c->in.reading) + { + pthread_cond_wait(cond, &c->iolock); + return 1; + } + +#if USE_POLL + memset(&fd, 0, sizeof(fd)); + fd.fd = c->fd; + fd.events = POLLIN; +#else + FD_ZERO(&rfds); + FD_SET(c->fd, &rfds); +#endif + ++c->in.reading; + +#if USE_POLL + if(count) + { + fd.events |= POLLOUT; + ++c->out.writing; + } +#else + FD_ZERO(&wfds); + if(count) + { + FD_SET(c->fd, &wfds); + ++c->out.writing; + } +#endif + + pthread_mutex_unlock(&c->iolock); + do { +#if USE_POLL + ret = poll(&fd, 1, -1); + /* If poll() returns an event we didn't expect, such as POLLNVAL, treat + * it as if it failed. */ + if(ret >= 0 && (fd.revents & ~fd.events)) + { + ret = -1; + break; + } +#else + ret = select(c->fd + 1, &rfds, &wfds, 0, 0); +#endif + } while (ret == -1 && errno == EINTR); + if(ret < 0) + { + _xcb_conn_shutdown(c, XCB_CONN_ERROR); + ret = 0; + } + pthread_mutex_lock(&c->iolock); + + if(ret) + { +#if USE_POLL + if((fd.revents & POLLIN) == POLLIN) +#else + if(FD_ISSET(c->fd, &rfds)) +#endif + ret = ret && _xcb_in_read(c); + +#if USE_POLL + if((fd.revents & POLLOUT) == POLLOUT) +#else + if(FD_ISSET(c->fd, &wfds)) +#endif + ret = ret && write_vec(c, vector, count); + } + + if(count) + --c->out.writing; + --c->in.reading; + + return ret; +} diff --git a/libxcb/src/xcb_in.c b/libxcb/src/xcb_in.c index e075a4047..969cfc08b 100644 --- a/libxcb/src/xcb_in.c +++ b/libxcb/src/xcb_in.c @@ -174,7 +174,7 @@ static int read_packet(xcb_connection_t *c) (genrep.response_type == XCB_REPLY ? 0 : sizeof(uint32_t))); if(!buf) { - _xcb_conn_shutdown(c); + _xcb_conn_shutdown(c, XCB_CONN_CLOSED_MEM_INSUFFICIENT); return 0; } @@ -210,7 +210,7 @@ static int read_packet(xcb_connection_t *c) struct reply_list *cur = malloc(sizeof(struct reply_list)); if(!cur) { - _xcb_conn_shutdown(c); + _xcb_conn_shutdown(c, XCB_CONN_CLOSED_MEM_INSUFFICIENT); free(buf); return 0; } @@ -227,7 +227,7 @@ static int read_packet(xcb_connection_t *c) event = malloc(sizeof(struct event_list)); if(!event) { - _xcb_conn_shutdown(c); + _xcb_conn_shutdown(c, XCB_CONN_CLOSED_MEM_INSUFFICIENT); free(buf); return 0; } @@ -433,7 +433,7 @@ static void insert_pending_discard(xcb_connection_t *c, pending_reply **prev_nex pend = malloc(sizeof(*pend)); if(!pend) { - _xcb_conn_shutdown(c); + _xcb_conn_shutdown(c, XCB_CONN_CLOSED_MEM_INSUFFICIENT); return; } @@ -633,7 +633,7 @@ int _xcb_in_expect_reply(xcb_connection_t *c, uint64_t request, enum workarounds assert(workaround != WORKAROUND_NONE || flags != 0); if(!pend) { - _xcb_conn_shutdown(c); + _xcb_conn_shutdown(c, XCB_CONN_CLOSED_MEM_INSUFFICIENT); return 0; } pend->first_request = pend->last_request = request; @@ -672,7 +672,7 @@ int _xcb_in_read(xcb_connection_t *c) if((n > 0) || (n < 0 && WSAGetLastError() == WSAEWOULDBLOCK)) #endif /* !_WIN32 */ return 1; - _xcb_conn_shutdown(c); + _xcb_conn_shutdown(c, XCB_CONN_ERROR); return 0; } @@ -691,7 +691,7 @@ int _xcb_in_read_block(xcb_connection_t *c, void *buf, int len) int ret = read_block(c->fd, (char *) buf + done, len - done); if(ret <= 0) { - _xcb_conn_shutdown(c); + _xcb_conn_shutdown(c, XCB_CONN_ERROR); return ret; } } diff --git a/libxcb/src/xcb_out.c b/libxcb/src/xcb_out.c index 4f27de116..c0601f270 100644 --- a/libxcb/src/xcb_out.c +++ b/libxcb/src/xcb_out.c @@ -1,372 +1,378 @@ -/* Copyright (C) 2001-2004 Bart Massey and Jamey Sharp. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the names of the authors or their - * institutions shall not be used in advertising or otherwise to promote the - * sale, use or other dealings in this Software without prior written - * authorization from the authors. - */ - -/* Stuff that sends stuff to the server. */ - -#include -#include -#include -#include - -#include "xcb.h" -#include "xcbext.h" -#include "xcbint.h" -#include "bigreq.h" - -static inline void send_request(xcb_connection_t *c, int isvoid, enum workarounds workaround, int flags, struct iovec *vector, int count) -{ - if(c->has_error) - return; - - ++c->out.request; - if(!isvoid) - c->in.request_expected = c->out.request; - if(workaround != WORKAROUND_NONE || flags != 0) - _xcb_in_expect_reply(c, c->out.request, workaround, flags); - - while(count && c->out.queue_len + vector[0].iov_len <= sizeof(c->out.queue)) - { - memcpy(c->out.queue + c->out.queue_len, vector[0].iov_base, vector[0].iov_len); - c->out.queue_len += vector[0].iov_len; - vector[0].iov_base = (char *) vector[0].iov_base + vector[0].iov_len; - vector[0].iov_len = 0; - ++vector, --count; - } - if(!count) - return; - - --vector, ++count; - vector[0].iov_base = c->out.queue; - vector[0].iov_len = c->out.queue_len; - c->out.queue_len = 0; - _xcb_out_send(c, vector, count); -} - -static void send_sync(xcb_connection_t *c) -{ - static const union { - struct { - uint8_t major; - uint8_t pad; - uint16_t len; - } fields; - uint32_t packet; - } sync_req = { { /* GetInputFocus */ 43, 0, 1 } }; - struct iovec vector[2]; - vector[1].iov_base = (char *) &sync_req; - vector[1].iov_len = sizeof(sync_req); - send_request(c, 0, WORKAROUND_NONE, XCB_REQUEST_DISCARD_REPLY, vector + 1, 1); -} - -static void get_socket_back(xcb_connection_t *c) -{ - while(c->out.return_socket && c->out.socket_moving) - pthread_cond_wait(&c->out.socket_cond, &c->iolock); - if(!c->out.return_socket) - return; - - c->out.socket_moving = 1; - pthread_mutex_unlock(&c->iolock); - c->out.return_socket(c->out.socket_closure); - pthread_mutex_lock(&c->iolock); - c->out.socket_moving = 0; - - pthread_cond_broadcast(&c->out.socket_cond); - c->out.return_socket = 0; - c->out.socket_closure = 0; - _xcb_in_replies_done(c); -} - -/* Public interface */ - -void xcb_prefetch_maximum_request_length(xcb_connection_t *c) -{ - if(c->has_error) - return; - pthread_mutex_lock(&c->out.reqlenlock); - if(c->out.maximum_request_length_tag == LAZY_NONE) - { - const xcb_query_extension_reply_t *ext; - ext = xcb_get_extension_data(c, &xcb_big_requests_id); - if(ext && ext->present) - { - c->out.maximum_request_length_tag = LAZY_COOKIE; - c->out.maximum_request_length.cookie = xcb_big_requests_enable(c); - } - else - { - c->out.maximum_request_length_tag = LAZY_FORCED; - c->out.maximum_request_length.value = c->setup->maximum_request_length; - } - } - pthread_mutex_unlock(&c->out.reqlenlock); -} - -uint32_t xcb_get_maximum_request_length(xcb_connection_t *c) -{ - if(c->has_error) - return 0; - xcb_prefetch_maximum_request_length(c); - pthread_mutex_lock(&c->out.reqlenlock); - if(c->out.maximum_request_length_tag == LAZY_COOKIE) - { - xcb_big_requests_enable_reply_t *r = xcb_big_requests_enable_reply(c, c->out.maximum_request_length.cookie, 0); - c->out.maximum_request_length_tag = LAZY_FORCED; - if(r) - { - c->out.maximum_request_length.value = r->maximum_request_length; - free(r); - } - else - c->out.maximum_request_length.value = c->setup->maximum_request_length; - } - pthread_mutex_unlock(&c->out.reqlenlock); - return c->out.maximum_request_length.value; -} - -unsigned int xcb_send_request(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *req) -{ - uint64_t request; - uint32_t prefix[2]; - int veclen = req->count; - enum workarounds workaround = WORKAROUND_NONE; - - if(c->has_error) - return 0; - - assert(c != 0); - assert(vector != 0); - assert(req->count > 0); - - if(!(flags & XCB_REQUEST_RAW)) - { - static const char pad[3]; - unsigned int i; - uint16_t shortlen = 0; - size_t longlen = 0; - assert(vector[0].iov_len >= 4); - /* set the major opcode, and the minor opcode for extensions */ - if(req->ext) - { - const xcb_query_extension_reply_t *extension = xcb_get_extension_data(c, req->ext); - if(!(extension && extension->present)) - { - _xcb_conn_shutdown(c); - return 0; - } - ((uint8_t *) vector[0].iov_base)[0] = extension->major_opcode; - ((uint8_t *) vector[0].iov_base)[1] = req->opcode; - } - else - ((uint8_t *) vector[0].iov_base)[0] = req->opcode; - - /* put together the length field, possibly using BIGREQUESTS */ - for(i = 0; i < req->count; ++i) - { - longlen += vector[i].iov_len; - if(!vector[i].iov_base) - { - vector[i].iov_base = (char *) pad; - assert(vector[i].iov_len <= sizeof(pad)); - } - } - assert((longlen & 3) == 0); - longlen >>= 2; - - if(longlen <= c->setup->maximum_request_length) - { - /* we don't need BIGREQUESTS. */ - shortlen = longlen; - longlen = 0; - } - else if(longlen > xcb_get_maximum_request_length(c)) - { - _xcb_conn_shutdown(c); - return 0; /* server can't take this; maybe need BIGREQUESTS? */ - } - - /* set the length field. */ - ((uint16_t *) vector[0].iov_base)[1] = shortlen; - if(!shortlen) - { - prefix[0] = ((uint32_t *) vector[0].iov_base)[0]; - prefix[1] = ++longlen; - vector[0].iov_base = (uint32_t *) vector[0].iov_base + 1; - vector[0].iov_len -= sizeof(uint32_t); - --vector, ++veclen; - vector[0].iov_base = prefix; - vector[0].iov_len = sizeof(prefix); - } - } - flags &= ~XCB_REQUEST_RAW; - - /* do we need to work around the X server bug described in glx.xml? */ - /* XXX: GetFBConfigs won't use BIG-REQUESTS in any sane - * configuration, but that should be handled here anyway. */ - if(req->ext && !req->isvoid && !strcmp(req->ext->name, "GLX") && - ((req->opcode == 17 && ((uint32_t *) vector[0].iov_base)[1] == 0x10004) || - req->opcode == 21)) - workaround = WORKAROUND_GLX_GET_FB_CONFIGS_BUG; - - /* get a sequence number and arrange for delivery. */ - pthread_mutex_lock(&c->iolock); - /* wait for other writing threads to get out of my way. */ - while(c->out.writing) - pthread_cond_wait(&c->out.cond, &c->iolock); - get_socket_back(c); - - /* send GetInputFocus (sync_req) when 64k-2 requests have been sent without - * a reply. */ - if(req->isvoid && c->out.request == c->in.request_expected + (1 << 16) - 2) - send_sync(c); - /* Also send sync_req (could use NoOp) at 32-bit wrap to avoid having - * applications see sequence 0 as that is used to indicate - * an error in sending the request */ - if((unsigned int) (c->out.request + 1) == 0) - send_sync(c); - - /* The above send_sync calls could drop the I/O lock, but this - * thread will still exclude any other thread that tries to write, - * so the sequence number postconditions still hold. */ - send_request(c, req->isvoid, workaround, flags, vector, veclen); - request = c->has_error ? 0 : c->out.request; - pthread_mutex_unlock(&c->iolock); - return request; -} - -int xcb_take_socket(xcb_connection_t *c, void (*return_socket)(void *closure), void *closure, int flags, uint64_t *sent) -{ - int ret; - if(c->has_error) - return 0; - pthread_mutex_lock(&c->iolock); - get_socket_back(c); - ret = _xcb_out_flush_to(c, c->out.request); - if(ret) - { - c->out.return_socket = return_socket; - c->out.socket_closure = closure; - if(flags) - _xcb_in_expect_reply(c, c->out.request, WORKAROUND_EXTERNAL_SOCKET_OWNER, flags); - assert(c->out.request == c->out.request_written); - *sent = c->out.request; - } - pthread_mutex_unlock(&c->iolock); - return ret; -} - -int xcb_writev(xcb_connection_t *c, struct iovec *vector, int count, uint64_t requests) -{ - int ret; - if(c->has_error) - return 0; - pthread_mutex_lock(&c->iolock); - c->out.request += requests; - ret = _xcb_out_send(c, vector, count); - pthread_mutex_unlock(&c->iolock); - return ret; -} - -int xcb_flush(xcb_connection_t *c) -{ - int ret; - if(c->has_error) - return 0; - pthread_mutex_lock(&c->iolock); - ret = _xcb_out_flush_to(c, c->out.request); - pthread_mutex_unlock(&c->iolock); - return ret; -} - -/* Private interface */ - -int _xcb_out_init(_xcb_out *out) -{ - if(pthread_cond_init(&out->socket_cond, 0)) - return 0; - out->return_socket = 0; - out->socket_closure = 0; - out->socket_moving = 0; - - if(pthread_cond_init(&out->cond, 0)) - return 0; - out->writing = 0; - - out->queue_len = 0; - - out->request = 0; - out->request_written = 0; - - if(pthread_mutex_init(&out->reqlenlock, 0)) - return 0; - out->maximum_request_length_tag = LAZY_NONE; - - return 1; -} - -void _xcb_out_destroy(_xcb_out *out) -{ - pthread_cond_destroy(&out->cond); - pthread_mutex_destroy(&out->reqlenlock); -} - -int _xcb_out_send(xcb_connection_t *c, struct iovec *vector, int count) -{ - int ret = 1; - while(ret && count) - ret = _xcb_conn_wait(c, &c->out.cond, &vector, &count); - c->out.request_written = c->out.request; - pthread_cond_broadcast(&c->out.cond); - _xcb_in_wake_up_next_reader(c); - return ret; -} - -void _xcb_out_send_sync(xcb_connection_t *c) -{ - /* wait for other writing threads to get out of my way. */ - while(c->out.writing) - pthread_cond_wait(&c->out.cond, &c->iolock); - get_socket_back(c); - send_sync(c); -} - -int _xcb_out_flush_to(xcb_connection_t *c, uint64_t request) -{ - assert(XCB_SEQUENCE_COMPARE(request, <=, c->out.request)); - if(XCB_SEQUENCE_COMPARE(c->out.request_written, >=, request)) - return 1; - if(c->out.queue_len) - { - struct iovec vec; - vec.iov_base = c->out.queue; - vec.iov_len = c->out.queue_len; - c->out.queue_len = 0; - return _xcb_out_send(c, &vec, 1); - } - while(c->out.writing) - pthread_cond_wait(&c->out.cond, &c->iolock); - assert(XCB_SEQUENCE_COMPARE(c->out.request_written, >=, request)); - return 1; -} +/* Copyright (C) 2001-2004 Bart Massey and Jamey Sharp. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the names of the authors or their + * institutions shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the authors. + */ + +/* Stuff that sends stuff to the server. */ + +#include +#include +#include +#include + +#include "xcb.h" +#include "xcbext.h" +#include "xcbint.h" +#include "bigreq.h" + +static inline void send_request(xcb_connection_t *c, int isvoid, enum workarounds workaround, int flags, struct iovec *vector, int count) +{ + if(c->has_error) + return; + + ++c->out.request; + if(!isvoid) + c->in.request_expected = c->out.request; + if(workaround != WORKAROUND_NONE || flags != 0) + _xcb_in_expect_reply(c, c->out.request, workaround, flags); + + while(count && c->out.queue_len + vector[0].iov_len <= sizeof(c->out.queue)) + { + memcpy(c->out.queue + c->out.queue_len, vector[0].iov_base, vector[0].iov_len); + c->out.queue_len += vector[0].iov_len; + vector[0].iov_base = (char *) vector[0].iov_base + vector[0].iov_len; + vector[0].iov_len = 0; + ++vector, --count; + } + if(!count) + return; + + --vector, ++count; + vector[0].iov_base = c->out.queue; + vector[0].iov_len = c->out.queue_len; + c->out.queue_len = 0; + _xcb_out_send(c, vector, count); +} + +static void send_sync(xcb_connection_t *c) +{ + static const union { + struct { + uint8_t major; + uint8_t pad; + uint16_t len; + } fields; + uint32_t packet; + } sync_req = { { /* GetInputFocus */ 43, 0, 1 } }; + struct iovec vector[2]; + vector[1].iov_base = (char *) &sync_req; + vector[1].iov_len = sizeof(sync_req); + send_request(c, 0, WORKAROUND_NONE, XCB_REQUEST_DISCARD_REPLY, vector + 1, 1); +} + +static void get_socket_back(xcb_connection_t *c) +{ + while(c->out.return_socket && c->out.socket_moving) + pthread_cond_wait(&c->out.socket_cond, &c->iolock); + if(!c->out.return_socket) + return; + + c->out.socket_moving = 1; + pthread_mutex_unlock(&c->iolock); + c->out.return_socket(c->out.socket_closure); + pthread_mutex_lock(&c->iolock); + c->out.socket_moving = 0; + + pthread_cond_broadcast(&c->out.socket_cond); + c->out.return_socket = 0; + c->out.socket_closure = 0; + _xcb_in_replies_done(c); +} + +/* Public interface */ + +void xcb_prefetch_maximum_request_length(xcb_connection_t *c) +{ + if(c->has_error) + return; + pthread_mutex_lock(&c->out.reqlenlock); + if(c->out.maximum_request_length_tag == LAZY_NONE) + { + const xcb_query_extension_reply_t *ext; + ext = xcb_get_extension_data(c, &xcb_big_requests_id); + if(ext && ext->present) + { + c->out.maximum_request_length_tag = LAZY_COOKIE; + c->out.maximum_request_length.cookie = xcb_big_requests_enable(c); + } + else + { + c->out.maximum_request_length_tag = LAZY_FORCED; + c->out.maximum_request_length.value = c->setup->maximum_request_length; + } + } + pthread_mutex_unlock(&c->out.reqlenlock); +} + +uint32_t xcb_get_maximum_request_length(xcb_connection_t *c) +{ + if(c->has_error) + return 0; + xcb_prefetch_maximum_request_length(c); + pthread_mutex_lock(&c->out.reqlenlock); + if(c->out.maximum_request_length_tag == LAZY_COOKIE) + { + xcb_big_requests_enable_reply_t *r = xcb_big_requests_enable_reply(c, c->out.maximum_request_length.cookie, 0); + c->out.maximum_request_length_tag = LAZY_FORCED; + if(r) + { + c->out.maximum_request_length.value = r->maximum_request_length; + free(r); + } + else + c->out.maximum_request_length.value = c->setup->maximum_request_length; + } + pthread_mutex_unlock(&c->out.reqlenlock); + return c->out.maximum_request_length.value; +} + +unsigned int xcb_send_request(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *req) +{ + uint64_t request; + uint32_t prefix[2]; + int veclen = req->count; + enum workarounds workaround = WORKAROUND_NONE; + + if(c->has_error) + return 0; + + assert(c != 0); + assert(vector != 0); + assert(req->count > 0); + + if(!(flags & XCB_REQUEST_RAW)) + { + static const char pad[3]; + unsigned int i; + uint16_t shortlen = 0; + size_t longlen = 0; + assert(vector[0].iov_len >= 4); + /* set the major opcode, and the minor opcode for extensions */ + if(req->ext) + { + const xcb_query_extension_reply_t *extension = xcb_get_extension_data(c, req->ext); + if(!(extension && extension->present)) + { + _xcb_conn_shutdown(c, XCB_CONN_CLOSED_EXT_NOTSUPPORTED); + return 0; + } + ((uint8_t *) vector[0].iov_base)[0] = extension->major_opcode; + ((uint8_t *) vector[0].iov_base)[1] = req->opcode; + } + else + ((uint8_t *) vector[0].iov_base)[0] = req->opcode; + + /* put together the length field, possibly using BIGREQUESTS */ + for(i = 0; i < req->count; ++i) + { + longlen += vector[i].iov_len; + if(!vector[i].iov_base) + { + vector[i].iov_base = (char *) pad; + assert(vector[i].iov_len <= sizeof(pad)); + } + } + assert((longlen & 3) == 0); + longlen >>= 2; + + if(longlen <= c->setup->maximum_request_length) + { + /* we don't need BIGREQUESTS. */ + shortlen = longlen; + longlen = 0; + } + else if(longlen > xcb_get_maximum_request_length(c)) + { + _xcb_conn_shutdown(c, XCB_CONN_CLOSED_REQ_LEN_EXCEED); + return 0; /* server can't take this; maybe need BIGREQUESTS? */ + } + + /* set the length field. */ + ((uint16_t *) vector[0].iov_base)[1] = shortlen; + if(!shortlen) + { + prefix[0] = ((uint32_t *) vector[0].iov_base)[0]; + prefix[1] = ++longlen; + vector[0].iov_base = (uint32_t *) vector[0].iov_base + 1; + vector[0].iov_len -= sizeof(uint32_t); + --vector, ++veclen; + vector[0].iov_base = prefix; + vector[0].iov_len = sizeof(prefix); + } + } + flags &= ~XCB_REQUEST_RAW; + + /* do we need to work around the X server bug described in glx.xml? */ + /* XXX: GetFBConfigs won't use BIG-REQUESTS in any sane + * configuration, but that should be handled here anyway. */ + if(req->ext && !req->isvoid && !strcmp(req->ext->name, "GLX") && + ((req->opcode == 17 && ((uint32_t *) vector[0].iov_base)[1] == 0x10004) || + req->opcode == 21)) + workaround = WORKAROUND_GLX_GET_FB_CONFIGS_BUG; + + /* get a sequence number and arrange for delivery. */ + pthread_mutex_lock(&c->iolock); + /* wait for other writing threads to get out of my way. */ + while(c->out.writing) + pthread_cond_wait(&c->out.cond, &c->iolock); + get_socket_back(c); + + /* send GetInputFocus (sync_req) when 64k-2 requests have been sent without + * a reply. */ + if(req->isvoid && c->out.request == c->in.request_expected + (1 << 16) - 2) + send_sync(c); + /* Also send sync_req (could use NoOp) at 32-bit wrap to avoid having + * applications see sequence 0 as that is used to indicate + * an error in sending the request */ + if((unsigned int) (c->out.request + 1) == 0) + send_sync(c); + + /* The above send_sync calls could drop the I/O lock, but this + * thread will still exclude any other thread that tries to write, + * so the sequence number postconditions still hold. */ + send_request(c, req->isvoid, workaround, flags, vector, veclen); + request = c->has_error ? 0 : c->out.request; + pthread_mutex_unlock(&c->iolock); + return request; +} + +int xcb_take_socket(xcb_connection_t *c, void (*return_socket)(void *closure), void *closure, int flags, uint64_t *sent) +{ + int ret; + if(c->has_error) + return 0; + pthread_mutex_lock(&c->iolock); + get_socket_back(c); + + /* _xcb_out_flush may drop the iolock allowing other threads to + * write requests, so keep flushing until we're done + */ + do + ret = _xcb_out_flush_to(c, c->out.request); + while (ret && c->out.request != c->out.request_written); + if(ret) + { + c->out.return_socket = return_socket; + c->out.socket_closure = closure; + if(flags) + _xcb_in_expect_reply(c, c->out.request, WORKAROUND_EXTERNAL_SOCKET_OWNER, flags); + assert(c->out.request == c->out.request_written); + *sent = c->out.request; + } + pthread_mutex_unlock(&c->iolock); + return ret; +} + +int xcb_writev(xcb_connection_t *c, struct iovec *vector, int count, uint64_t requests) +{ + int ret; + if(c->has_error) + return 0; + pthread_mutex_lock(&c->iolock); + c->out.request += requests; + ret = _xcb_out_send(c, vector, count); + pthread_mutex_unlock(&c->iolock); + return ret; +} + +int xcb_flush(xcb_connection_t *c) +{ + int ret; + if(c->has_error) + return 0; + pthread_mutex_lock(&c->iolock); + ret = _xcb_out_flush_to(c, c->out.request); + pthread_mutex_unlock(&c->iolock); + return ret; +} + +/* Private interface */ + +int _xcb_out_init(_xcb_out *out) +{ + if(pthread_cond_init(&out->socket_cond, 0)) + return 0; + out->return_socket = 0; + out->socket_closure = 0; + out->socket_moving = 0; + + if(pthread_cond_init(&out->cond, 0)) + return 0; + out->writing = 0; + + out->queue_len = 0; + + out->request = 0; + out->request_written = 0; + + if(pthread_mutex_init(&out->reqlenlock, 0)) + return 0; + out->maximum_request_length_tag = LAZY_NONE; + + return 1; +} + +void _xcb_out_destroy(_xcb_out *out) +{ + pthread_cond_destroy(&out->cond); + pthread_mutex_destroy(&out->reqlenlock); +} + +int _xcb_out_send(xcb_connection_t *c, struct iovec *vector, int count) +{ + int ret = 1; + while(ret && count) + ret = _xcb_conn_wait(c, &c->out.cond, &vector, &count); + c->out.request_written = c->out.request; + pthread_cond_broadcast(&c->out.cond); + _xcb_in_wake_up_next_reader(c); + return ret; +} + +void _xcb_out_send_sync(xcb_connection_t *c) +{ + /* wait for other writing threads to get out of my way. */ + while(c->out.writing) + pthread_cond_wait(&c->out.cond, &c->iolock); + get_socket_back(c); + send_sync(c); +} + +int _xcb_out_flush_to(xcb_connection_t *c, uint64_t request) +{ + assert(XCB_SEQUENCE_COMPARE(request, <=, c->out.request)); + if(XCB_SEQUENCE_COMPARE(c->out.request_written, >=, request)) + return 1; + if(c->out.queue_len) + { + struct iovec vec; + vec.iov_base = c->out.queue; + vec.iov_len = c->out.queue_len; + c->out.queue_len = 0; + return _xcb_out_send(c, &vec, 1); + } + while(c->out.writing) + pthread_cond_wait(&c->out.cond, &c->iolock); + assert(XCB_SEQUENCE_COMPARE(c->out.request_written, >=, request)); + return 1; +} diff --git a/libxcb/src/xcb_util.c b/libxcb/src/xcb_util.c index fcb11f042..9329b81dd 100644 --- a/libxcb/src/xcb_util.c +++ b/libxcb/src/xcb_util.c @@ -34,11 +34,11 @@ #include #include #include -#include #ifdef _WIN32 #include "xcb_windefs.h" #else +#include #include #include #include @@ -424,13 +424,24 @@ xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *displayname, int parsed = _xcb_parse_display(displayname, &host, &protocol, &display, screenp); if(!parsed) { - c = (xcb_connection_t *) &error_connection; + c = _xcb_conn_ret_error(XCB_CONN_CLOSED_PARSE_ERR); goto out; - } else + } else { +#ifdef _WIN32 + WSADATA wsaData; + if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) { + c = (xcb_connection_t *) &error_connection; + goto out; + } +#endif fd = _xcb_open(host, protocol, display); + } if(fd == -1) { - c = (xcb_connection_t *) &error_connection; + c = _xcb_conn_ret_error(XCB_CONN_ERROR); +#ifdef _WIN32 + WSACleanup(); +#endif goto out; } diff --git a/libxcb/src/xcbint.h b/libxcb/src/xcbint.h index 096576c4a..f9e5a52f7 100644 --- a/libxcb/src/xcbint.h +++ b/libxcb/src/xcbint.h @@ -174,8 +174,6 @@ void _xcb_ext_destroy(xcb_connection_t *c); /* xcb_conn.c */ -extern const int error_connection; - struct xcb_connection_t { int has_error; @@ -193,7 +191,10 @@ struct xcb_connection_t { _xcb_xid xid; }; -void _xcb_conn_shutdown(xcb_connection_t *c); +void _xcb_conn_shutdown(xcb_connection_t *c, int err); + +xcb_connection_t *_xcb_conn_ret_error(int err); + int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vector, int *count); diff --git a/libxcb/xcb-proto/NEWS b/libxcb/xcb-proto/NEWS index e6028d602..32bcc6924 100644 --- a/libxcb/xcb-proto/NEWS +++ b/libxcb/xcb-proto/NEWS @@ -1,5 +1,37 @@ +Release 1.7 (2012-01-11) +======================== +* Add missing padding bytes to ChangeKeyboardMapping request +* Corrected type of FakeInput rootX & rootY fields +* Changed Exception message in case of unknown/unhandled XML tags +* xcbgen: perform lenfield lookup within all anchestors +* Add support for new expr tags popcount, enumref, sumof +* Changed handling of anchestor types +* Assign switch name to bitcases +* Support name attribute for bitcases and set BitcaseType.has_name accordingly +* Use absolute imports in xcbgen for Python 3 compatibilit +* dri2: Update to version 1.3 (v2) +* glx: Replace some 'reserved' fields with explicit padding +* glx: Use glx:CONTEXT for share_list parameter of CreateNewContext +* glx: Use FBCONFIG type for fbconfig parameter of CreateNewContext and CreatePixmap +* glx: Add protocol for GLX_ARB_create_context and GLX_ARB_create_context_profile +* Add support for fence sync objects +* xf86dri: fix GetDrawableInfo reply +* xproto: fix TranslateCoordinates reply +* xcbgen: Add unop support +* xf86vidmode: Fix padding expressions +* dri2: Add proper padding before driver_name +* Add libdir/exec_prefix to xcb-xproto.pc +* Revive support for hex literals in protocol +* Add description of new protocol elements +* Add XKEYBOARD protocol description +* Fix ChangeHosts address string +* Fix SetFontPath path string encoding +* Fix some fields name +* Fix XKB GetState missing lookupMods field +* Add RENDER 0.11 definitions + Release 1.6 (2009-12-02) -======================= +======================== * Add DRI2 protocol, based off of dri2proto.h and the server code. (v2) * xf86dri.xml seems to have been wrong forever. Fixes bug #16894. * shape: add missing padding bytes to GetRectangles diff --git a/libxcb/xcb-proto/configure.ac b/libxcb/xcb-proto/configure.ac index 1a6ca0152..5368e2a05 100644 --- a/libxcb/xcb-proto/configure.ac +++ b/libxcb/xcb-proto/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ(2.57) AC_INIT([XCB Proto], - 1.6, + 1.7, [xcb@lists.freedesktop.org]) AC_CONFIG_SRCDIR([xcb-proto.pc.in]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) diff --git a/libxcb/xcb-proto/src/xkb.xml b/libxcb/xcb-proto/src/xkb.xml index f738378f5..e8f4c021d 100644 --- a/libxcb/xcb-proto/src/xkb.xml +++ b/libxcb/xcb-proto/src/xkb.xml @@ -1,2774 +1,2775 @@ - - - - - xproto - - - - 255 - - 32 - - - 4 - - - - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - - - - 0 - 1 - 2 - - - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - - - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - - - - 0 - 1 - - - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - - - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - - - - - 27 - 28 - 29 - 30 - 31 - - - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - - - - 6 - 7 - - - - - - - - - - - 0 - 4 - - - - 768 - 1280 - - - - - 0 - 5 - - - - 768 - - - - - 256 - 512 - 768 - 1024 - 1280 - 1536 - 65280 - - - - - 0 - 1 - 2 - 3 - - - - 254 - 255 - - - - 0 - 1 - 2 - 3 - - - - 7 - - - - 0 - 6 - 7 - - - - 7 - 6 - 5 - 4 - 3 - 2 - 1 - 0 - - - - 7 - 6 - 5 - 4 - 3 - 2 - 1 - 0 - - - - 15 - 14 - 13 - 12 - 11 - 10 - 9 - 8 - 7 - 6 - 5 - 4 - 3 - 2 - 1 - 0 - - - - 7 - 6 - 5 - 4 - 3 - 2 - 1 - 0 - - - - 0 - 1 - 2 - 3 - 4 - - - - 7 - 127 - - - - 7 - 6 - 5 - - - - 4 - 3 - 2 - 1 - 0 - - - - 4 - 3 - 2 - 1 - 0 - - - - - - - - - - - - - - - 0 - 1 - - - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - - - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - - - - 0 - 1 - 2 - 3 - 4 - - - - 0 - 1 - 2 - 3 - 4 - - - - - - - - - - - 4 - - - - - - 4 - - - 4 - - - - - - - length - - - - - - - length - - - - - - - - - - - - - - - - - - - - - - - - nMapEntries - - - - hasPreserve - nMapEntries - - - - - - - 4 - - - - - - nSyms - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - 1 - 2 - 3 - 4 - 129 - 130 - 131 - 132 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - nMapEntries - - - - preserve - nMapEntries - - - - - - - - - - nameLength - - - - valueLength - - - - - - - - - nPoints - - - - - - - - - - - nOutlines - - - - - - 4 - - - - - - - - - 4 - - - 4 - - - - - - - - - nKeys - - - - - - - - - nRows - - - - - - - - - - - nKeys - - - - - 1 - 2 - 3 - 4 - 5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - nRows - - - nDoodads - - - nOverlays - - - - - - - - length - - - - - - - - - - - - - namesPresent - - - - - mapsPresent - - - - - - - - 255 - 254 - 253 - - - - - - - - - - - - - 0 - 1 - 2 - 2 - - - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 20 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - 1 - 2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - 0 - - - - - - - - - - - - 0 - 1 - 2 - 2 - 3 - - - - 3 - 4 - 5 - 6 - - - - - - - - - - - - - - - - - - - - 0 - 2 - - - - - - - - - - - 0 - 1 - 2 - 3 - 4 - - - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - - - - - - - - - - - - - - 0 - 1 - 2 - - - - - - - 6 - - - - - - - - - - - - - - - - - - - - - - - - - 0 - 1 - - - - - - - - - - - - 0 - 1 - 2 - 3 - 4 - 5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - affectWhich - - clear - selectAll - - - - NewKeyboardNotify - - - - - StateNotify - - - - - ControlsNotify - - - - - IndicatorStateNotify - - - - - IndicatorMapNotify - - - - - NamesNotify - - - - - CompatMapNotify - - - - - BellNotify - - - - - ActionMessage - - - - - AccessXNotify - - - - - ExtensionDeviceNotify - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 32 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 32 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - present - - KeyTypes - - nTypes - - - - KeySyms - - nKeySyms - - - - KeyActions - - nKeyActions - - - totalActions - - - - KeyBehaviors - - totalKeyBehaviors - - - - VirtualMods - - nVModMapKeys - - - - ExplicitComponents - - totalKeyExplicit - - - - ModifierMap - - totalModMapKeys - - - - VirtualModMap - - totalVModMapKeys - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - present - - KeyTypes - - nTypes - - - - KeySyms - - nKeySyms - - - - KeyActions - - nKeyActions - - - totalActions - - - - KeyBehaviors - - totalKeyBehaviors - - - - VirtualMods - - nVModMapKeys - - - - ExplicitComponents - - totalKeyExplicit - - - - ModifierMap - - totalModMapKeys - - - - VirtualModMap - - totalVModMapKeys - - - - - - - - - - - - - - - - - - - - - - 16 - nSIRtrn - - - - - groupsRtrn - - - - - - - - - - - - - - - - - 16 - nSI - - - - - groups - - - - - - - - - - - - - - - - - - - - - - - - - - nIndicators - - - - - - - - - - - which - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - which - - Keycodes - - - - Geometry - - - - Symbols - - - - PhysSymbols - - - - Types - - - - Compat - - - - KeyTypeNames - - nTypes - - - - KTLevelNames - - - nTypes - - - - - - - IndicatorNames - - - indicators - - - - - VirtualModNames - - - virtualMods - - - - - GroupNames - - - groupNames - - - - - KeyNames - - nKeys - - - - KeyAliases - - nKeyAliases - - - - RGNames - - nRadioGroups - - - - - - - - - - - - - - - - - - - - - - - - which - - Keycodes - - - - Geometry - - - - Symbols - - - - PhysSymbols - - - - Types - - - - Compat - - - - KeyTypeNames - - nTypes - - - - KTLevelNames - - nKTLevels - - - - - - - IndicatorNames - - - indicators - - - - - VirtualModNames - - - virtualMods - - - - - GroupNames - - - groupNames - - - - - KeyNames - - nKeys - - - - KeyAliases - - nKeyAliases - - - - RGNames - - nRadioGroups - - - - - - - - - - - - - - - - - - - - - - - - - - - nProperties - - - nColors - - - nShapes - - - nSections - - - nDoodads - - - nKeyAliases - - - - - - - - - - - - - - - - - - - - - nProperties - - - nColors - - - nShapes - - - nSections - - - nDoodads - - - nKeyAliases - - - - - - - - - - - - - - - - - - - - - - - - - - - keymapsSpecLen - - - - keycodesSpecLen - - - - typesSpecLen - - - - compatMapSpecLen - - - - symbolsSpecLen - - - - geometrySpecLen - - - - - - - - - - - - - nKeymaps - - - nKeycodes - - - nTypes - - - nCompatMaps - - - nSymbols - - - nGeometries - - - - - - - - - - - - - keymapsSpecLen - - - - keycodesSpecLen - - - - typesSpecLen - - - - compatMapSpecLen - - - - symbolsSpecLen - - - - geometrySpecLen - - - - - - - - - - - - reported - - Types - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - present - - KeyTypes - - nTypes - - - - KeySyms - - nKeySyms - - - - KeyActions - - nKeyActions - - - totalActions - - - - KeyBehaviors - - totalKeyBehaviors - - - - VirtualMods - - nVModMapKeys - - - - ExplicitComponents - - totalKeyExplicit - - - - ModifierMap - - totalModMapKeys - - - - VirtualModMap - - totalVModMapKeys - - - - - - CompatMap - - - - - - - - - - 16 - nSIRtrn - - - - - groupsRtrn - - - - - ClientSymbols - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - present - - KeyTypes - - nTypes - - - - KeySyms - - nKeySyms - - - - KeyActions - - nKeyActions - - - totalActions - - - - KeyBehaviors - - totalKeyBehaviors - - - - VirtualMods - - nVModMapKeys - - - - ExplicitComponents - - totalKeyExplicit - - - - ModifierMap - - totalModMapKeys - - - - VirtualModMap - - totalVModMapKeys - - - - - - ServerSymbols - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - present - - KeyTypes - - nTypes - - - - KeySyms - - nKeySyms - - - - KeyActions - - nKeyActions - - - totalActions - - - - KeyBehaviors - - totalKeyBehaviors - - - - VirtualMods - - nVModMapKeys - - - - ExplicitComponents - - totalKeyExplicit - - - - ModifierMap - - totalModMapKeys - - - - VirtualModMap - - totalVModMapKeys - - - - - - IndicatorMaps - - - - - - - nIndicators - - - - KeyNames - - - - - - - - - - - - - - - - which - - Keycodes - - - - Geometry - - - - Symbols - - - - PhysSymbols - - - - Types - - - - Compat - - - - KeyTypeNames - - nTypes - - - - KTLevelNames - - nKTLevels - - - - - - - IndicatorNames - - - indicators - - - - - VirtualModNames - - - virtualMods - - - - - GroupNames - - - groupNames - - - - - KeyNames - - nKeys - - - - KeyAliases - - nKeyAliases - - - - RGNames - - nRadioGroups - - - - - - OtherNames - - - - - - - - - - - - - - - - which - - Keycodes - - - - Geometry - - - - Symbols - - - - PhysSymbols - - - - Types - - - - Compat - - - - KeyTypeNames - - nTypes - - - - KTLevelNames - - nKTLevels - - - - - - - IndicatorNames - - - indicators - - - - - VirtualModNames - - - virtualMods - - - - - GroupNames - - - groupNames - - - - - KeyNames - - nKeys - - - - KeyAliases - - nKeyAliases - - - - RGNames - - nRadioGroups - - - - - - Geometry - - - - - - - - - - - - - - - - - nProperties - - - nColors - - - nShapes - - - nSections - - - nDoodads - - - nKeyAliases - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - nameLen - - - nBtnsRtrn - - - nDeviceLedFBs - - - - - - - - - - - - - nBtns - - - nDeviceLedFBs - - - - - - - - - - - - msgLength - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + xproto + + + + 255 + + 32 + + + 4 + + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + + + + 0 + 1 + 2 + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + + + + 0 + 1 + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + + + + + 27 + 28 + 29 + 30 + 31 + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + + + + 6 + 7 + + + + + + + + + + + 0 + 4 + + + + 768 + 1280 + + + + + 0 + 5 + + + + 768 + + + + + 256 + 512 + 768 + 1024 + 1280 + 1536 + 65280 + + + + + 0 + 1 + 2 + 3 + + + + 254 + 255 + + + + 0 + 1 + 2 + 3 + + + + 7 + + + + 0 + 6 + 7 + + + + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0 + + + + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0 + + + + 15 + 14 + 13 + 12 + 11 + 10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0 + + + + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0 + + + + 0 + 1 + 2 + 3 + 4 + + + + 7 + 127 + + + + 7 + 6 + 5 + + + + 4 + 3 + 2 + 1 + 0 + + + + 4 + 3 + 2 + 1 + 0 + + + + + + + + + + + + + + + 0 + 1 + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + + + + 0 + 1 + 2 + 3 + 4 + + + + 0 + 1 + 2 + 3 + 4 + + + + + + + + + + + 4 + + + + + + 4 + + + 4 + + + + + + + length + + + + + + + length + + + + + + + + + + + + + + + + + + + + + + + + nMapEntries + + + + hasPreserve + nMapEntries + + + + + + + 4 + + + + + + nSyms + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 1 + 2 + 3 + 4 + 129 + 130 + 131 + 132 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + nMapEntries + + + + preserve + nMapEntries + + + + + + + + + + nameLength + + + + valueLength + + + + + + + + + nPoints + + + + + + + + + + + nOutlines + + + + + + 4 + + + + + + + + + 4 + + + 4 + + + + + + + + + nKeys + + + + + + + + + nRows + + + + + + + + + + + nKeys + + + + + 1 + 2 + 3 + 4 + 5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + nRows + + + nDoodads + + + nOverlays + + + + + + + + length + + + + + + + + + + + + + namesPresent + + + + + mapsPresent + + + + + + + + 255 + 254 + 253 + + + + + + + + + + + + + 0 + 1 + 2 + 2 + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 1 + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 0 + + + + + + + + + + + + 0 + 1 + 2 + 2 + 3 + + + + 3 + 4 + 5 + 6 + + + + + + + + + + + + + + + + + + + + 0 + 2 + + + + + + + + + + + 0 + 1 + 2 + 3 + 4 + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + + + + + + + + + + + + + + 0 + 1 + 2 + + + + + + + 6 + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 1 + + + + + + + + + + + + 0 + 1 + 2 + 3 + 4 + 5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + affectWhich + + clear + selectAll + + + + NewKeyboardNotify + + + + + StateNotify + + + + + ControlsNotify + + + + + IndicatorStateNotify + + + + + IndicatorMapNotify + + + + + NamesNotify + + + + + CompatMapNotify + + + + + BellNotify + + + + + ActionMessage + + + + + AccessXNotify + + + + + ExtensionDeviceNotify + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + present + + KeyTypes + + nTypes + + + + KeySyms + + nKeySyms + + + + KeyActions + + nKeyActions + + + totalActions + + + + KeyBehaviors + + totalKeyBehaviors + + + + VirtualMods + + nVModMapKeys + + + + ExplicitComponents + + totalKeyExplicit + + + + ModifierMap + + totalModMapKeys + + + + VirtualModMap + + totalVModMapKeys + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + present + + KeyTypes + + nTypes + + + + KeySyms + + nKeySyms + + + + KeyActions + + nKeyActions + + + totalActions + + + + KeyBehaviors + + totalKeyBehaviors + + + + VirtualMods + + nVModMapKeys + + + + ExplicitComponents + + totalKeyExplicit + + + + ModifierMap + + totalModMapKeys + + + + VirtualModMap + + totalVModMapKeys + + + + + + + + + + + + + + + + + + + + + + 16 + nSIRtrn + + + + + groupsRtrn + + + + + + + + + + + + + + + + + 16 + nSI + + + + + groups + + + + + + + + + + + + + + + + + + + + + + + + + + nIndicators + + + + + + + + + + + which + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + which + + Keycodes + + + + Geometry + + + + Symbols + + + + PhysSymbols + + + + Types + + + + Compat + + + + KeyTypeNames + + nTypes + + + + KTLevelNames + + + nTypes + + + + + + + IndicatorNames + + + indicators + + + + + VirtualModNames + + + virtualMods + + + + + GroupNames + + + groupNames + + + + + KeyNames + + nKeys + + + + KeyAliases + + nKeyAliases + + + + RGNames + + nRadioGroups + + + + + + + + + + + + + + + + + + + + + + + + which + + Keycodes + + + + Geometry + + + + Symbols + + + + PhysSymbols + + + + Types + + + + Compat + + + + KeyTypeNames + + nTypes + + + + KTLevelNames + + nKTLevels + + + + + + + IndicatorNames + + + indicators + + + + + VirtualModNames + + + virtualMods + + + + + GroupNames + + + groupNames + + + + + KeyNames + + nKeys + + + + KeyAliases + + nKeyAliases + + + + RGNames + + nRadioGroups + + + + + + + + + + + + + + + + + + + + + + + + + + + nProperties + + + nColors + + + nShapes + + + nSections + + + nDoodads + + + nKeyAliases + + + + + + + + + + + + + + + + + + + + + nProperties + + + nColors + + + nShapes + + + nSections + + + nDoodads + + + nKeyAliases + + + + + + + + + + + + + + + + + + + + + + + + + + + keymapsSpecLen + + + + keycodesSpecLen + + + + typesSpecLen + + + + compatMapSpecLen + + + + symbolsSpecLen + + + + geometrySpecLen + + + + + + + + + + + + + nKeymaps + + + nKeycodes + + + nTypes + + + nCompatMaps + + + nSymbols + + + nGeometries + + + + + + + + + + + + + keymapsSpecLen + + + + keycodesSpecLen + + + + typesSpecLen + + + + compatMapSpecLen + + + + symbolsSpecLen + + + + geometrySpecLen + + + + + + + + + + + + reported + + Types + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + present + + KeyTypes + + nTypes + + + + KeySyms + + nKeySyms + + + + KeyActions + + nKeyActions + + + totalActions + + + + KeyBehaviors + + totalKeyBehaviors + + + + VirtualMods + + nVModMapKeys + + + + ExplicitComponents + + totalKeyExplicit + + + + ModifierMap + + totalModMapKeys + + + + VirtualModMap + + totalVModMapKeys + + + + + + CompatMap + + + + + + + + + + 16 + nSIRtrn + + + + + groupsRtrn + + + + + ClientSymbols + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + present + + KeyTypes + + nTypes + + + + KeySyms + + nKeySyms + + + + KeyActions + + nKeyActions + + + totalActions + + + + KeyBehaviors + + totalKeyBehaviors + + + + VirtualMods + + nVModMapKeys + + + + ExplicitComponents + + totalKeyExplicit + + + + ModifierMap + + totalModMapKeys + + + + VirtualModMap + + totalVModMapKeys + + + + + + ServerSymbols + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + present + + KeyTypes + + nTypes + + + + KeySyms + + nKeySyms + + + + KeyActions + + nKeyActions + + + totalActions + + + + KeyBehaviors + + totalKeyBehaviors + + + + VirtualMods + + nVModMapKeys + + + + ExplicitComponents + + totalKeyExplicit + + + + ModifierMap + + totalModMapKeys + + + + VirtualModMap + + totalVModMapKeys + + + + + + IndicatorMaps + + + + + + + nIndicators + + + + KeyNames + + + + + + + + + + + + + + + + which + + Keycodes + + + + Geometry + + + + Symbols + + + + PhysSymbols + + + + Types + + + + Compat + + + + KeyTypeNames + + nTypes + + + + KTLevelNames + + nKTLevels + + + + + + + IndicatorNames + + + indicators + + + + + VirtualModNames + + + virtualMods + + + + + GroupNames + + + groupNames + + + + + KeyNames + + nKeys + + + + KeyAliases + + nKeyAliases + + + + RGNames + + nRadioGroups + + + + + + OtherNames + + + + + + + + + + + + + + + + which + + Keycodes + + + + Geometry + + + + Symbols + + + + PhysSymbols + + + + Types + + + + Compat + + + + KeyTypeNames + + nTypes + + + + KTLevelNames + + nKTLevels + + + + + + + IndicatorNames + + + indicators + + + + + VirtualModNames + + + virtualMods + + + + + GroupNames + + + groupNames + + + + + KeyNames + + nKeys + + + + KeyAliases + + nKeyAliases + + + + RGNames + + nRadioGroups + + + + + + Geometry + + + + + + + + + + + + + + + + + nProperties + + + nColors + + + nShapes + + + nSections + + + nDoodads + + + nKeyAliases + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + nameLen + + + nBtnsRtrn + + + nDeviceLedFBs + + + + + + + + + + + + + nBtns + + + nDeviceLedFBs + + + + + + + + + + + + msgLength + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libxcb/xcb-proto/src/xproto.xml b/libxcb/xcb-proto/src/xproto.xml index cbb5fa2db..42a6852a1 100644 --- a/libxcb/xcb-proto/src/xproto.xml +++ b/libxcb/xcb-proto/src/xproto.xml @@ -1482,7 +1482,10 @@ authorization from the authors. - + + + font_qty + @@ -2295,7 +2298,7 @@ authorization from the authors. - + address_len -- cgit v1.2.3