sync code with last improvements from OpenBSD

This commit is contained in:
purplerain 2023-08-28 05:57:34 +00:00
commit 88965415ff
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
26235 changed files with 29195616 additions and 0 deletions

View file

@ -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

View file

@ -0,0 +1,669 @@
# Makefile.in generated by automake 1.12.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2012 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 \
$(top_srcdir)/depcomp $(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_HEADER = $(top_builddir)/config.h
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
am__v_lt_1 =
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 \
$@
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
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_CC_1 =
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_CCLD_1 =
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@
CPPFLAGS = @CPPFLAGS@
CWARNFLAGS = @CWARNFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOT = @DOT@
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@
HAVE_DOT = @HAVE_DOT@
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@
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@
runstatedir = @runstatedir@
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)'; \
locs=`for p in $$list; do echo $$p; done | \
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
sort -u`; \
test -z "$$locs" || { \
echo rm -f $${locs}; \
rm -f $${locs}; \
}
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"
cscopelist: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
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 cscopelist 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:

87
lib/xcb-util/src/atoms.c Normal file
View file

@ -0,0 +1,87 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* Rely on vasprintf (GNU extension) instead of vsnprintf if
possible... */
#define _GNU_SOURCE
#include <stdio.h>
#include <xcb/xcb.h>
#include <stdlib.h>
#include <stdarg.h>
#include "xcb_atom.h"
#ifndef __has_attribute
# define __has_attribute(x) 0 /* Compatibility with older compilers. */
#endif
#if __has_attribute(__format__) \
|| defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203)
__attribute__((__format__(__printf__,1,2)))
#endif
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%u", base, id);
else
return makename("U%u", id);
}

259
lib/xcb-util/src/event.c Normal file
View file

@ -0,0 +1,259 @@
/*
* 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.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "xcb_event.h"
#include <sys/types.h>
#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;
}

View file

@ -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__ */

378
lib/xcb-util/src/xcb_aux.c Normal file
View file

@ -0,0 +1,378 @@
/*
* 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.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#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;
uint8_t 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(const 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 = (uint16_t) (r << n);
*green = (uint16_t) (g << n);
*blue = (uint16_t) (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);
}

214
lib/xcb-util/src/xcb_aux.h Normal file
View file

@ -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(const 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__ */

View file

@ -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__ */

View file

@ -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__ */