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,35 @@
MAINTAINERCLEANFILES = Makefile.in
lib_LTLIBRARIES = libxcb-cursor.la
xcbinclude_HEADERS = xcb_cursor.h
AM_CFLAGS = $(CWARNFLAGS)
libxcb_cursor_la_SOURCES = cursor.c shape_to_id.c load_cursor.c parse_cursor_file.c
libxcb_cursor_la_CPPFLAGS = $(XCB_CFLAGS) $(XPROTO_CFLAGS) $(XCB_RENDER_CFLAGS) $(XCB_RENDERUTIL_CFLAGS) $(XCB_IMAGE_CFLAGS)
libxcb_cursor_la_LIBADD = $(XCB_LIBS) $(XPROTO_LIBS) $(XCB_RENDER_LIBS) $(XCB_RENDERUTIL_LIBS) $(XCB_IMAGE_LIBS)
libxcb_cursor_la_LDFLAGS = -version-info 0:0:0 -no-undefined -export-symbols-regex '^xcb_cursor_'
pkgconfig_DATA = xcb-cursor.pc
EXTRA_DIST = xcb-cursor.pc.in cursor.h shape_to_id.gperf
# TODO: We cannot use --pic because then the gperf-generated code does not compile :-/
GPERFFLAGS = --includes --struct-type --language=ANSI-C --switch=1
CLEANFILES = shape_to_id.c
# shape_to_id.c: shape_to_id.gperf
# $(AM_V_GEN)if $(GPERF) $(GPERFFLAGS) shape_to_id.gperf >$@t; then \
mv $@t $@; \
elif $(GPERF) --version >/dev/null 2>&1; then \
rm $@t; \
exit 1; \
elif test -f $@; then \
rm $@t; \
touch $@; \
else \
rm $@t; \
exit 1; \
fi

View file

@ -0,0 +1,755 @@
# 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 = cursor
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/xcb-cursor.pc.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)/m4/xcb_util_m4_with_include_path.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES = xcb-cursor.pc
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)$(pkgconfigdir)" \
"$(DESTDIR)$(xcbincludedir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
am__DEPENDENCIES_1 =
libxcb_cursor_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1)
am_libxcb_cursor_la_OBJECTS = libxcb_cursor_la-cursor.lo \
libxcb_cursor_la-shape_to_id.lo \
libxcb_cursor_la-load_cursor.lo \
libxcb_cursor_la-parse_cursor_file.lo
libxcb_cursor_la_OBJECTS = $(am_libxcb_cursor_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_cursor_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(AM_CFLAGS) $(CFLAGS) $(libxcb_cursor_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@
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_cursor_la_SOURCES)
DIST_SOURCES = $(libxcb_cursor_la_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
DATA = $(pkgconfig_DATA)
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@
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@
GPERF = @GPERF@
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@
M4 = @M4@
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_IMAGE_CFLAGS = @XCB_IMAGE_CFLAGS@
XCB_IMAGE_LIBS = @XCB_IMAGE_LIBS@
XCB_LIBS = @XCB_LIBS@
XCB_RENDERUTIL_CFLAGS = @XCB_RENDERUTIL_CFLAGS@
XCB_RENDERUTIL_LIBS = @XCB_RENDERUTIL_LIBS@
XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
XCB_RENDER_LIBS = @XCB_RENDER_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@
MAINTAINERCLEANFILES = Makefile.in
lib_LTLIBRARIES = libxcb-cursor.la
xcbinclude_HEADERS = xcb_cursor.h
AM_CFLAGS = $(CWARNFLAGS)
libxcb_cursor_la_SOURCES = cursor.c shape_to_id.c load_cursor.c parse_cursor_file.c
libxcb_cursor_la_CPPFLAGS = $(XCB_CFLAGS) $(XPROTO_CFLAGS) $(XCB_RENDER_CFLAGS) $(XCB_RENDERUTIL_CFLAGS) $(XCB_IMAGE_CFLAGS)
libxcb_cursor_la_LIBADD = $(XCB_LIBS) $(XPROTO_LIBS) $(XCB_RENDER_LIBS) $(XCB_RENDERUTIL_LIBS) $(XCB_IMAGE_LIBS)
libxcb_cursor_la_LDFLAGS = -version-info 0:0:0 -no-undefined -export-symbols-regex '^xcb_cursor_'
pkgconfig_DATA = xcb-cursor.pc
EXTRA_DIST = xcb-cursor.pc.in cursor.h shape_to_id.gperf
# TODO: We cannot use --pic because then the gperf-generated code does not compile :-/
GPERFFLAGS = --includes --struct-type --language=ANSI-C --switch=1
CLEANFILES = shape_to_id.c
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 cursor/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign cursor/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):
xcb-cursor.pc: $(top_builddir)/config.status $(srcdir)/xcb-cursor.pc.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
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-cursor.la: $(libxcb_cursor_la_OBJECTS) $(libxcb_cursor_la_DEPENDENCIES) $(EXTRA_libxcb_cursor_la_DEPENDENCIES)
$(AM_V_CCLD)$(libxcb_cursor_la_LINK) -rpath $(libdir) $(libxcb_cursor_la_OBJECTS) $(libxcb_cursor_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxcb_cursor_la-cursor.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxcb_cursor_la-load_cursor.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxcb_cursor_la-parse_cursor_file.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxcb_cursor_la-shape_to_id.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 $@ $<
libxcb_cursor_la-cursor.lo: cursor.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libxcb_cursor_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libxcb_cursor_la-cursor.lo -MD -MP -MF $(DEPDIR)/libxcb_cursor_la-cursor.Tpo -c -o libxcb_cursor_la-cursor.lo `test -f 'cursor.c' || echo '$(srcdir)/'`cursor.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libxcb_cursor_la-cursor.Tpo $(DEPDIR)/libxcb_cursor_la-cursor.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cursor.c' object='libxcb_cursor_la-cursor.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libxcb_cursor_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libxcb_cursor_la-cursor.lo `test -f 'cursor.c' || echo '$(srcdir)/'`cursor.c
libxcb_cursor_la-shape_to_id.lo: shape_to_id.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libxcb_cursor_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libxcb_cursor_la-shape_to_id.lo -MD -MP -MF $(DEPDIR)/libxcb_cursor_la-shape_to_id.Tpo -c -o libxcb_cursor_la-shape_to_id.lo `test -f 'shape_to_id.c' || echo '$(srcdir)/'`shape_to_id.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libxcb_cursor_la-shape_to_id.Tpo $(DEPDIR)/libxcb_cursor_la-shape_to_id.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='shape_to_id.c' object='libxcb_cursor_la-shape_to_id.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libxcb_cursor_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libxcb_cursor_la-shape_to_id.lo `test -f 'shape_to_id.c' || echo '$(srcdir)/'`shape_to_id.c
libxcb_cursor_la-load_cursor.lo: load_cursor.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libxcb_cursor_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libxcb_cursor_la-load_cursor.lo -MD -MP -MF $(DEPDIR)/libxcb_cursor_la-load_cursor.Tpo -c -o libxcb_cursor_la-load_cursor.lo `test -f 'load_cursor.c' || echo '$(srcdir)/'`load_cursor.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libxcb_cursor_la-load_cursor.Tpo $(DEPDIR)/libxcb_cursor_la-load_cursor.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='load_cursor.c' object='libxcb_cursor_la-load_cursor.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libxcb_cursor_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libxcb_cursor_la-load_cursor.lo `test -f 'load_cursor.c' || echo '$(srcdir)/'`load_cursor.c
libxcb_cursor_la-parse_cursor_file.lo: parse_cursor_file.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libxcb_cursor_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libxcb_cursor_la-parse_cursor_file.lo -MD -MP -MF $(DEPDIR)/libxcb_cursor_la-parse_cursor_file.Tpo -c -o libxcb_cursor_la-parse_cursor_file.lo `test -f 'parse_cursor_file.c' || echo '$(srcdir)/'`parse_cursor_file.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libxcb_cursor_la-parse_cursor_file.Tpo $(DEPDIR)/libxcb_cursor_la-parse_cursor_file.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='parse_cursor_file.c' object='libxcb_cursor_la-parse_cursor_file.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libxcb_cursor_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libxcb_cursor_la-parse_cursor_file.lo `test -f 'parse_cursor_file.c' || echo '$(srcdir)/'`parse_cursor_file.c
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-pkgconfigDATA: $(pkgconfig_DATA)
@$(NORMAL_INSTALL)
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || 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_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
done
uninstall-pkgconfigDATA:
@$(NORMAL_UNINSTALL)
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir)
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) $(DATA) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" "$(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:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
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."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
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-pkgconfigDATA 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-pkgconfigDATA \
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-pkgconfigDATA 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-pkgconfigDATA \
uninstall-xcbincludeHEADERS
# shape_to_id.c: shape_to_id.gperf
# $(AM_V_GEN)if $(GPERF) $(GPERFFLAGS) shape_to_id.gperf >$@t; then \
# mv $@t $@; \
# elif $(GPERF) --version >/dev/null 2>&1; then \
# rm $@t; \
# exit 1; \
# elif test -f $@; then \
# rm $@t; \
# touch $@; \
# else \
# rm $@t; \
# exit 1; \
# fi
# 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:

View file

@ -0,0 +1,179 @@
/*
* vim:ts=4:sw=4:expandtab
*
* Copyright © 2013 Michael Stapelberg
*
* 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 <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <xcb/xcb.h>
#include <xcb/xcb_renderutil.h>
#include "cursor.h"
#include "xcb_cursor.h"
/*
* Parses the root windows RESOURCE_MANAGER atom contents and stores the
* attributes declared above in resource_manager_val.
*
*/
static void parse_resource_manager(xcb_cursor_context_t *c, const xcb_get_property_reply_t *rm_reply) {
int rm_length;
char *rm = NULL;
char *saveptr = NULL;
char *line = NULL;
char *sep = NULL;
if (rm_reply == NULL || (rm_length = xcb_get_property_value_length(rm_reply)) == 0)
return;
if (asprintf(&rm, "%.*s", rm_length, (char*)xcb_get_property_value(rm_reply)) == -1)
return;
for (char *str = rm; ; str = NULL) {
if ((line = strtok_r(str, "\n", &saveptr)) == NULL)
break;
/* Split the string at the delimiting : */
if ((sep = strchr(line, ':')) == NULL) {
/* Invalid line?! */
free(rm);
return;
}
*(sep++) = '\0';
while (isspace(*sep))
sep++;
/* strdup() may return NULL, which is interpreted later as the key not
* being available. */
if (strcmp(line, "Xcursor.theme") == 0) {
free(c->rm[RM_XCURSOR_THEME]);
c->rm[RM_XCURSOR_THEME] = strdup(sep);
} else if (strcmp(line, "Xcursor.size") == 0) {
free(c->rm[RM_XCURSOR_SIZE]);
c->rm[RM_XCURSOR_SIZE] = strdup(sep);
} else if (strcmp(line, "Xft.dpi") == 0) {
free(c->rm[RM_XFT_DPI]);
c->rm[RM_XFT_DPI] = strdup(sep);
}
}
free(rm);
}
/*
* Tries to figure out the cursor size by checking:
* 1. The environment variable XCURSOR_SIZE
* 2. The RESOURCE_MANAGER entry Xcursor.size
* 3. Guess with the RESOURCE_MANAGER entry Xft.dpi * 16 / 72
* 4. Guess with the display size.
*
*/
static uint32_t get_default_size(xcb_cursor_context_t *c, xcb_screen_t *screen) {
char *env;
uint16_t dim;
if ((env = getenv("XCURSOR_SIZE")) != NULL)
return atoi(env);
if (c->rm[RM_XCURSOR_SIZE] != NULL)
return atoi(c->rm[RM_XCURSOR_SIZE]);
if (c->rm[RM_XFT_DPI] != NULL) {
const int dpi = atoi(c->rm[RM_XFT_DPI]);
if (dpi > 0)
return dpi * 16 / 72;
}
if (screen->height_in_pixels < screen->width_in_pixels)
dim = screen->height_in_pixels;
else
dim = screen->width_in_pixels;
return dim / 48;
}
int xcb_cursor_context_new(xcb_connection_t *conn, xcb_screen_t *screen, xcb_cursor_context_t **ctx) {
xcb_cursor_context_t *c;
const xcb_query_extension_reply_t *ext;
xcb_get_property_cookie_t rm_cookie;
xcb_get_property_reply_t *rm_reply;
xcb_render_query_pict_formats_cookie_t pf_cookie;
xcb_render_query_version_cookie_t ver_cookie;
if ((*ctx = calloc(1, sizeof(struct xcb_cursor_context_t))) == NULL)
return -errno;
c = *ctx;
c->conn = conn;
c->root = screen->root;
c->render_version = RV_NONE;
ext = xcb_get_extension_data(conn, &xcb_render_id);
// XXX: Is it maybe necessary to ever use long_offset != 0?
// XXX: proper length? xlib seems to use 100 MB o_O
rm_cookie = xcb_get_property(conn, 0, c->root, XCB_ATOM_RESOURCE_MANAGER, XCB_ATOM_STRING, 0, 16 * 1024);
if (ext && ext->present) {
ver_cookie = xcb_render_query_version(conn, XCB_RENDER_MAJOR_VERSION, XCB_RENDER_MINOR_VERSION);
pf_cookie = xcb_render_query_pict_formats(conn);
}
c->cursor_font = xcb_generate_id(conn);
xcb_open_font(conn, c->cursor_font, strlen("cursor"), "cursor");
rm_reply = xcb_get_property_reply(conn, rm_cookie, NULL);
parse_resource_manager(c, rm_reply);
free(rm_reply);
if (ext && ext->present) {
xcb_render_query_version_reply_t *reply = xcb_render_query_version_reply(conn, ver_cookie, NULL);
if (reply && (reply->major_version >= 1 || reply->minor_version >= 8))
c->render_version = RV_ANIM_CURSOR;
else if (reply && (reply->major_version >= 1 || reply->minor_version >= 5))
c->render_version = RV_CURSOR;
free(reply);
c->pf_reply = xcb_render_query_pict_formats_reply(conn, pf_cookie, NULL);
c->pict_format = xcb_render_util_find_standard_format(c->pf_reply, XCB_PICT_STANDARD_ARGB_32);
}
c->size = get_default_size(c, screen);
return 0;
}
void xcb_cursor_context_free(xcb_cursor_context_t *c) {
free(c->rm[RM_XCURSOR_THEME]);
free(c->rm[RM_XCURSOR_SIZE]);
free(c->rm[RM_XFT_DPI]);
free(c->pf_reply);
free(c);
}

View file

@ -0,0 +1,169 @@
/*
* vim:ts=4:sw=4:expandtab
*
* Copyright © 2013 Michael Stapelberg
*
* 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.
*
*/
#ifndef CURSOR_H
#define CURSOR_H
#include <xcb/render.h>
#include "xcb_cursor.h"
enum {
RM_XCURSOR_THEME = 0,
RM_XCURSOR_SIZE,
RM_XFT_DPI,
RM_MAX,
};
enum render_version {
RV_NONE = 0,
/* RENDER's CreateCursor was added in RENDER 0.5 */
RV_CURSOR,
/* RENDER's CreateAnimCursor was added in RENDER 0.8 */
RV_ANIM_CURSOR
};
struct xcb_cursor_context_t {
xcb_connection_t *conn;
xcb_window_t root;
xcb_font_t cursor_font;
xcb_render_query_pict_formats_reply_t *pf_reply;
/* This is a pointer into pf_reply. */
xcb_render_pictforminfo_t *pict_format;
/* Specific values of the root windows RESOURCE_MANAGER atom contents. */
char *rm[RM_MAX];
/* Best cursor size. If a file contains multiple cursor images, the images
* which match the size best will be loaded. */
uint32_t size;
const char *home;
const char *path;
enum render_version render_version;
};
/*
* Cursor files start with a header. The header
* contains a magic number, a version number and a
* table of contents which has type and offset information
* for the remaining tables in the file.
*
* File minor versions increment for compatible changes
* File major versions increment for incompatible changes (never, we hope)
*
* Chunks of the same type are always upward compatible. Incompatible
* changes are made with new chunk types; the old data can remain under
* the old type. Upward compatible changes can add header data as the
* header lengths are specified in the file.
*
* File:
* FileHeader
* LISTofChunk
*
* FileHeader:
* CARD32 magic magic number
* CARD32 header bytes in file header
* CARD32 version file version
* CARD32 ntoc number of toc entries
* LISTofFileToc toc table of contents
*
* FileToc:
* CARD32 type entry type
* CARD32 subtype entry subtype (size for images)
* CARD32 position absolute file position
*/
/* little-endian */
#define XCURSOR_MAGIC 0x72756358
typedef struct xcint_file_header_t {
uint32_t magic;
uint32_t header;
uint32_t version;
uint32_t ntoc;
} __attribute__((packed)) xcint_file_header_t;
typedef struct xcint_file_toc_t {
uint32_t type;
uint32_t subtype;
uint32_t position;
} __attribute__((packed)) xcint_file_toc_t;
typedef struct xcint_cursor_file_t {
xcint_file_header_t header;
xcint_file_toc_t *tocs;
} xcint_cursor_file_t;
/*
* The rest of the file is a list of chunks, each tagged by type
* and version.
*
* Chunk:
* ChunkHeader
* <extra type-specific header fields>
* <type-specific data>
*
* ChunkHeader:
* CARD32 header bytes in chunk header + type header
* CARD32 type chunk type
* CARD32 subtype chunk subtype
* CARD32 version chunk type version
*/
typedef struct xcint_chunk_header_t {
uint32_t header;
uint32_t type;
uint32_t subtype;
uint32_t version;
} __attribute__((packed)) xcint_chunk_header_t;
#define XCURSOR_IMAGE_TYPE 0xfffd0002
#define XCURSOR_IMAGE_VERSION 1
#define XCURSOR_IMAGE_MAX_SIZE 0x7fff /* 32767x32767 max cursor size */
typedef struct xcint_image_t {
uint32_t width;
uint32_t height;
uint32_t xhot;
uint32_t yhot;
uint32_t delay;
uint32_t *pixels;
} __attribute__((packed)) xcint_image_t;
/* shape_to_id.c */
int cursor_shape_to_id(const char *name);
/* parse_cursor_file.c */
int parse_cursor_file(xcb_cursor_context_t *c, const int fd, xcint_image_t **images, int *nimg);
#endif

View file

@ -0,0 +1,282 @@
/*
* vim:ts=4:sw=4:expandtab
*
* Copyright © 2013 Michael Stapelberg
* Copyright © 2002 Keith Packard
*
* 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 <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <xcb/xcb.h>
#include <xcb/render.h>
#include <xcb/xcb_image.h>
#include "cursor.h"
#include "xcb_cursor.h"
static const char *cursor_path(struct xcb_cursor_context_t *c) {
if (c->path == NULL) {
c->path = getenv("XCURSOR_PATH");
if (c->path == NULL)
c->path = XCURSORPATH;
}
return c->path;
}
static const char *next_path(const char *path) {
const char *colon = strchr(path, ':');
return (colon ? colon + 1 : NULL);
}
/*
* _XcursorThemeInherits was directly copied from libxcursor so as to not break
* compatibility.
*
*/
#define XcursorWhite(c) ((c) == ' ' || (c) == '\t' || (c) == '\n')
#define XcursorSep(c) ((c) == ';' || (c) == ',')
static char *
_XcursorThemeInherits (const char *full)
{
char line[8192];
char *result = NULL;
FILE *f;
if (!full)
return NULL;
f = fopen (full, "r");
if (f)
{
while (fgets (line, sizeof (line), f))
{
if (!strncmp (line, "Inherits", 8))
{
char *l = line + 8;
char *r;
while (*l == ' ') l++;
if (*l != '=') continue;
l++;
while (*l == ' ') l++;
result = malloc (strlen (l));
if (result)
{
r = result;
while (*l)
{
while (XcursorSep(*l) || XcursorWhite (*l)) l++;
if (!*l)
break;
if (r != result)
*r++ = ':';
while (*l && !XcursorWhite(*l) &&
!XcursorSep(*l))
*r++ = *l++;
}
*r++ = '\0';
}
break;
}
}
fclose (f);
}
return result;
}
/*
* Tries to open the cursor file name in the theme/cursors subfolder of
* each component of cursor_path(). When the file cannot be found, but a file
* index.theme in the component is present, the Inherits= key will be
* extracted and open_cursor_file calls itself recursively to search the
* specified inherited themes, too.
*
*/
static int open_cursor_file(xcb_cursor_context_t *c, const char *theme, const char *name, int *scan_core) {
int fd = -1;
char *inherits = NULL;
*scan_core = -1;
if (strcmp(theme, "core") == 0 &&
(*scan_core = cursor_shape_to_id(name)) >= 0) {
return -1;
}
if (c->home == NULL)
if ((c->home = getenv("HOME")) == NULL)
return -1;
for (const char *path = cursor_path(c);
(path != NULL && fd == -1);
) {
const char *sep = strchr(path, ':');
const int pathlen = (sep ? (sep - path) : strlen(path));
char *themedir = NULL;
char *full = NULL;
if (*path == '~') {
if (asprintf(&themedir, "%s%.*s/%s", c->home, pathlen - 1, path + 1, theme) == -1)
return -1;
} else {
if (asprintf(&themedir, "%.*s/%s", pathlen, path, theme) == -1)
return -1;
}
if (asprintf(&full, "%s/%s/%s", themedir, "cursors", name) == -1) {
free(themedir);
return -1;
}
fd = open(full, O_RDONLY);
free(full);
if (fd == -1 && inherits == NULL) {
if (asprintf(&full, "%s/index.theme", themedir) == -1) {
free(themedir);
return -1;
}
inherits = _XcursorThemeInherits(full);
free(full);
}
free(themedir);
path = (sep ? sep + 1 : NULL);
}
for (const char *path = inherits;
(path != NULL && fd == -1);
(path = next_path(path))) {
fd = open_cursor_file(c, path, name, scan_core);
}
if (inherits != NULL)
free(inherits);
return fd;
}
xcb_cursor_t xcb_cursor_load_cursor(xcb_cursor_context_t *c, const char *name) {
/* The character id of the X11 "cursor" font when falling back to un-themed
* cursors. */
int core_char = -1;
int fd = -1;
xcint_image_t *images;
int nimg = 0;
xcb_pixmap_t pixmap = XCB_NONE;
xcb_gcontext_t gc = XCB_NONE;
uint32_t last_width = 0;
uint32_t last_height = 0;
xcb_cursor_t cid = XCB_NONE;
// NB: if !render_present, fd will be -1 and thus the next if statement
// will trigger the fallback.
if (c->render_version != RV_NONE) {
if (c->rm[RM_XCURSOR_THEME])
fd = open_cursor_file(c, c->rm[RM_XCURSOR_THEME], name, &core_char);
if (fd == -1 && core_char == -1)
fd = open_cursor_file(c, "default", name, &core_char);
}
if (fd == -1 || core_char > -1) {
if (core_char == -1)
core_char = cursor_shape_to_id(name);
if (core_char == -1)
return XCB_NONE;
cid = xcb_generate_id(c->conn);
xcb_create_glyph_cursor(c->conn, cid, c->cursor_font, c->cursor_font, core_char, core_char + 1, 0, 0, 0, 65535, 65535, 65535);
return cid;
}
if (parse_cursor_file(c, fd, &images, &nimg) < 0) {
close(fd);
return XCB_NONE;
}
close(fd);
/* create a cursor from it */
xcb_render_animcursorelt_t elements[nimg];
xcb_render_picture_t pic = xcb_generate_id(c->conn);
for (int n = 0; n < nimg; n++) {
xcint_image_t *i = &(images[n]);
xcb_image_t *img = xcb_image_create_native(c->conn, i->width, i->height, XCB_IMAGE_FORMAT_Z_PIXMAP, 32, NULL, (i->width * i->height * sizeof(uint32_t)), (uint8_t*)i->pixels);
if (pixmap == XCB_NONE ||
(i->width != last_width) ||
(i->height != last_height)) {
if (pixmap == XCB_NONE) {
pixmap = xcb_generate_id(c->conn);
gc = xcb_generate_id(c->conn);
} else {
xcb_free_pixmap(c->conn, pixmap);
xcb_free_gc(c->conn, gc);
}
xcb_create_pixmap(c->conn, 32, pixmap, c->root, i->width, i->height);
xcb_create_gc(c->conn, gc, pixmap, 0, NULL);
last_width = i->width;
last_height = i->height;
}
xcb_image_put(c->conn, pixmap, gc, img, 0, 0, 0);
xcb_render_create_picture(c->conn, pic, pixmap, c->pict_format->id, 0, NULL);
elements[n].cursor = xcb_generate_id(c->conn);
elements[n].delay = i->delay;
xcb_render_create_cursor(c->conn, elements[n].cursor, pic, i->xhot, i->yhot);
xcb_render_free_picture(c->conn, pic);
xcb_image_destroy(img);
free(i->pixels);
}
xcb_free_pixmap(c->conn, pixmap);
xcb_free_gc(c->conn, gc);
free(images);
if (nimg == 1 || c->render_version == RV_CURSOR) {
/* non-animated cursor or no support for animated cursors */
return elements[0].cursor;
} else {
cid = xcb_generate_id(c->conn);
xcb_render_create_anim_cursor (c->conn, cid, nimg, elements);
for (int n = 0; n < nimg; n++) {
xcb_free_cursor(c->conn, elements[n].cursor);
}
return cid;
}
}

View file

@ -0,0 +1,201 @@
/*
* vim:ts=4:sw=4:expandtab
*
* Copyright © 2013 Michael Stapelberg
*
* 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 <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdbool.h>
#ifdef HAVE_ENDIAN_H
#include <endian.h>
#endif
#ifdef HAVE_SYS_ENDIAN_H
#include <sys/endian.h>
# ifndef HAVE_LE32TOH
# define le32toh(x) letoh32(x)
# endif
#endif
#ifdef HAVE_SYS_BYTEORDER_H
#include <sys/byteorder.h>
# ifndef HAVE_LE32TOH
# define le32toh(x) LE_32(x)
# endif
#elif defined(HAVE_LIBKERN_OSBYTEORDER_H)
#include <libkern/OSByteOrder.h>
#define le32toh(x) OSSwapLittleToHostInt32(x)
#endif
#include <xcb/xcb.h>
#include "cursor.h"
#include "xcb_cursor.h"
static uint32_t dist(const uint32_t a, const uint32_t b) {
return (a > b ? (a - b) : (b - a));
}
static uint32_t find_best_size(xcint_cursor_file_t *cf, const uint32_t target, uint32_t *nsizesp) {
uint32_t best = 0;
/* Amount of cursors with the best size */
uint32_t nsizes = 0;
for (int n = 0; n < cf->header.ntoc; n++) {
const uint32_t size = cf->tocs[n].subtype;
if (cf->tocs[n].type != XCURSOR_IMAGE_TYPE)
continue;
/* If the distance is less to the target size, this is a better fit. */
if (best == 0 || dist(size, target) < dist(best, target)) {
best = size;
nsizes = 0;
}
if (size == best)
nsizes++;
}
*nsizesp = nsizes;
return best;
}
/* Returns true if and only if the read() call read the entirety of the data it
* was supposed to read. */
static bool read_entirely(int fd, void *buf, size_t count) {
return read(fd, buf, count) == count;
}
int parse_cursor_file(xcb_cursor_context_t *c, const int fd, xcint_image_t **images, int *nimg) {
/* Read the header, verify the magic value. */
xcint_cursor_file_t cf;
uint32_t nsizes = 0;
uint32_t best = 0;
uint32_t skip = 0;
/* The amount of images stored in 'images', used when cleaning up. */
int cnt = 0;
if (!read_entirely(fd, &(cf.header), sizeof(xcint_file_header_t)))
return -EINVAL;
cf.header.magic = le32toh(cf.header.magic);
cf.header.header = le32toh(cf.header.header);
cf.header.version = le32toh(cf.header.version);
cf.header.ntoc = le32toh(cf.header.ntoc);
if (cf.header.magic != XCURSOR_MAGIC)
return -EINVAL;
if ((skip = (cf.header.header - sizeof(xcint_file_header_t))) > 0)
if (lseek(fd, skip, SEEK_CUR) == EOF)
return -EINVAL;
if (cf.header.ntoc > 0x10000)
return -EINVAL;
/* Read the table of contents */
cf.tocs = malloc(cf.header.ntoc * sizeof(xcint_file_toc_t));
if (!read_entirely(fd, cf.tocs, cf.header.ntoc * sizeof(xcint_file_toc_t)))
goto error;
for (int n = 0; n < cf.header.ntoc; n++) {
cf.tocs[n].type = le32toh(cf.tocs[n].type);
cf.tocs[n].subtype = le32toh(cf.tocs[n].subtype);
cf.tocs[n].position = le32toh(cf.tocs[n].position);
}
/* No images? Invalid file. */
if ((best = find_best_size(&cf, c->size, &nsizes)) == 0 || nsizes == 0)
goto error;
*nimg = nsizes;
if ((*images = calloc(nsizes, sizeof(xcint_image_t))) == NULL)
goto error;
for (int n = 0; n < cf.header.ntoc; n++) {
xcint_chunk_header_t chunk;
/* for convenience */
xcint_image_t *i = &((*images)[cnt]);
uint32_t numpixels = 0;
uint32_t *p = NULL;
if (cf.tocs[n].type != XCURSOR_IMAGE_TYPE ||
cf.tocs[n].subtype != best)
continue;
lseek(fd, cf.tocs[n].position, SEEK_SET);
if (!read_entirely(fd, &chunk, sizeof(xcint_chunk_header_t)))
goto error2;
chunk.header = le32toh(chunk.header);
chunk.type = le32toh(chunk.type);
chunk.subtype = le32toh(chunk.subtype);
chunk.version = le32toh(chunk.version);
/* Sanity check, as libxcursor does it. */
if (chunk.type != cf.tocs[n].type ||
chunk.subtype != cf.tocs[n].subtype)
goto error2;
if (!read_entirely(fd, i, sizeof(xcint_image_t) - sizeof(uint32_t*))) // TODO: better type
goto error2;
i->width = le32toh(i->width);
i->height = le32toh(i->height);
i->xhot = le32toh(i->xhot);
i->yhot = le32toh(i->yhot);
i->delay = le32toh(i->delay);
/* Read the actual image data and convert it to host byte order */
/* Catch integer overflows */
if (((uint64_t)i->width) * i->height > UINT32_MAX)
goto error2;
numpixels = i->width * i->height;
i->pixels = malloc(numpixels * sizeof(uint32_t));
/* With the malloc, one more image is eligible for cleanup later. */
cnt++;
if (!read_entirely(fd, i->pixels, numpixels * sizeof(uint32_t)))
goto error2;
p = i->pixels;
for (int j = 0; j < numpixels; j++, p++)
*p = le32toh(*p);
}
free(cf.tocs);
return 0;
error2:
/* Free the memory for all images that were read so far. */
for (int n = 0; n < cnt; n++)
free((*images)[n].pixels);
free(*images);
error:
*images = NULL;
free(cf.tocs);
return -EINVAL;
}

View file

@ -0,0 +1,521 @@
/* ANSI-C code produced by gperf version 3.1 */
/* Command-line: gperf --includes --struct-type --language=ANSI-C --switch=1 /share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf */
/* Computed positions: -k'1-2,4,$' */
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
/* The character set is not based on ISO-646. */
#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
#endif
#line 1 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
struct shape_mapping { const char *name; int number; };
int cursor_shape_to_id(const char *name);
#include <string.h>
#define TOTAL_KEYWORDS 77
#define MIN_WORD_LENGTH 3
#define MAX_WORD_LENGTH 19
#define MIN_HASH_VALUE 4
#define MAX_HASH_VALUE 165
/* maximum key range = 162, duplicates = 0 */
#ifdef __GNUC__
__inline
#else
#ifdef __cplusplus
inline
#endif
#endif
static unsigned int
hash (register const char *str, register size_t len)
{
static unsigned char asso_values[] =
{
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 5,
0, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 30, 166,
166, 166, 166, 166, 166, 0, 166, 20, 5, 20,
65, 5, 50, 5, 30, 25, 166, 5, 15, 35,
25, 0, 40, 0, 0, 0, 0, 40, 0, 25,
50, 40, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
166, 166, 166, 166, 166, 166
};
register unsigned int hval = len;
switch (hval)
{
default:
hval += asso_values[(unsigned char)str[3]];
/*FALLTHROUGH*/
case 3:
case 2:
hval += asso_values[(unsigned char)str[1]];
/*FALLTHROUGH*/
case 1:
hval += asso_values[(unsigned char)str[0]];
break;
}
return hval + asso_values[(unsigned char)str[len - 1]];
}
struct shape_mapping *
in_word_set (register const char *str, register size_t len)
{
static struct shape_mapping wordlist[] =
{
#line 67 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"star",63},
#line 55 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"rtl_logo",51},
#line 8 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"boat",4},
#line 74 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"top_tee",70},
#line 73 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"top_side",69},
#line 75 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"trek",71},
#line 71 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"top_left_corner",67},
#line 72 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"top_right_corner",68},
#line 31 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"gobbler",27},
#line 13 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"bottom_tee",9},
#line 12 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"bottom_side",8},
#line 10 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"bottom_left_corner",6},
#line 11 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"bottom_right_corner",7},
#line 19 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"cross",15},
#line 69 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"tcross",65},
#line 38 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"left_ptr",34},
#line 21 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"crosshair",17},
#line 14 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"box_spiral",10},
#line 68 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"target",64},
#line 40 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"left_tee",36},
#line 39 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"left_side",35},
#line 15 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"center_ptr",11},
#line 20 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"cross_reverse",16},
#line 70 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"top_left_arrow",66},
#line 35 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"heart",31},
#line 63 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"shuttle",59},
#line 56 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"sailboat",52},
#line 60 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"sb_right_arrow",56},
#line 46 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"mouse",42},
#line 62 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"sb_v_double_arrow",58},
#line 43 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"lr_angle",39},
#line 5 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"arrow",1},
#line 9 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"bogosity",5},
#line 41 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"leftbutton",37},
#line 59 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"sb_left_arrow",55},
#line 49 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"plus",45},
#line 37 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"iron_cross",33},
#line 64 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"sizing",60},
#line 42 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"ll_angle",38},
#line 51 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"right_ptr",47},
#line 17 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"clock",13},
#line 23 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"dot",19},
#line 53 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"right_tee",49},
#line 52 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"right_side",48},
#line 6 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"based_arrow_down",2},
#line 78 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"ur_angle",74},
#line 16 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"circle",12},
#line 58 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"sb_h_double_arrow",54},
#line 4 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"X_cursor",0},
#line 50 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"question_arrow",46},
#line 61 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"sb_up_arrow",57},
#line 44 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"man",40},
#line 7 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"based_arrow_up",3},
#line 18 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"coffee_mug",14},
#line 47 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"pencil",43},
#line 76 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"ul_angle",72},
#line 80 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"xterm",76},
#line 54 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"rightbutton",50},
#line 66 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"spraycan",62},
#line 32 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"gumby",28},
#line 48 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"pirate",44},
#line 29 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"exchange",25},
#line 36 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"icon",32},
#line 79 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"watch",75},
#line 77 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"umbrella",73},
#line 25 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"double_arrow",21},
#line 57 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"sb_down_arrow",53},
#line 30 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"fleur",26},
#line 65 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"spider",61},
#line 34 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"hand2",30},
#line 33 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"hand1",29},
#line 24 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"dotbox",20},
#line 26 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"draft_large",22},
#line 22 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"diamond_cross",18},
#line 27 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"draft_small",23},
#line 45 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"middlebutton",41},
#line 28 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
{"draped_box",24}
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
{
register unsigned int key = hash (str, len);
if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE)
{
register struct shape_mapping *resword;
switch (key - 4)
{
case 0:
resword = &wordlist[0];
goto compare;
case 4:
resword = &wordlist[1];
goto compare;
case 5:
resword = &wordlist[2];
goto compare;
case 8:
resword = &wordlist[3];
goto compare;
case 9:
resword = &wordlist[4];
goto compare;
case 10:
resword = &wordlist[5];
goto compare;
case 11:
resword = &wordlist[6];
goto compare;
case 12:
resword = &wordlist[7];
goto compare;
case 13:
resword = &wordlist[8];
goto compare;
case 16:
resword = &wordlist[9];
goto compare;
case 17:
resword = &wordlist[10];
goto compare;
case 19:
resword = &wordlist[11];
goto compare;
case 20:
resword = &wordlist[12];
goto compare;
case 21:
resword = &wordlist[13];
goto compare;
case 22:
resword = &wordlist[14];
goto compare;
case 24:
resword = &wordlist[15];
goto compare;
case 25:
resword = &wordlist[16];
goto compare;
case 26:
resword = &wordlist[17];
goto compare;
case 27:
resword = &wordlist[18];
goto compare;
case 29:
resword = &wordlist[19];
goto compare;
case 30:
resword = &wordlist[20];
goto compare;
case 31:
resword = &wordlist[21];
goto compare;
case 34:
resword = &wordlist[22];
goto compare;
case 35:
resword = &wordlist[23];
goto compare;
case 36:
resword = &wordlist[24];
goto compare;
case 38:
resword = &wordlist[25];
goto compare;
case 39:
resword = &wordlist[26];
goto compare;
case 40:
resword = &wordlist[27];
goto compare;
case 41:
resword = &wordlist[28];
goto compare;
case 43:
resword = &wordlist[29];
goto compare;
case 44:
resword = &wordlist[30];
goto compare;
case 46:
resword = &wordlist[31];
goto compare;
case 49:
resword = &wordlist[32];
goto compare;
case 51:
resword = &wordlist[33];
goto compare;
case 54:
resword = &wordlist[34];
goto compare;
case 55:
resword = &wordlist[35];
goto compare;
case 56:
resword = &wordlist[36];
goto compare;
case 57:
resword = &wordlist[37];
goto compare;
case 59:
resword = &wordlist[38];
goto compare;
case 60:
resword = &wordlist[39];
goto compare;
case 61:
resword = &wordlist[40];
goto compare;
case 64:
resword = &wordlist[41];
goto compare;
case 65:
resword = &wordlist[42];
goto compare;
case 66:
resword = &wordlist[43];
goto compare;
case 67:
resword = &wordlist[44];
goto compare;
case 69:
resword = &wordlist[45];
goto compare;
case 72:
resword = &wordlist[46];
goto compare;
case 73:
resword = &wordlist[47];
goto compare;
case 74:
resword = &wordlist[48];
goto compare;
case 75:
resword = &wordlist[49];
goto compare;
case 77:
resword = &wordlist[50];
goto compare;
case 79:
resword = &wordlist[51];
goto compare;
case 80:
resword = &wordlist[52];
goto compare;
case 81:
resword = &wordlist[53];
goto compare;
case 82:
resword = &wordlist[54];
goto compare;
case 84:
resword = &wordlist[55];
goto compare;
case 86:
resword = &wordlist[56];
goto compare;
case 87:
resword = &wordlist[57];
goto compare;
case 89:
resword = &wordlist[58];
goto compare;
case 91:
resword = &wordlist[59];
goto compare;
case 92:
resword = &wordlist[60];
goto compare;
case 94:
resword = &wordlist[61];
goto compare;
case 95:
resword = &wordlist[62];
goto compare;
case 96:
resword = &wordlist[63];
goto compare;
case 99:
resword = &wordlist[64];
goto compare;
case 103:
resword = &wordlist[65];
goto compare;
case 104:
resword = &wordlist[66];
goto compare;
case 106:
resword = &wordlist[67];
goto compare;
case 107:
resword = &wordlist[68];
goto compare;
case 116:
resword = &wordlist[69];
goto compare;
case 121:
resword = &wordlist[70];
goto compare;
case 122:
resword = &wordlist[71];
goto compare;
case 127:
resword = &wordlist[72];
goto compare;
case 134:
resword = &wordlist[73];
goto compare;
case 137:
resword = &wordlist[74];
goto compare;
case 158:
resword = &wordlist[75];
goto compare;
case 161:
resword = &wordlist[76];
goto compare;
}
return 0;
compare:
{
register const char *s = resword->name;
if (*str == *s && !strcmp (str + 1, s + 1))
return resword;
}
}
}
return 0;
}
#line 81 "/share/OpenBSD/xenocara/lib/xcb-util-cursor/cursor/shape_to_id.gperf"
int cursor_shape_to_id(const char *name) {
struct shape_mapping *mapping = in_word_set(name, strlen(name));
return (mapping ? (mapping->number * 2) : -1);
}

View file

@ -0,0 +1,85 @@
struct shape_mapping { const char *name; int number; };
int cursor_shape_to_id(const char *name);
%%
X_cursor,0
arrow,1
based_arrow_down,2
based_arrow_up,3
boat,4
bogosity,5
bottom_left_corner,6
bottom_right_corner,7
bottom_side,8
bottom_tee,9
box_spiral,10
center_ptr,11
circle,12
clock,13
coffee_mug,14
cross,15
cross_reverse,16
crosshair,17
diamond_cross,18
dot,19
dotbox,20
double_arrow,21
draft_large,22
draft_small,23
draped_box,24
exchange,25
fleur,26
gobbler,27
gumby,28
hand1,29
hand2,30
heart,31
icon,32
iron_cross,33
left_ptr,34
left_side,35
left_tee,36
leftbutton,37
ll_angle,38
lr_angle,39
man,40
middlebutton,41
mouse,42
pencil,43
pirate,44
plus,45
question_arrow,46
right_ptr,47
right_side,48
right_tee,49
rightbutton,50
rtl_logo,51
sailboat,52
sb_down_arrow,53
sb_h_double_arrow,54
sb_left_arrow,55
sb_right_arrow,56
sb_up_arrow,57
sb_v_double_arrow,58
shuttle,59
sizing,60
spider,61
spraycan,62
star,63
target,64
tcross,65
top_left_arrow,66
top_left_corner,67
top_right_corner,68
top_side,69
top_tee,70
trek,71
ul_angle,72
umbrella,73
ur_angle,74
watch,75
xterm,76
%%
int cursor_shape_to_id(const char *name) {
struct shape_mapping *mapping = in_word_set(name, strlen(name));
return (mapping ? (mapping->number * 2) : -1);
}

View file

@ -0,0 +1,12 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: XCB cursor library
Description: XCB cursor utility library
Version: @PACKAGE_VERSION@
Requires: xcb
Requires.private: xcb-render xcb-renderutil xcb-image
Libs: -L${libdir} -lxcb-cursor @LIBS@
Cflags: -I${includedir}

View file

@ -0,0 +1,124 @@
#ifndef XCB_CURSOR_H
#define XCB_CURSOR_H
/* Copyright © 2013 Michael Stapelberg
*
* 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 <xcb/xcb.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @defgroup xcb__cursor_context_t XCB Cursor Functions
*
* These functions are the equivalent of libXcursor, but re-implemented for
* XCB. They respect the users configured cursor theme when loading cursors,
* specified by the X resources setting "Xcursor.theme".
*
* Here is how you would use these functions to change the X11 root window
* cursor to "watch":
* @code
* int screennr;
* xcb_connection_t *conn = xcb_connect(NULL, &screennr);
* if (conn == NULL || xcb_connection_has_error(conn))
* err(EXIT_FAILURE, "Could not connect to X11");
*
* xcb_screen_t *screen = xcb_aux_get_screen(conn, screennr);
* xcb_cursor_context_t *ctx;
* if (xcb_cursor_context_new(conn, screen, &ctx) < 0)
* err(EXIT_FAILURE, "Could not initialize xcb-cursor");
*
* xcb_cursor_t cid = xcb_cursor_load_cursor(ctx, "watch");
*
* xcb_screen_t *screen = xcb_setup_roots_iterator(xcb_get_setup(conn)).data;
* xcb_change_window_attributes(conn, screen->root, XCB_CW_CURSOR, (uint32_t[]){ cid });
* xcb_free_cursor(conn, cid);
* xcb_flush(conn);
*
* xcb_cursor_context_free(ctx);
* xcb_disconnect(conn);
* @endcode
*
* @{
*/
/**
* @struct xcb_cursor_context_t
* Describes a context for using this library.
*
* Create a context with @ref xcb_cursor_context_new (), then load one or more
* cursors with @ref xcb_cursor_load_cursor () and destroy the context with @ref
* xcb_cursor_context_free ().
*/
typedef struct xcb_cursor_context_t xcb_cursor_context_t;
/**
* Create a new @ref xcb_cursor_context_t.
*
* @param conn A working XCB connection, which will be used until you destroy
* the context with @ref xcb_cursor_context_free ().
* @param screen The xcb_screen_t to use (e.g. for getting the RESOURCE_MANAGER
* contents, for creating cursors on, for using the size as fallback when
* calculating the best cursor size).
* @param ctx A pointer to an xcb_cursor_context_t* which will be modified to
* refer to the newly created context.
* @return 0 on success, a negative error code otherwise.
*
* @ingroup xcb_cursor_context_t
*/
int xcb_cursor_context_new(xcb_connection_t *conn, xcb_screen_t *screen, xcb_cursor_context_t **ctx);
/**
* Loads the specified cursor, either from the cursor theme or by falling back
* to the X11 "cursor" font.
*
* @param ctx A cursor context, created with @ref xcb_cursor_context_new ()
* @param name The name of the cursor to load, e.g. "watch".
* @returns The ID of the created cursor. When you are done using it, use
* xcb_free_cursor. Calling @ref xcb_cursor_context_free () will NOT free the
* created cursor.
*
*/
xcb_cursor_t xcb_cursor_load_cursor(xcb_cursor_context_t *ctx, const char *name);
/**
* Frees the @ref xcb_cursor_context_t.
*
* @param ctx The context to free.
*
*/
void xcb_cursor_context_free(xcb_cursor_context_t *ctx);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif