summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am17
-rw-r--r--src/Makefile.in644
-rw-r--r--src/atoms.c76
-rw-r--r--src/event.c257
-rw-r--r--src/xcb_atom.h18
-rw-r--r--src/xcb_aux.c374
-rw-r--r--src/xcb_aux.h214
-rw-r--r--src/xcb_event.h90
-rw-r--r--src/xcb_util.h8
9 files changed, 1698 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..2545ad6
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,17 @@
+lib_LTLIBRARIES = libxcb-util.la
+
+AM_CPPFLAGS = $(XCB_CFLAGS)
+AM_CFLAGS = $(CWARNFLAGS)
+
+libxcb_util_la_LIBADD = $(XCB_LIBS)
+libxcb_util_la_LDFLAGS = -version-info 1: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_event.h
diff --git a/src/Makefile.in b/src/Makefile.in
new file mode 100644
index 0000000..4e8f0cd
--- /dev/null
+++ b/src/Makefile.in
@@ -0,0 +1,644 @@
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = src
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(xcbinclude_HEADERS)
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/m4/xcb_util_common.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(xcbincludedir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libxcb_util_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_libxcb_util_la_OBJECTS = atoms.lo event.lo xcb_aux.lo
+libxcb_util_la_OBJECTS = $(am_libxcb_util_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+libxcb_util_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(libxcb_util_la_LDFLAGS) $(LDFLAGS) -o \
+ $@
+DEFAULT_INCLUDES = -I.@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+SOURCES = $(libxcb_util_la_SOURCES)
+DIST_SOURCES = $(libxcb_util_la_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+HEADERS = $(xcbinclude_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_CFLAGS = @BASE_CFLAGS@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CHANGELOG_CMD = @CHANGELOG_CMD@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CWARNFLAGS = @CWARNFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DOXYGEN = @DOXYGEN@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_CMD = @INSTALL_CMD@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MAN_SUBSTS = @MAN_SUBSTS@
+MISC_MAN_DIR = @MISC_MAN_DIR@
+MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_CFLAGS = @STRICT_CFLAGS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XCB_CFLAGS = @XCB_CFLAGS@
+XCB_LIBS = @XCB_LIBS@
+XORG_MAN_PAGE = @XORG_MAN_PAGE@
+XPROTO_CFLAGS = @XPROTO_CFLAGS@
+XPROTO_LIBS = @XPROTO_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgconfigdir = @pkgconfigdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xcbincludedir = @xcbincludedir@
+lib_LTLIBRARIES = libxcb-util.la
+AM_CPPFLAGS = $(XCB_CFLAGS)
+AM_CFLAGS = $(CWARNFLAGS)
+libxcb_util_la_LIBADD = $(XCB_LIBS)
+libxcb_util_la_LDFLAGS = -version-info 1: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_event.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+ }
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libxcb-util.la: $(libxcb_util_la_OBJECTS) $(libxcb_util_la_DEPENDENCIES) $(EXTRA_libxcb_util_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libxcb_util_la_LINK) -rpath $(libdir) $(libxcb_util_la_OBJECTS) $(libxcb_util_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atoms.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/event.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xcb_aux.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-xcbincludeHEADERS: $(xcbinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ @list='$(xcbinclude_HEADERS)'; test -n "$(xcbincludedir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(xcbincludedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(xcbincludedir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(xcbincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(xcbincludedir)" || exit $$?; \
+ done
+
+uninstall-xcbincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(xcbinclude_HEADERS)'; test -n "$(xcbincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(xcbincludedir)'; $(am__uninstall_files_from_dir)
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(xcbincludedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-xcbincludeHEADERS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-libLTLIBRARIES uninstall-xcbincludeHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libLTLIBRARIES clean-libtool ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am \
+ install-libLTLIBRARIES install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip \
+ install-xcbincludeHEADERS installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-libLTLIBRARIES \
+ uninstall-xcbincludeHEADERS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/atoms.c b/src/atoms.c
new file mode 100644
index 0000000..7b3aec6
--- /dev/null
+++ b/src/atoms.c
@@ -0,0 +1,76 @@
+/* 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"
+
+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..d5c4d6b
--- /dev/null
+++ b/src/xcb_atom.h
@@ -0,0 +1,18 @@
+#ifndef __XCB_ATOM_H__
+#define __XCB_ATOM_H__
+
+#include <xcb/xcb.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+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_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__ */