diff options
-rw-r--r-- | ChangeLog | 855 | ||||
-rw-r--r-- | INSTALL | 291 | ||||
-rw-r--r-- | Makefile.am | 23 | ||||
-rw-r--r-- | NEWS | 12 | ||||
-rw-r--r-- | README | 39 | ||||
-rwxr-xr-x | autogen.sh | 4 | ||||
-rw-r--r-- | configure.ac | 30 | ||||
-rw-r--r-- | m4/ax_compare_version.m4 | 174 | ||||
-rw-r--r-- | m4/xcb_util_common.m4 | 44 | ||||
-rw-r--r-- | m4/xcb_util_m4_with_include_path.m4 | 24 | ||||
-rw-r--r-- | packaging/xcb-util.spec | 66 | ||||
-rw-r--r-- | src/Makefile.am | 33 | ||||
-rw-r--r-- | src/atomlist.m4 | 71 | ||||
-rw-r--r-- | src/atoms.c | 690 | ||||
-rw-r--r-- | src/atoms.gperf.m4 | 121 | ||||
-rw-r--r-- | src/event.c | 257 | ||||
-rw-r--r-- | src/xcb_atom.h | 21 | ||||
-rw-r--r-- | src/xcb_atom.h.m4 | 21 | ||||
-rw-r--r-- | src/xcb_aux.c | 374 | ||||
-rw-r--r-- | src/xcb_aux.h | 214 | ||||
-rw-r--r-- | src/xcb_bitops.h | 212 | ||||
-rw-r--r-- | src/xcb_event.h | 90 | ||||
-rw-r--r-- | src/xcb_util.h | 8 | ||||
-rw-r--r-- | xcb-atom.pc.in | 11 | ||||
-rw-r--r-- | xcb-aux.pc.in | 11 | ||||
-rw-r--r-- | xcb-event.pc.in | 11 | ||||
-rw-r--r-- | xcb-renderutil.pc.in | 11 | ||||
-rw-r--r-- | xcb-util.pc.in | 11 | ||||
-rw-r--r-- | xcb_util_intro.in | 24 |
29 files changed, 3753 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..3248a22 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,855 @@ +commit 8120792a02898625ed344828ad378b54b308e029 +Author: Arnaud Fontaine <arnau@debian.org> +Date: Tue Apr 26 01:30:17 2011 +0900 + + Release 0.3.8 + + Signed-off-by: Arnaud Fontaine <arnau@debian.org> + +commit 9c9d66a4dbe71328b9e38dc6d45b99eb06d19553 +Author: Arnaud Fontaine <arnau@debian.org> +Date: Tue Apr 26 01:30:13 2011 +0900 + + Fix package name + + Signed-off-by: Arnaud Fontaine <arnau@debian.org> + +commit eb0b55aa4ea037ebbe76c5820c3b1f4be30fcd33 +Author: Dirk Wallenstein <halsmit@t-online.de> +Date: Tue Apr 5 09:58:28 2011 +0200 + + Use an absolute URL for the m4 submodule + + A relative submodule URL requires m4 duplicates relative to every fork or local + mirror of this module. To select a different protocol with an absolute + submodule URL, the url.<base>.insteadOf configuration option can be used. + + Signed-off-by: Dirk Wallenstein <halsmit@t-online.de> + Reviewed-by: Arnaud Fontaine <arnau@debian.org> + Reviewed-by: Gaetan Nadon <memsize@videotron.ca> + +commit 4824b7dc328751dcfc48a3c2ae0f2be3df217ebd +Author: Jon TURNEY <jon.turney@dronecode.org.uk> +Date: Tue Mar 22 15:34:46 2011 +0000 + + Link with -no-undefined + + Use -no-undefined to assure libtool that the library has no unresolved + symbols at link time, so that libtool will build a shared library for + platforms require that all symbols are resolved when the library is linked. + + Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> + Acked-by: Julien Cristau <jcristau@debian.org> + Reviewed-by: Arnaud Fontaine <arnau@debian.org> + +commit fd626329982cc2766e5a85a75ea2800b7aa3f114 +Author: Gaetan Nadon <memsize@videotron.ca> +Date: Thu Mar 10 19:50:36 2011 -0500 + + pkg-config files: remove LIBS which is unrequired and undesirable + + LIBS is not supplied by the package configuration, it may be anything + the builder sets through the command line. Only -lxcb-util is needed. + + Signed-off-by: Gaetan Nadon <memsize@videotron.ca> + Reviewed-by: Arnaud Fontaine <arnau@debian.org> + +commit 363622a64830c75ee1c014f49f72c698a390f24d +Author: Gaetan Nadon <memsize@videotron.ca> +Date: Thu Mar 10 19:50:35 2011 -0500 + + Remove the Doxyfile which is unused, out dated and wrong. + + Signed-off-by: Gaetan Nadon <memsize@videotron.ca> + Reviewed-by: Arnaud Fontaine <arnau@debian.org> + +commit ca5b57231c0e9a3d4eda3530c4973323ed7f6977 +Author: Gaetan Nadon <memsize@videotron.ca> +Date: Thu Mar 10 19:50:35 2011 -0500 + + Fix distcheck due to xcb_atom.h + + Make does not see this target as being located in the builddir. + The main issue is that "built source" is not build in the directory. + + Rather than investing efforts in workarounds, this patch + builds the library the same way all other xorg libraries are built. + + Signed-off-by: Gaetan Nadon <memsize@videotron.ca> + Reviewed-by: Arnaud Fontaine <arnau@debian.org> + +commit 0de786c46a81fa10e07ad77ff0992a44abe4ac2b +Author: Gaetan Nadon <memsize@videotron.ca> +Date: Sun Mar 6 17:52:44 2011 -0500 + + config: generate ChangeLog and INSTALL + + By copying a snippet of Makefile for xorg modules. + One side-effect is that Makefile.in is no longer + deleted on maintainer clean. This should never be done as + it leaves your configuration in a half-broken state. + + Signed-off-by: Gaetan Nadon <memsize@videotron.ca> + Signed-off-by: Arnaud Fontaine <arnau@mini-dweeb.org> + +commit 14747e0ef8dfb6668e2bb2e8a6b0c9ef2dace7b3 +Author: Gaetan Nadon <memsize@videotron.ca> +Date: Sun Mar 6 17:52:43 2011 -0500 + + config: use the default xorg .gitignore file + + This will save future maintenance when module structure/tools change. + This patch depends on the util-common-m4 submodule patch in the m4 path + + Signed-off-by: Gaetan Nadon <memsize@videotron.ca> + Signed-off-by: Arnaud Fontaine <arnau@mini-dweeb.org> + +commit 02289cab0b802a1d21fc9d480176e83b36e566b7 +Author: Arnaud Fontaine <arnau@debian.org> +Date: Sat Sep 4 17:42:12 2010 +0100 + + Bump version to 0.3.8 + +commit 4010e925c7afe0c38dc20a364bf6fc41c99f6da1 +Author: Arnaud Fontaine <arnau@debian.org> +Date: Sat Sep 4 17:27:52 2010 +0100 + + Remove useless xcb_atom_get_fast*() and xcb_atom_get_name(). + + These functions and their types would require to write their unchecked + equivalent however it's not worth the effort when considering that + they only hide InternAtom request/reply and nothing else. + +commit 00a192d88d96bc838366e1541eab80fa9ecd23b3 +Author: Arnaud Fontaine <arnau@debian.org> +Date: Sat Sep 4 17:20:55 2010 +0100 + + Remove synchronous xcb_atom_get() + +commit 2f0334b3eb49fa3a0d6daf6b9dde10e480a5c59f +Author: Arnaud Fontaine <arnau@debian.org> +Date: Sat Sep 4 17:18:02 2010 +0100 + + Remove deprecated atoms. + + Atoms defined in this library has been moved to xproto and marked as + deprecated almost one year ago. + +commit 118a3c86b3d3b2fab20f365e4a5703e40ad2e1b1 +Author: Arnaud Fontaine <arnau@debian.org> +Date: Mon Aug 9 15:47:02 2010 -0500 + + Create a single shared library and header file and reset SONAME + +commit d57825bee26d57625fe6629b44b33506894b9b6d +Author: Arnaud Fontaine <arnau@debian.org> +Date: Sat Sep 4 13:15:42 2010 +0100 + + Split up atom, aux event into their own repository + +commit 81c62e7a04213abefa1ea82819887aaaa3c31a74 +Author: Jamey Sharp <jamey@minilop.net> +Date: Thu Jun 24 10:48:35 2010 -0700 + + Delete callback-based APIs for events, properties, and replies. + + They are poorly designed and not terribly useful. I wrote the original + versions of these libraries for demonstration purposes and would like to + actively discourage anyone from actually using them. + + After deleting the callback-based APIs, there was nothing interesting + left in property or reply, so those libraries are deleted outright. The + event library is no longer particularly related to event handling, but + that's a problem for another commit. + + The icccm library had some simple hooks for integrating with the + property library, which are precisely as useful as the property library + itself, so I deleted them too. (Arnaud suggested this in + <sa5ocib84hf.fsf@Orfeo.duckcorp.org>.) + + Since the icccm and event libraries have changed interfaces, this commit + bumps their SONAME versions. + + Signed-off-by: Jamey Sharp <jamey@minilop.net> + Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net> + Reviewed-by: Josh Triplett <josh@joshtriplett.org> + Acked-by: Julien Cristau <jcristau@debian.org> + +commit 16dd0d5a26b6efc8ed49daa56c9006a0abcc3f53 +Author: Jamey Sharp <jamey@minilop.net> +Date: Thu Jun 24 11:06:48 2010 -0700 + + Delete redundant core-protocol error codes. + + XCB already defines the error codes, though with unfortunate names. The + following sed replacements should correct any code that was using these + definitions: + + s/\<XCB_EVENT_ERROR_SUCCESS\>/0/g + s/\<XCB_EVENT_ERROR_BAD_COLOR\>/XCB_COLORMAP/g + s/\<XCB_EVENT_ERROR_BAD_GC\>/XCB_G_CONTEXT/g + s/\<XCB_EVENT_ERROR_BAD_/XCB_/g + + Signed-off-by: Jamey Sharp <jamey@minilop.net> + +commit 9139e56dfc3d9a66ab41df2032652aca58f32a77 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Mon Jun 14 13:49:09 2010 -0700 + + Rename XCB_EVENT_ERROR_SUCESS to XCB_EVENT_ERROR_SUCCESS + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + Signed-off-by: Jamey Sharp <jamey@minilop.net> + +commit 7a5ec0c175043d2b6c7a5e8fb381754884c141a2 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Mon Jun 14 13:49:08 2010 -0700 + + Fix typos in various header comments + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + Signed-off-by: Jamey Sharp <jamey@minilop.net> + +commit 2cbc3fcce36c2f5b2c5baec39bea26744bedd4fa +Author: Arnaud Fontaine <arnau@debian.org> +Date: Thu Feb 11 14:45:11 2010 +0000 + + Add AM_MAINTAINER_MODE for vendors + +commit bb143c54e578f69f33dab39fbdc62d2e9bb806cc +Author: Peter Harris <pharris@opentext.com> +Date: Fri Nov 6 15:52:42 2009 -0500 + + Deprecate namespaceless pre-defined atoms + + Signed-off-by: Peter Harris <pharris@opentext.com> + +commit 2ac7acd95bc775af21f65d8c5426e92d28780ab8 +Author: Jon TURNEY <jon.turney@dronecode.org.uk> +Date: Tue Oct 20 18:17:46 2009 +0100 + + Update autogen.sh to one that does builddir != srcdir + +commit ee40bb3b6a7c5c69c8693a573a459484a24a49d1 +Author: Arnaud Fontaine <arnau@debian.org> +Date: Fri Sep 25 13:08:15 2009 +0100 + + Bump version to 0.3.7 + +commit 60766d8a99cc67df7aa84d6e242f738d38c21938 +Author: Arnaud Fontaine <arnau@debian.org> +Date: Mon Aug 3 17:18:41 2009 +0200 + + Bump version to 0.3.6 + +commit 9ce2a1868f4992b3854400348dfd1dc59a3acf11 +Author: Arnaud Fontaine <arnau@debian.org> +Date: Wed Jul 15 16:26:56 2009 +0100 + + event: fix compiler warning due to missing include for memset + +commit 17cfe28823085af5d7e174e77482e9157bdbe6d9 +Author: Arnaud Fontaine <arnau@debian.org> +Date: Wed Jul 15 16:23:41 2009 +0100 + + event: update to libxcb 1.4 + + Remove useless macros to get error information because libxcb 1.4 now + provides additional fields (major_opcode, minor_opcode and + resource_id) like Xlib. + +commit 5755a6ea3f5d0b92ddfccd2439d802ea0af70dc8 +Author: Arnaud Fontaine <arnau@debian.org> +Date: Wed Jun 3 20:50:32 2009 +0900 + + Check for ssize_t in configure for xcb-util-common.h + +commit 214afd4127898d047d2c2c66c974ec9b1d50b6e4 +Author: Mikhail Gusarov <dottedmag@dottedmag.net> +Date: Sat May 30 17:10:35 2009 +0700 + + Typo in configure.ac + + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit fbc320ee434b45c37f7501e1cb31c9e51369e79a +Author: Julien Danjou <julien@danjou.info> +Date: Fri May 29 08:34:20 2009 +0200 + + Release xcb-util 0.3.5 + + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit dc9c1424ac0fe8543904bbe8365462246d703f39 +Author: Bob Ham <rah@bash.sh> +Date: Mon May 25 12:22:13 2009 +0200 + + Add a check on xproto version libxcb was compiled with + + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit 5e88d1fa0a4bdd2b19c7d9b5fdfb2d70a7fdc2ae +Author: Bart Massey <bart@cs.pdx.edu> +Date: Thu May 21 10:44:47 2009 -0700 + + wrapped xcb_atom.h for C++ per bug report of <comick@autistici.org> + +commit 04003178b1f9bc0c69a6ced184fbf81e5ee7b5ad +Author: Mikhail Gusarov <dottedmag@dottedmag.net> +Date: Sat May 16 02:08:46 2009 +0700 + + Zero out handlers list in xcb_event_handlers_init + + xcb_event_handle relies on the fact that handler for non-handled + event is NULL. Initialize handlers in xcb_event_handlers_init + to avoid calling function by uninitialized pointer. + + Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> + Signed-off-by: Peter Harris <pharris@opentext.com> + +commit 9002b649f3abb48337f16480cec2cc6f5eedef70 +Author: Alan Coopersmith <alan.coopersmith@sun.com> +Date: Tue Apr 21 15:27:24 2009 -0700 + + Make sure m4 supports -I flag, if not, try finding gnu m4 + + Solaris m4 does not support -I flag, but gnu m4 is included in + recent Solaris & OpenSolaris releases (and must already be installed + on any machine that runs autoconf to generate configure scripts) + + Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com> + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit 296a3d0a11f0ed609fe5c5c9036d353fe9e715cd +Author: Mikhail Gusarov <dottedmag@dottedmag.net> +Date: Sun Apr 19 20:01:00 2009 +0700 + + Add xcb_aux_change_window_attributes_checked + + There is xcb_aux_change_window_attributes, add the matching checked + function. + + Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit 6b36dc016a6d51df63324079ef3178599e8f802b +Author: Julien Danjou <julien@danjou.info> +Date: Wed Apr 15 15:21:21 2009 +0200 + + bump version to 0.3.4 + + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit 02c8c43a95bad0a390764c8aafe0699b69e6ee40 +Author: Julien Danjou <julien@danjou.info> +Date: Tue Apr 14 11:44:06 2009 +0200 + + event: add define to get request and error types + + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit bd40d52032e2fe7307171dc090754550cb4a302d +Author: Julien Danjou <julien@danjou.info> +Date: Tue Apr 14 11:24:00 2009 +0200 + + event: add error values + + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit 59b946a9429137cd9880e592e19f8db470dca049 +Author: Julien Danjou <julien@danjou.info> +Date: Tue Apr 14 11:16:52 2009 +0200 + + event: simplify proto + + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit 94a25d209e1cdfcdaf8e4bfd2cdb1bcb82042d84 +Author: Julien Danjou <julien@danjou.info> +Date: Thu Apr 2 12:11:01 2009 +0200 + + event: add functions to convert event/errors to labels + + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit 55ad587c67fe7890c71ef151ad15868d9929f2e1 +Author: Julien Danjou <julien@danjou.info> +Date: Sat Jan 31 15:08:44 2009 +0100 + + Release xcb-util 0.3.3 + +commit ca5debb213cd7f650c3ce80261e08c72620831a3 +Author: Julien Danjou <julien@danjou.info> +Date: Tue Dec 16 14:14:50 2008 +0100 + + Release xcb-util 0.3.2 + + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit 3ea3d2816452896dc62d0e6838e8c421805a533d +Author: Peter Harris <peter.harris@hummingbird.com> +Date: Sat Nov 29 12:26:46 2008 -0500 + + Don't call exit() in xcb_aux_get_depth; return 0 instead. + +commit b73811ede8e84896a202cd15121e0ed62d7143d0 +Author: Julien Danjou <julien@danjou.info> +Date: Fri Nov 21 10:49:09 2008 +0100 + + build: add check for xproto >= 7.0.8 + + This is needed to have _X_INLINE. + + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit c335374c92f231365630708d028ffa7c927459f4 +Author: Jonathan Landis <landijk-dev@yahoo.com> +Date: Fri Nov 21 10:10:15 2008 +0100 + + Fix copyright statement + + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit 887d528bfa11fafc81431e41fe5e8655464a5195 +Author: Julien Danjou <julien@danjou.info> +Date: Thu Nov 20 15:34:54 2008 +0100 + + Release xcb-util 0.3.1 + +commit 5f491f9e612ff143a3e559820c5494b061be2433 +Author: Julien Danjou <julien@danjou.info> +Date: Fri Nov 7 11:02:08 2008 +0100 + + configure: stop if m4 is not found + + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit e96984a40f43114b8ff7640a2c017442105ab28a +Author: Ulrich Eckhardt <doomster@knuut.de> +Date: Mon Sep 29 16:35:10 2008 -0700 + + "Clean up" magic structure stuff for C++. + + Signed-off-by: Bart Massey <bart@cs.pdx.edu> + +commit 1b81ef7e1abffb9a244183d6fbf4a1e6e2cb11e1 +Author: Henning Sten <henning.sten@yahoo.com> +Date: Wed Sep 17 20:59:23 2008 +0200 + + introduce function xcb_atom_get (essentially a synchronous xcb_intern_atom, use it only on non-performance critical execution paths) + + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit 68c0ed4b85a526ff70e5363d6468ee9603f448d1 +Author: Henning Sten <henning.sten@yahoo.com> +Date: Tue Sep 16 20:28:13 2008 +0200 + + add doxygen documentation markup for XCB_EVENT_RESPONSE_TYPE_MASK macro + + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit 23b1626b4972c234a12200c46aa416846d8f9fb7 +Author: Julien Danjou <julien@danjou.info> +Date: Tue Sep 16 17:11:40 2008 +0200 + + doc: enable doxygen doc in various submodule + + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit 612dc375bfbf5d92da31b0d4e24bd96a539be0f0 +Author: Julien Danjou <julien@danjou.info> +Date: Tue Sep 16 17:11:14 2008 +0200 + + doc: add various authors, remove old todo item + + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit 06fe4ed34220807e0f0e7c75ad6d542b157e4ea4 +Author: Julien Danjou <julien@danjou.info> +Date: Tue Sep 16 15:27:49 2008 +0200 + + event: define XCB_EVENT_RESPONSE_TYPE_MASK + + And use it. + + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit cb96efd21d7cfaa2e99d618fe6fac120d34aed02 +Author: Julien Danjou <julien@danjou.info> +Date: Tue Sep 16 15:23:24 2008 +0200 + + event: rework, rename and add some documentation + + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit 38a56fc80ebbd683818231fe2f8253ef93071839 +Author: Julien Danjou <julien@danjou.info> +Date: Tue Sep 16 11:03:23 2008 +0200 + + atom: include xcb headers + + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit f33cf7f649e14be9658e46d0978e687a76c4ea1c +Author: Julien Danjou <julien@danjou.info> +Date: Mon Sep 15 21:00:24 2008 +0200 + + atom: bump version info + + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit 40a1102d1329e452a837bfe559fbd0a9cf3767b6 +Author: Julien Danjou <julien@danjou.info> +Date: Mon Sep 15 20:59:12 2008 +0200 + + atom: prefix functions and types + + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit c607afb79b0a16b6f41d8999cb61e52a89241fac +Author: Arnaud Fontaine <arnau@debian.org> +Date: Mon Sep 8 17:46:42 2008 +0200 + + [icccm] Bump library version number to 0.3.0. + +commit 5f8dfed11b3fb485f952ab42971d05cf75a305b8 +Author: Arnaud Fontaine <arnau@debian.org> +Date: Thu Sep 11 19:06:57 2008 +0200 + + [atom] Move '*discriminated_atom*' functions from icccm to atom + +commit 8a4dfb917f12b4e3ef36d135081379927c1ca1db +Author: Keith Packard <keithp@keithp.com> +Date: Sun Sep 7 21:46:45 2008 -0700 + + xcb_mask must not be zero when n == 32. + + left shift of a 32-bit value by 32 is undefined, don't try to use it. + +commit 07385216de016e272a7d65978e8c2a86782a62e3 +Author: Julien Danjou <julien@danjou.info> +Date: Fri Aug 1 11:43:26 2008 +0200 + + prepare 0.2.1 release + + Signed-off-by: Julien Danjou <julien@danjou.info> + +commit 428778df9148a070aaac067d8b9cccf7b6fa9406 +Author: Bart Massey <bart@cs.pdx.edu> +Date: Wed Mar 5 13:27:07 2008 -0800 + + fixed missed reference in previous patch + +commit 0f9f33d9419d6bbb79af81775f7ec5e8ba5f5e0a +Author: Arnaud Fontaine <arnaud@andesi.org> +Date: Mon Jan 28 14:26:05 2008 -0800 + + Add xcb_poll_for_event_loop and rename xcb_event_loop to match. + + I'm currently porting Awesome[0] from Xlib to XCB as a school project for + my bachelor. I discussed with Vincent about adding a non-blocking + xcb_event_loop on IRC because I had to write one for Awesome and wondered + if this kind of function could be added to xcb-util. + + [0] http://awesome.naquadah.org + + Signed-off-by: Jamey Sharp <jamey@minilop.net> + +commit 3ce9210fe2a5597699b8e4fec8fc030999be51e7 +Author: Bart Massey <bart@cs.pdx.edu> +Date: Wed Mar 5 13:24:34 2008 -0800 + + made xcb_handle_event() externally visible + +commit ef27e7f190e9840efa000019b29fbdd7a865caeb +Author: Bart Massey <bart@cs.pdx.edu> +Date: Mon Dec 17 09:10:59 2007 -0800 + + re-fixed my stupid visual_class typo; thanks to Thomas Hunger for the report + +commit 5d22c197f90f5be91cb247b04581962f4426ef08 +Author: Bart Massey <bart@cs.pdx.edu> +Date: Sat Dec 8 15:27:04 2007 -0800 + + fixed existing roundups, added rounddowns + +commit 8b825188a070abef9767bc199868ae5bfc79068c +Author: Bart Massey <bart@cs.pdx.edu> +Date: Sat Dec 8 13:29:19 2007 -0800 + + added aux_clear_window() for xlib compatibility, in spite of misgivings + +commit 08e3c71b1ad0b75bd4231c23bb143e81b4d64473 +Author: Bart Massey <bart@cs.pdx.edu> +Date: Fri Dec 7 00:51:31 2007 -0800 + + fixed xcb_params_gc_t so that tile_stipple_origin members had reasonable naming + +commit de72d4184249afb381a6761cc369f2e7cfc16d3d +Author: Bart Massey <bart@cs.pdx.edu> +Date: Fri Dec 7 00:48:25 2007 -0800 + + used doxygen -u to create a much more elaborate doxyfile + +commit ed9113c3e79bd951ad3a36f64fc6a1fd6fca0648 +Author: Bart Massey <bart@cs.pdx.edu> +Date: Fri Dec 7 00:30:32 2007 -0800 + + added fast inline bitops xcb_bitops.h + +commit 78accd46db65b88e1e2c0e3d714038e7ba679533 +Author: Bart Massey <bart@cs.pdx.edu> +Date: Fri Dec 7 00:27:52 2007 -0800 + + added aux_set_line_attributes_checked + +commit 3bf56c9d1d1e8b2af7869e02a4a0d3804fca8212 +Author: Bart Massey <bart@cs.pdx.edu> +Date: Fri Dec 7 00:24:57 2007 -0800 + + added PARAM macros + +commit 5d00736869e46a5e142867c08d2727b2d30a6156 +Author: Bart Massey <bart@cs.pdx.edu> +Date: Fri Dec 7 00:22:51 2007 -0800 + + xcb_aux_parse_color() + +commit adc7f0f474cda01de0b26b0bc4dc7aa3960458c6 +Author: Bart Massey <bart@cs.pdx.edu> +Date: Fri Dec 7 00:20:11 2007 -0800 + + added checked version of aux_change_gc function + +commit 47ec324d913bc4e11b0db399ac28f1e106bc7037 +Author: Bart Massey <bart@cs.pdx.edu> +Date: Fri Dec 7 00:18:10 2007 -0800 + + added checked versions of aux_create_window and aux_create_gc functions + +commit 71f52d1a1807c471b713064adf249c90d73f3b3f +Author: Bart Massey <bart@cs.pdx.edu> +Date: Fri Dec 7 00:14:29 2007 -0800 + + added xcb_aux_find_visual functions + +commit 1e170eafd033687165d4c4c0b77358c35d6c30de +Author: Bart Massey <bart@cs.pdx.edu> +Date: Fri Dec 7 00:11:41 2007 -0800 + + added xcb_aux_get_depth_by_visual_id() + +commit e15f40b9758942568e09855e0a041654d53a3842 +Author: Jamey Sharp <jamey@minilop.net> +Date: Tue Nov 6 17:37:07 2007 -0800 + + All util libraries require the XCB 1.0 API; check for it in configure. + +commit 0f1f1e2b85a2b867e9c50ad548475bbc3a8158f8 +Author: Tilman Sauerbeck <tilman@code-monkey.de> +Date: Fri May 11 18:16:25 2007 +0200 + + atom: Replace 'char *atom_names[]' with one big string and array of offsets. + + This reduces the memory footprint of libxcb-atom.so, and the number of + relocations that have to be performed on load. + + before: + + atom/.libs/libxcb-atom.so: 73 relocations + + text data bss dec hex filename + 9587 588 132 10307 2843 atom/.libs/libxcb-atom.so + + after: + + atom/.libs/libxcb-atom.so: 5 relocations + + text data bss dec hex filename + 9183 316 132 9631 259f atom/.libs/libxcb-atom.so + + Signed-off-by: Jamey Sharp <jamey@minilop.net> + +commit c7ce8e2377241dc436ea1623313178dec3acf2ad +Author: Tilman Sauerbeck <tilman@code-monkey.de> +Date: Sun May 6 22:35:26 2007 +0200 + + Bug #10877: Fixed the atom values that are written to the hash table. + + Signed-off-by: Jamey Sharp <jamey@minilop.net> + +commit c452816e77aa49b9b3564dae5ec2285a3249c7e2 +Author: TORRI Vincent <torri@alf94-3-82-66-248-160.fbx.proxad.net> +Date: Fri Apr 6 17:54:52 2007 +0200 + + event/events.c + event/xcb_event.h + icccm/icccm.c + icccm/xcb_icccm.h + property/prop.c + property/xcb_property.h + wm/manage.c + wm/xcb_wm.h + wm/xcbwm-test.c + + xcb namespace added, _t sufix added for some types, formatting + +commit 4a7f5c495cc0135d669f79fa22a965986fa6c35e +Author: Jamey Sharp <jamey@minilop.net> +Date: Fri Mar 2 17:36:29 2007 -0800 + + Release xcb-util 0.2 + +commit 64e01af41f2056270537e43d26e46db6a1696b39 +Author: TORRI Vincent <torri@alf94-3-82-66-248-160.fbx.proxad.net> +Date: Wed Feb 21 20:27:07 2007 +0100 + + rename the libraries from libXCBFoo.* to libxcb-foo.*. Use foo_CPPFLAGS instead of foo_CFLAGS (*_CFLAGS variables store preprocessor options) + +commit a4d35e5dd8bff5c381594304a9d03de0c0a655f6 +Author: Alan Coopersmith <alan.coopersmith@sun.com> +Date: Wed Jun 7 12:06:00 2006 -0700 + + Bug #7150: Rename "len" to "namelen" to avoid m4 substitution + + This is the second of two fixes needed to get xcb-util building on + Solaris. + + Signed-off-by: Jamey Sharp <jamey@minilop.net> + +commit 7addcb94f4fb814d312bec27bcd7e30486d4061e +Author: Alan Coopersmith <alan.coopersmith@sun.com> +Date: Wed Jun 7 12:06:00 2006 -0700 + + Bug #7150: Check for gcc & Sun cc in configure.ac and use correct flags to turn on more warnings for each + + This is the first of two fixes needed to get xcb-util building on + Solaris. + + Signed-off-by: Jamey Sharp <jamey@minilop.net> + +commit 7c3ea033e51c0e00e68325ec53dca5ba3717b610 +Author: Jamey Sharp <jamey@minilop.net> +Date: Sun Nov 12 17:48:28 2006 -0800 + + Clean up built sources. Makes `distcheck` pass. + +commit 809f0deeecf381d9350fa9dc0eed62a01ddc2abe +Author: Jamey Sharp <jamey@minilop.net> +Date: Sun Nov 12 17:30:00 2006 -0800 + + Bug #6781: make util compile with srcdir != builddir. + +commit dd3f8dd5828eecd8395fc3ec1da8e21f57da3b6c +Author: Ian Osgood <iano@quirkster.com> +Date: Sat Oct 7 11:45:07 2006 -0700 + + Adapt xcb/util libraries for removal of XID structures. + +commit 76940f795615b5315690bec277b011046cc14f2d +Author: Ian Osgood <iano@quirkster.com> +Date: Tue Sep 26 08:36:01 2006 -0700 + + Install headers to "xcb", not "X11/XCB". + +commit 7d775611f0da257663b8b9bb865389908573b16e +Author: Ian Osgood <iano@quirkster.com> +Date: Tue Sep 26 08:21:26 2006 -0700 + + Naming changes must go into m4 files. + +commit c0ca7a3e22afa03ba8b1a11e97aa8e56d45ee3e3 +Author: Jamey Sharp <jamey@minilop.net> +Date: Mon Sep 25 04:13:01 2006 -0700 + + libxcb now installs header files in <xcb>, not <X11/XCB>. + +commit 817d5a1b72d1e2822b8dc4706a276f3b025a464f +Author: Ian Osgood <iano@quirkster.com> +Date: Sun Sep 24 13:34:03 2006 -0700 + + All xcb-util libraries compile after the Great Renaming. + + Many of the exported library functions still need to follow the new convention. + +commit ed0e9f4ed98188a80462c5c2964f7383faec2b4f +Author: Josh Triplett <josh@freedesktop.org> +Date: Sun Sep 24 03:15:39 2006 -0700 + + Integrate top-level .gitignore into .gitignore for each subdirectory + + In preparation for the repository split, move the relevant contents of the + top-level .gitignore into the .gitignore for each immediate subdirectory. + +commit 2ed2cfbb967c9a3a983c90514f8ff6784e5d47e0 +Author: Bart Massey <bart@cs.pdx.edu> +Date: Tue Sep 12 02:02:47 2006 -0700 + + Removed GNU make constructs from Makefile. + Prepared for repair of "make distcheck". + +commit d510a2e18805f33a19afd0bf5c45b32d56b40359 +Author: TORRI Vincent <torri@doursse.(none)> +Date: Fri Jul 28 09:00:37 2006 +0200 + + use XCBNone instead of None + +commit 66f8cf96ded8de4180b8955a83e0c0fce16fe579 +Author: TORRI Vincent <torri@doursse.(none)> +Date: Thu Jun 8 07:02:15 2006 +0200 + + fix compilation with c++ compilers. Remove some trailing spaces + +commit bad580c5803d918dedc2afbd96c2b3701bccfdf8 +Author: Donnie Berkholz <spyderous@gentoo.org> +Date: Sun May 7 20:32:32 2006 -0700 + + Add correct dependencies in xcb-util. + +commit f42905de7b4cdea9aea3f9168d81f966f89ce2e6 +Author: Josh Triplett <josh@freedesktop.org> +Date: Fri Apr 28 16:00:37 2006 -0700 + + Add m4 files to EXTRA_DIST. + +commit 43afb8c92626370dd07615d234ad86d2b3e70b05 +Author: TORRI Vincent <torri@doursse.(none)> +Date: Fri Apr 28 20:50:19 2006 +0200 + + Merge branch 'master' of git+ssh://doursse@git.freedesktop.org/git/xcb + +commit 93c472fdbf8db1badc7ab093fe198f944ceaf058 +Author: Josh Triplett <josh@freedesktop.org> +Date: Thu Apr 27 11:25:28 2006 -0700 + + Set all package bugreporting addresses to xcb@lists.freedesktop.org + +commit 122cc67f76886e1f996645cd402c0d473d85f408 +Author: Josh Triplett <josh@freedesktop.org> +Date: Thu Apr 27 01:06:46 2006 -0700 + + Fix xcb-util library dependencies, including both the new dependency libXCBImage needs on libXCBShm, as well as many other issues discovered in the process. These include using automake variables appropriately in order to actually link shared libraries against each other and ensure libraries have NEEDED entries for the libraries they depend on, consequently needing to reorder the top-level SUBDIRS to build property before icccm, adding dependencies to .pc.in files, fixing .pc.in files to not all use the name and description for XCBImage, and adding appropriate library dependencies to test programs. + +commit c88fa5935eeee20481bfe466cc18e3870bb96b18 +Author: Jamey Sharp <jamey@minilop.net> +Date: Wed Mar 8 22:49:59 2006 -0800 + + Unify autofoo .gitignore bits into one top-level file, and remove resulting redundancies. + +commit 9dca188b7f1d048d75cc7a13199cb4d0d436f274 +Author: Jamey Sharp <jamey@minilop.net> +Date: Sat Feb 18 23:57:14 2006 -0800 + + Update .gitignores for .o files and autofoo stuff. + +commit f4b4cbd6a661cb06ff993365f3b9ec17a81e3c3f +Author: Eric Anholt <anholt@FreeBSD.org> +Date: Sat Feb 18 22:56:03 2006 -0800 + + Move .cvsignore to .gitignore. + +commit 7944b54ff8d97e29dad9947aac05780e5c389737 +Author: Josh Triplett <josh@freedesktop.org> +Date: Sat Feb 18 16:49:41 2006 -0800 + + Remove xcl and CVSROOT. @@ -0,0 +1,291 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, +2006, 2007, 2008 Free Software Foundation, Inc. + + This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + + Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 6. Often, you can also type `make uninstall' to remove the installed + files again. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple `-arch' options to the +compiler but only a single `-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the `lipo' tool if you have problems. + +Installation Names +================== + + By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU +CC is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its `<wchar.h>' header file. The option `-nodtk' can be used as +a workaround. If GNU CC is not installed, it is therefore recommended +to try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of all of the options to `configure', and exit. + +`--help=short' +`--help=recursive' + Print a summary of the options unique to this package's + `configure', and exit. The `short' variant lists options used + only in the top level, while the `recursive' variant lists options + also present in any nested packages. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--prefix=DIR' + Use DIR as the installation prefix. *Note Installation Names:: + for more details, including other options available for fine-tuning + the installation locations. + +`--no-create' +`-n' + Run the configure checks, but stop before creating any output + files. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..fbd016c --- /dev/null +++ b/Makefile.am @@ -0,0 +1,23 @@ + +ACLOCAL_AMFLAGS = -I m4 + +SUBDIRS = src + +pkgconfig_DATA = \ + xcb-atom.pc \ + xcb-aux.pc \ + xcb-event.pc \ + xcb-util.pc \ + xcb-renderutil.pc + +MAINTAINERCLEANFILES = ChangeLog INSTALL + +.PHONY: ChangeLog INSTALL + +INSTALL: + $(INSTALL_CMD) + +ChangeLog: + $(CHANGELOG_CMD) + +dist-hook: ChangeLog INSTALL @@ -0,0 +1,12 @@ +Release 0.3.8 (2010-04-25) +========================== + +- Split up atom, aux event into their own repository. +- Create a single shared library and header file. +- Remove namespaceless pre-defined atoms. +- Remove synchronous xcb_atom_get(). +- Remove useless xcb_atom_get_fast*() and xcb_atom_get_name(). +- Delete redundant core-protocol error codes. +- Delete callback-based APIs for events, properties, and replies. +- Link with -no-undefined. +- Add AM_MAINTAINER_MODE for vendors. @@ -0,0 +1,39 @@ +About XCB util modules +====================== + +The XCB util modules provides a number of libraries which sit on top +of libxcb, the core X protocol library, and some of the extension +libraries. These experimental libraries provide convenience functions +and interfaces which make the raw X protocol more usable. Some of the +libraries also provide client-side code which is not strictly part of +the X protocol but which have traditionally been provided by Xlib. + +If you find any of these libraries useful, please let us know what +you're using and why you aren't in a mental hospital yet. We'd welcome +patches/suggestions for enhancement and new libraries; Please report any +issues you find to the freedesktop.org bug tracker, at: + + <https://bugs.freedesktop.org/enter_bug.cgi?product=XCB> + +Discussion about XCB occurs on the XCB mailing list: + + <mailto:xcb at lists.freedesktop.org> + <http://lists.freedesktop.org/mailman/listinfo/xcb> + +About XCB util module +===================== + +XCB util module provides the following library: + + - aux: Convenient access to connection setup and some core requests. + - atom: Standard core X atom constants and atom caching. + - event: Some utilities that have little to do with events any more. + +You can obtain the latest development versions of XCB util using +GIT. For anonymous checkouts, use: + + git clone --recursive git://anongit.freedesktop.org/git/xcb/util + +For developers, use: + + git clone --recursive git+ssh://git.freedesktop.org/git/xcb/util diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..70429df --- /dev/null +++ b/autogen.sh @@ -0,0 +1,4 @@ +#! /bin/sh +libtoolize --force +autoreconf -v --install || exit 1 +./configure "$@" diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..3272ca0 --- /dev/null +++ b/configure.ac @@ -0,0 +1,30 @@ +dnl XCB_UTIL_M4_WITH_INCLUDE_PATH requires Autoconf >= 2.62 +AC_PREREQ(2.62) +AC_INIT([xcb-util],0.3.8,[xcb@lists.freedesktop.org]) +AC_CONFIG_SRCDIR([Makefile.am]) +AC_CONFIG_MACRO_DIR([m4]) +AM_INIT_AUTOMAKE([foreign dist-bzip2]) +AM_MAINTAINER_MODE + +XCB_UTIL_M4_WITH_INCLUDE_PATH +XCB_UTIL_COMMON([1.4], [1.6]) + +AC_CHECK_PROGS(GPERF, gperf, [no]) +if test $GPERF = "no"; then + AC_MSG_ERROR([Can't find gperf, please install it and try again]) +fi + +AC_CHECK_FUNCS_ONCE(vasprintf) +AC_TYPE_SSIZE_T + +PKG_CHECK_MODULES(XPROTO, xproto >= 7.0.8) + +AC_CONFIG_FILES([Makefile + src/Makefile + xcb-atom.pc + xcb-aux.pc + xcb-event.pc + xcb-util.pc + xcb-renderutil.pc + xcb_util_intro]) +AC_OUTPUT diff --git a/m4/ax_compare_version.m4 b/m4/ax_compare_version.m4 new file mode 100644 index 0000000..e22b50f --- /dev/null +++ b/m4/ax_compare_version.m4 @@ -0,0 +1,174 @@ +# =========================================================================== +# http://autoconf-archive.cryp.to/ax_compare_version.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# +# DESCRIPTION +# +# This macro compares two version strings. Due to the various number of +# minor-version numbers that can exist, and the fact that string +# comparisons are not compatible with numeric comparisons, this is not +# necessarily trivial to do in a autoconf script. This macro makes doing +# these comparisons easy. +# +# The six basic comparisons are available, as well as checking equality +# limited to a certain number of minor-version levels. +# +# The operator OP determines what type of comparison to do, and can be one +# of: +# +# eq - equal (test A == B) +# ne - not equal (test A != B) +# le - less than or equal (test A <= B) +# ge - greater than or equal (test A >= B) +# lt - less than (test A < B) +# gt - greater than (test A > B) +# +# Additionally, the eq and ne operator can have a number after it to limit +# the test to that number of minor versions. +# +# eq0 - equal up to the length of the shorter version +# ne0 - not equal up to the length of the shorter version +# eqN - equal up to N sub-version levels +# neN - not equal up to N sub-version levels +# +# When the condition is true, shell commands ACTION-IF-TRUE are run, +# otherwise shell commands ACTION-IF-FALSE are run. The environment +# variable 'ax_compare_version' is always set to either 'true' or 'false' +# as well. +# +# Examples: +# +# AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8]) +# AX_COMPARE_VERSION([3.15],[lt],[3.15.8]) +# +# would both be true. +# +# AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8]) +# AX_COMPARE_VERSION([3.15],[gt],[3.15.8]) +# +# would both be false. +# +# AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8]) +# +# would be true because it is only comparing two minor versions. +# +# AX_COMPARE_VERSION([3.15.7],[eq0],[3.15]) +# +# would be true because it is only comparing the lesser number of minor +# versions of the two values. +# +# Note: The characters that separate the version numbers do not matter. An +# empty string is the same as version 0. OP is evaluated by autoconf, not +# configure, so must be a string, not a variable. +# +# The author would like to acknowledge Guido Draheim whose advice about +# the m4_case and m4_ifvaln functions make this macro only include the +# portions necessary to perform the specific comparison specified by the +# OP argument in the final configure script. +# +# LICENSE +# +# Copyright (c) 2008 Tim Toolan <toolan@ele.uri.edu> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. + +dnl ######################################################################### +AC_DEFUN([AX_COMPARE_VERSION], [ + AC_PROG_AWK + + # Used to indicate true or false condition + ax_compare_version=false + + # Convert the two version strings to be compared into a format that + # allows a simple string comparison. The end result is that a version + # string of the form 1.12.5-r617 will be converted to the form + # 0001001200050617. In other words, each number is zero padded to four + # digits, and non digits are removed. + AS_VAR_PUSHDEF([A],[ax_compare_version_A]) + A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \ + -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \ + -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \ + -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \ + -e 's/[[^0-9]]//g'` + + AS_VAR_PUSHDEF([B],[ax_compare_version_B]) + B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \ + -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \ + -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \ + -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \ + -e 's/[[^0-9]]//g'` + + dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary + dnl # then the first line is used to determine if the condition is true. + dnl # The sed right after the echo is to remove any indented white space. + m4_case(m4_tolower($2), + [lt],[ + ax_compare_version=`echo "x$A +x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"` + ], + [gt],[ + ax_compare_version=`echo "x$A +x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"` + ], + [le],[ + ax_compare_version=`echo "x$A +x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"` + ], + [ge],[ + ax_compare_version=`echo "x$A +x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"` + ],[ + dnl Split the operator from the subversion count if present. + m4_bmatch(m4_substr($2,2), + [0],[ + # A count of zero means use the length of the shorter version. + # Determine the number of characters in A and B. + ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'` + ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'` + + # Set A to no more than B's length and B to no more than A's length. + A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"` + B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"` + ], + [[0-9]+],[ + # A count greater than zero means use only that many subversions + A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"` + B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"` + ], + [.+],[ + AC_WARNING( + [illegal OP numeric parameter: $2]) + ],[]) + + # Pad zeros at end of numbers to make same length. + ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`" + B="$B`echo $A | sed 's/./0/g'`" + A="$ax_compare_version_tmp_A" + + # Check for equality or inequality as necessary. + m4_case(m4_tolower(m4_substr($2,0,2)), + [eq],[ + test "x$A" = "x$B" && ax_compare_version=true + ], + [ne],[ + test "x$A" != "x$B" && ax_compare_version=true + ],[ + AC_WARNING([illegal OP parameter: $2]) + ]) + ]) + + AS_VAR_POPDEF([A])dnl + AS_VAR_POPDEF([B])dnl + + dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE. + if test "$ax_compare_version" = "true" ; then + m4_ifvaln([$4],[$4],[:])dnl + m4_ifvaln([$5],[else $5])dnl + fi +]) dnl AX_COMPARE_VERSION diff --git a/m4/xcb_util_common.m4 b/m4/xcb_util_common.m4 new file mode 100644 index 0000000..f9463d3 --- /dev/null +++ b/m4/xcb_util_common.m4 @@ -0,0 +1,44 @@ +# XCB_UTIL_COMMON(xcb-required-version, xcb-proto-required-version) +# ----------------------------------------------------------------- +# +# Defines default options for xcb-util libraries. xorg/util/macros >= +# 1.6.0 is required for cross-platform compiler flags and to build +# library documentation. +# +AC_DEFUN([XCB_UTIL_COMMON], [ +m4_ifndef([AX_COMPARE_VERSION], + [m4_fatal([could not find AX_COMPARE_VERSION in macros search path])]) + +AC_REQUIRE([AC_PROG_LIBTOOL]) + +# Define header files and pkgconfig paths +xcbincludedir='${includedir}/xcb' +AC_SUBST(xcbincludedir) +pkgconfigdir='${libdir}/pkgconfig' +AC_SUBST(pkgconfigdir) + +# Check xcb version +PKG_CHECK_MODULES(XCB, xcb >= [$1]) + +# Check version of xcb-proto that xcb was compiled against +xcbproto_required=[$2] + +AC_MSG_CHECKING([whether libxcb was compiled against xcb-proto >= $xcbproto_required]) +xcbproto_version=`$PKG_CONFIG --variable=xcbproto_version xcb` +AX_COMPARE_VERSION([$xcbproto_version],[ge],[$xcbproto_required], xcbproto_ok="yes", + xcbproto_ok="no") +AC_MSG_RESULT([$xcbproto_ok]) + +if test $xcbproto_ok = no; then + AC_MSG_ERROR([libxcb was compiled against xcb-proto $xcbproto_version; it needs to be compiled against version $xcbproto_required or higher]) +fi + +# Call macros from Xorg util-macros +m4_ifndef([XORG_MACROS_VERSION], + [m4_fatal([must install xorg-macros 1.6.0 or later before running autoconf/autogen])]) + +XORG_MACROS_VERSION([1.6.0]) +XORG_DEFAULT_OPTIONS +XORG_ENABLE_DEVEL_DOCS +XORG_WITH_DOXYGEN +]) # XCB_UTIL_COMMON diff --git a/m4/xcb_util_m4_with_include_path.m4 b/m4/xcb_util_m4_with_include_path.m4 new file mode 100644 index 0000000..a3ddce4 --- /dev/null +++ b/m4/xcb_util_m4_with_include_path.m4 @@ -0,0 +1,24 @@ +# XCB_UTIL_M4_WITH_INCLUDE_PATH +# ------------------------------ +# +# This macro attempts to locate an m4 macro processor which supports +# -I option and is only useful for modules relying on M4 in order to +# expand macros in source code files. +# +# M4: variable holding the path to an usable m4 program. +# +# This macro requires Autoconf 2.62 or later as it is relying upon +# AC_PATH_PROGS_FEATURE_CHECK macro. NOTE: As soon as the minimum +# required version of Autoconf for Xorg is bumped to 2.62, this macro +# is supposed to be shipped with xorg/util/macros. +# +AC_DEFUN([XCB_UTIL_M4_WITH_INCLUDE_PATH], [ +AC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4], + [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4], + [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \ + ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]], + [AC_MSG_ERROR([could not find m4 that supports -I option])], + [$PATH:/usr/gnu/bin])]) + +AC_SUBST([M4], [$ac_cv_path_M4]) +]) # XCB_UTIL_M4_WITH_INCLUDE_PATH diff --git a/packaging/xcb-util.spec b/packaging/xcb-util.spec new file mode 100644 index 0000000..6e53c25 --- /dev/null +++ b/packaging/xcb-util.spec @@ -0,0 +1,66 @@ +Name: xcb-util +Summary: utility libraries for X C Binding +Version: 0.3.8 +Release: slp.1.3 +Group: System/Libraries +License: MIT +URL: http://xcb.freedesktop.org/ +Source: %{name}-%{version}.tar.gz + +BuildRequires: pkgconfig(xorg-macros) +BuildRequires: libxcb-devel >= 1.4, m4 +BuildRequires: pkgconfig(xproto) +BuildRequires: gperf +Provides: xcb-renderutil + +%description +Description: %{summary} +The xcb-util module provides a number of libraries which sit on top of +libxcb, the core X protocol library, and some of the extension +libraries. These experimental libraries provide convenience functions +and interfaces which make the raw X protocol more usable. Some of the +libraries also provide client-side code which is not strictly part of +the X protocol but which have traditionally been provided by Xlib. + +%package devel +Summary: Development and header files for xcb-util +Group: System Environment/Libraries +Requires: %{name} = %{version}-%{release}, pkgconfig + +%description devel +Development files for xcb-util. + +%prep +%setup -q + +%build + +./autogen.sh +%reconfigure --disable-static + +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +%make_install + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%remove_docs + +%clean +rm -rf %{buildroot} + + +%files +%defattr(-,root,root,-) +%{_libdir}/libxcb-util.so.0* + +%files devel +%defattr(-,root,root,-) +%{_libdir}/pkgconfig/*.pc +%{_libdir}/*.so +%{_includedir}/xcb/*.h + + diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..13b5313 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,33 @@ + +lib_LTLIBRARIES = libxcb-util.la + +AM_CPPFLAGS = $(XCB_CFLAGS) +AM_CFLAGS = $(CWARNFLAGS) + +libxcb_util_la_LIBADD = $(XCB_LIBS) +libxcb_util_la_LDFLAGS = -version-info 0:0:0 -no-undefined +libxcb_util_la_SOURCES = \ + atoms.c \ + event.c \ + xcb_aux.c + +xcbinclude_HEADERS = \ + xcb_util.h \ + xcb_atom.h \ + xcb_aux.h \ + xcb_bitops.h \ + xcb_event.h + +BUILT_SOURCES = atoms.c atoms.gperf xcb_atom.h +CLEANFILES = $(BUILT_SOURCES) +EXTRA_DIST = atomlist.m4 atoms.gperf.m4 xcb_atom.h.m4 + +atoms.c: atoms.gperf + $(GPERF) --output-file $@ $< + +atoms.gperf: $(srcdir)/atoms.gperf.m4 $(srcdir)/atomlist.m4 + $(M4) -I$(srcdir) $< >$@ + +xcb_atom.h: $(srcdir)/xcb_atom.h.m4 $(srcdir)/atomlist.m4 + $(M4) -I$(srcdir) $< >$@ + diff --git a/src/atomlist.m4 b/src/atomlist.m4 new file mode 100644 index 0000000..1c84740 --- /dev/null +++ b/src/atomlist.m4 @@ -0,0 +1,71 @@ +define(`FOREACH', `ifelse(`$1', , , `DO($1) +FOREACH(shift($@))')')FOREACH( +PRIMARY, +SECONDARY, +ARC, +ATOM, +BITMAP, +CARDINAL, +COLORMAP, +CURSOR, +CUT_BUFFER0, +CUT_BUFFER1, +CUT_BUFFER2, +CUT_BUFFER3, +CUT_BUFFER4, +CUT_BUFFER5, +CUT_BUFFER6, +CUT_BUFFER7, +DRAWABLE, +FONT, +INTEGER, +PIXMAP, +POINT, +RECTANGLE, +RESOURCE_MANAGER, +RGB_COLOR_MAP, +RGB_BEST_MAP, +RGB_BLUE_MAP, +RGB_DEFAULT_MAP, +RGB_GRAY_MAP, +RGB_GREEN_MAP, +RGB_RED_MAP, +STRING, +VISUALID, +WINDOW, +WM_COMMAND, +WM_HINTS, +WM_CLIENT_MACHINE, +WM_ICON_NAME, +WM_ICON_SIZE, +WM_NAME, +WM_NORMAL_HINTS, +WM_SIZE_HINTS, +WM_ZOOM_HINTS, +MIN_SPACE, +NORM_SPACE, +MAX_SPACE, +END_SPACE, +SUPERSCRIPT_X, +SUPERSCRIPT_Y, +SUBSCRIPT_X, +SUBSCRIPT_Y, +UNDERLINE_POSITION, +UNDERLINE_THICKNESS, +STRIKEOUT_ASCENT, +STRIKEOUT_DESCENT, +ITALIC_ANGLE, +X_HEIGHT, +QUAD_WIDTH, +WEIGHT, +POINT_SIZE, +RESOLUTION, +COPYRIGHT, +NOTICE, +FONT_NAME, +FAMILY_NAME, +FULL_NAME, +CAP_HEIGHT, +WM_CLASS, +WM_TRANSIENT_FOR, +)dnl diff --git a/src/atoms.c b/src/atoms.c new file mode 100644 index 0000000..cdd8e38 --- /dev/null +++ b/src/atoms.c @@ -0,0 +1,690 @@ +/* C code produced by gperf version 3.0.3 */ +/* Command-line: gperf --output-file atoms.c atoms.gperf */ +/* Computed positions: -k'3,6,9,$' */ + +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +/* The character set is not based on ISO-646. */ +error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." +#endif + +#line 1 "atoms.gperf" + + +/* Rely on vasprintf (GNU extension) instead of vsnprintf if + possible... */ +#ifdef HAVE_VASPRINTF +#define _GNU_SOURCE +#include <stdio.h> +#endif + +#include <xcb/xcb.h> +#include <stdlib.h> +#include <stdarg.h> +#include "xcb_atom.h" + +#line 25 "atoms.gperf" +struct atom_map { int name; xcb_atom_t value; }; +#include <string.h> +/* maximum key range = 146, duplicates = 0 */ + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static unsigned int +hash (str, len) + register const char *str; + register unsigned int len; +{ + static const unsigned char asso_values[] = + { + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 75, 70, + 65, 60, 40, 35, 20, 5, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 35, 0, 45, 15, 0, + 150, 50, 0, 5, 150, 150, 15, 35, 0, 40, + 5, 150, 10, 15, 0, 25, 150, 20, 70, 40, + 55, 150, 150, 150, 150, 15, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150 + }; + register int hval = len; + + switch (hval) + { + default: + hval += asso_values[(unsigned char)str[8]]; + /*FALLTHROUGH*/ + case 8: + case 7: + case 6: + hval += asso_values[(unsigned char)str[5]]; + /*FALLTHROUGH*/ + case 5: + case 4: + case 3: + hval += asso_values[(unsigned char)str[2]]; + break; + } + return hval + asso_values[(unsigned char)str[len - 1]]; +} + +struct stringpool_t + { + char stringpool_str4[sizeof("FONT")]; + char stringpool_str6[sizeof("NOTICE")]; + char stringpool_str9[sizeof("FONT_NAME")]; + char stringpool_str10[sizeof("POINT")]; + char stringpool_str11[sizeof("WEIGHT")]; + char stringpool_str14[sizeof("MIN_SPACE")]; + char stringpool_str15[sizeof("CAP_HEIGHT")]; + char stringpool_str16[sizeof("BITMAP")]; + char stringpool_str17[sizeof("INTEGER")]; + char stringpool_str19[sizeof("COPYRIGHT")]; + char stringpool_str24[sizeof("FULL_NAME")]; + char stringpool_str26[sizeof("STRIKEOUT_ASCENT")]; + char stringpool_str27[sizeof("STRIKEOUT_DESCENT")]; + char stringpool_str28[sizeof("RGB_GREEN_MAP")]; + char stringpool_str29[sizeof("END_SPACE")]; + char stringpool_str32[sizeof("RGB_BEST_MAP")]; + char stringpool_str33[sizeof("CARDINAL")]; + char stringpool_str36[sizeof("CURSOR")]; + char stringpool_str37[sizeof("WM_CLIENT_MACHINE")]; + char stringpool_str38[sizeof("WM_HINTS")]; + char stringpool_str41[sizeof("CUT_BUFFER7")]; + char stringpool_str42[sizeof("RGB_GRAY_MAP")]; + char stringpool_str43[sizeof("DRAWABLE")]; + char stringpool_str45[sizeof("RGB_DEFAULT_MAP")]; + char stringpool_str46[sizeof("WINDOW")]; + char stringpool_str47[sizeof("RGB_BLUE_MAP")]; + char stringpool_str48[sizeof("UNDERLINE_POSITION")]; + char stringpool_str51[sizeof("RGB_RED_MAP")]; + char stringpool_str53[sizeof("VISUALID")]; + char stringpool_str54[sizeof("RECTANGLE")]; + char stringpool_str56[sizeof("CUT_BUFFER6")]; + char stringpool_str57[sizeof("WM_NAME")]; + char stringpool_str58[sizeof("X_HEIGHT")]; + char stringpool_str61[sizeof("SUBSCRIPT_Y")]; + char stringpool_str62[sizeof("PRIMARY")]; + char stringpool_str63[sizeof("COLORMAP")]; + char stringpool_str64[sizeof("UNDERLINE_THICKNESS")]; + char stringpool_str65[sizeof("QUAD_WIDTH")]; + char stringpool_str66[sizeof("RESOURCE_MANAGER")]; + char stringpool_str67[sizeof("WM_ICON_NAME")]; + char stringpool_str68[sizeof("RGB_COLOR_MAP")]; + char stringpool_str70[sizeof("WM_NORMAL_HINTS")]; + char stringpool_str71[sizeof("CUT_BUFFER5")]; + char stringpool_str73[sizeof("WM_CLASS")]; + char stringpool_str75[sizeof("WM_COMMAND")]; + char stringpool_str76[sizeof("CUT_BUFFER4")]; + char stringpool_str78[sizeof("SUPERSCRIPT_Y")]; + char stringpool_str79[sizeof("ATOM")]; + char stringpool_str80[sizeof("NORM_SPACE")]; + char stringpool_str81[sizeof("WM_TRANSIENT_FOR")]; + char stringpool_str82[sizeof("WM_ICON_SIZE")]; + char stringpool_str83[sizeof("WM_ZOOM_HINTS")]; + char stringpool_str84[sizeof("MAX_SPACE")]; + char stringpool_str85[sizeof("POINT_SIZE")]; + char stringpool_str86[sizeof("PIXMAP")]; + char stringpool_str90[sizeof("RESOLUTION")]; + char stringpool_str91[sizeof("SUBSCRIPT_X")]; + char stringpool_str92[sizeof("ITALIC_ANGLE")]; + char stringpool_str93[sizeof("ARC")]; + char stringpool_str96[sizeof("CUT_BUFFER3")]; + char stringpool_str98[sizeof("WM_SIZE_HINTS")]; + char stringpool_str101[sizeof("CUT_BUFFER2")]; + char stringpool_str106[sizeof("CUT_BUFFER1")]; + char stringpool_str108[sizeof("SUPERSCRIPT_X")]; + char stringpool_str111[sizeof("CUT_BUFFER0")]; + char stringpool_str116[sizeof("STRING")]; + char stringpool_str121[sizeof("FAMILY_NAME")]; + char stringpool_str149[sizeof("SECONDARY")]; + }; +static const struct stringpool_t stringpool_contents = + { + "FONT", + "NOTICE", + "FONT_NAME", + "POINT", + "WEIGHT", + "MIN_SPACE", + "CAP_HEIGHT", + "BITMAP", + "INTEGER", + "COPYRIGHT", + "FULL_NAME", + "STRIKEOUT_ASCENT", + "STRIKEOUT_DESCENT", + "RGB_GREEN_MAP", + "END_SPACE", + "RGB_BEST_MAP", + "CARDINAL", + "CURSOR", + "WM_CLIENT_MACHINE", + "WM_HINTS", + "CUT_BUFFER7", + "RGB_GRAY_MAP", + "DRAWABLE", + "RGB_DEFAULT_MAP", + "WINDOW", + "RGB_BLUE_MAP", + "UNDERLINE_POSITION", + "RGB_RED_MAP", + "VISUALID", + "RECTANGLE", + "CUT_BUFFER6", + "WM_NAME", + "X_HEIGHT", + "SUBSCRIPT_Y", + "PRIMARY", + "COLORMAP", + "UNDERLINE_THICKNESS", + "QUAD_WIDTH", + "RESOURCE_MANAGER", + "WM_ICON_NAME", + "RGB_COLOR_MAP", + "WM_NORMAL_HINTS", + "CUT_BUFFER5", + "WM_CLASS", + "WM_COMMAND", + "CUT_BUFFER4", + "SUPERSCRIPT_Y", + "ATOM", + "NORM_SPACE", + "WM_TRANSIENT_FOR", + "WM_ICON_SIZE", + "WM_ZOOM_HINTS", + "MAX_SPACE", + "POINT_SIZE", + "PIXMAP", + "RESOLUTION", + "SUBSCRIPT_X", + "ITALIC_ANGLE", + "ARC", + "CUT_BUFFER3", + "WM_SIZE_HINTS", + "CUT_BUFFER2", + "CUT_BUFFER1", + "SUPERSCRIPT_X", + "CUT_BUFFER0", + "STRING", + "FAMILY_NAME", + "SECONDARY" + }; +#define stringpool ((const char *) &stringpool_contents) +#ifdef __GNUC__ +__inline +#ifdef __GNUC_STDC_INLINE__ +__attribute__ ((__gnu_inline__)) +#endif +#endif +const struct atom_map * +in_word_set (str, len) + register const char *str; + register unsigned int len; +{ + enum + { + TOTAL_KEYWORDS = 68, + MIN_WORD_LENGTH = 3, + MAX_WORD_LENGTH = 19, + MIN_HASH_VALUE = 4, + MAX_HASH_VALUE = 149 + }; + + static const struct atom_map wordlist[] = + { + {-1}, {-1}, {-1}, {-1}, +#line 44 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str4,18}, + {-1}, +#line 88 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str6,62}, + {-1}, {-1}, +#line 89 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str9,63}, +#line 47 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str10,21}, +#line 84 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str11,58}, + {-1}, {-1}, +#line 69 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str14,43}, +#line 92 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str15,66}, +#line 31 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str16,5}, +#line 45 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str17,19}, + {-1}, +#line 87 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str19,61}, + {-1}, {-1}, {-1}, {-1}, +#line 91 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str24,65}, + {-1}, +#line 79 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str26,53}, +#line 80 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str27,54}, +#line 55 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str28,29}, +#line 72 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str29,46}, + {-1}, {-1}, +#line 51 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str32,25}, +#line 32 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str33,6}, + {-1}, {-1}, +#line 34 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str36,8}, +#line 62 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str37,36}, +#line 61 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str38,35}, + {-1}, {-1}, +#line 42 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str41,16}, +#line 54 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str42,28}, +#line 43 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str43,17}, + {-1}, +#line 53 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str45,27}, +#line 59 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str46,33}, +#line 52 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str47,26}, +#line 77 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str48,51}, + {-1}, {-1}, +#line 56 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str51,30}, + {-1}, +#line 58 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str53,32}, +#line 48 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str54,22}, + {-1}, +#line 41 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str56,15}, +#line 65 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str57,39}, +#line 82 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str58,56}, + {-1}, {-1}, +#line 76 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str61,50}, +#line 27 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str62,1}, +#line 33 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str63,7}, +#line 78 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str64,52}, +#line 83 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str65,57}, +#line 49 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str66,23}, +#line 63 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str67,37}, +#line 50 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str68,24}, + {-1}, +#line 66 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str70,40}, +#line 40 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str71,14}, + {-1}, +#line 93 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str73,67}, + {-1}, +#line 60 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str75,34}, +#line 39 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str76,13}, + {-1}, +#line 74 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str78,48}, +#line 30 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str79,4}, +#line 70 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str80,44}, +#line 94 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str81,68}, +#line 64 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str82,38}, +#line 68 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str83,42}, +#line 71 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str84,45}, +#line 85 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str85,59}, +#line 46 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str86,20}, + {-1}, {-1}, {-1}, +#line 86 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str90,60}, +#line 75 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str91,49}, +#line 81 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str92,55}, +#line 29 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str93,3}, + {-1}, {-1}, +#line 38 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str96,12}, + {-1}, +#line 67 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str98,41}, + {-1}, {-1}, +#line 37 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str101,11}, + {-1}, {-1}, {-1}, {-1}, +#line 36 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str106,10}, + {-1}, +#line 73 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str108,47}, + {-1}, {-1}, +#line 35 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str111,9}, + {-1}, {-1}, {-1}, {-1}, +#line 57 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str116,31}, + {-1}, {-1}, {-1}, {-1}, +#line 90 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str121,64}, + {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, + {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, + {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, +#line 28 "atoms.gperf" + {(int)(long)&((struct stringpool_t *)0)->stringpool_str149,2} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + register int key = hash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + { + register int o = wordlist[key].name; + if (o >= 0) + { + register const char *s = o + stringpool; + + if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0') + return &wordlist[key]; + } + } + } + return 0; +} +#line 95 "atoms.gperf" + + +static const char atom_names[] = + "PRIMARY\0" + "SECONDARY\0" + "ARC\0" + "ATOM\0" + "BITMAP\0" + "CARDINAL\0" + "COLORMAP\0" + "CURSOR\0" + "CUT_BUFFER0\0" + "CUT_BUFFER1\0" + "CUT_BUFFER2\0" + "CUT_BUFFER3\0" + "CUT_BUFFER4\0" + "CUT_BUFFER5\0" + "CUT_BUFFER6\0" + "CUT_BUFFER7\0" + "DRAWABLE\0" + "FONT\0" + "INTEGER\0" + "PIXMAP\0" + "POINT\0" + "RECTANGLE\0" + "RESOURCE_MANAGER\0" + "RGB_COLOR_MAP\0" + "RGB_BEST_MAP\0" + "RGB_BLUE_MAP\0" + "RGB_DEFAULT_MAP\0" + "RGB_GRAY_MAP\0" + "RGB_GREEN_MAP\0" + "RGB_RED_MAP\0" + "STRING\0" + "VISUALID\0" + "WINDOW\0" + "WM_COMMAND\0" + "WM_HINTS\0" + "WM_CLIENT_MACHINE\0" + "WM_ICON_NAME\0" + "WM_ICON_SIZE\0" + "WM_NAME\0" + "WM_NORMAL_HINTS\0" + "WM_SIZE_HINTS\0" + "WM_ZOOM_HINTS\0" + "MIN_SPACE\0" + "NORM_SPACE\0" + "MAX_SPACE\0" + "END_SPACE\0" + "SUPERSCRIPT_X\0" + "SUPERSCRIPT_Y\0" + "SUBSCRIPT_X\0" + "SUBSCRIPT_Y\0" + "UNDERLINE_POSITION\0" + "UNDERLINE_THICKNESS\0" + "STRIKEOUT_ASCENT\0" + "STRIKEOUT_DESCENT\0" + "ITALIC_ANGLE\0" + "X_HEIGHT\0" + "QUAD_WIDTH\0" + "WEIGHT\0" + "POINT_SIZE\0" + "RESOLUTION\0" + "COPYRIGHT\0" + "NOTICE\0" + "FONT_NAME\0" + "FAMILY_NAME\0" + "FULL_NAME\0" + "CAP_HEIGHT\0" + "WM_CLASS\0" + "WM_TRANSIENT_FOR\0" +; + +static const uint16_t atom_name_offsets[] = { + 0, + 8, + 18, + 22, + 27, + 34, + 43, + 52, + 59, + 71, + 83, + 95, + 107, + 119, + 131, + 143, + 155, + 164, + 169, + 177, + 184, + 190, + 200, + 217, + 231, + 244, + 257, + 273, + 286, + 300, + 312, + 319, + 328, + 335, + 346, + 355, + 373, + 386, + 399, + 407, + 423, + 437, + 451, + 461, + 472, + 482, + 492, + 506, + 520, + 532, + 544, + 563, + 583, + 600, + 618, + 631, + 640, + 651, + 658, + 669, + 680, + 690, + 697, + 707, + 719, + 729, + 740, + 749, +}; + +xcb_atom_t xcb_atom_get_predefined(uint16_t name_len, const char *name) +{ + const struct atom_map *value = in_word_set(name, name_len); + xcb_atom_t ret = XCB_NONE; + if(value) + ret = value->value; + return ret; +} + +const char *xcb_atom_get_name_predefined(xcb_atom_t atom) +{ + if(atom <= 0 || atom > (sizeof(atom_name_offsets) / sizeof(*atom_name_offsets))) + return 0; + return atom_names + atom_name_offsets[atom - 1]; +} + +static char *makename(const char *fmt, ...) +{ + char *ret; + int n; + va_list ap; + +#ifndef HAVE_VASPRINTF + char *np; + int size = 64; + + /* First allocate 'size' bytes, should be enough usually */ + if((ret = malloc(size)) == NULL) + return NULL; + + while(1) + { + va_start(ap, fmt); + n = vsnprintf(ret, size, fmt, ap); + va_end(ap); + + if(n < 0) + return NULL; + + if(n < size) + return ret; + + size = n + 1; + if((np = realloc(ret, size)) == NULL) + { + free(ret); + return NULL; + } + + ret = np; + } +#else + va_start(ap, fmt); + n = vasprintf(&ret, fmt, ap); + va_end(ap); + + if(n < 0) + return NULL; + + return ret; +#endif +} + +char *xcb_atom_name_by_screen(const char *base, uint8_t screen) +{ + return makename("%s_S%u", base, screen); +} + +char *xcb_atom_name_by_resource(const char *base, uint32_t resource) +{ + return makename("%s_R%08X", base, resource); +} + +char *xcb_atom_name_unique(const char *base, uint32_t id) +{ + if(base) + return makename("%s_U%lu", base, id); + else + return makename("U%lu", id); +} diff --git a/src/atoms.gperf.m4 b/src/atoms.gperf.m4 new file mode 100644 index 0000000..8876e26 --- /dev/null +++ b/src/atoms.gperf.m4 @@ -0,0 +1,121 @@ +%{ + +/* Rely on vasprintf (GNU extension) instead of vsnprintf if + possible... */ +#ifdef HAVE_VASPRINTF +#define _GNU_SOURCE +#include <stdio.h> +#endif + +#include <xcb/xcb.h> +#include <stdlib.h> +#include <stdarg.h> +#include "xcb_atom.h" + +%} + +%readonly-tables +%pic +%null-strings +%enum +%includes +%compare-strncmp + +%struct-type +struct atom_map { int name; xcb_atom_t value; }; +%% +define(`COUNT', 0)dnl +define(`DO', `$1,define(`COUNT', incr(COUNT))COUNT')dnl +include(atomlist.m4)`'dnl +%% + +static const char atom_names[] = +define(`DO', ` "$1\0"')dnl +include(atomlist.m4); + +static const uint16_t atom_name_offsets[] = { +define(`OFFSET', 0)dnl +define(`DO', ` OFFSET,define(`OFFSET', eval(OFFSET+1+len($1)))')dnl +include(atomlist.m4)`'dnl +}; + +xcb_atom_t xcb_atom_get_predefined(uint16_t name_len, const char *name) +{ + const struct atom_map *value = in_word_set(name, name_len); + xcb_atom_t ret = XCB_NONE; + if(value) + ret = value->value; + return ret; +} + +const char *xcb_atom_get_name_predefined(xcb_atom_t atom) +{ + if(atom <= 0 || atom > (sizeof(atom_name_offsets) / sizeof(*atom_name_offsets))) + return 0; + return atom_names + atom_name_offsets[atom - 1]; +} + +static char *makename(const char *fmt, ...) +{ + char *ret; + int n; + va_list ap; + +#ifndef HAVE_VASPRINTF + char *np; + int size = 64; + + /* First allocate 'size' bytes, should be enough usually */ + if((ret = malloc(size)) == NULL) + return NULL; + + while(1) + { + va_start(ap, fmt); + n = vsnprintf(ret, size, fmt, ap); + va_end(ap); + + if(n < 0) + return NULL; + + if(n < size) + return ret; + + size = n + 1; + if((np = realloc(ret, size)) == NULL) + { + free(ret); + return NULL; + } + + ret = np; + } +#else + va_start(ap, fmt); + n = vasprintf(&ret, fmt, ap); + va_end(ap); + + if(n < 0) + return NULL; + + return ret; +#endif +} + +char *xcb_atom_name_by_screen(const char *base, uint8_t screen) +{ + return makename("%s_S%u", base, screen); +} + +char *xcb_atom_name_by_resource(const char *base, uint32_t resource) +{ + return makename("%s_R%08X", base, resource); +} + +char *xcb_atom_name_unique(const char *base, uint32_t id) +{ + if(base) + return makename("%s_U%lu", base, id); + else + return makename("U%lu", id); +} diff --git a/src/event.c b/src/event.c new file mode 100644 index 0000000..de8899a --- /dev/null +++ b/src/event.c @@ -0,0 +1,257 @@ +/* + * Copyright © 2008-2009 Julien Danjou <julien@danjou.info> + * + * 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. + */ + +#include <assert.h> +#include <stdlib.h> +#include <string.h> + +#include "xcb_event.h" + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#define ssizeof(foo) (ssize_t)sizeof(foo) +#define countof(foo) (ssizeof(foo) / ssizeof(foo[0])) + +static const char *labelError[] = +{ + "Success", + "BadRequest", + "BadValue", + "BadWindow", + "BadPixmap", + "BadAtom", + "BadCursor", + "BadFont", + "BadMatch", + "BadDrawable", + "BadAccess", + "BadAlloc", + "BadColor", + "BadGC", + "BadIDChoice", + "BadName", + "BadLength", + "BadImplementation", +}; + +static const char *labelRequest[] = +{ + "no request", + "CreateWindow", + "ChangeWindowAttributes", + "GetWindowAttributes", + "DestroyWindow", + "DestroySubwindows", + "ChangeSaveSet", + "ReparentWindow", + "MapWindow", + "MapSubwindows", + "UnmapWindow", + "UnmapSubwindows", + "ConfigureWindow", + "CirculateWindow", + "GetGeometry", + "QueryTree", + "InternAtom", + "GetAtomName", + "ChangeProperty", + "DeleteProperty", + "GetProperty", + "ListProperties", + "SetSelectionOwner", + "GetSelectionOwner", + "ConvertSelection", + "SendEvent", + "GrabPointer", + "UngrabPointer", + "GrabButton", + "UngrabButton", + "ChangeActivePointerGrab", + "GrabKeyboard", + "UngrabKeyboard", + "GrabKey", + "UngrabKey", + "AllowEvents", + "GrabServer", + "UngrabServer", + "QueryPointer", + "GetMotionEvents", + "TranslateCoords", + "WarpPointer", + "SetInputFocus", + "GetInputFocus", + "QueryKeymap", + "OpenFont", + "CloseFont", + "QueryFont", + "QueryTextExtents", + "ListFonts", + "ListFontsWithInfo", + "SetFontPath", + "GetFontPath", + "CreatePixmap", + "FreePixmap", + "CreateGC", + "ChangeGC", + "CopyGC", + "SetDashes", + "SetClipRectangles", + "FreeGC", + "ClearArea", + "CopyArea", + "CopyPlane", + "PolyPoint", + "PolyLine", + "PolySegment", + "PolyRectangle", + "PolyArc", + "FillPoly", + "PolyFillRectangle", + "PolyFillArc", + "PutImage", + "GetImage", + "PolyText", + "PolyText", + "ImageText", + "ImageText", + "CreateColormap", + "FreeColormap", + "CopyColormapAndFree", + "InstallColormap", + "UninstallColormap", + "ListInstalledColormaps", + "AllocColor", + "AllocNamedColor", + "AllocColorCells", + "AllocColorPlanes", + "FreeColors", + "StoreColors", + "StoreNamedColor", + "QueryColors", + "LookupColor", + "CreateCursor", + "CreateGlyphCursor", + "FreeCursor", + "RecolorCursor", + "QueryBestSize", + "QueryExtension", + "ListExtensions", + "ChangeKeyboardMapping", + "GetKeyboardMapping", + "ChangeKeyboardControl", + "GetKeyboardControl", + "Bell", + "ChangePointerControl", + "GetPointerControl", + "SetScreenSaver", + "GetScreenSaver", + "ChangeHosts", + "ListHosts", + "SetAccessControl", + "SetCloseDownMode", + "KillClient", + "RotateProperties", + "ForceScreenSaver", + "SetPointerMapping", + "GetPointerMapping", + "SetModifierMapping", + "GetModifierMapping", + "major 120", + "major 121", + "major 122", + "major 123", + "major 124", + "major 125", + "major 126", + "NoOperation", +}; + +static const char *labelEvent[] = +{ + "error", + "reply", + "KeyPress", + "KeyRelease", + "ButtonPress", + "ButtonRelease", + "MotionNotify", + "EnterNotify", + "LeaveNotify", + "FocusIn", + "FocusOut", + "KeymapNotify", + "Expose", + "GraphicsExpose", + "NoExpose", + "VisibilityNotify", + "CreateNotify", + "DestroyNotify", + "UnmapNotify", + "MapNotify", + "MapRequest", + "ReparentNotify", + "ConfigureNotify", + "ConfigureRequest", + "GravityNotify", + "ResizeRequest", + "CirculateNotify", + "CirculateRequest", + "PropertyNotify", + "SelectionClear", + "SelectionRequest", + "SelectionNotify", + "ColormapNotify", + "ClientMessage", + "MappingNotify", +}; + +const char * +xcb_event_get_label(uint8_t type) +{ + if(type < countof(labelEvent)) + return labelEvent[type]; + return NULL; +} + +const char * +xcb_event_get_error_label(uint8_t type) +{ + if(type < countof(labelError)) + return labelError[type]; + return NULL; +} + +const char * +xcb_event_get_request_label(uint8_t type) +{ + if(type < countof(labelRequest)) + return labelRequest[type]; + return NULL; +} diff --git a/src/xcb_atom.h b/src/xcb_atom.h new file mode 100644 index 0000000..27449bd --- /dev/null +++ b/src/xcb_atom.h @@ -0,0 +1,21 @@ +#ifndef __XCB_ATOM_H__ +#define __XCB_ATOM_H__ + +#include <xcb/xcb.h> + +#ifdef __cplusplus +extern "C" { +#endif + +xcb_atom_t xcb_atom_get_predefined(uint16_t name_len, const char *name); +const char *xcb_atom_get_name_predefined(xcb_atom_t atom); + +char *xcb_atom_name_by_screen(const char *base, uint8_t screen); +char *xcb_atom_name_by_resource(const char *base, uint32_t resource); +char *xcb_atom_name_unique(const char *base, uint32_t id); + +#ifdef __cplusplus +} +#endif + +#endif /* __XCB_ATOM_H__ */ diff --git a/src/xcb_atom.h.m4 b/src/xcb_atom.h.m4 new file mode 100644 index 0000000..27449bd --- /dev/null +++ b/src/xcb_atom.h.m4 @@ -0,0 +1,21 @@ +#ifndef __XCB_ATOM_H__ +#define __XCB_ATOM_H__ + +#include <xcb/xcb.h> + +#ifdef __cplusplus +extern "C" { +#endif + +xcb_atom_t xcb_atom_get_predefined(uint16_t name_len, const char *name); +const char *xcb_atom_get_name_predefined(xcb_atom_t atom); + +char *xcb_atom_name_by_screen(const char *base, uint8_t screen); +char *xcb_atom_name_by_resource(const char *base, uint32_t resource); +char *xcb_atom_name_unique(const char *base, uint32_t id); + +#ifdef __cplusplus +} +#endif + +#endif /* __XCB_ATOM_H__ */ diff --git a/src/xcb_aux.c b/src/xcb_aux.c new file mode 100644 index 0000000..c810398 --- /dev/null +++ b/src/xcb_aux.c @@ -0,0 +1,374 @@ +/* + * Copyright © 2008 Bart Massey <bart@cs.pdx.edu> + * Copyright © 2008 Ian Osgood <iano@quirkster.com> + * Copyright © 2008 Jamey Sharp <jamey@minilop.net> + * Copyright © 2008 Josh Triplett <josh@freedesktop.org> + * + * 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. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <xcb/xcb.h> +#include "xcb_aux.h" + +/* Connection related functions */ + +uint8_t +xcb_aux_get_depth (xcb_connection_t *c, + xcb_screen_t *screen) +{ + xcb_drawable_t drawable; + xcb_get_geometry_reply_t *geom; + int depth = 0; + + drawable = screen->root; + geom = xcb_get_geometry_reply (c, xcb_get_geometry(c, drawable), 0); + + if (geom) { + depth = geom->depth; + free (geom); + } + + return depth; +} + +uint8_t +xcb_aux_get_depth_of_visual (xcb_screen_t *screen, + xcb_visualid_t id) +{ + xcb_depth_iterator_t i; + xcb_visualtype_iterator_t j; + for (i = xcb_screen_allowed_depths_iterator(screen); + i.rem; xcb_depth_next(&i)) + for (j = xcb_depth_visuals_iterator(i.data); + j.rem; xcb_visualtype_next(&j)) + if (j.data->visual_id == id) + return i.data->depth; + return 0; +} + +xcb_screen_t * +xcb_aux_get_screen (xcb_connection_t *c, + int screen) +{ + xcb_screen_iterator_t i = xcb_setup_roots_iterator(xcb_get_setup(c)); + for (; i.rem; --screen, xcb_screen_next(&i)) + if (screen == 0) + return i.data; + return 0; +} + +xcb_visualtype_t * +xcb_aux_get_visualtype (xcb_connection_t *c, + int scr, + xcb_visualid_t vid) +{ + xcb_screen_t *screen; + xcb_depth_t *depth; + xcb_visualtype_iterator_t iter; + int cur; + + screen = xcb_aux_get_screen (c, scr); + if (!screen) return NULL; + + depth = xcb_screen_allowed_depths_iterator(screen).data; + if (!depth) return NULL; + + iter = xcb_depth_visuals_iterator(depth); + for (cur = 0 ; cur < iter.rem ; xcb_visualtype_next(&iter), ++cur) + if (vid == iter.data->visual_id) + return iter.data; + + return NULL; +} + +xcb_visualtype_t * +xcb_aux_find_visual_by_id (xcb_screen_t *screen, + xcb_visualid_t id) +{ + xcb_depth_iterator_t i; + xcb_visualtype_iterator_t j; + for (i = xcb_screen_allowed_depths_iterator(screen); + i.rem; xcb_depth_next(&i)) + for (j = xcb_depth_visuals_iterator(i.data); + j.rem; xcb_visualtype_next(&j)) + if (j.data->visual_id == id) + return j.data; + return 0; +} + +xcb_visualtype_t * +xcb_aux_find_visual_by_attrs (xcb_screen_t *screen, + int8_t class, + int8_t depth) +{ + xcb_depth_iterator_t i; + xcb_visualtype_iterator_t j; + for (i = xcb_screen_allowed_depths_iterator(screen); + i.rem; xcb_depth_next(&i)) { + if (depth != -1 && i.data->depth != depth) + continue; + for (j = xcb_depth_visuals_iterator(i.data); + j.rem; xcb_visualtype_next(&j)) + if (class == -1 || j.data->_class == class) + return j.data; + } + return 0; +} + +void +xcb_aux_sync (xcb_connection_t *c) +{ + free(xcb_get_input_focus_reply(c, xcb_get_input_focus(c), NULL)); +} + +/* structs instead of value lists */ +/* TODO: generate the struct types and functions from protocol masks and descriptions */ + +/* This generic implementation of pack_list depends on: + a) structs packed to uint32_t size + b) structs consist of just uint32_t/int32_t fields in the same order as bitmask +*/ + +static void +pack_list( uint32_t mask, const uint32_t *src, uint32_t *dest ) +{ + for ( ; mask; mask >>= 1, src++) + if (mask & 1) + *dest++ = *src; +} + +xcb_void_cookie_t +xcb_aux_create_window (xcb_connection_t *c, + uint8_t depth, + xcb_window_t wid, + xcb_window_t parent, + int16_t x, + int16_t y, + uint16_t width, + uint16_t height, + uint16_t border_width, + uint16_t _class, + xcb_visualid_t visual, + uint32_t mask, + const xcb_params_cw_t *params) +{ + uint32_t value_list[16]; + pack_list(mask, (const uint32_t *)params, value_list); + return xcb_create_window(c, depth, wid, parent, + x, y, width, height, border_width, + _class, visual, mask, value_list); +} + +xcb_void_cookie_t +xcb_aux_create_window_checked (xcb_connection_t *c, + uint8_t depth, + xcb_window_t wid, + xcb_window_t parent, + int16_t x, + int16_t y, + uint16_t width, + uint16_t height, + uint16_t border_width, + uint16_t _class, + xcb_visualid_t visual, + uint32_t mask, + const xcb_params_cw_t *params) +{ + uint32_t value_list[16]; + pack_list(mask, (const uint32_t *)params, value_list); + return xcb_create_window_checked(c, depth, wid, parent, + x, y, width, height, border_width, + _class, visual, mask, value_list); +} + +xcb_void_cookie_t +xcb_aux_change_window_attributes_checked (xcb_connection_t *c, + xcb_window_t window, + uint32_t mask, + const xcb_params_cw_t *params) +{ + uint32_t value_list[16]; + pack_list(mask, (const uint32_t *)params, value_list); + return xcb_change_window_attributes_checked( c, window, mask, value_list ); +} + +xcb_void_cookie_t +xcb_aux_change_window_attributes (xcb_connection_t *c, + xcb_window_t window, + uint32_t mask, + const xcb_params_cw_t *params) +{ + uint32_t value_list[16]; + pack_list(mask, (const uint32_t *)params, value_list); + return xcb_change_window_attributes( c, window, mask, value_list ); +} + +xcb_void_cookie_t +xcb_aux_configure_window (xcb_connection_t *c, + xcb_window_t window, + uint16_t mask, + const xcb_params_configure_window_t *params) +{ + uint32_t value_list[8]; + pack_list(mask, (const uint32_t *)params, value_list); + return xcb_configure_window( c, window, mask, value_list ); +} + +xcb_void_cookie_t +xcb_aux_create_gc (xcb_connection_t *c, + xcb_gcontext_t gid, + xcb_drawable_t drawable, + uint32_t mask, + const xcb_params_gc_t *params) +{ + uint32_t value_list[32]; + pack_list(mask, (const uint32_t *)params, value_list); + return xcb_create_gc( c, gid, drawable, mask, value_list ); +} + +xcb_void_cookie_t +xcb_aux_create_gc_checked (xcb_connection_t *c, + xcb_gcontext_t gid, + xcb_drawable_t drawable, + uint32_t mask, + const xcb_params_gc_t *params) +{ + uint32_t value_list[32]; + pack_list(mask, (const uint32_t *)params, value_list); + return xcb_create_gc_checked( c, gid, drawable, mask, value_list); +} + +xcb_void_cookie_t +xcb_aux_change_gc (xcb_connection_t *c, + xcb_gcontext_t gc, + uint32_t mask, + const xcb_params_gc_t *params) +{ + uint32_t value_list[32]; + pack_list(mask, (const uint32_t *)params, value_list); + return xcb_change_gc( c, gc, mask, value_list ); +} + +xcb_void_cookie_t +xcb_aux_change_gc_checked (xcb_connection_t *c, + xcb_gcontext_t gc, + uint32_t mask, + const xcb_params_gc_t *params) +{ + uint32_t value_list[32]; + pack_list(mask, (const uint32_t *)params, value_list); + return xcb_change_gc_checked( c, gc, mask, value_list ); +} + +xcb_void_cookie_t +xcb_aux_change_keyboard_control (xcb_connection_t *c, + uint32_t mask, + const xcb_params_keyboard_t *params) +{ + uint32_t value_list[16]; + pack_list(mask, (const uint32_t *)params, value_list); + return xcb_change_keyboard_control( c, mask, value_list ); +} + +/* Color related functions */ + +/* Return true if the given color name can be translated locally, + in which case load the components. Otherwise, a lookup_color request + will be needed, so return false. */ +int +xcb_aux_parse_color(char *color_name, + uint16_t *red, uint16_t *green, uint16_t *blue) +{ + int n, r, g, b, i; + if (!color_name || *color_name != '#') + return 0; + /* + * Excitingly weird RGB parsing code from Xlib. + */ + n = strlen (color_name); + color_name++; + n--; + if (n != 3 && n != 6 && n != 9 && n != 12) + return 0; + n /= 3; + g = b = 0; + do { + r = g; + g = b; + b = 0; + for (i = n; --i >= 0; ) { + char c = *color_name++; + b <<= 4; + if (c >= '0' && c <= '9') + b |= c - '0'; + else if (c >= 'A' && c <= 'F') + b |= c - ('A' - 10); + else if (c >= 'a' && c <= 'f') + b |= c - ('a' - 10); + else return 0; + } + } while (*color_name != '\0'); + n <<= 2; + n = 16 - n; + *red = r << n; + *green = g << n; + *blue = b << n; + return 1; +} + +/* Drawing related functions */ + +/* Adapted from Xlib */ +xcb_void_cookie_t +xcb_aux_set_line_attributes_checked (xcb_connection_t *dpy, + xcb_gcontext_t gc, + uint16_t linewidth, + int32_t linestyle, + int32_t capstyle, + int32_t joinstyle) +{ + uint32_t mask = 0; + xcb_params_gc_t gv; + + XCB_AUX_ADD_PARAM(&mask, &gv, line_width, linewidth); + XCB_AUX_ADD_PARAM(&mask, &gv, line_style, linestyle); + XCB_AUX_ADD_PARAM(&mask, &gv, cap_style, capstyle); + XCB_AUX_ADD_PARAM(&mask, &gv, join_style, joinstyle); + return xcb_aux_change_gc_checked(dpy, gc, mask, &gv); +} + +/* Adapted from Xlib */ +/* XXX It would be wiser for apps just to call + clear_area() directly. */ +xcb_void_cookie_t +xcb_aux_clear_window(xcb_connection_t * dpy, + xcb_window_t w) +{ + return xcb_clear_area(dpy, 0, w, 0, 0, 0, 0); +} diff --git a/src/xcb_aux.h b/src/xcb_aux.h new file mode 100644 index 0000000..d49d438 --- /dev/null +++ b/src/xcb_aux.h @@ -0,0 +1,214 @@ +#ifndef __XCB_AUX_H__ +#define __XCB_AUX_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + + +uint8_t xcb_aux_get_depth (xcb_connection_t *c, + xcb_screen_t *screen); + +uint8_t xcb_aux_get_depth_of_visual (xcb_screen_t *screen, + xcb_visualid_t id); + +xcb_screen_t *xcb_aux_get_screen (xcb_connection_t *c, + int screen); + +xcb_visualtype_t *xcb_aux_get_visualtype (xcb_connection_t *c, + int screen, + xcb_visualid_t vid); + +xcb_visualtype_t * +xcb_aux_find_visual_by_id (xcb_screen_t *screen, + xcb_visualid_t id); + +xcb_visualtype_t * +xcb_aux_find_visual_by_attrs (xcb_screen_t *screen, + int8_t class_, + int8_t depth); + +void xcb_aux_sync (xcb_connection_t *c); + +/* internal helper macro for XCB_AUX_ADD_PARAM +It gives the offset of the field 'param' in the structure pointed to by +'paramsp' in multiples of an uint32_t's size. */ +#define XCB_AUX_INTERNAL_OFFSETOF(paramsp, param) \ + ((uint32_t const*)(&((paramsp)->param))-(uint32_t const*)(paramsp)) + +/* add an optional parameter to an xcb_params_* structure +parameters: + maskp: pointer to bitmask whos bits mark used parameters + paramsp: pointer to structure with parameters + param: parameter to set + value: value to set the parameter to +*/ +#define XCB_AUX_ADD_PARAM(maskp, paramsp, param, value) \ + ((*(maskp)|=1<<XCB_AUX_INTERNAL_OFFSETOF((paramsp),param)), \ + ((paramsp)->param=(value))) + +typedef struct { + uint32_t back_pixmap; + uint32_t back_pixel; + uint32_t border_pixmap; + uint32_t border_pixel; + uint32_t bit_gravity; + uint32_t win_gravity; + uint32_t backing_store; + uint32_t backing_planes; + uint32_t backing_pixel; + uint32_t override_redirect; + uint32_t save_under; + uint32_t event_mask; + uint32_t dont_propagate; + uint32_t colormap; + uint32_t cursor; +} xcb_params_cw_t; + +xcb_void_cookie_t +xcb_aux_create_window (xcb_connection_t *c, + uint8_t depth, + xcb_window_t wid, + xcb_window_t parent, + int16_t x, + int16_t y, + uint16_t width, + uint16_t height, + uint16_t border_width, + uint16_t class_, + xcb_visualid_t visual, + uint32_t mask, + const xcb_params_cw_t *params); + +xcb_void_cookie_t +xcb_aux_create_window_checked (xcb_connection_t *c, + uint8_t depth, + xcb_window_t wid, + xcb_window_t parent, + int16_t x, + int16_t y, + uint16_t width, + uint16_t height, + uint16_t border_width, + uint16_t class_, + xcb_visualid_t visual, + uint32_t mask, + const xcb_params_cw_t *params); + +xcb_void_cookie_t +xcb_aux_change_window_attributes (xcb_connection_t *c, + xcb_window_t window, + uint32_t mask, + const xcb_params_cw_t *params); + +xcb_void_cookie_t +xcb_aux_change_window_attributes_checked (xcb_connection_t *c, + xcb_window_t window, + uint32_t mask, + const xcb_params_cw_t *params); + +typedef struct { + int32_t x; + int32_t y; + uint32_t width; + uint32_t height; + uint32_t border_width; + uint32_t sibling; + uint32_t stack_mode; +} xcb_params_configure_window_t; + +xcb_void_cookie_t +xcb_aux_configure_window (xcb_connection_t *c, + xcb_window_t window, + uint16_t mask, + const xcb_params_configure_window_t *params); + +typedef struct { + uint32_t function; + uint32_t plane_mask; + uint32_t foreground; + uint32_t background; + uint32_t line_width; + uint32_t line_style; + uint32_t cap_style; + uint32_t join_style; + uint32_t fill_style; + uint32_t fill_rule; + uint32_t tile; + uint32_t stipple; + uint32_t tile_stipple_origin_x; + uint32_t tile_stipple_origin_y; + uint32_t font; + uint32_t subwindow_mode; + uint32_t graphics_exposures; + uint32_t clip_originX; + uint32_t clip_originY; + uint32_t mask; + uint32_t dash_offset; + uint32_t dash_list; + uint32_t arc_mode; +} xcb_params_gc_t; + +xcb_void_cookie_t +xcb_aux_create_gc (xcb_connection_t *c, + xcb_gcontext_t cid, + xcb_drawable_t drawable, + uint32_t mask, + const xcb_params_gc_t *params); + +xcb_void_cookie_t +xcb_aux_create_gc_checked (xcb_connection_t *c, + xcb_gcontext_t gid, + xcb_drawable_t drawable, + uint32_t mask, + const xcb_params_gc_t *params); +xcb_void_cookie_t +xcb_aux_change_gc (xcb_connection_t *c, + xcb_gcontext_t gc, + uint32_t mask, + const xcb_params_gc_t *params); + +xcb_void_cookie_t +xcb_aux_change_gc_checked (xcb_connection_t *c, + xcb_gcontext_t gc, + uint32_t mask, + const xcb_params_gc_t *params); +typedef struct { + uint32_t key_click_percent; + uint32_t bell_percent; + uint32_t bell_pitch; + uint32_t bell_duration; + uint32_t led; + uint32_t led_mode; + uint32_t key; + uint32_t auto_repeat_mode; +} xcb_params_keyboard_t; + +xcb_void_cookie_t +xcb_aux_change_keyboard_control (xcb_connection_t *c, + uint32_t mask, + const xcb_params_keyboard_t *params); + +int +xcb_aux_parse_color(char *color_name, + uint16_t *red, uint16_t *green, uint16_t *blue); + +xcb_void_cookie_t +xcb_aux_set_line_attributes_checked (xcb_connection_t *dpy, + xcb_gcontext_t gc, + uint16_t linewidth, + int32_t linestyle, + int32_t capstyle, + int32_t joinstyle); + +xcb_void_cookie_t +xcb_aux_clear_window(xcb_connection_t * dpy, + xcb_window_t w); + +#ifdef __cplusplus +} +#endif + + +#endif /* __XCB_AUX_H__ */ diff --git a/src/xcb_bitops.h b/src/xcb_bitops.h new file mode 100644 index 0000000..a6872a1 --- /dev/null +++ b/src/xcb_bitops.h @@ -0,0 +1,212 @@ +#ifndef __XCB_BITOPS_H__ +#define __XCB_BITOPS_H__ + +/* Copyright (C) 2007 Bart Massey + * + * 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. + */ + +#include <assert.h> +#include <inttypes.h> +#include <X11/Xfuncproto.h> + +/** + * @defgroup xcb__bitops XCB Bit Operations + * + * Inline functions for common bit ops used in XCB and elsewhere. + * + * @{ + */ + + +/** + * Create a low-order bitmask. + * @param n Mask size. + * @return Mask. + * + * Create a bitmask with the lower @p n bits set and the + * rest of the word clear. + * @ingroup xcb__bitops + */ +_X_INLINE static uint32_t +xcb_mask(uint32_t n) +{ + return n == 32 ? ~0 : (1 << n) - 1; +} + + +/** + * Population count. + * @param n Integer representing a bitset. + * @return Number of 1 bits in the bitset. + * + * This is a reasonably fast algorithm for counting the bits + * in a 32-bit word. Currently a classic binary + * divide-and-conquer popcount: popcount_2() from + * http://en.wikipedia.org/wiki/Hamming_weight. + * @ingroup xcb__bitops + */ + + +/* 15 ops, 3 long immediates, 14 stages, 9 alu ops, 9 alu stages */ +_X_INLINE static uint32_t +xcb_popcount(uint32_t x) +{ + uint32_t m1 = 0x55555555; + uint32_t m2 = 0x33333333; + uint32_t m4 = 0x0f0f0f0f; + x -= (x >> 1) & m1; + x = (x & m2) + ((x >> 2) & m2); + x = (x + (x >> 4)) & m4; + x += x >> 8; + return (x + (x >> 16)) & 0x3f; +} + + +/** + * Round up to the next power-of-two unit size. + * @param base Number to be rounded up. + * @param pad Multiple to be rounded to; must be a power of two. + * @return Rounded-up number. + * + * Rounds @p base up to a multiple of @p pad, where @p pad + * is a power of two. The more general case is handled by + * xcb_roundup(). + * @ingroup xcb__bitops + */ +_X_INLINE static uint32_t +xcb_roundup_2 (uint32_t base, uint32_t pad) +{ + return (base + pad - 1) & -pad; +} + +/** + * Round down to the next power-of-two unit size. + * @param base Number to be rounded down. + * @param pad Multiple to be rounded to; must be a power of two. + * @return Rounded-down number. + * + * Rounds @p base down to a multiple of @p pad, where @p pad + * is a power of two. The more general case is handled by + * xcb_rounddown(). + * @ingroup xcb__bitops + */ +_X_INLINE static uint32_t +xcb_rounddown_2 (uint32_t base, uint32_t pad) +{ + return base & -pad; +} + +/** + * Round up to the next unit size. + * @param base Number to be rounded up. + * @param pad Multiple to be rounded to. + * @return Rounded-up number. + * + * This is a general routine for rounding @p base up + * to a multiple of @p pad. If you know that @p pad + * is a power of two, you should probably call xcb_roundup_2() + * instead. + * @ingroup xcb__bitops + */ +_X_INLINE static uint32_t +xcb_roundup (uint32_t base, uint32_t pad) +{ + uint32_t b = base + pad - 1; + /* faster if pad is a power of two */ + if (((pad - 1) & pad) == 0) + return b & -pad; + return b - b % pad; +} + + +/** + * Round down to the next unit size. + * @param base Number to be rounded down. + * @param pad Multiple to be rounded to. + * @return Rounded-down number. + * + * This is a general routine for rounding @p base down + * to a multiple of @p pad. If you know that @p pad + * is a power of two, you should probably call xcb_rounddown_2() + * instead. + * @ingroup xcb__bitops + */ +_X_INLINE static uint32_t +xcb_rounddown (uint32_t base, uint32_t pad) +{ + /* faster if pad is a power of two */ + if (((pad - 1) & pad) == 0) + return base & -pad; + return base - base % pad; +} + + +/** + * Reverse bits of word. + * @param x Target word. + * @param n Number of low-order bits to reverse. + * @return Word with low @p n bits reversed, all others 0. + * + * Reverses the bottom @p n bits of @p x. + * @ingroup xcb__bitops + */ +_X_INLINE static uint32_t +xcb_bit_reverse(uint32_t x, uint8_t n) { + uint32_t m1 = 0x00ff00ff; + uint32_t m2 = 0x0f0f0f0f; + uint32_t m3 = 0x33333333; + uint32_t m4 = 0x55555555; + x = ((x << 16) | (x >> 16)); + x = ((x & m1) << 8) | ((x >> 8) & m1); + x = ((x & m2) << 4) | ((x >> 4) & m2); + x = ((x & m3) << 2) | ((x >> 2) & m3); + x = ((x & m4) << 1) | ((x >> 1) & m4); + x >>= 32 - n; + return x; +} + + +/** + * Host byte order. + * @return The byte order of the host. + * + * Tests the host's byte order and returns either + * XCB_IMAGE_ORDER_MSB_FIRST or XCB_IMAGE_ORDER_LSB_FIRST + * as appropriate. + * @ingroup xcb__bitops + */ +_X_INLINE static xcb_image_order_t +xcb_host_byte_order(void) { + uint32_t endian_test = 0x01020304; + + switch (*(char *)&endian_test) { + case 0x01: + return XCB_IMAGE_ORDER_MSB_FIRST; + case 0x04: + return XCB_IMAGE_ORDER_LSB_FIRST; + } + assert(0); +} + +#endif /* __XCB_BITOPS_H__ */ diff --git a/src/xcb_event.h b/src/xcb_event.h new file mode 100644 index 0000000..ee911fc --- /dev/null +++ b/src/xcb_event.h @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2008-2009 Julien Danjou <julien@danjou.info> + * + * 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. + */ + +/** + * @defgroup xcb__event_t XCB Event Functions + * + * These functions ease the handling of X events received. + * + * @{ + */ + +#ifndef __XCB_EVENT_H__ +#define __XCB_EVENT_H__ + +#include <xcb/xcb.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Bit mask to find event type regardless of event source. + * + * Each event in the X11 protocol contains an 8-bit type code. + * The most-significant bit in this code is set if the event was + * generated from a SendEvent request. This mask can be used to + * determine the type of event regardless of how the event was + * generated. See the X11R6 protocol specification for details. + */ +#define XCB_EVENT_RESPONSE_TYPE_MASK (0x7f) +#define XCB_EVENT_RESPONSE_TYPE(e) (e->response_type & XCB_EVENT_RESPONSE_TYPE_MASK) +#define XCB_EVENT_SENT(e) (e->response_type & ~XCB_EVENT_RESPONSE_TYPE_MASK) + +/** + * @brief Convert an event response type to a label. + * @param type The event type. + * @return A string with the event name, or NULL if unknown. + */ +const char * xcb_event_get_label(uint8_t type); + +/** + * @brief Convert an event error type to a label. + * @param type The error type. + * @return A string with the event name, or NULL if unknown or if the event is + * not an error. + */ +const char * xcb_event_get_error_label(uint8_t type); + +/** + * @brief Convert an event request type to a label. + * @param type The request type. + * @return A string with the event name, or NULL if unknown or if the event is + * not an error. + */ +const char * xcb_event_get_request_label(uint8_t type); + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +#endif /* __XCB_EVENT_H__ */ diff --git a/src/xcb_util.h b/src/xcb_util.h new file mode 100644 index 0000000..0f06f1b --- /dev/null +++ b/src/xcb_util.h @@ -0,0 +1,8 @@ +#ifndef __XCB_UTIL_H__ +#define __XCB_UTIL_H__ + +#include <xcb/xcb_atom.h> +#include <xcb/xcb_aux.h> +#include <xcb/xcb_event.h> + +#endif /* __XCB_UTIL_H__ */ diff --git a/xcb-atom.pc.in b/xcb-atom.pc.in new file mode 100644 index 0000000..fcc39e8 --- /dev/null +++ b/xcb-atom.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: XCB Atom library +Description: XCB atom cache +Version: @PACKAGE_VERSION@ +Requires: xcb +Libs: -L${libdir} -lxcb-util +Cflags: -I${includedir} diff --git a/xcb-aux.pc.in b/xcb-aux.pc.in new file mode 100644 index 0000000..d049081 --- /dev/null +++ b/xcb-aux.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: XCB Aux library +Description: XCB convenient functions +Version: @PACKAGE_VERSION@ +Requires: xcb +Libs: -L${libdir} -lxcb-util +Cflags: -I${includedir} diff --git a/xcb-event.pc.in b/xcb-event.pc.in new file mode 100644 index 0000000..4a7d618 --- /dev/null +++ b/xcb-event.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: XCB Event library +Description: XCB event callback interface +Version: @PACKAGE_VERSION@ +Requires: xcb +Libs: -L${libdir} -lxcb-util +Cflags: -I${includedir} diff --git a/xcb-renderutil.pc.in b/xcb-renderutil.pc.in new file mode 100644 index 0000000..9875d90 --- /dev/null +++ b/xcb-renderutil.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: XCB Util Core library +Description: XCB util core interface +Version: @PACKAGE_VERSION@ +Requires: xcb +Libs: -L${libdir} -lxcb-util +Cflags: -I${includedir} diff --git a/xcb-util.pc.in b/xcb-util.pc.in new file mode 100644 index 0000000..9875d90 --- /dev/null +++ b/xcb-util.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: XCB Util Core library +Description: XCB util core interface +Version: @PACKAGE_VERSION@ +Requires: xcb +Libs: -L${libdir} -lxcb-util +Cflags: -I${includedir} diff --git a/xcb_util_intro.in b/xcb_util_intro.in new file mode 100644 index 0000000..f063613 --- /dev/null +++ b/xcb_util_intro.in @@ -0,0 +1,24 @@ +/** +@file +@brief XCB Utility functions + +These routines are used to facilitate the use of XCB in programs. +*/ + +/** + +@mainpage XCB Utility Documentation +@version @PACKAGE_VERSION@ +@author Ian Osgood <iano@quirkster.com> +@author Bart Massey <bart@cs.pdx.edu> +@author Jamey Sharp <jamey@minilop.net> +@author Josh Triplett <josh@freedesktop.org> +@author Keith Packard <keithp@keithp.com> +@author Vincent Torri <torri@iecn.u-nancy.fr> +@author Julien Danjou <julien@danjou.info> +@author Arnaud Fontaine <arnau@debian.org> +@date 2005-2008 + +@section intro What is available ? + +*/ |